[PATCH core] gnu: patchelf: Build from git sources.

  • Open
  • quality assurance status badge
Details
3 participants
  • attila.lendvai
  • Attila Lendvai
  • Z572
Owner
unassigned
Submitted by
attila.lendvai
Severity
normal
A
A
attila.lendvai wrote on 28 Sep 14:12 +0200
(address . guix-patches@gnu.org)(name . Attila Lendvai)(address . attila@lendvai.name)
91e06adbec896b8e685d7bc2501da3e7dc932233.1727525522.git.attila@lendvai.name
From: Attila Lendvai <attila@lendvai.name>

Rationale: it makes it much easier to build a pending PR by using
`(commit "pull/544/head")` in the origin, or in general to experiment
with different patchelf versions. It also makes it more resilient
against attacks hidden in release tarballs.

Change-Id: I94eaedcd826c32b2c90823fe026718213f8d5962
---

sadly, this leads to endless rebuilds...

gnu/packages/elf.scm | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)

Toggle diff (60 lines)
diff --git a/gnu/packages/elf.scm b/gnu/packages/elf.scm
index dc2db836321..21228a9d878 100644
--- a/gnu/packages/elf.scm
+++ b/gnu/packages/elf.scm
@@ -278,19 +278,19 @@ (define-public patchelf
(name "patchelf")
(version "0.18.0")
(source (origin
- (method url-fetch)
- (uri (string-append
- "https://github.com/NixOS/patchelf/releases/download/"
- version
- "/patchelf-" version ".tar.bz2"))
- (sha256
- (base32
- "02s7ap86rx6yagfh9xwp96sgsj0p6hp99vhiq9wn4mxshakv4lhr"))))
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/NixOS/patchelf")
+ (commit version)))
+ (file-name (git-file-name "patchelf" version))
+ (sha256
+ (base32
+ "1v5mh8wdax4a97hw79nvzy0dixkbs0h487xkskkljkkdamq4rj5z"))))
(build-system gnu-build-system)
(arguments
'(#:phases
(modify-phases %standard-phases
- (add-after 'unpack 'fix-tests
+ (add-after 'bootstrap 'fix-tests
;; Our GCC code ensures that RUNPATH is never empty, it includes
;; at least glibc/lib and gcc:lib/lib.
(lambda* (#:key inputs #:allow-other-keys)
@@ -298,8 +298,8 @@ (define-public patchelf
;; Disable checking for an empty runpath:
(("^if test.*") "")
;; Find libgcc_s.so, which is necessary for the test:
- (("/xxxxxxxxxxxxxxx") (string-append (assoc-ref inputs "gcc:lib")
- "/lib")))
+ (("/xxxxxxxxxxxxxxx")
+ (dirname (search-input-file inputs "/lib/libgcc_s.so"))))
(substitute* "tests/replace-needed.sh"
;; This test assumes that only libc will be linked alongside
;; libfoo, but we also link libgcc_s.
@@ -312,7 +312,10 @@ (define-public patchelf
(substitute* "tests/Makefile.in"
((".*shared-rpath\\.sh \\.*") "")))))))
(native-inputs
- `(("gcc:lib" ,gcc "lib")))
+ (list
+ autoconf
+ automake
+ (list gcc "lib")))
(home-page "https://nixos.org/patchelf.html")
(synopsis "Modify the dynamic linker and RPATH of ELF executables")
(description

base-commit: 4f86fa20179ded1e6314eeba7da17309d501a32f
--
2.46.0
Z
(address . attila.lendvai@gmail.com)
87r0928mms.fsf@iscas.ac.cn
attila.lendvai@gmail.com writes:

Toggle quote (37 lines)
> From: Attila Lendvai <attila@lendvai.name>
>
> Rationale: it makes it much easier to build a pending PR by using
> `(commit "pull/544/head")` in the origin, or in general to experiment
> with different patchelf versions. It also makes it more resilient
> against attacks hidden in release tarballs.
>
> Change-Id: I94eaedcd826c32b2c90823fe026718213f8d5962
> ---
>
> sadly, this leads to endless rebuilds...
>
> gnu/packages/elf.scm | 27 +++++++++++++++------------
> 1 file changed, 15 insertions(+), 12 deletions(-)
>
> diff --git a/gnu/packages/elf.scm b/gnu/packages/elf.scm
> index dc2db836321..21228a9d878 100644
> --- a/gnu/packages/elf.scm
> +++ b/gnu/packages/elf.scm
> @@ -278,19 +278,19 @@ (define-public patchelf
> (name "patchelf")
> (version "0.18.0")
> (source (origin
> - (method url-fetch)
> - (uri (string-append
> - "https://github.com/NixOS/patchelf/releases/download/"
> - version
> - "/patchelf-" version ".tar.bz2"))
> - (sha256
> - (base32
> - "02s7ap86rx6yagfh9xwp96sgsj0p6hp99vhiq9wn4mxshakv4lhr"))))
> + (method git-fetch)
> + (uri (git-reference
> + (url "https://github.com/NixOS/patchelf")
> + (commit version)))
> + (file-name (git-file-name "patchelf" version))

i think should "(git-file-name name version)" ?

Toggle quote (10 lines)
> + (sha256
> + (base32
> + "1v5mh8wdax4a97hw79nvzy0dixkbs0h487xkskkljkkdamq4rj5z"))))
> (build-system gnu-build-system)
> (arguments
> '(#:phases
> (modify-phases %standard-phases
> - (add-after 'unpack 'fix-tests
> + (add-after 'bootstrap 'fix-tests

Just a question, why do you need to change to bootstrap here?

Toggle quote (24 lines)
> ;; Our GCC code ensures that RUNPATH is never empty, it includes
> ;; at least glibc/lib and gcc:lib/lib.
> (lambda* (#:key inputs #:allow-other-keys)
> @@ -298,8 +298,8 @@ (define-public patchelf
> ;; Disable checking for an empty runpath:
> (("^if test.*") "")
> ;; Find libgcc_s.so, which is necessary for the test:
> - (("/xxxxxxxxxxxxxxx") (string-append (assoc-ref inputs "gcc:lib")
> - "/lib")))
> + (("/xxxxxxxxxxxxxxx")
> + (dirname (search-input-file inputs "/lib/libgcc_s.so"))))
> (substitute* "tests/replace-needed.sh"
> ;; This test assumes that only libc will be linked alongside
> ;; libfoo, but we also link libgcc_s.
> @@ -312,7 +312,10 @@ (define-public patchelf
> (substitute* "tests/Makefile.in"
> ((".*shared-rpath\\.sh \\.*") "")))))))
> (native-inputs
> - `(("gcc:lib" ,gcc "lib")))
> + (list
> + autoconf
> + automake
> + (list gcc "lib")))

It would be nice to mention removing labels and adding new dependencies
in the submission, and etc/committer.scm maybe useful.

Toggle quote (5 lines)
> (synopsis "Modify the dynamic linker and RPATH of ELF executables")
> (description
>
> base-commit: 4f86fa20179ded1e6314eeba7da17309d501a32f
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEfr6klGDOXiwIdX/bO1qpk+Gi3/AFAmb5fGsACgkQO1qpk+Gi
3/Cy7w//UKSJiyTtUJyut54f7ZehQV0EdZ6I/IC7qVRrWb1naDGPGvzyRBHYEnk2
/1BBSQerlT4d/flkVct3LQP5+gbdm7iH92tFiYSqSOnOezLDT/MyqGS7pxPTMmhG
P6myOwdyHUd+GBtiUM3a/co8kXrhpyOlYq58NN48JSmubcuDQqERAeuXA4oos0VE
okqcvG6oVF9u1zSxTyEkgXTiGSzKodPRH9aOuADZnChAjMasRlimWqwlbrGec3QS
3PY7JRyFmaCZYmN0fdkPaSmFuyAlq88NSyuiL6srT0bJx2dlzKPXZuHkKUVn6TEJ
xQnMEY6sOlCXpNEDp1eWpnOqMKz0aG2AibLtMRvwj5ErvHVdqowEeKSVjivG1a4i
aeMcJzuEFk7hzELusug8FazMAarKGCKdUgp4aVxzDba6IbkBk1/4TYAmhVFRkEJX
irBs/hsoigctE2Rrnj4E0nNmt7vP997vrL4mB8QI91vfJElN0osrwEP+MsXrQxYF
ObCgwNTBlx3ntJsRst6vM+slB/ODWsbq1btDGkUlPmqbhz7YDS4c9bDyrHFW1GmY
JM6sqd+jmlaoYnyhgFSGGVmdTKpWDkTs8vATU7aNBTb5QUdidZl23u6sZrHhk/bF
fO44LE5H4gdgRN6Eq4HgLdus07bbyKF8awDeFAH8mpMoHIcVrow=
=l3KM
-----END PGP SIGNATURE-----

A
A
Attila Lendvai wrote on 30 Sep 10:14 +0200
(name . Z572)(address . zhengjunjie@iscas.ac.cn)
KrCzt5SaJzVnwJ-T14UrBQDEE1jPco5sPPzr6z1f4iOm8z_QBGEtXPa69SL9tZqkRU81X84IMnaTGe_Y0Vh4IPoPaefbuxV23r_Z_eEi_XI=@lendvai.name
Toggle quote (6 lines)
> > + (file-name (git-file-name "patchelf" version))
>
>
> i think should "(git-file-name name version)" ?


hrm. i tried that at first, but it errored out with `name` being undefined. i retried it just now to double check, and now it works. i must have been confused by something.

the updated patch will have `name` in there.


Toggle quote (14 lines)
> > + (sha256
> > + (base32
> > + "1v5mh8wdax4a97hw79nvzy0dixkbs0h487xkskkljkkdamq4rj5z"))))
> > (build-system gnu-build-system)
> > (arguments
> > '(#:phases
> > (modify-phases %standard-phases
> > - (add-after 'unpack 'fix-tests
> > + (add-after 'bootstrap 'fix-tests
>
>
> Just a question, why do you need to change to bootstrap here?


because the last substitute* touches `tests/Makefile.in` which is generated by the bootstrap phase (by the auto* tools).

but now that you asked, i've changed it to target `tests/Makefile.am` instead.


Toggle quote (12 lines)
> > (native-inputs
> > - `(("gcc:lib" ,gcc "lib")))
> > + (list
> > + autoconf
> > + automake
> > + (list gcc "lib")))
>
>
> It would be nice to mention removing labels and adding new dependencies
> in the submission, and etc/committer.scm maybe useful.


ok, i'll send an updated patch soon.

BTW, etc/committer.scm broke on this package. i've sent a patch to fix that:


--
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
“Where there are rulers, there are no rules, only interest-serving opinions enforced by violence. To want rulers is to beg for chaos.”
— Brandon Roark
A
A
attila.lendvai wrote on 30 Sep 10:15 +0200
[PATCH core v2] gnu: patchelf: Build from git
(address . 73529@debbugs.gnu.org)(name . Attila Lendvai)(address . attila@lendvai.name)
9706446756fd9c5c9e40ae1fa8fc6ca326407178.1727684109.git.attila@lendvai.name
From: Attila Lendvai <attila@lendvai.name>

Rationale: it makes it much easier for anyone to build a pending PR (simply by
using `(commit "pull/544/head")` in the origin). It also makes it more
resilient against attacks hidden in release tarballs.

* gnu/packages/elf.scm (patchelf): Change source origin to the git repo and
adjust inputs accordingly.
[native-inputs]: Add autoconf, automake.

Change-Id: I94eaedcd826c32b2c90823fe026718213f8d5962
---
gnu/packages/elf.scm | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)

Toggle diff (58 lines)
diff --git a/gnu/packages/elf.scm b/gnu/packages/elf.scm
index dc2db836321..98b80c24b3e 100644
--- a/gnu/packages/elf.scm
+++ b/gnu/packages/elf.scm
@@ -278,14 +278,14 @@ (define-public patchelf
(name "patchelf")
(version "0.18.0")
(source (origin
- (method url-fetch)
- (uri (string-append
- "https://github.com/NixOS/patchelf/releases/download/"
- version
- "/patchelf-" version ".tar.bz2"))
- (sha256
- (base32
- "02s7ap86rx6yagfh9xwp96sgsj0p6hp99vhiq9wn4mxshakv4lhr"))))
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/NixOS/patchelf")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1v5mh8wdax4a97hw79nvzy0dixkbs0h487xkskkljkkdamq4rj5z"))))
(build-system gnu-build-system)
(arguments
'(#:phases
@@ -298,8 +298,8 @@ (define-public patchelf
;; Disable checking for an empty runpath:
(("^if test.*") "")
;; Find libgcc_s.so, which is necessary for the test:
- (("/xxxxxxxxxxxxxxx") (string-append (assoc-ref inputs "gcc:lib")
- "/lib")))
+ (("/xxxxxxxxxxxxxxx")
+ (dirname (search-input-file inputs "/lib/libgcc_s.so"))))
(substitute* "tests/replace-needed.sh"
;; This test assumes that only libc will be linked alongside
;; libfoo, but we also link libgcc_s.
@@ -309,10 +309,13 @@ (define-public patchelf
;; we still need to find libgcc_s (see above).
(("^\"\\$\\{SCRATCH\\}\"\\/simple.$") ""))
;; Skip this test for now.
- (substitute* "tests/Makefile.in"
+ (substitute* "tests/Makefile.am"
((".*shared-rpath\\.sh \\.*") "")))))))
(native-inputs
- `(("gcc:lib" ,gcc "lib")))
+ (list
+ autoconf
+ automake
+ (list gcc "lib")))
(home-page "https://nixos.org/patchelf.html")
(synopsis "Modify the dynamic linker and RPATH of ELF executables")
(description

base-commit: d74fc6c8e6428c37a5bfad85b08999ff47000208
--
2.46.0
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 73529@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 73529
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch