* [PATCH 0/3] Add reposurgeon.
@ 2016-04-09 19:26 Mathieu Lirzin
2016-04-09 19:26 ` [PATCH 1/3] gnu: Add docbook-xml-4.1.2 Mathieu Lirzin
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Mathieu Lirzin @ 2016-04-09 19:26 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1: Type: text/plain, Size: 716 bytes --]
Hello,
Here is reposurgeon, and docbook-xml-4.1.2 which is one of its dependencies.
While reading the documentation in order to make the build reproducible, I
have found a recommendation to use ‘guix archive ...’ without a pointer, which
in my case would have been helpful.
Thanks in advance for the review(s).
Mathieu Lirzin (3):
gnu: Add docbook-xml-4.1.2.
gnu: Add reposurgeon.
doc: Add a reference to 'Invoking guix archive'.
doc/guix.texi | 5 +--
gnu/packages/docbook.scm | 30 ++++++++++++++++--
gnu/packages/version-control.scm | 68 ++++++++++++++++++++++++++++++++++++++--
3 files changed, 96 insertions(+), 7 deletions(-)
--
2.8.0.rc3
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] gnu: Add docbook-xml-4.1.2.
2016-04-09 19:26 [PATCH 0/3] Add reposurgeon Mathieu Lirzin
@ 2016-04-09 19:26 ` Mathieu Lirzin
2016-04-13 20:54 ` Ludovic Courtès
2016-04-09 19:26 ` [PATCH 2/3] gnu: Add reposurgeon Mathieu Lirzin
2016-04-09 19:26 ` [PATCH 3/3] doc: Add a reference to 'Invoking guix archive' Mathieu Lirzin
2 siblings, 1 reply; 9+ messages in thread
From: Mathieu Lirzin @ 2016-04-09 19:26 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1: Type: text/plain, Size: 186 bytes --]
* gnu/packages/docbook.scm (docbook-xml-4.1.2): New variable.
---
gnu/packages/docbook.scm | 30 +++++++++++++++++++++++++++---
1 file changed, 27 insertions(+), 3 deletions(-)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-docbook-xml-4.1.2.patch --]
[-- Type: text/x-patch; name="0001-gnu-Add-docbook-xml-4.1.2.patch", Size: 2710 bytes --]
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index 9f5fbf1..2bd86fe 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
+;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -74,7 +75,7 @@ by no means limited to these applications.) This package provides XML DTDs.")
(define-public docbook-xml-4.4
(package (inherit docbook-xml)
- (version "4.4")
+ (version "4.4")
(source (origin
(method url-fetch)
(uri (string-append "http://www.docbook.org/xml/" version
@@ -85,7 +86,7 @@ by no means limited to these applications.) This package provides XML DTDs.")
(define-public docbook-xml-4.3
(package (inherit docbook-xml)
- (version "4.3")
+ (version "4.3")
(source (origin
(method url-fetch)
(uri (string-append "http://www.docbook.org/xml/" version
@@ -96,7 +97,7 @@ by no means limited to these applications.) This package provides XML DTDs.")
(define-public docbook-xml-4.2
(package (inherit docbook-xml)
- (version "4.2")
+ (version "4.2")
(source (origin
(method url-fetch)
(uri (string-append "http://www.docbook.org/xml/" version
@@ -105,6 +106,29 @@ by no means limited to these applications.) This package provides XML DTDs.")
(base32
"18hgwvmywh6a5jh38szjmg3hg2r4v5lb6r3ydc3rd8cp9wg61i5c"))))))
+(define-public docbook-xml-4.1.2
+ (package (inherit docbook-xml)
+ (version "4.1.2")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "http://www.docbook.org/xml/" version
+ "/docbkx412.zip"))
+ (sha256
+ (base32
+ "0wkp5rvnqj0ghxia0558mnn4c7s3n501j99q2isp3sp0ci069w1h"))))
+ (arguments
+ '(#:modules ((guix build utils))
+ #:builder
+ (begin
+ (use-modules (guix build utils))
+ (let ((source (assoc-ref %build-inputs "source"))
+ (unzip (string-append (assoc-ref %build-inputs "unzip")
+ "/bin/unzip"))
+ (dtd (string-append (assoc-ref %outputs "out")
+ "/xml/dtd/docbook")))
+ (mkdir-p dtd)
+ (zero? (system* unzip source "-d" dtd))))))))
+
(define-public docbook-xsl
(package
(name "docbook-xsl")
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] gnu: Add reposurgeon.
2016-04-09 19:26 [PATCH 0/3] Add reposurgeon Mathieu Lirzin
2016-04-09 19:26 ` [PATCH 1/3] gnu: Add docbook-xml-4.1.2 Mathieu Lirzin
@ 2016-04-09 19:26 ` Mathieu Lirzin
2016-04-13 21:01 ` Ludovic Courtès
2016-04-09 19:26 ` [PATCH 3/3] doc: Add a reference to 'Invoking guix archive' Mathieu Lirzin
2 siblings, 1 reply; 9+ messages in thread
From: Mathieu Lirzin @ 2016-04-09 19:26 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1: Type: text/plain, Size: 206 bytes --]
* gnu/packages/version-control.scm (reposurgeon): New variable.
---
gnu/packages/version-control.scm | 68 ++++++++++++++++++++++++++++++++++++++--
1 file changed, 66 insertions(+), 2 deletions(-)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-gnu-Add-reposurgeon.patch --]
[-- Type: text/x-patch; name="0002-gnu-Add-reposurgeon.patch", Size: 4453 bytes --]
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 0b70d54..bc28498 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -3,7 +3,7 @@
;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013, 2014 Andreas Enge <andreas@enge.fr>
-;;; Copyright © 2015 Mathieu Lirzin <mthl@openmailbox.org>
+;;; Copyright © 2015, 2016 Mathieu Lirzin <mthl@gnu.org>
;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2015, 2016 Efraim Flashner <efraim@flashner.co.il>
@@ -27,7 +27,7 @@
(define-module (gnu packages version-control)
#:use-module ((guix licenses)
- #:select (asl2.0 bsd-2
+ #:select (asl2.0 bsd-2 bsd-3
gpl1+ gpl2 gpl2+ gpl3+ lgpl2.1
x11-style))
#:use-module (guix utils)
@@ -1013,6 +1013,70 @@ as possible. Resolution of contention for source files, a major headache for
any project with more than one developer, is one of Aegis's major functions.")
(license gpl3+)))
+(define-public reposurgeon
+ (package
+ (name "reposurgeon")
+ (version "3.37")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "http://www.catb.org/~esr/"
+ name "/" name "-" version ".tar.xz"))
+ (sha256
+ (base32
+ "14asjg4xy3mhh5z0r3k7c1wv9y803j2zfq32g5q5m95sf7yzygan"))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:tests? #f ;no test suite distributed
+ #:phases
+ (modify-phases %standard-phases
+ (delete 'configure)
+ (add-before 'build 'fix-docbook
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "XML_CATALOG_FILE"
+ (string-append (assoc-ref inputs "docbook-xsl")
+ "/xml/xsl/docbook-xsl-"
+ ,(package-version docbook-xsl)
+ "/manpages/docbook.xsl"))
+ (substitute* '("repocutter.xml" "repodiffer.xml" "repomapper.xml"
+ "reposurgeon.xml" "repotool.xml")
+ (("docbook/docbookx.dtd")
+ (string-append (assoc-ref inputs "docbook-xml")
+ "/xml/dtd/docbook/docbookx.dtd")))
+ ;; xsltproc generates random ids when the source document doesn't
+ ;; provide them. This is making the build not reproducible.
+ (substitute* "reposurgeon.xml"
+ (("<refsect2><title>WRITING ")
+ "<refsect2 id='writing'><title>WRITING ")
+ (("<refsect2><title>READING")
+ "<refsect2 id='reading'><title>READING"))
+ #t))
+ (add-after 'install 'install-emacs-data
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ (install-file "reposurgeon-mode.el"
+ (string-append out "/share/emacs/site-lisp"))
+ #t))))
+ #:make-flags
+ (list (string-append "target=" (assoc-ref %outputs "out")))))
+ (inputs
+ `(("python" ,python-wrapper)))
+ (native-inputs
+ `(("asciidoc" ,asciidoc)
+ ("docbook-xml" ,docbook-xml-4.1.2)
+ ("docbook-xsl" ,docbook-xsl)
+ ("libxml2" ,libxml2)
+ ("xmlto" ,xmlto)))
+ (home-page "http://www.catb.org/~esr/reposurgeon/")
+ (synopsis "Edit version-control repository history")
+ (description "Reposurgeon enables risky operations that version-control
+systems don't want to let you do, such as editing past comments and metadata
+and removing commits. It works with any version control system that can
+export and import Git fast-import streams, including Git, Mercurial, Fossil,
+Bazaar, CVS, RCS, and Src. It can also read Subversion dump files directly
+and can thus be used to script production of very high-quality conversions
+from Subversion to any supported Distributed Version Control System (DVCS).")
+ (license (list bsd-2 bsd-3))))
+
(define-public tig
(package
(name "tig")
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] doc: Add a reference to 'Invoking guix archive'.
2016-04-09 19:26 [PATCH 0/3] Add reposurgeon Mathieu Lirzin
2016-04-09 19:26 ` [PATCH 1/3] gnu: Add docbook-xml-4.1.2 Mathieu Lirzin
2016-04-09 19:26 ` [PATCH 2/3] gnu: Add reposurgeon Mathieu Lirzin
@ 2016-04-09 19:26 ` Mathieu Lirzin
2016-04-13 21:01 ` Ludovic Courtès
2 siblings, 1 reply; 9+ messages in thread
From: Mathieu Lirzin @ 2016-04-09 19:26 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1: Type: text/plain, Size: 171 bytes --]
* doc/guix.texi (Common Build Options): Add a reference to 'Invoking
guix archive'.
---
doc/guix.texi | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0003-doc-Add-a-reference-to-Invoking-guix-archive.patch --]
[-- Type: text/x-patch; name="0003-doc-Add-a-reference-to-Invoking-guix-archive.patch", Size: 750 bytes --]
diff --git a/doc/guix.texi b/doc/guix.texi
index dcc1124..6c7107c 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4057,8 +4057,9 @@ binaries are genuine. @xref{Invoking guix challenge}, for more.
Note that, currently, the differing build results are not kept around,
so you will have to manually investigate in case of an error---e.g., by
-stashing one of the build results with @code{guix archive --export},
-then rebuilding, and finally comparing the two results.
+stashing one of the build results with @code{guix archive --export}
+(@pxref{Invoking guix archive}), then rebuilding, and finally comparing
+the two results.
@item --no-build-hook
Do not attempt to offload builds @i{via} the ``build hook'' of the daemon
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] gnu: Add docbook-xml-4.1.2.
2016-04-09 19:26 ` [PATCH 1/3] gnu: Add docbook-xml-4.1.2 Mathieu Lirzin
@ 2016-04-13 20:54 ` Ludovic Courtès
0 siblings, 0 replies; 9+ messages in thread
From: Ludovic Courtès @ 2016-04-13 20:54 UTC (permalink / raw)
To: Mathieu Lirzin; +Cc: guix-devel
Mathieu Lirzin <mthl@gnu.org> skribis:
> * gnu/packages/docbook.scm (docbook-xml-4.1.2): New variable.
OK!
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] gnu: Add reposurgeon.
2016-04-09 19:26 ` [PATCH 2/3] gnu: Add reposurgeon Mathieu Lirzin
@ 2016-04-13 21:01 ` Ludovic Courtès
2016-04-21 15:44 ` Mathieu Lirzin
0 siblings, 1 reply; 9+ messages in thread
From: Ludovic Courtès @ 2016-04-13 21:01 UTC (permalink / raw)
To: Mathieu Lirzin; +Cc: guix-devel
Mathieu Lirzin <mthl@gnu.org> skribis:
> * gnu/packages/version-control.scm (reposurgeon): New variable.
[...]
> + (add-before 'build 'fix-docbook
> + (lambda* (#:key inputs #:allow-other-keys)
> + (setenv "XML_CATALOG_FILE"
> + (string-append (assoc-ref inputs "docbook-xsl")
> + "/xml/xsl/docbook-xsl-"
> + ,(package-version docbook-xsl)
> + "/manpages/docbook.xsl"))
Could you add a comment on why this is needed?
Normally, with libxml2 as an input, ‘XML_CATALOG_FILE’ should be
properly initialized.
> + ;; xsltproc generates random ids when the source document doesn't
> + ;; provide them. This is making the build not reproducible.
> + (substitute* "reposurgeon.xml"
Eventually we should fix it in libxslt along these lines:
https://bugzilla.gnome.org/show_bug.cgi?id=758148
Could you send an updated patch?
Thanks!
Ludo’.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] doc: Add a reference to 'Invoking guix archive'.
2016-04-09 19:26 ` [PATCH 3/3] doc: Add a reference to 'Invoking guix archive' Mathieu Lirzin
@ 2016-04-13 21:01 ` Ludovic Courtès
0 siblings, 0 replies; 9+ messages in thread
From: Ludovic Courtès @ 2016-04-13 21:01 UTC (permalink / raw)
To: Mathieu Lirzin; +Cc: guix-devel
Mathieu Lirzin <mthl@gnu.org> skribis:
> * doc/guix.texi (Common Build Options): Add a reference to 'Invoking
> guix archive'.
OK, thanks!
Ludo'.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] gnu: Add reposurgeon.
2016-04-13 21:01 ` Ludovic Courtès
@ 2016-04-21 15:44 ` Mathieu Lirzin
2016-04-24 21:20 ` Ludovic Courtès
0 siblings, 1 reply; 9+ messages in thread
From: Mathieu Lirzin @ 2016-04-21 15:44 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 1404 bytes --]
ludo@gnu.org (Ludovic Courtès) writes:
> Mathieu Lirzin <mthl@gnu.org> skribis:
>
>> * gnu/packages/version-control.scm (reposurgeon): New variable.
>
> [...]
>
>> + (add-before 'build 'fix-docbook
>> + (lambda* (#:key inputs #:allow-other-keys)
>> + (setenv "XML_CATALOG_FILE"
>> + (string-append (assoc-ref inputs "docbook-xsl")
>> + "/xml/xsl/docbook-xsl-"
>> + ,(package-version docbook-xsl)
>> + "/manpages/docbook.xsl"))
>
> Could you add a comment on why this is needed?
> Normally, with libxml2 as an input, ‘XML_CATALOG_FILE’ should be
> properly initialized.
In fact that was not needed, so I have removed this snippet.
>> + ;; xsltproc generates random ids when the source document doesn't
>> + ;; provide them. This is making the build not reproducible.
>> + (substitute* "reposurgeon.xml"
>
> Eventually we should fix it in libxslt along these lines:
>
> https://bugzilla.gnome.org/show_bug.cgi?id=758148
>
> Could you send an updated patch?
After some digging, I have found that the generated IDs were based on
their node pointer address in the parse tree. So I have added an
additional patch which should be applied in the next release of libxslt.
[-- Attachment #2: 0001-gnu-libxslt-Make-generated-documentation-reproducibl.patch --]
[-- Type: text/x-diff, Size: 10218 bytes --]
From aa709979cad4ac7d8b4ea8b34815e5ea7f4dde1d Mon Sep 17 00:00:00 2001
From: Mathieu Lirzin <mthl@gnu.org>
Date: Mon, 18 Apr 2016 23:21:42 +0200
Subject: [PATCH 1/2] gnu: libxslt: Make generated documentation reproducible.
* gnu/packages/patches/libxslt-generated-ids.patch: New file.
* gnu/packages/patches/libxslt-remove-date-timestamps.patch: Likewise.
* gnu/packages/xml.scm (libxslt)[source]: Use them.
* gnu-system.am (dist_patch_DATA): Add them.
---
gnu-system.am | 2 +
gnu/packages/patches/libxslt-generated-ids.patch | 173 +++++++++++++++++++++
.../patches/libxslt-remove-date-timestamps.patch | 66 ++++++++
gnu/packages/xml.scm | 5 +-
4 files changed, 245 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/libxslt-generated-ids.patch
create mode 100644 gnu/packages/patches/libxslt-remove-date-timestamps.patch
diff --git a/gnu-system.am b/gnu-system.am
index d58155a..8a0ad82 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -594,6 +594,8 @@ dist_patch_DATA = \
gnu/packages/patches/libwmf-CVE-2015-4695.patch \
gnu/packages/patches/libwmf-CVE-2015-4696.patch \
gnu/packages/patches/libxslt-CVE-2015-7995.patch \
+ gnu/packages/patches/libxslt-generated-ids.patch \
+ gnu/packages/patches/libxslt-remove-date-timestamps.patch \
gnu/packages/patches/lirc-localstatedir.patch \
gnu/packages/patches/libpthread-glibc-preparation.patch \
gnu/packages/patches/lm-sensors-hwmon-attrs.patch \
diff --git a/gnu/packages/patches/libxslt-generated-ids.patch b/gnu/packages/patches/libxslt-generated-ids.patch
new file mode 100644
index 0000000..4273875
--- /dev/null
+++ b/gnu/packages/patches/libxslt-generated-ids.patch
@@ -0,0 +1,173 @@
+This makes generated IDs deterministic.
+
+Written by Daniel Veillard.
+
+This should be fixed in next release (2.29).
+See https://bugzilla.gnome.org/show_bug.cgi?id=751621.
+
+diff --git a/libxslt/functions.c b/libxslt/functions.c
+index 6448bde..5b00a6d 100644
+--- a/libxslt/functions.c
++++ b/libxslt/functions.c
+@@ -651,6 +651,63 @@ xsltFormatNumberFunction(xmlXPathParserContextPtr ctxt, int nargs)
+ }
+
+ /**
++ * xsltCleanupIds:
++ * @ctxt: the transformation context
++ * @root: the root of the resulting document
++ *
++ * This clean up ids which may have been saved in Element contents
++ * by xsltGenerateIdFunction() to provide stable IDs on elements.
++ *
++ * Returns the number of items cleaned or -1 in case of error
++ */
++int
++xsltCleanupIds(xsltTransformContextPtr ctxt, xmlNodePtr root) {
++ xmlNodePtr cur;
++ int count = 0;
++
++ if ((ctxt == NULL) || (root == NULL))
++ return(-1);
++ if (root->type != XML_ELEMENT_NODE)
++ return(-1);
++
++ cur = root;
++ while (cur != NULL) {
++ if (cur->type == XML_ELEMENT_NODE) {
++ if (cur->content != NULL) {
++ cur->content = NULL;
++ count++;
++ }
++ if (cur->children != NULL) {
++ cur = cur->children;
++ continue;
++ }
++ }
++ if (cur->next != NULL) {
++ cur = cur->next;
++ continue;
++ }
++ do {
++ cur = cur->parent;
++ if (cur == NULL)
++ break;
++ if (cur == (xmlNodePtr) root) {
++ cur = NULL;
++ break;
++ }
++ if (cur->next != NULL) {
++ cur = cur->next;
++ break;
++ }
++ } while (cur != NULL);
++ }
++
++fprintf(stderr, "Attributed %d IDs for element, cleaned up %d\n",
++ ctxt->nextid, count);
++
++ return(count);
++}
++
++/**
+ * xsltGenerateIdFunction:
+ * @ctxt: the XPath Parser context
+ * @nargs: the number of arguments
+@@ -701,7 +758,39 @@ xsltGenerateIdFunction(xmlXPathParserContextPtr ctxt, int nargs){
+ if (obj)
+ xmlXPathFreeObject(obj);
+
+- val = (long)((char *)cur - (char *)&base_address);
++ /*
++ * Try to provide stable ID for generated document:
++ * - usually ID are computed to be placed on elements via attributes
++ * so using the element as the node for the ID
++ * - the cur->content should be a correct placeholder for this, we use
++ * it to hold element node numbers in xmlXPathOrderDocElems to
++ * speed up XPath too
++ * - xsltCleanupIds() clean them up before handing the XSLT output
++ * to the API client.
++ * - other nodes types use the node address method but that should
++ * not end up in resulting document ID
++ * - we can enable this by default without risk of performance issues
++ * only the one pass xsltCleanupIds() is added
++ */
++ if (cur->type == XML_ELEMENT_NODE) {
++ if (cur->content == NULL) {
++ xsltTransformContextPtr tctxt;
++
++ tctxt = xsltXPathGetTransformContext(ctxt);
++ if (tctxt == NULL) {
++ val = (long)((char *)cur - (char *)&base_address);
++ } else {
++ tctxt->nextid++;
++ val = tctxt->nextid;
++ cur->content = (void *) (val);
++ }
++ } else {
++ val = (long) cur->content;
++ }
++ } else {
++ val = (long)((char *)cur - (char *)&base_address);
++ }
++
+ if (val >= 0) {
+ sprintf((char *)str, "idp%ld", val);
+ } else {
+diff --git a/libxslt/functions.h b/libxslt/functions.h
+index e0e0bf9..4a1e163 100644
+--- a/libxslt/functions.h
++++ b/libxslt/functions.h
+@@ -64,6 +64,13 @@ XSLTPUBFUN void XSLTCALL
+ int nargs);
+
+ /*
++ * Cleanup for ID generation
++ */
++XSLTPUBFUN int XSLTCALL
++ xsltCleanupIds (xsltTransformContextPtr ctxt,
++ xmlNodePtr root);
++
++/*
+ * And the registration
+ */
+
+diff --git a/libxslt/transform.c b/libxslt/transform.c
+index 24f9eb2..2bdf6bf 100644
+--- a/libxslt/transform.c
++++ b/libxslt/transform.c
+@@ -700,6 +700,7 @@ xsltNewTransformContext(xsltStylesheetPtr style, xmlDocPtr doc) {
+ cur->traceCode = (unsigned long*) &xsltDefaultTrace;
+ cur->xinclude = xsltGetXIncludeDefault();
+ cur->keyInitLevel = 0;
++ cur->nextid = 0;
+
+ return(cur);
+
+@@ -6092,6 +6093,13 @@ xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc,
+ if (root != NULL) {
+ const xmlChar *doctype = NULL;
+
++ /*
++ * cleanup ids which may have been saved in Elements content ptrs
++ */
++ if (ctxt->nextid != 0) {
++ xsltCleanupIds(ctxt, root);
++ }
++
+ if ((root->ns != NULL) && (root->ns->prefix != NULL))
+ doctype = xmlDictQLookup(ctxt->dict, root->ns->prefix, root->name);
+ if (doctype == NULL)
+diff --git a/libxslt/xsltInternals.h b/libxslt/xsltInternals.h
+index 95e8fe6..8eedae4 100644
+--- a/libxslt/xsltInternals.h
++++ b/libxslt/xsltInternals.h
+@@ -1786,6 +1786,8 @@ struct _xsltTransformContext {
+ int funcLevel; /* Needed to catch recursive functions issues */
+ int maxTemplateDepth;
+ int maxTemplateVars;
++
++ unsigned long nextid;/* for generating stable ids */
+ };
+
+ /**
diff --git a/gnu/packages/patches/libxslt-remove-date-timestamps.patch b/gnu/packages/patches/libxslt-remove-date-timestamps.patch
new file mode 100644
index 0000000..51470d0
--- /dev/null
+++ b/gnu/packages/patches/libxslt-remove-date-timestamps.patch
@@ -0,0 +1,66 @@
+Use deterministic SOURCE_DATE_EPOCH for embedded timestamps in generated documentation.
+
+Written by Eduard Sanou.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=758148
+
+--- libxslt-1.1.28.orig/libexslt/date.c
++++ libxslt-1.1.28/libexslt/date.c
+@@ -46,6 +46,7 @@
+ #include "exslt.h"
+
+ #include <string.h>
++#include <errno.h>
+
+ #ifdef HAVE_MATH_H
+ #include <math.h>
+@@ -747,21 +748,46 @@ static exsltDateValPtr
+ exsltDateCurrent (void)
+ {
+ struct tm localTm, gmTm;
++ struct tm *tb = NULL;
+ time_t secs;
+ int local_s, gm_s;
+ exsltDateValPtr ret;
++ char *source_date_epoch;
+
+ ret = exsltDateCreateDate(XS_DATETIME);
+ if (ret == NULL)
+ return NULL;
+
+- /* get current time */
+ secs = time(NULL);
++ /*
++ * Allow the date and time to be set externally by an exported
++ * environment variable to enable reproducible builds.
++ */
++ source_date_epoch = getenv("SOURCE_DATE_EPOCH");
++ if (source_date_epoch) {
++ errno = 0;
++ secs = (time_t) strtol (source_date_epoch, NULL, 10);
++ if (errno == 0) {
++ tb = gmtime(&secs);
++ if (tb == NULL) {
++ /* SOURCE_DATE_EPOCH is not a valid date */
++ return NULL;
++ } else {
++ localTm = *tb;
++ }
++ } else {
++ /* SOURCE_DATE_EPOCH is not a valid number */
++ return NULL;
++ }
++ } else {
++ /* get current time */
+ #if HAVE_LOCALTIME_R
+- localtime_r(&secs, &localTm);
++ localtime_r(&secs, &localTm);
+ #else
+- localTm = *localtime(&secs);
++ localTm = *localtime(&secs);
+ #endif
++ }
++
+
+ /* get real year, not years since 1900 */
+ ret->value.date.year = localTm.tm_year + 1900;
diff --git a/gnu/packages/xml.scm b/gnu/packages/xml.scm
index e1f111e..33ce970 100644
--- a/gnu/packages/xml.scm
+++ b/gnu/packages/xml.scm
@@ -7,6 +7,7 @@
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2015 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2015 Raimon Grau <raimonster@gmail.com>
+;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -132,7 +133,9 @@ project (but it is usable outside of the Gnome platform).")
(sha256
(base32
"13029baw9kkyjgr7q3jccw2mz38amq7mmpr5p3bh775qawd1bisz"))
- (patches (search-patches "libxslt-CVE-2015-7995.patch"))))
+ (patches (search-patches "libxslt-generated-ids.patch"
+ "libxslt-remove-date-timestamps.patch"
+ "libxslt-CVE-2015-7995.patch"))))
(build-system gnu-build-system)
(home-page "http://xmlsoft.org/XSLT/index.html")
(synopsis "C library for applying XSLT stylesheets to XML documents")
--
2.8.0.rc3
[-- Attachment #3: 0002-gnu-Add-reposurgeon.patch --]
[-- Type: text/x-diff, Size: 4039 bytes --]
From 2e4a62093625709447bfb9e749b5bed50905669b Mon Sep 17 00:00:00 2001
From: Mathieu Lirzin <mthl@gnu.org>
Date: Fri, 8 Apr 2016 00:16:37 +0200
Subject: [PATCH 2/2] gnu: Add reposurgeon.
* gnu/packages/version-control.scm (reposurgeon): New variable.
---
gnu/packages/version-control.scm | 54 ++++++++++++++++++++++++++++++++++++++--
1 file changed, 52 insertions(+), 2 deletions(-)
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 117d01d..042ccd9 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -3,7 +3,7 @@
;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013, 2014 Andreas Enge <andreas@enge.fr>
-;;; Copyright © 2015 Mathieu Lirzin <mthl@openmailbox.org>
+;;; Copyright © 2015, 2016 Mathieu Lirzin <mthl@gnu.org>
;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2015, 2016 Efraim Flashner <efraim@flashner.co.il>
@@ -27,7 +27,7 @@
(define-module (gnu packages version-control)
#:use-module ((guix licenses)
- #:select (asl2.0 bsd-2
+ #:select (asl2.0 bsd-2 bsd-3
gpl1+ gpl2 gpl2+ gpl3+ lgpl2.1
x11-style))
#:use-module (guix utils)
@@ -1013,6 +1013,56 @@ as possible. Resolution of contention for source files, a major headache for
any project with more than one developer, is one of Aegis's major functions.")
(license gpl3+)))
+(define-public reposurgeon
+ (package
+ (name "reposurgeon")
+ (version "3.37")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "http://www.catb.org/~esr/" name "/"
+ name "-" version ".tar.xz"))
+ (sha256
+ (base32
+ "14asjg4xy3mhh5z0r3k7c1wv9y803j2zfq32g5q5m95sf7yzygan"))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:tests? #f ;no test suite distributed
+ #:make-flags
+ (list (string-append "target=" (assoc-ref %outputs "out")))
+ #:phases
+ (modify-phases %standard-phases
+ (delete 'configure)
+ (add-before 'build 'fix-docbook
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* (find-files "." "\\.xml$")
+ (("docbook/docbookx.dtd")
+ (string-append (assoc-ref inputs "docbook-xml")
+ "/xml/dtd/docbook/docbookx.dtd")))
+ #t))
+ (add-after 'install 'install-emacs-data
+ (lambda* (#:key outputs #:allow-other-keys)
+ (install-file "reposurgeon-mode.el"
+ (string-append (assoc-ref outputs "out")
+ "/share/emacs/site-lisp")))))))
+ (inputs
+ `(("python" ,python-wrapper)))
+ (native-inputs
+ `(("asciidoc" ,asciidoc)
+ ("docbook-xml" ,docbook-xml-4.1.2)
+ ("docbook-xsl" ,docbook-xsl)
+ ("libxml2" ,libxml2)
+ ("xmlto" ,xmlto)))
+ (home-page "http://www.catb.org/~esr/reposurgeon/")
+ (synopsis "Edit version-control repository history")
+ (description "Reposurgeon enables risky operations that version-control
+systems don't want to let you do, such as editing past comments and metadata
+and removing commits. It works with any version control system that can
+export and import Git fast-import streams, including Git, Mercurial, Fossil,
+Bazaar, CVS, RCS, and Src. It can also read Subversion dump files directly
+and can thus be used to script production of very high-quality conversions
+from Subversion to any supported Distributed Version Control System (DVCS).")
+ (license (list bsd-2 bsd-3))))
+
(define-public tig
(package
(name "tig")
--
2.8.0.rc3
[-- Attachment #4: Type: text/plain, Size: 44 bytes --]
Thanks for the review.
--
Mathieu Lirzin
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] gnu: Add reposurgeon.
2016-04-21 15:44 ` Mathieu Lirzin
@ 2016-04-24 21:20 ` Ludovic Courtès
0 siblings, 0 replies; 9+ messages in thread
From: Ludovic Courtès @ 2016-04-24 21:20 UTC (permalink / raw)
To: Mathieu Lirzin; +Cc: guix-devel
Hello!
Mathieu Lirzin <mthl@gnu.org> skribis:
> ludo@gnu.org (Ludovic Courtès) writes:
[...]
>>> + ;; xsltproc generates random ids when the source document doesn't
>>> + ;; provide them. This is making the build not reproducible.
>>> + (substitute* "reposurgeon.xml"
>>
>> Eventually we should fix it in libxslt along these lines:
>>
>> https://bugzilla.gnome.org/show_bug.cgi?id=758148
>>
>> Could you send an updated patch?
>
> After some digging, I have found that the generated IDs were based on
> their node pointer address in the parse tree. So I have added an
> additional patch which should be applied in the next release of libxslt.
Awesome!
(I realize that maybe we miscommunicated, given that “eventually” is a
“false friend” compared to French.)
> From aa709979cad4ac7d8b4ea8b34815e5ea7f4dde1d Mon Sep 17 00:00:00 2001
> From: Mathieu Lirzin <mthl@gnu.org>
> Date: Mon, 18 Apr 2016 23:21:42 +0200
> Subject: [PATCH 1/2] gnu: libxslt: Make generated documentation reproducible.
>
> * gnu/packages/patches/libxslt-generated-ids.patch: New file.
> * gnu/packages/patches/libxslt-remove-date-timestamps.patch: Likewise.
> * gnu/packages/xml.scm (libxslt)[source]: Use them.
> * gnu-system.am (dist_patch_DATA): Add them.
OK for ‘core-updates’.
We’ll have to merge ‘master’ in ‘core-updates’ first, because of
‘search-patches’. You’re welcome to try it yourself if you want, but if
in doubt (in case of merge conflicts), I can do it.
> From 2e4a62093625709447bfb9e749b5bed50905669b Mon Sep 17 00:00:00 2001
> From: Mathieu Lirzin <mthl@gnu.org>
> Date: Fri, 8 Apr 2016 00:16:37 +0200
> Subject: [PATCH 2/2] gnu: Add reposurgeon.
>
> * gnu/packages/version-control.scm (reposurgeon): New variable.
[...]
> + (license (list bsd-2 bsd-3))))
I overlooked it before, but a comment above stating how the list is to
be interpreted would be welcome.
OK with this change.
Thank you!
Ludo’.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-04-24 21:20 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-09 19:26 [PATCH 0/3] Add reposurgeon Mathieu Lirzin
2016-04-09 19:26 ` [PATCH 1/3] gnu: Add docbook-xml-4.1.2 Mathieu Lirzin
2016-04-13 20:54 ` Ludovic Courtès
2016-04-09 19:26 ` [PATCH 2/3] gnu: Add reposurgeon Mathieu Lirzin
2016-04-13 21:01 ` Ludovic Courtès
2016-04-21 15:44 ` Mathieu Lirzin
2016-04-24 21:20 ` Ludovic Courtès
2016-04-09 19:26 ` [PATCH 3/3] doc: Add a reference to 'Invoking guix archive' Mathieu Lirzin
2016-04-13 21:01 ` Ludovic Courtès
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).