From 2bd17f8a15f414471b63412d0a2d4c2253e760c0 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Thu, 19 May 2022 15:24:45 +0300 Subject: gnu: dpkg: Fix calling dpkg from perl modules. * gnu/packages/debian.scm (dpkg)[arguments]: Add phase to wrap perl scripts with PERL5LIB and the path to dpkg itself. [inputs]: Add guile-3.0. --- gnu/packages/debian.scm | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/gnu/packages/debian.scm b/gnu/packages/debian.scm index aec65e3386..65132d9259 100644 --- a/gnu/packages/debian.scm +++ b/gnu/packages/debian.scm @@ -33,6 +33,7 @@ #:use-module (gnu packages dbm) #:use-module (gnu packages gettext) #:use-module (gnu packages gnupg) + #:use-module (gnu packages guile) #:use-module (gnu packages ncurses) #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) @@ -361,7 +362,40 @@ other apt sources typically provided by open source developers.") (setenv "PERL_LIBDIR" (string-append out "/lib/perl5/site_perl/" - ,(package-version perl))))))))) + ,(package-version perl)))))) + (add-after 'install 'wrap-scripts + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (with-directory-excursion (string-append out "/bin") + (for-each + (lambda (file) + (wrap-script file + ;; Make sure all perl scripts in "bin" find the + ;; required Perl modules at runtime. + `("PERL5LIB" ":" prefix + (,(string-append out + "/lib/perl5/site_perl") + ,(getenv "PERL5LIB"))) + ;; DPKG perl modules always expect dpkg to be installed. + ;; Work around this by adding dpkg to the path of the scripts. + `("PATH" ":" prefix (,(string-append out "/bin"))))) + (list "dpkg-architecture" + "dpkg-buildflags" + "dpkg-buildpackage" + "dpkg-checkbuilddeps" + "dpkg-distaddfile" + "dpkg-genbuildinfo" + "dpkg-genchanges" + "dpkg-gencontrol" + "dpkg-gensymbols" + "dpkg-mergechangelogs" + "dpkg-name" + "dpkg-parsechangelog" + "dpkg-scanpackages" + "dpkg-scansources" + "dpkg-shlibdeps" + "dpkg-source" + "dpkg-vendor"))))))))) (native-inputs `(("autoconf" ,autoconf) ("automake" ,automake) @@ -371,6 +405,7 @@ other apt sources typically provided by open source developers.") ("perl-io-string" ,perl-io-string))) (inputs (list bzip2 + guile-3.0 ; For wrap-script libmd ncurses perl -- cgit v1.2.3