summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-01-27 22:23:19 +0100
committerLudovic Courtès <ludo@gnu.org>2021-02-04 09:23:39 +0100
commit55daad123e896c0e83361496cf49625289ee3571 (patch)
tree44eedcc466b3ba3a3af9a25ef1a13c19ebca2a3b
parent316fc2acbb112bfa572ae30f95a93bcd56621234 (diff)
build: Add '--with-channel-commit' and related configure flags.
Partially fixes <https://bugs.gnu.org/45896>. * m4/guix.m4 (GUIX_CHANNEL_METADATA): New macro. * configure.ac: Use it. * guix/config.scm.in (%channel-metadata): Adjust accordingly.
-rw-r--r--configure.ac1
-rw-r--r--guix/config.scm.in20
-rw-r--r--m4/guix.m430
3 files changed, 47 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac
index aa97f67ebee..aa604711436 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,6 +25,7 @@ AM_GNU_GETTEXT_VERSION([0.18.1])
25 25
26GUIX_SYSTEM_TYPE 26GUIX_SYSTEM_TYPE
27GUIX_ASSERT_SUPPORTED_SYSTEM 27GUIX_ASSERT_SUPPORTED_SYSTEM
28GUIX_CHANNEL_METADATA
28 29
29AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = "xyes"]) 30AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = "xyes"])
30 31
diff --git a/guix/config.scm.in b/guix/config.scm.in
index 223c9eb4183..d582d91d74b 100644
--- a/guix/config.scm.in
+++ b/guix/config.scm.in
@@ -61,9 +61,23 @@
61(define %channel-metadata 61(define %channel-metadata
62 ;; When true, this is an sexp containing metadata for the 'guix' channel 62 ;; When true, this is an sexp containing metadata for the 'guix' channel
63 ;; this file was built from. This is used by (guix describe). 63 ;; this file was built from. This is used by (guix describe).
64 64 (let ((url @GUIX_CHANNEL_URL@)
65 ;; TODO: Implement 'configure.ac' machinery to initialize it. 65 (commit @GUIX_CHANNEL_COMMIT@)
66 #f) 66 (intro @GUIX_CHANNEL_INTRODUCTION@))
67 (and url commit
68 `(repository
69 (version 0)
70 (url ,url)
71 (branch "master") ;XXX: doesn't really matter
72 (commit ,commit)
73 (name guix)
74 ,@(if intro
75 `((introduction
76 (channel-introduction
77 (version 0)
78 (commit ,(car intro))
79 (signer ,(cdr intro)))))
80 '())))))
67 81
68(define %storedir 82(define %storedir
69 "@storedir@") 83 "@storedir@")
diff --git a/m4/guix.m4 b/m4/guix.m4
index f8eb5aaf517..c1ce0876fa0 100644
--- a/m4/guix.m4
+++ b/m4/guix.m4
@@ -1,5 +1,5 @@
1dnl GNU Guix --- Functional package management for GNU 1dnl GNU Guix --- Functional package management for GNU
2dnl Copyright © 2012, 2013, 2014, 2015, 2016, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org> 2dnl Copyright © 2012, 2013, 2014, 2015, 2016, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
3dnl Copyright © 2014 Mark H Weaver <mhw@netris.org> 3dnl Copyright © 2014 Mark H Weaver <mhw@netris.org>
4dnl Copyright © 2017 Efraim Flashner <efraim@flashner.co.il> 4dnl Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
5dnl 5dnl
@@ -398,3 +398,31 @@ that of the existing installation '$guix_cv_current_localstatedir'])
398 esac 398 esac
399 fi 399 fi
400 fi]) 400 fi])
401
402dnl GUIX_CHANNEL_METADATA
403dnl
404dnl Provide the channel metadata for this build. This allows 'guix describe'
405dnl to return meaningful data, as it would for a 'guix pull'-provided 'guix'.
406dnl The default URL and introduction are taken from (guix channels).
407AC_DEFUN([GUIX_CHANNEL_METADATA], [
408 AC_ARG_WITH([channel-url], [AS_HELP_STRING([--with-channel-url=URL],
409 [assert that this is built from the Git repository at URL])],
410 [guix_channel_url="\"$withval\""],
411 [guix_channel_url="\"https://git.savannah.gnu.org/git/guix.git\""])
412 AC_ARG_WITH([channel-commit], [AS_HELP_STRING([--with-channel-commit=COMMIT],
413 [assert that this is built from COMMIT])],
414 [guix_channel_commit="\"$withval\""],
415 [guix_channel_commit="#f"])
416 AC_ARG_WITH([channel-introduction], [AS_HELP_STRING([--with-channel-introduction=COMMIT:FINGERPRINT],
417 [specify COMMIT and FINGERPRINT as the introduction of this channel])],
418 [guix_channel_introduction="'(\"`echo $withval | cut -f1 -d:`\" \"`echo $withval | cut -f2 -d:`\")"],
419 [guix_channel_introduction="'(\"9edb3f66fd807b096b48283debdcddccfea34bad\" . \"BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA\")"])
420
421 GUIX_CHANNEL_URL="$guix_channel_url"
422 GUIX_CHANNEL_COMMIT="$guix_channel_commit"
423 GUIX_CHANNEL_INTRODUCTION="$guix_channel_introduction"
424
425 AC_SUBST([GUIX_CHANNEL_URL])
426 AC_SUBST([GUIX_CHANNEL_COMMIT])
427 AC_SUBST([GUIX_CHANNEL_INTRODUCTION])
428])