From 1b0ec97bce2db93ec4159a13fb0a184f012df4fe Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Sun, 24 Sep 2023 02:00:00 +0200 Subject: [PATCH] gnu: xen: Build reproducibly * gnu/packages/virtualization.scm (xen)[source]: Add patches. [arguments]: Add a new 'remove-cruft phase. * gnu/packages/patches/xen-docs-use-predictable-ordering.patch, * gnu/packages/patches/xen-remove-config.gz-timestamp.patch: New files. * gnu/local.mk (dist_patch_DATA): Add them both. --- gnu/local.mk | 2 + .../xen-docs-use-predictable-ordering.patch | 34 +++++++++++++++++ .../xen-remove-config.gz-timestamp.patch | 37 +++++++++++++++++++ gnu/packages/virtualization.scm | 13 ++++++- 4 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 gnu/packages/patches/xen-docs-use-predictable-ordering.patch create mode 100644 gnu/packages/patches/xen-remove-config.gz-timestamp.patch diff --git a/gnu/local.mk b/gnu/local.mk index 491638899b..c4215cd59a 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -2121,6 +2121,8 @@ dist_patch_DATA = \ %D%/packages/patches/wpa-supplicant-dbus-group-policy.patch \ %D%/packages/patches/x265-arm-flags.patch \ %D%/packages/patches/xdg-desktop-portal-wlr-harcoded-length.patch\ + %D%/packages/patches/xen-docs-use-predictable-ordering.patch \ + %D%/packages/patches/xen-remove-config.gz-timestamp.patch \ %D%/packages/patches/xf86-video-ark-remove-mibstore.patch \ %D%/packages/patches/xf86-video-nouveau-fixup-ABI.patch \ %D%/packages/patches/xf86-video-savage-xorg-compat.patch \ diff --git a/gnu/packages/patches/xen-docs-use-predictable-ordering.patch b/gnu/packages/patches/xen-docs-use-predictable-ordering.patch new file mode 100644 index 0000000000..557da5775a --- /dev/null +++ b/gnu/packages/patches/xen-docs-use-predictable-ordering.patch @@ -0,0 +1,34 @@ +From: Tobias Geerinckx-Rice +Date: Sun Sep 24 02:00:00 2023 +0200 +Subject: xen: docs: Use predictable ordering. + +What follows was taken verbatim from Debian. See: +https://sources.debian.org/patches/xen/4.14.5%2B94-ge49571868d-1/ + +From: Maximilian Engelhardt +Date: Fri, 18 Dec 2020 21:42:34 +0100 +Subject: docs: use predictable ordering in generated documentation + +When the seq number is equal, sort by the title to get predictable +output ordering. This is useful for reproducible builds. + +Signed-off-by: Maximilian Engelhardt +Acked-by: Andrew Cooper +(cherry picked from commit e18dadc5b709290b8038a1cacb52bc3b3b69cf21) +--- + docs/xen-headers | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/docs/xen-headers b/docs/xen-headers +index 5415563..8c434d7 100755 +--- a/docs/xen-headers ++++ b/docs/xen-headers +@@ -331,7 +331,7 @@ sub output_index () { +

Starting points

+
    + END +- foreach my $ic (sort { $a->{Seq} <=> $b->{Seq} } @incontents) { ++ foreach my $ic (sort { $a->{Seq} <=> $b->{Seq} or $a->{Title} cmp $b->{Title} } @incontents) { + $o .= "
  • {Href}\">$ic->{Title}
  • \n"; + } + $o .= "
\n"; diff --git a/gnu/packages/patches/xen-remove-config.gz-timestamp.patch b/gnu/packages/patches/xen-remove-config.gz-timestamp.patch new file mode 100644 index 0000000000..a7396c564d --- /dev/null +++ b/gnu/packages/patches/xen-remove-config.gz-timestamp.patch @@ -0,0 +1,37 @@ +From: Tobias Geerinckx-Rice +Date: Sun Sep 24 02:00:00 2023 +0200 +Subject: xen: docs: Use predictable ordering. + +What follows was taken verbatim from Debian. See: +https://sources.debian.org/patches/xen/4.14.5%2B94-ge49571868d-1/ + +From: =?utf-8?b?IkZyw6lkw6lyaWMgUGllcnJldCAoZmVwaXRyZSki?= + +Date: Wed, 4 Nov 2020 09:24:40 +0100 +Subject: xen: don't have timestamp inserted in config.gz +MIME-Version: 1.0 +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 8bit + +This is for improving reproducible builds. + +Signed-off-by: Frédéric Pierret (fepitre) +Acked-by: Jan Beulich +(cherry picked from commit 5816d327e44ab37ae08730f4c54a80835998f31f) +--- + xen/common/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/xen/common/Makefile b/xen/common/Makefile +index 06881d0..32cd650 100644 +--- a/xen/common/Makefile ++++ b/xen/common/Makefile +@@ -77,7 +77,7 @@ obj-$(CONFIG_HAS_DEVICE_TREE) += libfdt/ + + CONF_FILE := $(if $(patsubst /%,,$(KCONFIG_CONFIG)),$(XEN_ROOT)/xen/)$(KCONFIG_CONFIG) + config.gz: $(CONF_FILE) +- gzip -c $< >$@ ++ gzip -n -c $< >$@ + + config_data.o: config.gz + diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm index 9097355e4e..779164c53f 100644 --- a/gnu/packages/virtualization.scm +++ b/gnu/packages/virtualization.scm @@ -2288,7 +2288,10 @@ (define-public xen (file-name (git-file-name name version)) (sha256 (base32 - "1cdzpxbihkdn4za8ly0lgkbxrafjzbxjflhfn83kyg4bam1vv7mn")))) + "1cdzpxbihkdn4za8ly0lgkbxrafjzbxjflhfn83kyg4bam1vv7mn")) + (patches + (search-patches "xen-docs-use-predictable-ordering.patch" + "xen-remove-config.gz-timestamp.patch")))) (build-system gnu-build-system) (arguments (list @@ -2409,7 +2412,13 @@ (define (filter-environment! filter-predicate (apply invoke "make" "world" "-j" (number->string (if parallel-build? (parallel-job-count) 1)) - make-flags)))))) + make-flags))) + (add-after 'install 'remove-cruft + (lambda _ + (with-directory-excursion #$output + ;; Delete useless (and irreproducible) build-time left-overs. + (for-each delete-file + (find-files "share/doc" "^\\.deps$")))))))) (inputs (list acpica ; TODO: patch iasl invocation bridge-utils ; TODO: patch invocations