GNU bug report logs - #30147
Simplify “scripts/guix”

Previous Next

Package: guix-patches;

Reported by: Mathieu Lirzin <mthl <at> gnu.org>

Date: Wed, 17 Jan 2018 19:26:01 UTC

Severity: normal

Done: ludo <at> gnu.org (Ludovic Courtès)

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Mathieu Lirzin <mthl <at> gnu.org>
Subject: bug#30147: closed (Re: [bug#30147] Simplify “scripts/guix”)
Date: Tue, 23 Jan 2018 09:15:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#30147: Simplify “scripts/guix”

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 30147 <at> debbugs.gnu.org.

-- 
30147: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=30147
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: ludo <at> gnu.org (Ludovic Courtès)
To: Mathieu Lirzin <mthl <at> gnu.org>
Cc: 30147-done <at> debbugs.gnu.org
Subject: Re: [bug#30147] Simplify “scripts/guix”
Date: Tue, 23 Jan 2018 10:13:57 +0100
[Message part 3 (text/plain, inline)]
Hello,

Mathieu Lirzin <mthl <at> gnu.org> skribis:

> From 342444897673d5f9d9a475986e76ca2e912f6674 Mon Sep 17 00:00:00 2001
> From: Mathieu Lirzin <mthl <at> gnu.org>
> Date: Wed, 17 Jan 2018 17:14:24 +0100
> Subject: [PATCH 1/2] =?UTF-8?q?build:=20Expand=20=E2=80=98scripts/guix?=
>  =?UTF-8?q?=E2=80=99=20at=20Make=20time.?=
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> This moves the complexity of Autotools variable expansion outside of the
> application code.
>
> * scripts/guix.in (config-lookup): Delete.
> (maybe-augment-load-paths!, run-guix-main): Use fully expanded variables
> instead of calling ‘config-lookup’.
> * configure.ac: Don't use AC_CONFIG_FILES for ‘scripts/guix’.
> * Makefile.am (scripts/guix): New rule.
> (do_subst): New variable.
> (CLEANFILES, EXTRA_DIST): Adapt.

That’s a good idea.  I applied it with the changes below, mostly to
account for Eric’s suggestions.

[Message part 4 (text/x-patch, inline)]
diff --git a/Makefile.am b/Makefile.am
index 5e36dbf44..9bafdab49 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -29,17 +29,17 @@
 bin_SCRIPTS = scripts/guix
 
 # Handle substitution of fully-expanded Autoconf variables.
-do_subst = sed \
-  -e 's,[@]GUILE[@],$(GUILE),g' \
-  -e 's,[@]guilemoduledir[@],$(guilemoduledir),g' \
-  -e 's,[@]guileobjectdir[@],$(guileobjectdir),g' \
+do_subst = $(SED)					\
+  -e 's,[@]GUILE[@],$(GUILE),g'				\
+  -e 's,[@]guilemoduledir[@],$(guilemoduledir),g'	\
+  -e 's,[@]guileobjectdir[@],$(guileobjectdir),g'	\
   -e 's,[@]localedir[@],$(localedir),g'
 
 scripts/guix: scripts/guix.in Makefile
-	$(AM_V_GEN)rm -f $@ $@-t \
-	  && $(MKDIR_P) $(@D) \
-	  && $(do_subst) <$(srcdir)/$@.in >$@-t \
-	  && chmod a+x,a-w $@-t && mv -f $@-t $@
+	$(AM_V_at)rm -f $@ $@-t
+	$(AM_V_at)$(MKDIR_P) "$(@D)"
+	$(AM_V_GEN)$(do_subst) < "$(srcdir)/$@.in" > "$@-t"
+	$(AM_V_at)chmod a+x,a-w "$@-t" && mv -f "$@-t" "$@"
 
 nodist_noinst_SCRIPTS =				\
   pre-inst-env					\
diff --git a/configure.ac b/configure.ac
index c50dcaf2e..f69f79648 100644
--- a/configure.ac
+++ b/configure.ac
@@ -124,6 +124,8 @@ dnl Make sure we don't suffer from the bug in 'equal?' wrt. syntax objects
 dnl found in 2.2.1.  See <https://bugs.gnu.org/29903>.
 GUIX_ASSERT_SYNTAX_OBJECT_EQUAL
 
+AC_PROG_SED
+
 dnl Decompressors, for use by the substituter and other modules.
 AC_PATH_PROG([GZIP], [gzip])
 AC_PATH_PROG([BZIP2], [bzip2])
[Message part 5 (text/plain, inline)]
> From b6f8331455da1ffc4896b06cd2ee98e09b05be43 Mon Sep 17 00:00:00 2001
> From: Mathieu Lirzin <mthl <at> gnu.org>
> Date: Wed, 17 Jan 2018 19:55:49 +0100
> Subject: [PATCH 2/2] guix: Refactor script.
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> * scripts/guix.in: Use ‘and-let*’ and remove empty surrounding ‘let’.
> (run-guix-main, maybe-augment-load-paths!): Inline them.

This is entirely subjective but I prefer the current style (in fact I
never use SRFI-2), so I’d rather skip this patch.  WDYT?  :-)

Thank you!

Ludo’.
[Message part 6 (message/rfc822, inline)]
From: Mathieu Lirzin <mthl <at> gnu.org>
To: guix-patches <at> gnu.org
Subject: Simplify “scripts/guix”
Date: Wed, 17 Jan 2018 20:25:14 +0100
[Message part 7 (text/plain, inline)]
Hi,

Here are some improvements for “scripts/guix”.

[0001-build-Expand-scripts-guix-at-Make-time.patch (text/x-patch, attachment)]
[0002-guix-Refactor-script.patch (text/x-patch, attachment)]
[Message part 10 (text/plain, inline)]
Thanks.

-- 
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37

This bug report was last modified 7 years and 161 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.