diff mbox

[1/4] gnu: Separate util-linux into three packages.

Message ID 1478812461-18483-1-git-send-email-jmd@gnu.org
State New
Headers show

Commit Message

John Darrington Nov. 10, 2016, 9:14 p.m. UTC
* gnu/packages/linux.scm (util-linux/base): New variable,
(util-linux/mount): New variable,  (util-linux) Refine
inheriting from util-linux/base.
---
 gnu/packages/linux.scm | 69 ++++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 55 insertions(+), 14 deletions(-)

Comments

Hartmut Goebel Nov. 11, 2016, 2:43 p.m. UTC | #1
Am 10.11.2016 um 22:14 schrieb John Darrington:
> +(define-public util-linux/base
>    (package
> -    (name "util-linux")
> +    (name "util-linux-base")

I'm in favour of naming the variable as the package. This eases using them.

> +(define-public util-linux
> +  (package
> +    (inherit util-linux/base)
> +    (name "util-linux")
> +    (source (origin (inherit (package-source util-linux/base))))

I'm curious: Why do you need to inherit the package-source here?
John Darrington Nov. 11, 2016, 4:03 p.m. UTC | #2
On Fri, Nov 11, 2016 at 03:43:32PM +0100, Hartmut Goebel wrote:
     Am 10.11.2016 um 22:14 schrieb John Darrington:
     > +(define-public util-linux/base
     >    (package
     > -    (name "util-linux")
     > +    (name "util-linux-base")
     
     I'm in favour of naming the variable as the package. This eases using them.

I tried that.  It seems that there is a precident to use /variant  for the variable.
However / is not permitted in the name
     
     > +(define-public util-linux
     > +  (package
     > +    (inherit util-linux/base)
     > +    (name "util-linux")
     > +    (source (origin (inherit (package-source util-linux/base))))
     
     I'm curious: Why do you need to inherit the package-source here?
     

Well I don't actually *need* to.  I could have copied it.  But I thought that
having 3 copies would make maintenance difficult---somebody might update one,
but forget the other two.
Hartmut Goebel Nov. 11, 2016, 4:40 p.m. UTC | #3
Am 11.11.2016 um 17:03 schrieb John Darrington:
>     
>      > +(define-public util-linux
>      > +  (package
>      > +    (inherit util-linux/base)
>      > +    (name "util-linux")
>      > +    (source (origin (inherit (package-source util-linux/base))))
>      
>      I'm curious: Why do you need to inherit the package-source here?
>      
>
> Well I don't actually *need* to.  I could have copied it.  But I thought that
> having 3 copies would make maintenance difficult---somebody might update one,
> but forget the other two.

Sorry for not being precise enough. I meant why are us using "inherit"
here? I thought

    (source (package-source util-linux/base))

would suffice and result in the same?
John Darrington Nov. 11, 2016, 7:36 p.m. UTC | #4
On Fri, Nov 11, 2016 at 05:40:51PM +0100, Hartmut Goebel wrote:
     Am 11.11.2016 um 17:03 schrieb John Darrington:
     >     
     >      > +(define-public util-linux
     >      > +  (package
     >      > +    (inherit util-linux/base)
     >      > +    (name "util-linux")
     >      > +    (source (origin (inherit (package-source util-linux/base))))
     >      
     >      I'm curious: Why do you need to inherit the package-source here?
     >      
     >
     > Well I don't actually *need* to.  I could have copied it.  But I thought that
     > having 3 copies would make maintenance difficult---somebody might update one,
     > but forget the other two.
     
     Sorry for not being precise enough. I meant why are us using "inherit"
     here? I thought
     
         (source (package-source util-linux/base))
     
     would suffice and result in the same?
     
You're right.  Thanks for the suggestion.

J'
Ludovic Courtès Nov. 12, 2016, 2:53 p.m. UTC | #5
Hi!

John Darrington <jmd@gnu.org> skribis:

> * gnu/packages/linux.scm (util-linux/base): New variable,
> (util-linux/mount): New variable,  (util-linux) Refine
> inheriting from util-linux/base.

Do I get it right that these changes aim to make ‘mount -t nfs’ work?
That is, to allow ‘mount’ to find the ‘mount.nfs’(?) program.

If so, would it work to just do:

  "--enable-fs-paths-default=/run/current-system/profile/sbin"

?

That would only work on GuixSD, but Guix’s ‘mount’ is certainly not very
useful on foreign distros.

Thanks,
Ludo’.
John Darrington Nov. 12, 2016, 3:28 p.m. UTC | #6
On Sat, Nov 12, 2016 at 03:53:59PM +0100, Ludovic Court??s wrote:
     Hi!
     
     John Darrington <jmd@gnu.org> skribis:
     
     > * gnu/packages/linux.scm (util-linux/base): New variable,
     > (util-linux/mount): New variable,  (util-linux) Refine
     > inheriting from util-linux/base.
     
     Do I get it right that these changes aim to make ???mount -t nfs??? work?
     That is, to allow ???mount??? to find the ???mount.nfs???(?) program.

That is correct.
     
     If so, would it work to just do:
     
       "--enable-fs-paths-default=/run/current-system/profile/sbin"
     
     ?
     
     That would only work on GuixSD, but Guix???s ???mount??? is certainly not very
     useful on foreign distros.
     

That would certainly be a solution easier to do.   
But doesn't it mean that we have a "functionally impure" system?

J'
John Darrington Nov. 12, 2016, 5:09 p.m. UTC | #7
On Sat, Nov 12, 2016 at 04:28:08PM +0100, John Darrington wrote:
          
          If so, would it work to just do:
          
            "--enable-fs-paths-default=/run/current-system/profile/sbin"
          
          ?
          
          That would only work on GuixSD, but Guix???s ???mount??? is certainly not very
          useful on foreign distros.
     
     That would certainly be a solution easier to do.   
     But doesn't it mean that we have a "functionally impure" system?
     

Also, it would only work if nfs-utils was installed in the current system profile,
which need not be the case.  It might be installed only in root's profile or I might 
want to see what happens if I use an alternative version of nfs-utils.

J'
Ludovic Courtès Nov. 12, 2016, 10:55 p.m. UTC | #8
John Darrington <john@darrington.wattle.id.au> skribis:

> On Sat, Nov 12, 2016 at 04:28:08PM +0100, John Darrington wrote:
>           
>           If so, would it work to just do:
>           
>             "--enable-fs-paths-default=/run/current-system/profile/sbin"
>           
>           ?
>           
>           That would only work on GuixSD, but Guix???s ???mount??? is certainly not very
>           useful on foreign distros.
>      
>      That would certainly be a solution easier to do.   
>      But doesn't it mean that we have a "functionally impure" system?
>      
>
> Also, it would only work if nfs-utils was installed in the current system profile,
> which need not be the case.  It might be installed only in root's profile or I might 
> want to see what happens if I use an alternative version of nfs-utils.

That ‘mount’ can invoke ‘mount.nfs’ looks like a convenience to me, not
something highly critical.

I would say that dynamic composition (‘mount’ looking up ‘mount.nfs’ &
co. in $PATH) is OK in this case.  The NFS service in GuixSD could
extend ‘profile-service-type’ such that ‘nfs-utils’ is indeed in the
system profile.

WDYT?

Thanks,
Ludo’.
John Darrington Nov. 13, 2016, 8:21 a.m. UTC | #9
On Sat, Nov 12, 2016 at 11:55:13PM +0100, Ludovic Court??s wrote:
     John Darrington <john@darrington.wattle.id.au> skribis:
     
     > On Sat, Nov 12, 2016 at 04:28:08PM +0100, John Darrington wrote:
     >           
     >           If so, would it work to just do:
     >           
     >             "--enable-fs-paths-default=/run/current-system/profile/sbin"
     >           
     >           ?
     >           
     >           That would only work on GuixSD, but Guix???s ???mount??? is certainly not very
     >           useful on foreign distros.
     >      
     >      That would certainly be a solution easier to do.   
     >      But doesn't it mean that we have a "functionally impure" system?
     >      
     >
     > Also, it would only work if nfs-utils was installed in the current system profile,
     > which need not be the case.  It might be installed only in root's profile or I might 
     > want to see what happens if I use an alternative version of nfs-utils.
     
     That ???mount??? can invoke ???mount.nfs??? looks like a convenience to me, not
     something highly critical.

Well it's critical if "mount -a" is going to work, and thus if NFS filesystems (such as /home in
many networks) can be automatically mounted at boot time.
     
     I would say that dynamic composition (???mount??? looking up ???mount.nfs??? &
     co. in $PATH) is OK in this case.  The NFS service in GuixSD could
     extend ???profile-service-type??? such that ???nfs-utils??? is indeed in the
     system profile.
     
Ok If you think it's acceptable I'll push a change with just the
"--enable-fs-paths-default=/run/current-system/profile/sbin" option for now.  If it
turns out not to be good enough then we can rethink it later.

J'
Ludovic Courtès Nov. 13, 2016, 11:59 a.m. UTC | #10
John Darrington <john@darrington.wattle.id.au> skribis:

> On Sat, Nov 12, 2016 at 11:55:13PM +0100, Ludovic Court??s wrote:

[...]

>      > Also, it would only work if nfs-utils was installed in the current system profile,
>      > which need not be the case.  It might be installed only in root's profile or I might 
>      > want to see what happens if I use an alternative version of nfs-utils.
>      
>      That ???mount??? can invoke ???mount.nfs??? looks like a convenience to me, not
>      something highly critical.
>
> Well it's critical if "mount -a" is going to work, and thus if NFS filesystems (such as /home in
> many networks) can be automatically mounted at boot time.

GuixSD doesn’t use the ‘mount’ command to mount file systems so that
shouldn’t have any influence.

>      I would say that dynamic composition (???mount??? looking up ???mount.nfs??? &
>      co. in $PATH) is OK in this case.  The NFS service in GuixSD could
>      extend ???profile-service-type??? such that ???nfs-utils??? is indeed in the
>      system profile.
>      
> Ok If you think it's acceptable I'll push a change with just the
> "--enable-fs-paths-default=/run/current-system/profile/sbin" option for now.  If it
> turns out not to be good enough then we can rethink it later.

Yes, I agree.

1,093 packages depend on util-linux.  Per the strategy outlined at
<https://lists.gnu.org/archive/html/guix-devel/2016-10/msg00933.html>
this could go to ‘staging’ but I think this should go to ‘core-updates’
which we’ll reopen to fix <http://bugs.gnu.org/24703>.

Thanks,
Ludo’.
John Darrington Nov. 13, 2016, 2:06 p.m. UTC | #11
On Sun, Nov 13, 2016 at 12:59:50PM +0100, Ludovic Court??s wrote:
     John Darrington <john@darrington.wattle.id.au> skribis:
     
     > On Sat, Nov 12, 2016 at 11:55:13PM +0100, Ludovic Court??s wrote:
     
     [...]
     
     >      > Also, it would only work if nfs-utils was installed in the current system profile,
     >      > which need not be the case.  It might be installed only in root's profile or I might 
     >      > want to see what happens if I use an alternative version of nfs-utils.
     >      
     >      That ???mount??? can invoke ???mount.nfs??? looks like a convenience to me, not
     >      something highly critical.
     >
     > Well it's critical if "mount -a" is going to work, and thus if NFS filesystems (such as /home in
     > many networks) can be automatically mounted at boot time.
     
     GuixSD doesn???t use the ???mount??? command to mount file systems so that
     shouldn???t have any influence.

What does it use instead?
     
     1,093 packages depend on util-linux.  Per the strategy outlined at
     <https://lists.gnu.org/archive/html/guix-devel/2016-10/msg00933.html>
     this could go to ???staging??? but I think this should go to ???core-updates???
     which we???ll reopen to fix <http://bugs.gnu.org/24703>.

I'm irritated that util-linux has so many, completely unrelated things in it.  For example
it contains the "mount", "cal" and "col" commands.    Regardless of the NFS issues, I 
suggest we consider separating it anyway, into several packages all deriving from the common
source.
     

J'
Ludovic Courtès Nov. 14, 2016, 9:48 a.m. UTC | #12
John Darrington <john@darrington.wattle.id.au> skribis:

> On Sun, Nov 13, 2016 at 12:59:50PM +0100, Ludovic Court??s wrote:
>      John Darrington <john@darrington.wattle.id.au> skribis:
>      
>      > On Sat, Nov 12, 2016 at 11:55:13PM +0100, Ludovic Court??s wrote:
>      
>      [...]
>      
>      >      > Also, it would only work if nfs-utils was installed in the current system profile,
>      >      > which need not be the case.  It might be installed only in root's profile or I might 
>      >      > want to see what happens if I use an alternative version of nfs-utils.
>      >      
>      >      That ???mount??? can invoke ???mount.nfs??? looks like a convenience to me, not
>      >      something highly critical.
>      >
>      > Well it's critical if "mount -a" is going to work, and thus if NFS filesystems (such as /home in
>      > many networks) can be automatically mounted at boot time.
>      
>      GuixSD doesn???t use the ???mount??? command to mount file systems so that
>      shouldn???t have any influence.
>
> What does it use instead?

The ‘mount’ system call; see (gnu build file-systems).

>      1,093 packages depend on util-linux.  Per the strategy outlined at
>      <https://lists.gnu.org/archive/html/guix-devel/2016-10/msg00933.html>
>      this could go to ???staging??? but I think this should go to ???core-updates???
>      which we???ll reopen to fix <http://bugs.gnu.org/24703>.
>
> I'm irritated that util-linux has so many, completely unrelated things in it.  For example
> it contains the "mount", "cal" and "col" commands.    Regardless of the NFS issues, I 
> suggest we consider separating it anyway, into several packages all deriving from the common
> source.

The strategy is to stick to what upstream does, in general, and I’m not
convinced splitting would buy us much (in terms of disk usage, for
instance.)

Ludo’.
John Darrington Nov. 14, 2016, 5:46 p.m. UTC | #13
On Mon, Nov 14, 2016 at 10:48:18AM +0100, Ludovic Court??s wrote:
     John Darrington <john@darrington.wattle.id.au> skribis:

     >      GuixSD doesn???t use the ???mount??? command to mount file systems so that
     >      shouldn???t have any influence.
     >
     > What does it use instead?
     
     The ???mount??? system call; see (gnu build file-systems).

I confess, I have not really thought about this before. But supposing somebody has in their /etc/config.scm:

  (file-systems 
   (cons*
    (file-system
      (device "my-root")
      (title 'label)
      (mount-point "/")
      (type "ext4"))
    (file-system
      (device "fileserver.example.com:/home")
      (title 'device)
      (mount-point "/home")
      (type "nfs4"))
    %base-file-systems))

Would the /home filesystem then get mounted on boot?
     
     > I'm irritated that util-linux has so many, completely unrelated things in it.  For example
     > it contains the "mount", "cal" and "col" commands.    Regardless of the NFS issues, I 
     > suggest we consider separating it anyway, into several packages all deriving from the common
     > source.
     
     The strategy is to stick to what upstream does, in general, and I???m not
     convinced splitting would buy us much (in terms of disk usage, for
     instance.)

In general I think that is a sensible strategy.  Splitting, would not buy us anything 
in terms of disk space, but I think it would mean less rebuilding when some configure 
option needs to be changed.

J'
Ludovic Courtès Nov. 15, 2016, 10:46 a.m. UTC | #14
John Darrington <john@darrington.wattle.id.au> skribis:

> On Mon, Nov 14, 2016 at 10:48:18AM +0100, Ludovic Court??s wrote:
>      John Darrington <john@darrington.wattle.id.au> skribis:
>
>      >      GuixSD doesn???t use the ???mount??? command to mount file systems so that
>      >      shouldn???t have any influence.
>      >
>      > What does it use instead?
>      
>      The ???mount??? system call; see (gnu build file-systems).
>
> I confess, I have not really thought about this before. But supposing somebody has in their /etc/config.scm:
>
>   (file-systems 
>    (cons*
>     (file-system
>       (device "my-root")
>       (title 'label)
>       (mount-point "/")
>       (type "ext4"))
>     (file-system
>       (device "fileserver.example.com:/home")
>       (title 'device)
>       (mount-point "/home")
>       (type "nfs4"))
>     %base-file-systems))
>
> Would the /home filesystem then get mounted on boot?

Maybe not.  :-)

The man page for mount(2) says:

--8<---------------cut here---------------start------------->8--- Values
for the filesystemtype argument supported by the kernel are listed in
/proc/filesystems (e.g., "btrfs", "ext4", "jfs", "xfs", "vfat", "fuse",
"tmpfs", "cgroup", "proc", "mqueue", "nfs", "cifs", "iso9660").  Further
types may become available when the appropriate modules are loaded.
--8<---------------cut here---------------end--------------->8---

I don’t know what happens with NFS, you’ll have to tell us.

>      > I'm irritated that util-linux has so many, completely unrelated things in it.  For example
>      > it contains the "mount", "cal" and "col" commands.    Regardless of the NFS issues, I 
>      > suggest we consider separating it anyway, into several packages all deriving from the common
>      > source.
>      
>      The strategy is to stick to what upstream does, in general, and I???m not
>      convinced splitting would buy us much (in terms of disk usage, for
>      instance.)
>
> In general I think that is a sensible strategy.  Splitting, would not buy us anything 
> in terms of disk space, but I think it would mean less rebuilding when some configure 
> option needs to be changed.

Yeah, but that’s probably not a significant improvement in terms of
avoiding rebuilds.

Ludo’.
diff mbox

Patch

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 73c177a..0a1eff5 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -430,15 +430,15 @@  use the proc file system.  We're not about changing the world, but
 providing the system administrator with some help in common tasks.")
     (license license:gpl2+)))
 
-(define-public util-linux
+(define-public util-linux/base
   (package
-    (name "util-linux")
+    (name "util-linux-base")
     (version "2.27")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://kernel.org/linux/utils/"
-                                  name "/v" (version-major+minor version) "/"
-                                  name "-" version ".tar.xz"))
+                                  "util-linux" "/v" (version-major+minor version) "/"
+                                  "util-linux" "-" version ".tar.xz"))
               (sha256
                (base32
                 "1ivdx1bhjbakf77agm9dn3wyxia1wgz9lzxgd61zqxw3xzih9gzw"))
@@ -453,8 +453,40 @@  providing the system administrator with some help in common tasks.")
                     (("build_kill=yes") "build_kill=no"))
                   #t))))
     (build-system gnu-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (add-after
+                      'install 'move-static-libraries
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (let ((out    (assoc-ref outputs "out"))
+                            (static (assoc-ref outputs "static")))
+                        (mkdir-p (string-append static "/lib"))
+                        (with-directory-excursion out
+                          (for-each (lambda (file)
+                                      (rename-file file
+                                                   (string-append static "/"
+                                                                  file)))
+                                    (find-files "lib" "\\.a$")))
+                        #t))))))
     (outputs '("out"
                "static"))      ; >2 MiB of static .a libraries
+    (home-page "https://www.kernel.org/pub/linux/utils/util-linux/")
+    (synopsis "Collection of utilities for the Linux kernel")
+    (description "Util-linux is a diverse collection of Linux kernel
+utilities.  It provides dmesg and includes tools for working with file systems,
+block devices, UUIDs, TTYs, and many other tools.")
+
+    ;; Note that util-linux doesn't use the same license for all the
+    ;; code.  GPLv2+ is the default license for a code without an
+    ;; explicitly defined license.
+    (license (list license:gpl3+ license:gpl2+ license:gpl2 license:lgpl2.0+
+                   license:bsd-4 license:public-domain))))
+
+(define-public util-linux
+  (package
+    (inherit util-linux/base)
+    (name "util-linux")
+    (source (origin (inherit (package-source util-linux/base))))
     (arguments
      `(#:configure-flags (list "--disable-use-tty-group"
 
@@ -500,18 +532,27 @@  providing the system administrator with some help in common tasks.")
               ("ncurses" ,ncurses)))
     (native-inputs
      `(("perl" ,perl)
-       ("net-base" ,net-base)))                   ;for tests
-    (home-page "https://www.kernel.org/pub/linux/utils/util-linux/")
-    (synopsis "Collection of utilities for the Linux kernel")
+       ("net-base" ,net-base)))))                   ;for tests
+
+(define-public util-linux/mount
+  (package
+    (inherit util-linux/base)
+    (name "util-linux-mount")
+    (source (origin (inherit (package-source util-linux/base))))
+    (arguments
+     `(#:configure-flags (list "--disable-all-programs"
+                               "--disable-bash-completion"
+                               "--disable-nls"
+                               "--enable-libmount"
+                               "--enable-libblkid"
+                               "--enable-libuuid"
+                               "--enable-mount")
+       ,@(package-arguments util-linux/base)))
+    (synopsis "Mount/Umount utilities for the Linux kernel")
     (description "Util-linux is a diverse collection of Linux kernel
-utilities.  It provides dmesg and includes tools for working with file systems,
-block devices, UUIDs, TTYs, and many other tools.")
+utilities.  However, this is a minimally configured package providing just
+the @code{mount} and @code{umount} utilities.")))
 
-    ;; Note that util-linux doesn't use the same license for all the
-    ;; code.  GPLv2+ is the default license for a code without an
-    ;; explicitly defined license.
-    (license (list license:gpl3+ license:gpl2+ license:gpl2 license:lgpl2.0+
-                   license:bsd-4 license:public-domain))))
 
 (define-public procps
   (package