[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] distro: Add util-linux.

From: Ludovic Courtès
Subject: Re: [PATCH] distro: Add util-linux.
Date: Sun, 02 Dec 2012 23:56:56 +0100
User-agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.2 (gnu/linux)

Hi Nikita,

Nikita Karetnikov <address@hidden> skribis:

> There are some issues:
> 1. './pre-inst-env guix-build -K util-linux' raises the following
> warning:
> kdupexe: warning: no binary for interpreter address@hidden@' found in $PATH

A bug in util-linux’s build system.

I worked around it like this:

diff --git a/distro/packages/util-linux.scm b/distro/packages/util-linux.scm
index ad6b03b..bc91839 100644
--- a/distro/packages/util-linux.scm
+++ b/distro/packages/util-linux.scm
@@ -19,6 +19,7 @@
 (define-module (distro packages util-linux)
   #:use-module (distro packages compression)
   #:use-module (distro packages ncurses)
+  #:use-module (distro packages perl)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu))
@@ -37,9 +38,19 @@
     (build-system gnu-build-system)
-    (arguments `(#:configure-flags '("--disable-use-tty-group")))
+    (arguments
+     `(#:configure-flags '("--disable-use-tty-group")
+       #:phases (alist-cons-after
+                 'install 'patch-chkdupexe
+                 (lambda* (#:key outputs #:allow-other-keys)
+                   (let ((out (assoc-ref outputs "out")))
+                     (substitute* (string-append out "/bin/chkdupexe")
+                       ;; Allow `patch-shebang' to do its work.
+                       (("@PERL@") "/bin/perl"))))
+                 %standard-phases)))
     (inputs `(("zlib" ,zlib)
-              ("ncurses" ,ncurses)))
+              ("ncurses" ,ncurses)
+              ("perl" ,perl)))
     (home-page "https://www.kernel.org/pub/linux/utils/util-linux/";)
      "util-linux is a random collection of utilities for the Linux kernel")
The #:phases thing inserts a phase right after the “make install” phase.
That new phase modifies the installed ‘chkdupexe’ to replace @PERL@ by
/bin/perl.  The ‘patch-shebang’ phase happens just after, and it
automatically replaces /bin/perl by /nix/store/...-perl/bin/perl.

Could you send an updated patch with this fix, and which adds util-linux
to ‘linux.scm’ instead?  The idea is to have all Linux-related tools in

> 2. I'm not sure that this formatting
> (uri (string-append "mirror://kernel.org/linux/utils/"
>                       name "/v" version "/"
>                     name "-" version ".2" ".tar.xz"))
> is valid for the following mirrors:
> (kernel.org
>  "http://www.all.kernel.org/pub/";
>  "http://ramses.wh2.tu-dresden.de/pub/mirrors/kernel.org/";
>  "http://linux-kernel.uio.no/pub/";
>  "http://kernel.osuosl.org/pub/";
>  "ftp://ftp.funet.fi/pub/mirrors/ftp.kernel.org/pub/";)
> As far as I can tell, it only works for kernel.org. How to check this?

The ‘mirror://kernel.org/’ prefix expands to the above mirror URLs.  See
‘url-fetch’ in (guix build download) for details.

> 3. 'util-linux' uses a lot of licenses. According to
> 'README.licensing', it uses GPLv3+, GPLv2+, GPLv2, LGPLv2+, BSD with
> advertising, and Public Domain. GPLv2+ is the default license for code
> without an explicitly defined license.
> I've found a file that uses the Expat license
> (i.e. 'util-linux-2.21.2/config/install-sh') and some files with
> suspicious licenses.

‘install-sh’ comes from Automake.

> Examples:
> 'util-linux-2.21.2/disk-utils/mkfs.bfs.8':
> .\" Copyright 1999 Andries E. Brouwer (address@hidden)
> .\" May be freely distributed.
> What does "free" mean in this context?
> 'util-linux-2.21.2/disk-utils/mkfs.minix.c':
> * (C) 1991 Linus Torvalds. This file may be redistributed as per
> * the Linux copyright.
> And what does the above mean?

I think it means that these people had no clue but that they intended to
make it GPLv2.

Another funny one is ‘chkdupexe’:

  # Copyright 1993 Nicolai Langfeldt. address@hidden
  #  Distribute under gnu copyleft (included in perl package) 

> These examples show that we can't rely on 'README.licensing'. I guess
> that we can use regexps to match against the licenses that are listed
> in 'README.licensing' and check the rest manually.
> What would you use?

For this kind of questions, I’d first check the list at
<http://libreplanet.org/wiki/Software_blacklist>, and then ask for
advice on the gnu-linux-libre list (see
<http://lists.nongnu.org/mailman/listinfo/gnu-linux-libre>), which is
where people knowledgeable in this area are.

Now, my guess is that util-linux is OK, just hacked up with lack of
rigor.  ;-)

> 4. It's necessary to do the following to force Guix to rebuild a
> package:
> nix-store --delete /nix/store/*-util-linux-2.21.tar.xz
> nix-store --delete /nix/store/*-util-linux-2.21
> ./pre-inst-env guix-build -K util-linux
> Is this a bug?

No, it’s a feature!  :-)

Nix and Guix work on the assumption that builds are deterministic.  This
allows them to cache successful build results (and even build failures,
but this is not enabled by default.)

In fact, in the example above, you can build util-linux as many times as
you want, and you’ll most likely always get the same result, bit-by-bit.

In the event where a build process is non-deterministic, deleting the
results as shown above will allow you to restart the build, and maybe
notice that you get a different result.  That is rare enough in
practice, and usually a sign of a bug in the package’s build system.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]