unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Nikita Karetnikov <nikita.karetnikov@gmail.com>
Cc: bug-guix@gnu.org
Subject: Re: [PATCH] distro: Add util-linux.
Date: Sun, 02 Dec 2012 23:56:56 +0100	[thread overview]
Message-ID: <87r4n8jc5j.fsf@gnu.org> (raw)
In-Reply-To: <CAD15K4sT08R5mLDr33dgwmnHoGXiYzMJLrxPik6r15ZkHbA-3g@mail.gmail.com> (Nikita Karetnikov's message of "Sun, 2 Dec 2012 07:43:45 +0300")

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

Hi Nikita,

Nikita Karetnikov <nikita.karetnikov@gmail.com> skribis:

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

A bug in util-linux’s build system.

I worked around it like this:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1479 bytes --]

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 @@
        (base32
         "1rpgghf7n0zx0cdy8hibr41wvkm2qp1yvd8ab1rxr193l1jmgcir"))))
     (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/")
     (synopsis
      "util-linux is a random collection of utilities for the Linux kernel")

[-- Attachment #3: Type: text/plain, Size: 3757 bytes --]


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
there.

> 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 (aeb@cwi.nl)
> .\" 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. janl@math.uio.no
  #  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.

Thanks,
Ludo’.

  reply	other threads:[~2012-12-02 22:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-02  4:43 [PATCH] distro: Add util-linux Nikita Karetnikov
2012-12-02 22:56 ` Ludovic Courtès [this message]
2012-12-03 23:54   ` Nikita Karetnikov
2012-12-04 16:48     ` Ludovic Courtès
2012-12-03 15:14 ` Simon Josefsson
2012-12-03 15:27   ` Ludovic Courtès
2012-12-03 17:29     ` Simon Josefsson
2012-12-03 18:12       ` Nikita Karetnikov
2012-12-03 20:37       ` 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=87r4n8jc5j.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=bug-guix@gnu.org \
    --cc=nikita.karetnikov@gmail.com \
    /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).