From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: 49149@debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Subject: [bug#49149] [PATCH 4/7] pack: Improve naming of the packs store file names.
Date: Mon, 21 Jun 2021 02:12:02 -0400 [thread overview]
Message-ID: <20210621061205.31878-5-maxim.cournoyer@gmail.com> (raw)
In-Reply-To: <20210621061205.31878-1-maxim.cournoyer@gmail.com>
Instead of just naming them by their pack type, add information from the
package(s) they contain to make it easier to differentiate them.
* guix/scripts/pack.scm (manifest->friendly-name): Extract procedure from ...
(docker-image): ... here. Adjust REPOSITORY argument value accordingly.
(guix-pack): Derive NAME using MANIFEST->FRIENDLY-NAME.
---
guix/scripts/pack.scm | 44 +++++++++++++++++++++++++------------------
1 file changed, 26 insertions(+), 18 deletions(-)
diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm
index 7ea97a4b7a..9d4bb9f497 100644
--- a/guix/scripts/pack.scm
+++ b/guix/scripts/pack.scm
@@ -172,6 +172,23 @@ dependencies are registered."
(computed-file "store-database" build
#:options `(#:references-graphs ,(zip labels items))))
+;;; XXX: The following procedure has to *also* be used in the build side
+;;; G-Exp, because PROFILE is passed as a derivation in the tests.
+(define define-manifest->friendly-name
+ '(define (manifest->friendly-name manifest)
+ "Return a friendly name computed from the entries in MANIFEST, a
+<manifest> object."
+ (let loop ((names (map manifest-entry-name
+ (manifest-entries manifest))))
+ (define str (string-join names "-"))
+ (if (< (string-length str) 40)
+ str
+ (match names
+ ((_) str)
+ ((names ... _) (loop names))))))) ;drop one entry
+
+(eval define-manifest->friendly-name (current-module))
+
\f
;;;
;;; Tarball format.
@@ -540,7 +557,7 @@ the image."
(file-append (store-database (list profile))
"/db/db.sqlite")))
- (define defmod 'define-module) ;trick Geiser
+ (define defmod 'define-module) ;trick Geiser
(define build
;; Guile-JSON and Guile-Gcrypt are required by (guix docker).
@@ -558,6 +575,8 @@ the image."
(srfi srfi-1) (srfi srfi-19)
(ice-9 match))
+ #$define-manifest->friendly-name
+
(define environment
(map (match-lambda
((spec . value)
@@ -581,19 +600,6 @@ the image."
`((directory "/tmp" ,(getuid) ,(getgid) #o1777)
,@(append-map symlink->directives '#$symlinks)))
- (define tag
- ;; Compute a meaningful "repository" name, which will show up in
- ;; the output of "docker images".
- (let ((manifest (profile-manifest #$profile)))
- (let loop ((names (map manifest-entry-name
- (manifest-entries manifest))))
- (define str (string-join names "-"))
- (if (< (string-length str) 40)
- str
- (match names
- ((_) str)
- ((names ... _) (loop names))))))) ;drop one entry
-
(setenv "PATH" #+(file-append archiver "/bin"))
(build-docker-image #$output
@@ -601,7 +607,8 @@ the image."
(call-with-input-file "profile"
read-reference-graph))
#$profile
- #:repository tag
+ #:repository (manifest->friendly-name
+ (profile-manifest #$profile))
#:database #+database
#:system (or #$target %host-type)
#:environment environment
@@ -1209,8 +1216,6 @@ Create a bundle of PACKAGE.\n"))
manifest)
manifest)))
(pack-format (assoc-ref opts 'format))
- (name (string-append (symbol->string pack-format)
- "-pack"))
(target (assoc-ref opts 'target))
(bootstrap? (assoc-ref opts 'bootstrap?))
(compressor (if bootstrap?
@@ -1244,7 +1249,10 @@ Create a bundle of PACKAGE.\n"))
(hooks (if bootstrap?
'()
%default-profile-hooks))
- (locales? (not bootstrap?)))))
+ (locales? (not bootstrap?))))
+ (name (string-append (manifest->friendly-name manifest)
+ "-" (symbol->string pack-format)
+ "-pack")))
(define (lookup-package package)
(manifest-lookup manifest (manifest-pattern (name package))))
--
2.32.0
next prev parent reply other threads:[~2021-06-21 6:13 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-21 6:10 [bug#49149] [PATCH 0/7] Add deb format for guix pack Maxim Cournoyer
2021-06-21 6:11 ` [bug#49149] [PATCH 1/7] pack: Extract builder code from self-contained-tarball Maxim Cournoyer
2021-06-21 6:11 ` [bug#49149] [PATCH] tentatively reuse rlib for cargo-build-system Maxim Cournoyer
2021-06-21 20:28 ` Maxim Cournoyer
2021-06-21 6:12 ` [bug#49149] [PATCH 2/7] pack: Factorize base tar options Maxim Cournoyer
2021-06-21 6:12 ` [bug#49149] [PATCH 3/7] pack: Fix typo Maxim Cournoyer
2021-06-21 6:12 ` Maxim Cournoyer [this message]
2021-06-21 18:11 ` [bug#49149] [PATCH 4/7] pack: Improve naming of the packs store file names Maxime Devos
2021-06-22 14:03 ` Maxim Cournoyer
2021-06-23 10:22 ` Maxime Devos
2021-06-24 4:40 ` [bug#49149] [PATCH v2 1/7] pack: Extract builder code from self-contained-tarball Maxim Cournoyer
2021-06-24 4:40 ` [bug#49149] [PATCH v2 2/7] pack: Factorize base tar options Maxim Cournoyer
2021-06-24 4:40 ` [bug#49149] [PATCH v2 3/7] pack: Fix typo Maxim Cournoyer
2021-06-24 4:40 ` [bug#49149] [PATCH v2 4/7] pack: Improve naming of the packs store file names Maxim Cournoyer
2021-06-26 5:03 ` [bug#49149] [PATCH 0/7] Add deb format for guix pack Maxim Cournoyer
2021-06-30 10:13 ` Ludovic Courtès
2021-06-30 18:36 ` Maxim Cournoyer
2021-07-01 13:26 ` Ludovic Courtès
2021-07-04 3:21 ` Maxim Cournoyer
2021-07-05 16:14 ` Ludovic Courtès
2021-07-05 20:42 ` Maxim Cournoyer
2021-06-24 4:40 ` [bug#49149] [PATCH v2 5/7] pack: Prevent duplicate files in tar archives Maxim Cournoyer
2021-06-24 4:40 ` [bug#49149] [PATCH v2 6/7] tests: pack: Fix compressor extension Maxim Cournoyer
2021-06-24 4:40 ` [bug#49149] [PATCH v2 7/7] pack: Add support for the deb format Maxim Cournoyer
2021-06-26 16:58 ` Maxime Devos
2021-06-29 19:20 ` bug#49149: [PATCH 0/7] Add deb format for guix pack Maxim Cournoyer
2021-06-30 10:10 ` [bug#49149] " Ludovic Courtès
2021-06-24 4:44 ` [bug#49149] [PATCH 4/7] pack: Improve naming of the packs store file names Maxim Cournoyer
2021-06-23 21:16 ` [bug#49149] [PATCH 0/7] Add deb format for guix pack Ludovic Courtès
2021-06-21 6:12 ` [bug#49149] [PATCH 5/7] pack: Prevent duplicate files in tar archives Maxim Cournoyer
2021-06-30 10:06 ` [bug#49149] [PATCH 0/7] Add deb format for guix pack Ludovic Courtès
2021-06-30 18:16 ` Maxim Cournoyer
2021-07-01 13:24 ` Ludovic Courtès
2021-06-21 6:12 ` [bug#49149] [PATCH 6/7] tests: pack: Fix compressor extension Maxim Cournoyer
2021-06-21 6:12 ` [bug#49149] [PATCH 7/7] pack: Add support for the deb format Maxim Cournoyer
2021-06-21 16:44 ` [bug#49149] Add deb format for guix pack jgart via Guix-patches via
2021-06-23 21:28 ` [bug#49149] [PATCH 0/7] " Ludovic Courtès
2021-06-29 17:49 ` Maxim Cournoyer
2021-06-30 9:15 ` Ludovic Courtès
2021-06-30 13:49 ` zimoun
2021-06-30 15:06 ` zimoun
2021-06-30 16:55 ` Maxim Cournoyer
2021-06-30 16:54 ` Maxim Cournoyer
2021-06-30 17:28 ` Maxim Cournoyer
2021-06-30 17:36 ` Maxim Cournoyer
2021-06-30 17:47 ` zimoun
2021-06-30 19:20 ` Maxim Cournoyer
2021-07-01 13:08 ` zimoun
2021-06-30 16:42 ` Maxim Cournoyer
2021-07-01 13:20 ` Ludovic Courtès
2021-07-01 13:52 ` zimoun
2021-07-05 16:17 ` 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=20210621061205.31878-5-maxim.cournoyer@gmail.com \
--to=maxim.cournoyer@gmail.com \
--cc=49149@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).