From patchwork Fri Jan 28 18:18:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Wurmus X-Patchwork-Id: 36866 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id ABA1327BBEA; Fri, 28 Jan 2022 18:24:04 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 0346327BBE9 for ; Fri, 28 Jan 2022 18:24:04 +0000 (GMT) Received: from localhost ([::1]:50812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDVuk-0001B9-BN for patchwork@mira.cbaines.net; Fri, 28 Jan 2022 13:24:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43270) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDVpu-0004JP-UY for guix-patches@gnu.org; Fri, 28 Jan 2022 13:19:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:39341) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nDVpu-00074w-Ki for guix-patches@gnu.org; Fri, 28 Jan 2022 13:19:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nDVpu-0002FI-HY for guix-patches@gnu.org; Fri, 28 Jan 2022 13:19:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53613] [PATCH] guix: Restore profile hook for TeX Live font maps. Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 28 Jan 2022 18:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 53613 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 53613@debbugs.gnu.org Cc: Ricardo Wurmus X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16433938968560 (code B ref -1); Fri, 28 Jan 2022 18:19:02 +0000 Received: (at submit) by debbugs.gnu.org; 28 Jan 2022 18:18:16 +0000 Received: from localhost ([127.0.0.1]:60477 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nDVpA-0002Dz-6i for submit@debbugs.gnu.org; Fri, 28 Jan 2022 13:18:16 -0500 Received: from lists.gnu.org ([209.51.188.17]:43504) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nDVp7-0002Dq-SZ for submit@debbugs.gnu.org; Fri, 28 Jan 2022 13:18:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43012) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDVp7-00037t-NW for guix-patches@gnu.org; Fri, 28 Jan 2022 13:18:13 -0500 Received: from sender4-of-o51.zoho.com ([136.143.188.51]:21145) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDVp4-00070c-GD for guix-patches@gnu.org; Fri, 28 Jan 2022 13:18:12 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1643393888; cv=none; d=zohomail.com; s=zohoarc; b=Tbb9N7aEyNsw8NH65WgS+qjF3RwqKX0Yoec50yXP6YTC6WX5hShYlgyl6nrXKsJhDYZHg98VWjNwZNRih/3tdnENVs3NaRBBrrQgK98j9C4h+w9BjC+6AJVRFkgLapwLH/BVuSEG+WF4hGDyGY5AQgFxVmzyMP9kFAZtrss03EU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643393888; h=Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Subject:To; bh=TeSGmzbxj99/NBFmZvQeBsUEd2iKm4oCj8E7B47N4do=; b=Uu2BK7FeoYdKIQkBYkNpdtitgHdGxQWlbAikqAWDLctfbGP0gzgYufJKEOfZwPVcyjSPOJroOmYLQlzbrUDHnJIRDesmzas/TmSlpO1xnXcxUcYbJVYnBZfLFHCruMU0nbkRUuWwu02ck9bC9GbsXF8Mu3APFacl0fo0wtSBrn0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1643393888; s=zoho; d=elephly.net; i=rekado@elephly.net; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Transfer-Encoding; bh=TeSGmzbxj99/NBFmZvQeBsUEd2iKm4oCj8E7B47N4do=; b=NqylvxTCz8QOp5p9ejmHnJJ+jGRV3pQDkERy6AvmbBJIlxiITmr6ky4Pg+Ncm1sE Km7HUk3HwpMysmLECFK0tTGqocuV3yhuhT/XahHUovKGECcGtSL+iz4c7TQrdmtLKAM XJAm7680bc1J7qaz2QMDJ4W3PmxMUdzP2zsWl3h4= Received: from localhost (p54ad4fa1.dip0.t-ipconnect.de [84.173.79.161]) by mx.zohomail.com with SMTPS id 1643393886514667.9815203075382; Fri, 28 Jan 2022 10:18:06 -0800 (PST) From: Ricardo Wurmus Date: Fri, 28 Jan 2022 19:18:01 +0100 Message-Id: <20220128181801.14998-1-rekado@elephly.net> X-Mailer: git-send-email 2.34.0 MIME-Version: 1.0 X-ZohoMailClient: External Received-SPF: pass client-ip=136.143.188.51; envelope-from=rekado@elephly.net; helo=sender4-of-o51.zoho.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/tex.scm (texlive-default-updmap.cfg): New variable. * guix/profiles.scm (texlive-configuration): Rename this... (texlive-font-maps): ...to this; update to run updmap-sys on the contents of the profile to generate only font maps. (%default-profile-hooks): Add texlive-font-maps. * guix/status.scm (hook-message): Rename unused texlive-configuration to texlive-font-maps. --- gnu/packages/tex.scm | 12 ++++++ guix/profiles.scm | 99 +++++++++++++++++++------------------------- guix/status.scm | 4 +- 3 files changed, 56 insertions(+), 59 deletions(-) diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm index 89f60f89d5..72437ce2f6 100644 --- a/gnu/packages/tex.scm +++ b/gnu/packages/tex.scm @@ -4314,6 +4314,18 @@ (define-public texlive-base '() default-packages))))) +(define-public texlive-default-updmap.cfg + (origin + (method url-fetch) + (uri (string-append "https://tug.org/svn/texlive/tags/" + %texlive-tag "/Master/texmf-dist/web2c/updmap.cfg" + "?revision=" (number->string %texlive-revision))) + (file-name (string-append "updmap.cfg-" + (number->string %texlive-revision))) + (sha256 + (base32 + "0zhpyld702im6352fwp41f2hgfkpj2b4j1kfsjqbkijlcmvb6w2c")))) + ;;; TODO: Add a TeX Live profile hook computing fonts maps (and others?) ;;; configuration from the packages in the profile, similar to what's done ;;; below. diff --git a/guix/profiles.scm b/guix/profiles.scm index 1d354ecb78..403dbc18ed 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -1738,8 +1738,8 @@ (define (manual-database/optional manifest) (manual-database manifest) (return #f)))) -(define (texlive-configuration manifest) - "Return a derivation that builds a TeXlive configuration for the entries in +(define (texlive-font-maps manifest) + "Return a derivation that builds the TeX Live font maps for the entries in MANIFEST." (define entry->texlive-input (match-lambda @@ -1768,72 +1768,56 @@ (define build ;; Build a modifiable union of all texlive inputs. We do this so ;; that TeX live can resolve the parent and grandparent directories ;; correctly. There might be a more elegant way to accomplish this. - (union-build #$output + (union-build "/tmp/texlive" '#$(append-map entry->texlive-input (manifest-entries manifest)) #:create-all-directories? #t #:log-port (%make-void-port "w")) - (let ((texmf.cnf (string-append - #$output - "/share/texmf-dist/web2c/texmf.cnf"))) - (when (file-exists? texmf.cnf) - (substitute* texmf.cnf - (("^TEXMFROOT = .*") - (string-append "TEXMFROOT = " #$output "/share\n")) - (("^TEXMF = .*") - "TEXMF = $TEXMFROOT/share/texmf-dist\n")) - - ;; XXX: This is annoying, but it's necessary because texlive-bin - ;; does not provide wrapped executables. - (setenv "PATH" - (string-append #$(file-append coreutils "/bin") - ":" - #$(file-append sed "/bin"))) - (setenv "PERL5LIB" #$(file-append texlive-bin "/share/tlpkg")) - (setenv "TEXMF" (string-append #$output "/share/texmf-dist")) - - ;; Remove invalid maps from config file. - (let* ((web2c (string-append #$output "/share/texmf-config/web2c/")) - (maproot (string-append #$output "/share/texmf-dist/fonts/map/")) - (updmap.cfg (string-append web2c "updmap.cfg"))) - (mkdir-p web2c) - - ;; Some profiles may already have this file, which prevents us - ;; from copying it. Since we need to generate it from scratch - ;; anyway, we delete it here. - (when (file-exists? updmap.cfg) - (delete-file updmap.cfg)) - (copy-file #$updmap.cfg updmap.cfg) - (make-file-writable updmap.cfg) - (let* ((port (open-pipe* OPEN_WRITE - #$(file-append texlive-bin "/bin/updmap-sys") - "--syncwithtrees" - "--nohash" - "--force" - (string-append "--cnffile=" web2c "updmap.cfg")))) - (display "Y\n" port) - (when (not (zero? (status:exit-val (close-pipe port)))) - (error "failed to filter updmap.cfg"))) - - ;; Generate font maps. - (invoke #$(file-append texlive-bin "/bin/updmap-sys") - (string-append "--cnffile=" web2c "updmap.cfg") - (string-append "--dvipdfmxoutputdir=" - maproot "updmap/dvipdfmx/") - (string-append "--dvipsoutputdir=" - maproot "updmap/dvips/") - (string-append "--pdftexoutputdir=" - maproot "updmap/pdftex/"))))) - #t))) + + ;; XXX: This is annoying, but it's necessary because texlive-bin + ;; does not provide wrapped executables. + (setenv "PATH" + (string-append #$(file-append coreutils "/bin") + ":" + #$(file-append sed "/bin"))) + (setenv "PERL5LIB" #$(file-append texlive-bin "/share/tlpkg")) + (setenv "GUIX_TEXMF" "/tmp/texlive/share/texmf-dist") + + ;; Remove invalid maps from config file. + (let* ((web2c (string-append #$output "/share/texmf-dist/web2c/")) + (maproot (string-append #$output "/share/texmf-dist/fonts/map/")) + (updmap.cfg (string-append web2c "updmap.cfg"))) + (mkdir-p web2c) + (copy-file #$updmap.cfg updmap.cfg) + (make-file-writable updmap.cfg) + (let* ((port (open-pipe* OPEN_WRITE + #$(file-append texlive-bin "/bin/updmap-sys") + "--syncwithtrees" + "--nohash" + "--force" + (string-append "--cnffile=" updmap.cfg)))) + (display "Y\n" port) + (when (not (zero? (status:exit-val (close-pipe port)))) + (error "failed to filter updmap.cfg"))) + + ;; Generate font maps. + (invoke #$(file-append texlive-bin "/bin/updmap-sys") + (string-append "--cnffile=" updmap.cfg) + (string-append "--dvipdfmxoutputdir=" + maproot "dvipdfmx/updmap") + (string-append "--dvipsoutputdir=" + maproot "dvips/updmap") + (string-append "--pdftexoutputdir=" + maproot "pdftex/updmap")))))) (mlet %store-monad ((texlive-base (manifest-lookup-package manifest "texlive-base"))) (if texlive-base - (gexp->derivation "texlive-configuration" build + (gexp->derivation "texlive-font-maps" build #:substitutable? #f #:local-build? #t #:properties `((type . profile-hook) - (hook . texlive-configuration))) + (hook . texlive-font-maps))) (return #f)))) (define %default-profile-hooks @@ -1849,6 +1833,7 @@ (define %default-profile-hooks glib-schemas gtk-icon-themes gtk-im-modules + texlive-font-maps xdg-desktop-database xdg-mime-database)) diff --git a/guix/status.scm b/guix/status.scm index eefe18365f..fba28765df 100644 --- a/guix/status.scm +++ b/guix/status.scm @@ -395,8 +395,8 @@ (define (hook-message hook-type) (G_ "building XDG MIME database...")) ('fonts-dir (G_ "building fonts directory...")) - ('texlive-configuration - (G_ "building TeX Live configuration...")) + ('texlive-font-maps + (G_ "building TeX Live font maps...")) ('manual-database (G_ "building database for manual pages...")) ('package-cache ;package cache generated by 'guix pull'