unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: mhw@netris.org
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org
Subject: Re: [PATCHES] Add 'file' to %final-inputs; patch /usr/bin/file
Date: Fri, 22 Aug 2014 02:12:54 -0400	[thread overview]
Message-ID: <878umhaw7t.fsf@netris.org> (raw)
In-Reply-To: <87iollbzkm.fsf_-_@netris.org> (mhw@netris.org's message of "Thu, 21 Aug 2014 12:02:49 -0400")

[-- Attachment #1: Type: text/plain, Size: 92 bytes --]

Here are updated versions of these patches.  Please disregard the
earlier ones.

     Mark


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: [PATCH 1/3] gnu: bootstrap: Add 'file' to %boot0-inputs and %final-inputs --]
[-- Type: text/x-patch, Size: 1888 bytes --]

From 554d86b02c75922a1c05b5e65cfccd3cc8bd23db Mon Sep 17 00:00:00 2001
From: Mark H Weaver <mhw@netris.org>
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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: [PATCH 2/3] gnu-build-system: Add 'patch-usr-bin-file' to %standard-phases --]
[-- Type: text/x-patch, Size: 2419 bytes --]

From 883f77d92f5b1e8af294f88abea0b09487fb901b Mon Sep 17 00:00:00 2001
From: Mark H Weaver <mhw@netris.org>
Date: Thu, 21 Aug 2014 11:30:08 -0400
Subject: [PATCH 2/3] gnu-build-system: 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 | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index 8636931..a1fe26e 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.scm
@@ -106,6 +106,31 @@ 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, if present."
+  (let ((file "configure")
+        (file-command (or (and=> (assoc-ref (or native-inputs inputs) "file")
+                                 (cut string-append <> "/bin/file"))
+                          (which "file"))))
+    (cond ((not (file-exists? file))
+           (format (current-error-port)
+                   "patch-usr-bin-file: warning: `~a' not found~%"
+                   file))
+          ((not file-command)
+           (format (current-error-port)
+                   "patch-usr-bin-file: warning: `file' not found in PATH~%"))
+          (else
+           (let ((st (stat file)))
+             (substitute* file
+               (("/usr/bin/file")
+                (begin
+                  (format (current-error-port)
+                          "patch-usr-bin-file: ~a: changing `~a' to `~a'~%"
+                          file "/usr/bin/file" file-command)
+                  file-command)))
+             (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 +378,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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: [PATCH 3/3] gnu: Rely on 'file' implicit input and 'patch-usr-bin-file' --]
[-- Type: text/x-patch, Size: 15538 bytes --]

From 6818e2a6e53afa7b90379a4a99f014308c8cd2ee Mon Sep 17 00:00:00 2001
From: Mark H Weaver <mhw@netris.org>
Date: Thu, 21 Aug 2014 22:39:18 -0400
Subject: [PATCH 3/3] gnu: Rely on 'file' implicit input and
 'patch-usr-bin-file'.

* gnu/packages/admin.scm (sudo):
* gnu/packages/gawk.scm (gawk): Remove workaround on MIPS.

* gnu/packages/mcrypt.scm (mcrypt, libmhash):
* gnu/packages/file.scm (file): Remove 'file' from native-inputs.

* gnu/packages/mc.scm (mc):
* gnu/packages/pretty-print.scm (a2ps, trueprint, source-highlight):
* gnu/packages/image.scm (libtiff): Remove 'file' from native-inputs.
  Remove 'patch-configure' phase.
---
 gnu/packages/admin.scm        |  13 +----
 gnu/packages/file.scm         |   3 --
 gnu/packages/gawk.scm         |  11 -----
 gnu/packages/image.scm        |  12 +----
 gnu/packages/mc.scm           |  11 +----
 gnu/packages/mcrypt.scm       |   7 +--
 gnu/packages/pretty-print.scm | 112 +++++++++++++++++-------------------------
 7 files changed, 51 insertions(+), 118 deletions(-)

diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index c259974..4d60c17 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -648,18 +648,7 @@ system administrator.")
                       "")
                      (("^install: (.*)install-sudoers(.*)" _ before after)
                       ;; Don't try to create /etc/sudoers.
-                      (string-append "install: " before after "\n")))
-
-                   ;; XXX FIXME sudo 1.8.10p3 was bootstrapped with a
-                   ;; prerelease libtool, which fails on MIPS in the absence
-                   ;; of /usr/bin/file.  As a temporary workaround, we patch
-                   ;; the configure script to hardcode use of the little
-                   ;; endian N32 ABI on MIPS.
-                   ,@(if (equal? "mips64el-linux" (or (%current-target-system)
-                                                      (%current-system)))
-                         '((substitute* "configure"
-                             (("\\$emul") "elf32ltsmipn32")))
-                         '()))
+                      (string-append "install: " before after "\n"))))
                  %standard-phases)
 
        ;; XXX: The 'testsudoers' test series expects user 'root' to exist, but
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 6185409..fd14b4c 100644
--- a/gnu/packages/gawk.scm
+++ b/gnu/packages/gawk.scm
@@ -55,17 +55,6 @@
                           '((substitute* "extension/Makefile.in"
                               (("^.*: check-for-shared-lib-support" match)
                                (string-append "### " match))))
-                          '())
-
-                    ;; XXX FIXME gawk 4.1.1 was bootstrapped with a prerelease
-                    ;; libtool, which fails on MIPS in the absence of
-                    ;; /usr/bin/file.  As a temporary workaround, we patch
-                    ;; the configure script to hardcode use of the little
-                    ;; endian N32 ABI on MIPS.
-                    ,@(if (equal? "mips64el-linux" (or (%current-target-system)
-                                                       (%current-system)))
-                          '((substitute* "extension/configure"
-                              (("\\$emul") "elf32ltsmipn32")))
                           '())))
                 %standard-phases)))
    (inputs `(("libsigsegv" ,libsigsegv)
diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
index 014266c..06f6271 100644
--- a/gnu/packages/image.scm
+++ b/gnu/packages/image.scm
@@ -19,7 +19,6 @@
 (define-module (gnu packages image)
   #:use-module (gnu packages)
   #:use-module (gnu packages compression)
-  #:use-module (gnu packages file)
   #:use-module ((guix licenses) #:renamer (symbol-prefix-proc 'license:))
   #:use-module (guix packages)
   #:use-module (guix download)
@@ -97,20 +96,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/mc.scm b/gnu/packages/mc.scm
index aba14d5..6e3747c 100644
--- a/gnu/packages/mc.scm
+++ b/gnu/packages/mc.scm
@@ -28,7 +28,6 @@
   #:use-module (gnu packages ssh)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages check)
-  #:use-module (gnu packages file)
   #:use-module (gnu packages perl))
 
 (define-public mc
@@ -46,7 +45,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 +53,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..12a4827 100644
--- a/gnu/packages/mcrypt.scm
+++ b/gnu/packages/mcrypt.scm
@@ -23,8 +23,7 @@
   #:use-module (guix build-system gnu)
   #:use-module (gnu packages)
   #:use-module (gnu packages compression)
-  #:use-module (gnu packages perl)
-  #:use-module (gnu packages file))
+  #:use-module (gnu packages perl))
 
 (define-public mcrypt
   (package
@@ -68,7 +67,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 +93,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/pretty-print.scm b/gnu/packages/pretty-print.scm
index 8c51b54..07837eb 100644
--- a/gnu/packages/pretty-print.scm
+++ b/gnu/packages/pretty-print.scm
@@ -30,8 +30,7 @@
   #:use-module (gnu packages bison)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages gperf)
-  #:use-module (gnu packages perl)
-  #:use-module (gnu packages file))
+  #:use-module (gnu packages perl))
 
 (define-public a2ps
   (package
@@ -53,45 +52,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 +108,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 +164,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


  reply	other threads:[~2014-08-22  6:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-20 18:58 Making 'file' an implicit native input in core-updates mhw
2014-08-20 19:21 ` Eric Bavier
2014-08-20 21:33 ` Ludovic Courtès
2014-08-21 16:02   ` [PATCHES] Add 'file' to %final-inputs; patch /usr/bin/file mhw
2014-08-22  6:12     ` mhw [this message]
2014-08-22  9:09       ` Ludovic Courtès
2014-08-22  9:03     ` Ludovic Courtès
2014-08-30 20:22     ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878umhaw7t.fsf@netris.org \
    --to=mhw@netris.org \
    --cc=guix-devel@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).