From mboxrd@z Thu Jan 1 00:00:00 1970 From: mhw@netris.org Subject: [PATCHES] Add 'file' to %final-inputs; patch /usr/bin/file Date: Thu, 21 Aug 2014 12:02:49 -0400 Message-ID: <87iollbzkm.fsf_-_@netris.org> References: <87mwazasyc.fsf@netris.org> <877g22978h.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33957) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKUpk-0001QY-EN for guix-devel@gnu.org; Thu, 21 Aug 2014 12:03:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XKUpf-0000hI-IS for guix-devel@gnu.org; Thu, 21 Aug 2014 12:03:27 -0400 In-Reply-To: <877g22978h.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Wed, 20 Aug 2014 23:33:18 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable ludo@gnu.org (Ludovic Court=C3=A8s) writes: > mhw@netris.org skribis: > >> Given that this problem is becoming increasingly common, I think we >> should add 'file' as an implicit native-input for the gnu-build-system >> in core-updates, and also add a new phase to %standard-phases that >> substitutes /usr/bin/file in the usual places with a path that works in >> the build environment. > > Yes, that makes sense. > > If you want, you (yes, you ;-)) can start it in a branch off > core-updates, or directly in core-updates, if that=E2=80=99s fine this wa= y. Here are proposed patches for core-updates. I chose to add a 'file-boot0' to '%boot0-inputs' to make 'file' available as early as possible in the bootstrap, on the theory that any library could soon depend on 'file'. I've successfully built 'hello' on i686 with these patches applied, but I've not yet tested them on MIPS. If I test them on the Loongson 3A machine, then when hydra offloads the same builds, the build logs on hydra will be empty. It would be good if hydra would copy over the saved build log in that case. Do these patches look right to you? Do you expect that cross-compilation would be handled correctly? Thanks! Mark --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-gnu-bootstrap-Add-file-to-boot0-inputs-and-final-inp.patch Content-Description: [PATCH 1/3] gnu: bootstrap: Add 'file' to %boot0-inputs and %final-inputs >From cc6c36bb7ab93271c302b6e3c44a051ace1e729d Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Thu, 21 Aug 2014 11:26:40 -0400 Subject: [PATCH 1/3] gnu: bootstrap: Add 'file' to %boot0-inputs and %final-inputs. * gnu/packages/base.scm (file-boot0): New variable. (%boot0-inputs): Add 'file-boot0'. (%final-inputs): Add 'file' to list of packages to 'finalize'. --- gnu/packages/base.scm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 8060ab6..30176cf 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -29,6 +29,7 @@ #:use-module (gnu packages compression) #:use-module (gnu packages gcc) #:use-module (gnu packages ed) + #:use-module (gnu packages file) #:use-module (gnu packages gawk) #:use-module (gnu packages guile) #:use-module (gnu packages multiprecision) @@ -630,11 +631,20 @@ and daylight-saving rules.") (current-source-location) #:guile %bootstrap-guile))) +(define file-boot0 + (package-with-bootstrap-guile + (package-with-explicit-inputs file + `(("make" ,gnu-make-boot0) + ,@%bootstrap-inputs) + (current-source-location) + #:guile %bootstrap-guile))) + (define %boot0-inputs `(("make" ,gnu-make-boot0) ("diffutils" ,diffutils-boot0) ("findutils" ,findutils-boot0) + ("file" ,file-boot0) ,@%bootstrap-inputs)) (define* (nix-system->gnu-triplet @@ -1187,6 +1197,7 @@ store.") ("gzip" ,gzip) ("bzip2" ,bzip2) ("xz" ,xz) + ("file" ,file) ("diffutils" ,diffutils) ("patch" ,patch) ("sed" ,sed) -- 1.8.4 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0002-build-system-gnu-Add-patch-usr-bin-file-to-standard-.patch Content-Description: [PATCH 2/3] build-system/gnu: Add 'patch-usr-bin-file' to %standard-phases >From c41191e84b79af9021c7a17cdd1fd10564e96ad9 Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Thu, 21 Aug 2014 11:30:08 -0400 Subject: [PATCH 2/3] build-system/gnu: Add 'patch-usr-bin-file' to %standard-phases. * guix/build/gnu-build-system.scm (patch-usr-bin-file): New procedure. (%standard-phases): Add it. --- guix/build/gnu-build-system.scm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index 8636931..470e96e 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -106,6 +106,23 @@ working directory." (and (zero? (system* "tar" "xvf" source)) (chdir (first-subdirectory "."))))) +(define* (patch-usr-bin-file #:key native-inputs inputs #:allow-other-keys) + "Patch occurrences of /usr/bin/file in configure script, if present." + (let ((file "configure") + (new (and=> (assoc-ref (or native-inputs inputs) "file") + (cut string-append <> "/bin/file")))) + (when (and new (file-exists? file)) + (let ((st (stat file))) + (substitute* file + (("/usr/bin/file" old) + (begin + (format (current-error-port) + "patch-usr-bin-file: ~a: changing `~a' to `~a'~%" + file old new) + new))) + (set-file-time file st))) + #t)) + (define* (patch-source-shebangs #:key source #:allow-other-keys) "Patch shebangs in all source files; this includes non-executable files such as `.in' templates. Most scripts honor $SHELL and @@ -353,6 +370,7 @@ makefiles." (let-syntax ((phases (syntax-rules () ((_ p ...) `((p . ,p) ...))))) (phases set-paths unpack + patch-usr-bin-file patch-source-shebangs configure patch-generated-file-shebangs build check install patch-shebangs strip))) -- 1.8.4 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0003-gnu-Rely-on-file-as-an-implicit-input-and-on-patch-u.patch Content-Description: [PATCH 3/3] gnu: Rely on 'file' as an implicit input, and on 'patch-usr-bin-file' >From 02afc88c008bbe42d15199fc8e062a3fba6cf762 Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Thu, 21 Aug 2014 11:40:43 -0400 Subject: [PATCH 3/3] gnu: Rely on 'file' as an implicit input, and on 'patch-usr-bin-file'. * gnu/packages/admin.scm (sudo): Remove 'file' native-input * gnu/packages/bdw-gc.scm (libatomic-ops, libgc): Remove 'file' native-input. * gnu/packages/bittorrent.scm (transmission): Remove 'file' input. * gnu/packages/cmake.scm (cmake): Remove 'file' input. * gnu/packages/file.scm (file): Remove 'file' native-input. * gnu/packages/gawk.scm (gawk): Remove 'file' native-input. * gnu/packages/image.scm (libtiff): Remove 'file' native-input. Remove 'patch-configure' phase. * gnu/packages/libffi.scm (libffi): Remove 'file' native-input. * gnu/packages/mc.scm (mc): Remove 'file' native-input. Remove 'patch-configure' phase. * gnu/packages/mcrypt.scm (libmcrypt, libmhash): Remove 'file' native-input. * gnu/packages/patchutils.scm (quilt): Remove 'file' input. * gnu/packages/pretty-print.scm (a2ps, trueprint, source-highlight): Remove 'file' native-input. Remove 'patch-configure' phase. --- gnu/packages/admin.scm | 6 --- gnu/packages/bdw-gc.scm | 14 +----- gnu/packages/bittorrent.scm | 1 - gnu/packages/cmake.scm | 2 - gnu/packages/file.scm | 3 -- gnu/packages/gawk.scm | 6 --- gnu/packages/image.scm | 11 +---- gnu/packages/libffi.scm | 6 --- gnu/packages/mc.scm | 10 +--- gnu/packages/mcrypt.scm | 4 +- gnu/packages/patchutils.scm | 1 - gnu/packages/pretty-print.scm | 109 +++++++++++++++++------------------------- 12 files changed, 49 insertions(+), 124 deletions(-) diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm index 83b0180..8a85827 100644 --- a/gnu/packages/admin.scm +++ b/gnu/packages/admin.scm @@ -659,12 +659,6 @@ system administrator.") `(("groff" ,groff) ("linux-pam" ,linux-pam) ("coreutils" ,coreutils))) - (native-inputs - `(;; 'file' is needed by the pre-release libtool on MIPS. - ,@(if (equal? "mips64el-linux" (or (%current-target-system) - (%current-system))) - `(("file" ,file)) - '()))) (home-page "http://www.sudo.ws/") (synopsis "Run commands as root") (description diff --git a/gnu/packages/bdw-gc.scm b/gnu/packages/bdw-gc.scm index e68ca50..e5a08b0 100644 --- a/gnu/packages/bdw-gc.scm +++ b/gnu/packages/bdw-gc.scm @@ -76,12 +76,6 @@ C or C++ programs, though that is not its primary goal.") (base32 "1pdm0h1y7bgkczr8byg20r6bq15m5072cqm5pny4f9crc9gn3yh4")))) (build-system gnu-build-system) - (native-inputs - `(;; 'file' is needed by the pre-release libtool on MIPS. - ,@(if (equal? "mips64el-linux" (or (%current-target-system) - (%current-system))) - `(("file" ,file)) - '()))) (outputs '("out" "debug")) (synopsis "Accessing hardware atomic memory update operations") (description @@ -106,13 +100,7 @@ lock-free code, experiment with thread programming paradigms, etc.") "18mg28rr6kwr5clc65k4l4hkyy4kd16amx831sjf8q2lqkbhlck3")))) ;; New dependencies. - (native-inputs - `(("pkg-config" ,pkg-config) - ;; 'file' is needed by the pre-release libtool on MIPS. - ,@(if (equal? "mips64el-linux" (or (%current-target-system) - (%current-system))) - `(("file" ,file)) - '()))) + (native-inputs `(("pkg-config" ,pkg-config))) (inputs `(("libatomic-ops" ,libatomic-ops))) ;; 'USE_LIBC_PRIVATES' is now the default. diff --git a/gnu/packages/bittorrent.scm b/gnu/packages/bittorrent.scm index 496120a..c3e874b 100644 --- a/gnu/packages/bittorrent.scm +++ b/gnu/packages/bittorrent.scm @@ -66,7 +66,6 @@ ("libevent" ,libevent) ("curl" ,curl) ("openssl" ,openssl) - ("file" ,file) ("zlib" ,zlib) ("gtk+" ,gtk+))) (native-inputs diff --git a/gnu/packages/cmake.scm b/gnu/packages/cmake.scm index 87a70de..afe816d 100644 --- a/gnu/packages/cmake.scm +++ b/gnu/packages/cmake.scm @@ -78,8 +78,6 @@ (string-join (take (string-split version #\.) 2) ".")))))) %standard-phases))) - (inputs - `(("file" ,file))) (home-page "http://www.cmake.org/") (synopsis "Cross-platform build system") (description diff --git a/gnu/packages/file.scm b/gnu/packages/file.scm index f53c22f..067f20e 100644 --- a/gnu/packages/file.scm +++ b/gnu/packages/file.scm @@ -35,9 +35,6 @@ (sha256 (base32 "01xz106biz6x4h5ilymg5v3367djvgnfp4lm87132cjqdmqgn6b5")))) (build-system gnu-build-system) - (native-inputs - ;; This package depends upon a native install of itself. - (if (%current-target-system) `(("file" ,file)) '() )) (synopsis "file, a file type guesser") (description "The file command is a file type guesser, a command-line tool that tells diff --git a/gnu/packages/gawk.scm b/gnu/packages/gawk.scm index 737e610..adcf385 100644 --- a/gnu/packages/gawk.scm +++ b/gnu/packages/gawk.scm @@ -63,12 +63,6 @@ ,@(if (%current-target-system) `(("bash" ,bash)) '()))) - (native-inputs - `(;; 'file' is needed by the pre-release libtool on MIPS. - ,@(if (equal? "mips64el-linux" (or (%current-target-system) - (%current-system))) - `(("file" ,file)) - '()))) (home-page "http://www.gnu.org/software/gawk/") (synopsis "A text scanning and processing language") (description diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm index 014266c..25bb0e1 100644 --- a/gnu/packages/image.scm +++ b/gnu/packages/image.scm @@ -97,20 +97,11 @@ image files in PBMPLUS PPM/PGM, GIF, BMP, and Targa file formats.") (inputs `(("zlib" ,zlib) ("libjpeg-8" ,libjpeg-8))) ;; currently does not compile with libjpeg version 9 - (native-inputs `(("file" ,file))) (arguments `(#:configure-flags (list (string-append "--with-jpeg-include-dir=" (assoc-ref %build-inputs "libjpeg-8") - "/include")) - #:phases - (alist-cons-before - 'configure 'patch-configure - (lambda _ - (substitute* "configure" - (("`/usr/bin/file") - (string-append "`" (which "file"))))) - %standard-phases))) + "/include")))) (synopsis "Libtiff, a library for handling TIFF files") (description "Libtiff provides support for the Tag Image File Format (TIFF), a format diff --git a/gnu/packages/libffi.scm b/gnu/packages/libffi.scm index 067838f..8033fdc 100644 --- a/gnu/packages/libffi.scm +++ b/gnu/packages/libffi.scm @@ -45,12 +45,6 @@ (base32 "1sznmrhcswwbyqla9y2ximlkzbxks59wjfs3lh7qf8ayranyxzlp")))) (build-system gnu-build-system) - (native-inputs - `(;; 'file' is needed by the pre-release libtool on MIPS. - ,@(if (equal? "mips64el-linux" (or (%current-target-system) - (%current-system))) - `(("file" ,file)) - '()))) (arguments `(#:phases (alist-cons-after 'install 'post-install ,post-install-phase %standard-phases))) diff --git a/gnu/packages/mc.scm b/gnu/packages/mc.scm index aba14d5..e83f82c 100644 --- a/gnu/packages/mc.scm +++ b/gnu/packages/mc.scm @@ -46,7 +46,6 @@ (patches (list (search-patch "mc-fix-ncurses-build.patch"))))) (build-system gnu-build-system) (native-inputs `(("pkg-config" ,pkg-config) - ("file" ,file) ("perl" ,perl))) (inputs `(("aspell" ,aspell) ("ncurses" ,ncurses) @@ -55,14 +54,7 @@ ("check" ,check))) (arguments `(#:configure-flags - '("--with-screen=ncurses" "--enable-aspell") - #:phases - (alist-cons-before - 'configure 'patch-configure - (lambda _ - (substitute* "configure" - (("/usr/bin/file") (which "file")))) - %standard-phases))) + '("--with-screen=ncurses" "--enable-aspell"))) (home-page "http://www.midnight-commander.org") (synopsis "Graphical file manager") (description diff --git a/gnu/packages/mcrypt.scm b/gnu/packages/mcrypt.scm index eac8c72..a656639 100644 --- a/gnu/packages/mcrypt.scm +++ b/gnu/packages/mcrypt.scm @@ -68,7 +68,6 @@ them.") (base32 "0gipgb939vy9m66d3k8il98rvvwczyaw2ixr8yn6icds9c3nrsz4")))) (build-system gnu-build-system) - (native-inputs `(("file" ,file))) (home-page "http://mcrypt.sourceforge.net/") (synopsis "Encryption algorithm library") (description @@ -95,8 +94,7 @@ XTEA, 3WAY, TWOFISH, BLOWFISH, ARCFOUR, WAKE and more.") (patches (list (search-patch "mhash-keygen-test-segfault.patch"))))) (build-system gnu-build-system) (native-inputs - `(("file" ,file) - ("perl" ,perl))) ;for tests + `(("perl" ,perl))) ;for tests (home-page "http://mhash.sourceforge.net/") (synopsis "Thread-safe hash library") (description diff --git a/gnu/packages/patchutils.scm b/gnu/packages/patchutils.scm index 48f4d29..854be3c 100644 --- a/gnu/packages/patchutils.scm +++ b/gnu/packages/patchutils.scm @@ -96,7 +96,6 @@ listing the files modified by a patch.") (build-system gnu-build-system) (inputs `(("perl" ,perl) ("less" ,less) - ("file" ,file) ("ed" ,ed))) (arguments '(#:parallel-tests? #f diff --git a/gnu/packages/pretty-print.scm b/gnu/packages/pretty-print.scm index 8c51b54..2209cb9 100644 --- a/gnu/packages/pretty-print.scm +++ b/gnu/packages/pretty-print.scm @@ -53,45 +53,39 @@ ("imagemagick" ,imagemagick))) (native-inputs `(("gperf" ,gperf) - ("perl" ,perl) - ("file" ,file))) + ("perl" ,perl))) (arguments '(#:phases (alist-cons-before - 'configure 'patch-configure + 'build 'patch-scripts (lambda _ - (substitute* "configure" - (("/usr/bin/file") (which "file")))) + (substitute* + '("afm/make_fonts_map.sh" + "tests/defs" + "tests/backup.tst" + "tests/styles.tst") + (("/bin/rm") (which "rm")))) (alist-cons-before - 'build 'patch-scripts - (lambda _ - (substitute* - '("afm/make_fonts_map.sh" - "tests/defs" - "tests/backup.tst" - "tests/styles.tst") - (("/bin/rm") (which "rm")))) - (alist-cons-before - 'check 'patch-test-files - ;; Alternatively, we could unpatch the shebangs in tstfiles - (lambda* (#:key inputs #:allow-other-keys) - (let ((perl (assoc-ref inputs "perl"))) - (substitute* '("tests/ps-ref/includeres.ps" - "tests/gps-ref/includeres.ps") - (("/usr/local/bin/perl") - (string-append perl "/bin/perl")))) - ;; Some of the reference postscript contain a 'version 3' - ;; string that in inconsistent with the source text in the - ;; tstfiles directory. Erroneous search-and-replace? - (substitute* '("tests/ps-ref/InsertBlock.ps" - "tests/gps-ref/InsertBlock.ps" - "tests/ps-ref/bookie.ps" - "tests/gps-ref/bookie.ps") - (("version 3") "version 2")) - (substitute* '("tests/ps-ref/psmandup.ps" - "tests/gps-ref/psmandup.ps") - (("#! */bin/sh") (string-append - "#!" (which "sh"))))) - %standard-phases))))) + 'check 'patch-test-files + ;; Alternatively, we could unpatch the shebangs in tstfiles + (lambda* (#:key inputs #:allow-other-keys) + (let ((perl (assoc-ref inputs "perl"))) + (substitute* '("tests/ps-ref/includeres.ps" + "tests/gps-ref/includeres.ps") + (("/usr/local/bin/perl") + (string-append perl "/bin/perl")))) + ;; Some of the reference postscript contain a 'version 3' + ;; string that in inconsistent with the source text in the + ;; tstfiles directory. Erroneous search-and-replace? + (substitute* '("tests/ps-ref/InsertBlock.ps" + "tests/gps-ref/InsertBlock.ps" + "tests/ps-ref/bookie.ps" + "tests/gps-ref/bookie.ps") + (("version 3") "version 2")) + (substitute* '("tests/ps-ref/psmandup.ps" + "tests/gps-ref/psmandup.ps") + (("#! */bin/sh") (string-append + "#!" (which "sh"))))) + %standard-phases)))) (home-page "http://www.gnu.org/software/a2ps") (synopsis "Any file to PostScript, including pretty-printing") (description @@ -115,16 +109,9 @@ special cases, such as pretty-printing \"--help\" output.") (base32 "13rkc0fga10xyf56yy9dnq95zndnfadkhxflnp24skszj21y8jqh")))) (build-system gnu-build-system) - (native-inputs `(("file" ,file))) (arguments ;; Must define DIFF_CMD for tests to pass - '(#:configure-flags '("CPPFLAGS=-DDIFF_CMD=\\\"diff\\\"") - #:phases (alist-cons-before - 'configure 'patch-configure - (lambda _ - (substitute* "configure" - (("/usr/bin/file") (which "file")))) - %standard-phases))) + '(#:configure-flags '("CPPFLAGS=-DDIFF_CMD=\\\"diff\\\""))) (home-page "http://www.gnu.org/software/trueprint") (synopsis "Pretty-print C sources and other plain text to PostScript") (description @@ -178,34 +165,28 @@ different programming languages.") `(("boost" ,boost))) (native-inputs `(("bison" ,bison) - ("flex" ,flex) - ("file" ,file))) + ("flex" ,flex))) (arguments `(#:configure-flags (list (string-append "--with-boost=" (assoc-ref %build-inputs "boost"))) #:parallel-tests? #f ;There appear to be race conditions #:phases (alist-cons-before - 'configure 'patch-configure + 'check 'patch-test-files (lambda _ - (substitute* "configure" - (("/usr/bin/file") (which "file")))) - (alist-cons-before - 'check 'patch-test-files - (lambda _ - ;; Unpatch shebangs in test input so that source-highlight - ;; is still able to infer input language - (substitute* '("tests/test.sh" - "tests/test2.sh" - "tests/test.tcl") - (((string-append "#! *" (which "sh"))) "#!/bin/sh")) - ;; Initial patching unrecoverably removes whitespace, so - ;; remove it also in the comparison output. - (substitute* '("tests/test.sh.html" - "tests/test2.sh.html" - "tests/test.tcl.html") - (("#! */bin/sh") "#!/bin/sh"))) - %standard-phases)))) + ;; Unpatch shebangs in test input so that source-highlight + ;; is still able to infer input language + (substitute* '("tests/test.sh" + "tests/test2.sh" + "tests/test.tcl") + (((string-append "#! *" (which "sh"))) "#!/bin/sh")) + ;; Initial patching unrecoverably removes whitespace, so + ;; remove it also in the comparison output. + (substitute* '("tests/test.sh.html" + "tests/test2.sh.html" + "tests/test.tcl.html") + (("#! */bin/sh") "#!/bin/sh"))) + %standard-phases))) (home-page "http://www.gnu.org/software/src-highlite") (synopsis "Produce a document with syntax highlighting from a source file") (description -- 1.8.4 --=-=-=--