unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 45896@debbugs.gnu.org
Subject: bug#45896: [PATCH 2/3] build: Add '--with-channel-commit' and related configure flags.
Date: Wed, 27 Jan 2021 22:51:29 +0100	[thread overview]
Message-ID: <20210127215130.24530-2-ludo@gnu.org> (raw)
In-Reply-To: <20210127215130.24530-1-ludo@gnu.org>

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.
---
 configure.ac       |  1 +
 guix/config.scm.in | 20 +++++++++++++++++---
 m4/guix.m4         | 30 +++++++++++++++++++++++++++++-
 3 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index aa97f67ebe..aa60471143 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,6 +25,7 @@ AM_GNU_GETTEXT_VERSION([0.18.1])
 
 GUIX_SYSTEM_TYPE
 GUIX_ASSERT_SUPPORTED_SYSTEM
+GUIX_CHANNEL_METADATA
 
 AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = "xyes"])
 
diff --git a/guix/config.scm.in b/guix/config.scm.in
index 223c9eb418..d582d91d74 100644
--- a/guix/config.scm.in
+++ b/guix/config.scm.in
@@ -61,9 +61,23 @@
 (define %channel-metadata
   ;; When true, this is an sexp containing metadata for the 'guix' channel
   ;; this file was built from.  This is used by (guix describe).
-
-  ;; TODO: Implement 'configure.ac' machinery to initialize it.
-  #f)
+  (let ((url    @GUIX_CHANNEL_URL@)
+        (commit @GUIX_CHANNEL_COMMIT@)
+        (intro  @GUIX_CHANNEL_INTRODUCTION@))
+    (and url commit
+         `(repository
+           (version 0)
+           (url ,url)
+           (branch "master")                      ;XXX: doesn't really matter
+           (commit ,commit)
+           (name guix)
+           ,@(if intro
+                 `((introduction
+                    (channel-introduction
+                     (version 0)
+                     (commit ,(car intro))
+                     (signer ,(cdr intro)))))
+                 '())))))
 
 (define %storedir
   "@storedir@")
diff --git a/m4/guix.m4 b/m4/guix.m4
index f8eb5aaf51..c1ce0876fa 100644
--- a/m4/guix.m4
+++ b/m4/guix.m4
@@ -1,5 +1,5 @@
 dnl GNU Guix --- Functional package management for GNU
-dnl Copyright © 2012, 2013, 2014, 2015, 2016, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
+dnl Copyright © 2012, 2013, 2014, 2015, 2016, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
 dnl Copyright © 2014 Mark H Weaver <mhw@netris.org>
 dnl Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
 dnl
@@ -398,3 +398,31 @@ that of the existing installation '$guix_cv_current_localstatedir'])
       esac
     fi
   fi])
+
+dnl GUIX_CHANNEL_METADATA
+dnl
+dnl Provide the channel metadata for this build.  This allows 'guix describe'
+dnl to return meaningful data, as it would for a 'guix pull'-provided 'guix'.
+dnl The default URL and introduction are taken from (guix channels).
+AC_DEFUN([GUIX_CHANNEL_METADATA], [
+  AC_ARG_WITH([channel-url], [AS_HELP_STRING([--with-channel-url=URL],
+    [assert that this is built from the Git repository at URL])],
+    [guix_channel_url="\"$withval\""],
+    [guix_channel_url="\"https://git.savannah.gnu.org/git/guix.git\""])
+  AC_ARG_WITH([channel-commit], [AS_HELP_STRING([--with-channel-commit=COMMIT],
+    [assert that this is built from COMMIT])],
+    [guix_channel_commit="\"$withval\""],
+    [guix_channel_commit="#f"])
+  AC_ARG_WITH([channel-introduction], [AS_HELP_STRING([--with-channel-introduction=COMMIT:FINGERPRINT],
+    [specify COMMIT and FINGERPRINT as the introduction of this channel])],
+    [guix_channel_introduction="'(\"`echo $withval | cut -f1 -d:`\" \"`echo $withval | cut -f2 -d:`\")"],
+    [guix_channel_introduction="'(\"9edb3f66fd807b096b48283debdcddccfea34bad\" . \"BBB0 2DDF 2CEA F6A8 0D1D  E643 A2A0 6DF2 A33A 54FA\")"])
+
+  GUIX_CHANNEL_URL="$guix_channel_url"
+  GUIX_CHANNEL_COMMIT="$guix_channel_commit"
+  GUIX_CHANNEL_INTRODUCTION="$guix_channel_introduction"
+
+  AC_SUBST([GUIX_CHANNEL_URL])
+  AC_SUBST([GUIX_CHANNEL_COMMIT])
+  AC_SUBST([GUIX_CHANNEL_INTRODUCTION])
+])
-- 
2.30.0





  reply	other threads:[~2021-01-27 21:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15 17:51 bug#45896: Non-pull ‘guix’ should know its channels Ludovic Courtès
2021-01-26 13:16 ` Ludovic Courtès
2021-01-27 21:53   ` Ludovic Courtès
2021-01-27 21:51 ` bug#45896: [PATCH 1/3] channels: Record 'guix' channel metadata in (guix config) Ludovic Courtès
2021-01-27 21:51   ` Ludovic Courtès [this message]
2021-01-27 21:51   ` bug#45896: [PATCH 3/3] gnu: guix: Pass the '--with-channel-commit' configure flag Ludovic Courtès
2021-02-04 12:46     ` bug#45896: Non-pull ‘guix’ should know its channels Ludovic Courtès
2021-01-27 21:53   ` 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=20210127215130.24530-2-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=45896@debbugs.gnu.org \
    /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).