bug-guix
[Top][All Lists]
Advanced

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

Re: [PATCH] Replace individual scripts with master 'guix' script


From: Ludovic Courtès
Subject: Re: [PATCH] Replace individual scripts with master 'guix' script
Date: Thu, 14 Feb 2013 14:41:54 +0100
User-agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.2 (gnu/linux)

Hi!

Mark H Weaver <address@hidden> skribis:

> From 726ef0a61f943522ecb5a8d8b609c6810727b9d3 Mon Sep 17 00:00:00 2001
> From: Mark H Weaver <address@hidden>
> Date: Thu, 14 Feb 2013 04:15:25 -0500
> Subject: [PATCH 1/2] PRELIMINARY: Replace individual scripts with master
>  'guix' script.
>
> TODO: Update documentation.
> TODO: Install links for 'guix-package' and friends.
>
> * scripts/guix.in: New script.
>
> * Makefile.am (bin_SCRIPTS): Add 'scripts/guix'.  Remove 'guix-build',
>   'guix-download', 'guix-import', 'guix-package', and 'guix-gc'.
>
>   (MODULES): Add 'guix/scripts/guix-build.scm',
>   'guix/scripts/guix-download.scm', 'guix/scripts/guix-import.scm',
>   'guix/scripts/guix-package.scm', and 'guix/scripts/guix-gc.scm'.
>
> * configure.ac (AC_CONFIG_FILES): Add 'scripts/guix'.  Remove 'guix-build',
>   'guix-download', 'guix-import', 'guix-package', and 'guix-gc'.
>
> * guix-build.in, guix-download.in, guix-gc.in, guix-import.in,
>   guix-package.in: Remove shell script boilerplate.  Move to guix/scripts and
>   change suffix from ".in" to ".scm".  Change module name from (NAME) to
>   (guix scripts NAME).
>
> * pre-inst-env.in: Add "@abs_top_builddir@/scripts" to the front of $PATH.
>   Export $GUIX_UNINSTALLED.
>
> * .gitignore: Add '/scripts/guix'.  Remove '/guix-build', '/guix-download',
>   '/guix-package', '/guix-import', and '/guix-gc'.

Perfect, this is the way to go, also wrt. the forthcoming guix-pull
(which will pull Scheme code from Guix from the repo, similar to
‘apt-get update’ or ‘nix-channel --update’.)

A few remarks:

  • Remove the ‘guix-’ prefix from module names, so
    guix/scripts/build.scm instead of guix/scripts/guix-build.scm;

  • No need to add .gitignore to change logs;

  • Make sure to update po/POTFILES.in;

  • Arrange commits such that everything always works; thus, update
    tests to use the new command names in the same commit that changes
    those commands.

+  (define (main arg0 . args)
+    (setlocale LC_ALL "")  ; XXX Is there a reason not to do this?

Rather do as currently done:

  (install-locale)
  (textdomain "guix")
  (setvbuf (current-output-port) _IOLBF)
  (setvbuf (current-error-port) _IOLBF)

+    (maybe-augment-load-paths!)
+    (let ((cmd (basename arg0)))
+      (cond ((string-prefix? "guix-" cmd)
+             (run-script cmd args))
+            ((not (null? args))
+             (run-script (string-append "guix-" (car args))
+                         (cdr args)))
+            (else
+             ;; TODO: Dynamically generate a summary of available commands.

Yes, that would be neat.

We also need to support --version and --help here, using SRFI-37 as is
the current scripts.

+             (format (current-error-port)
+                     "Usage: guix <command> [<args>]~%")

Messages must be i18n’d, and use standard GNU notation:

  Usage: guix COMMAND ARGS...

Thanks for working on that, it’s good to see that I’m becoming less of a
bottleneck!  :-)

Ludo’.



reply via email to

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