From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id WKgIGmx9SGRGRgEASxT56A (envelope-from ) for ; Wed, 26 Apr 2023 03:25:00 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 8AYDGmx9SGTCDwAAauVa8A (envelope-from ) for ; Wed, 26 Apr 2023 03:25:00 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1BCBE471F9 for ; Wed, 26 Apr 2023 03:25:00 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1682472300; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=z/19qJg1A4d1Heyz6CnkNRVY2SPXB8Agr01oqnOPQL0=; b=a/J0dGFvdwnQ4XF90yd4Bs/F1xjUiJ/sx/cPawBvvoiCpkbRdAZkq23EBrp0ggtpOSInfw +n3NvtwlyW7eYUgmMNgFGTVQBEZTdRn7OijXBcHUC+MdHsNN1PcR99CLVHYNgoSGtOiytB tCKA62OcRXlIXBBAw0wWjiSS5Y4vC0Wai2n5avWaxDEKUs5FwIuuk1tPI4vaDykFvhnc5F hUhuaCWJejLIkQYkc060iBc0w1Msibk4c9+vRNO2+D11Va5/bozTONsuqxSFhvjhjQJaKu ulmbzxUXxiH0OqiohL1BLfhJUhzPLQdlzz7Bvz59tFu1dKCZdOhyVhyzQRLzjw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1682472300; a=rsa-sha256; cv=none; b=WTQjyLf/xpIhix620zjFQ6JJHepUFwpPlJKOZxRiFJZwr3p4BlsVoMGd2JADLpMqtoP4EZ 4+DCdUZ8F1jktd8cYG4HJ4bGQE2pyBYaTvYI52pagQNIILAGzEpo3+AugtlUmbPfvXawbf OISOCeKWCjBxQIjF0oH6V/dKH0AQ1UQ+04yda+2/mKAstEsc2On21C8kAB+zsjbhI8EJNT AdANZ89MNGv+8Bi9ef+mTqbrYi4XvhgXN1rp7v/ES8Dd/kWTwEsjauHIcALPwr8qWMYBDu JwFz3SIK+8iawFpBYW9j97i3F2S6B0bfiOLRH0hGSgM5aB6N8plxest1Rulcmg== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prTTy-0006cm-OB; Tue, 25 Apr 2023 20:58:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1prTTw-0006bj-NL for guix-patches@gnu.org; Tue, 25 Apr 2023 20:58:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prTTu-00013O-J5 for guix-patches@gnu.org; Tue, 25 Apr 2023 20:58:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1prTTu-0001d3-Es for guix-patches@gnu.org; Tue, 25 Apr 2023 20:58:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63081] [PATCH 3/8] gnu: docbook-xsl: Refactor package. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 26 Apr 2023 00:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63081 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63081@debbugs.gnu.org Cc: andreas@enge.fr, Bruno Victal , maxim.cournoyer@gmail.com Received: via spool by 63081-submit@debbugs.gnu.org id=B63081.16824706646175 (code B ref 63081); Wed, 26 Apr 2023 00:58:02 +0000 Received: (at 63081) by debbugs.gnu.org; 26 Apr 2023 00:57:44 +0000 Received: from localhost ([127.0.0.1]:53839 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1prTTc-0001bQ-5O for submit@debbugs.gnu.org; Tue, 25 Apr 2023 20:57:44 -0400 Received: from smtpm3.myservices.hosting ([185.26.105.234]:42738) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1prTTY-0001ax-0y for 63081@debbugs.gnu.org; Tue, 25 Apr 2023 20:57:40 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpm3.myservices.hosting (Postfix) with ESMTP id A22E0216F3; Wed, 26 Apr 2023 02:57:38 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 547E4800A0; Wed, 26 Apr 2023 02:57:38 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id xbl27_eFDydE; Wed, 26 Apr 2023 02:57:37 +0200 (CEST) Received: from guix-nuc.home.arpa (unknown [10.192.1.83]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 9DBC58009E; Wed, 26 Apr 2023 02:57:37 +0200 (CEST) From: Bruno Victal Date: Wed, 26 Apr 2023 01:56:55 +0100 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: UNKNOWN X-Migadu-Spam-Score: 0.45 X-Spam-Score: 0.45 X-Migadu-Queue-Id: 1BCBE471F9 X-Migadu-Scanner: in3.migadu.com X-TUID: eTrrIlIqvtwg * gnu/packages/docbook.scm (docbook-xsl)[source]: Patch in snippet. [arguments]: Use sxml representation for xmlc file. Use xmlcatalog to manipulate catalog.xml instead of substitute*. Use #:install-plan instead of replacing 'install phase. [native-inputs]: Add docbook-xml-4.4 and libxml2, required for tests. --- gnu/packages/docbook.scm | 158 +++++++++++++++++++++++++-------------- 1 file changed, 102 insertions(+), 56 deletions(-) diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm index 79d5069fb0..2fe0c2dbc5 100644 --- a/gnu/packages/docbook.scm +++ b/gnu/packages/docbook.scm @@ -290,9 +290,16 @@ (define-public docbook-xsl (url "https://github.com/docbook/xslt10-stylesheets") (commit commit))) (file-name (git-file-name name version)) - ;; Multiple .jar files are bundled with the sources. (modules '((guix build utils))) - (snippet '(for-each delete-file (find-files "." "\\.jar$"))) + (snippet + #~(begin + ;; Multiple .jar files are bundled with the sources. + (for-each delete-file + (find-files "." "\\.jar$")) + ;; Do not build webhelp files, as they require a Saxon from + ;; 2005, which is not packaged in Guix. + (substitute* "xsl/Makefile" + ((" webhelp") "")))) (sha256 (base32 "1bl8dwrcy7skrlh80fpsmiw045bv2j0aym231ikcv3hvm2pi98dj")))) @@ -300,67 +307,106 @@ (define-public docbook-xsl (arguments (list #:make-flags #~(list "XSLTENGINE=xsltproc") + #:modules '((guix build gnu-build-system) + (guix build utils) + (sxml simple)) #:phases - #~(modify-phases %standard-phases - (replace 'configure - (lambda _ - ;; The build systems insist on a ~/.xmlc, and it is simpler to - ;; create a dummy config file than to patch it into - ;; submission. - (setenv "HOME" "/tmp") - (call-with-output-file "/tmp/.xmlc" - (lambda (port) - (format port "\ - - - - - - - -\n"))) - (substitute* "xsl/Makefile" - ;; Do not build webhelp files, as they require a Saxon from - ;; 2005, which is not packaged in Guix. - ((" webhelp") "")))) - (add-before 'install 'generate-catalog.xml - (lambda* (#:key make-flags #:allow-other-keys) - (apply invoke "make" "-C" "xsl" "catalog.xml" make-flags))) + #~(let ((dest-path (format #f "~a/xml/xsl/~a-~a" + #$output #$name #$version))) + (modify-phases %standard-phases + (replace 'configure + (lambda _ + ;; The build systems insist on a ~/.xmlc, and it is simpler to + ;; create a dummy config file than to patch it into + ;; submission. + (setenv "HOME" "/tmp") + (call-with-output-file "/tmp/.xmlc" + (lambda (port) + (sxml->xml + '(*TOP* + (*PI* xml "version='1.0'") + (config + (java (@ (xml:id "bigmem")) + (java-options (@ (name "Xmx512m")))) + (xsltproc (@ (xml:id "xsltproc") + (exec "xsltproc"))) + (xmllint (@ (xml:id "xmllint") + (exec "xmllint"))))) + port))))) + (add-before 'install 'generate-catalog.xml + (lambda* (#:key make-flags #:allow-other-keys) + (apply invoke "make" "-C" "xsl" "catalog.xml" make-flags))) + (add-before 'install 'patch-catalog-xml + (lambda* (#:key inputs #:allow-other-keys) + (let ((xmlcatalog (search-input-file inputs + "/bin/xmlcatalog")) + (catalog-files (find-files "." "catalog\\.xml$")) + (store-uri (string-append "file://" dest-path "/"))) + (for-each + (lambda (catalog) + ;; Replace /snapshot/ reference with one based on + ;; BASE-VERSION. + (let ((versioned-uri + (format + #f "https://cdn.docbook.org/release/xsl/~a/" + #$base-version))) + (invoke xmlcatalog "--noout" + "--del" + "https://cdn.docbook.org/release/xsl/snapshot/" + catalog) + (for-each + (lambda (type) + (invoke xmlcatalog "--noout" + "--add" type + versioned-uri + store-uri + catalog)) + (list "rewriteSystem" "rewriteURI"))) + + ;; Patch /current/ references to point to /gnu/store/…. + (for-each + (lambda (type) + (invoke xmlcatalog "--noout" + "--add" type + "https://cdn.docbook.org/release/xsl/current/" + store-uri + catalog)) + (list "rewriteSystem" "rewriteURI")) + + ;; Re-add the no longer present compatibility entries for + ;; v.1.79.1 or earlier URIs. + (for-each + (lambda (type) + (invoke xmlcatalog "--noout" + "--add" type + "http://docbook.sourceforge.net/release/xsl/current/" + store-uri + catalog)) + (list "rewriteSystem" "rewriteURI"))) + catalog-files)))) (replace 'install (lambda _ - (let ((xml (string-append #$output "/xml/xsl/" - #$name "-" #$version)) - (select-rx (make-regexp + (let ((select-rx (make-regexp "(\\.xml$|\\.xsl$|\\.dtd$|\\.ent$)"))) ;; Install catalog. (chdir "xsl") - (install-file "catalog.xml" xml) - (install-file "VERSION.xsl" xml) - (substitute* (string-append xml "/catalog.xml") - ;; Re-add the no longer present compatibility entries. - ((".*.*" anchor) - (string-append "\ - - - \n" anchor)) - (("/snapshot/") - (string-append "/" #$base-version "/")) - (("rewritePrefix=\"./") - (string-append "rewritePrefix=\"file://" xml "/"))) + (install-file "catalog.xml" dest-path) + (install-file "VERSION.xsl" dest-path) ;; Install style sheets. - (for-each (lambda (dir) - (for-each (lambda (f) - (install-file - f (string-append xml "/" (dirname f)))) - (find-files dir select-rx))) - '("assembly" "common" "eclipse" "epub" "epub3" "fo" - "highlighting" "html" "htmlhelp" "javahelp" "lib" - "manpages" "params" "profiling" "roundtrip" - "template" "website" - "xhtml" "xhtml-1_1" "xhtml5")))))))) - (native-inputs (list libxml2 + (for-each + (lambda (dir) + (for-each (lambda (f) + (install-file + f + (string-append dest-path "/" (dirname f)))) + (find-files dir select-rx))) + '("assembly" "common" "eclipse" "epub" "epub3" "fo" + "highlighting" "html" "htmlhelp" "javahelp" "lib" + "manpages" "params" "profiling" "roundtrip" + "template" "website" + "xhtml" "xhtml-1_1" "xhtml5"))))))))) + (native-inputs (list docbook-xml-4.4 ; for tests + libxml2 libxslt perl perl-xml-xpath)) -- 2.39.2