From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id +LsaCRou0GAyRQAAgWs5BA (envelope-from ) for ; Mon, 21 Jun 2021 08:13:46 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id UGrcBBou0GBsRQAA1q6Kng (envelope-from ) for ; Mon, 21 Jun 2021 06:13:46 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9CF531B0EA for ; Mon, 21 Jun 2021 08:13:45 +0200 (CEST) Received: from localhost ([::1]:40006 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lvDBo-0000Z9-Od for larch@yhetil.org; Mon, 21 Jun 2021 02:13:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47942) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lvDBA-0007vP-CK for guix-patches@gnu.org; Mon, 21 Jun 2021 02:13:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:51896) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lvDBA-0001th-3r for guix-patches@gnu.org; Mon, 21 Jun 2021 02:13:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lvDBA-0006cm-0Q for guix-patches@gnu.org; Mon, 21 Jun 2021 02:13:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49149] [PATCH 4/7] pack: Improve naming of the packs store file names. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 21 Jun 2021 06:13:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49149 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49149@debbugs.gnu.org Cc: Maxim Cournoyer Received: via spool by 49149-submit@debbugs.gnu.org id=B49149.162425597125391 (code B ref 49149); Mon, 21 Jun 2021 06:13:03 +0000 Received: (at 49149) by debbugs.gnu.org; 21 Jun 2021 06:12:51 +0000 Received: from localhost ([127.0.0.1]:35198 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lvDAx-0006bN-Gw for submit@debbugs.gnu.org; Mon, 21 Jun 2021 02:12:51 -0400 Received: from mail-qk1-f171.google.com ([209.85.222.171]:35488) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lvDAv-0006aX-QZ for 49149@debbugs.gnu.org; Mon, 21 Jun 2021 02:12:50 -0400 Received: by mail-qk1-f171.google.com with SMTP id q190so24939267qkd.2 for <49149@debbugs.gnu.org>; Sun, 20 Jun 2021 23:12:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=v/TsY7TUeHjjKKjuzsJGN8fmXHrFAsNNkILKEI0FWYI=; b=psYIXNjXvH5cb+0EF/NWbr4FsWM9hxGZtBWYR7uOi1B35tkfUaSjAZXFWKLuFzLsel qtD9Oo39SCICdu3OdDUMmjLu0J5VaDwUS1yJwDi1i0VD0u8hNNPYz+aeYPawpiySTmck gpffgNAyuxZXGMsKN3nZlfz9gtuUDDzYY0Q4sz2DsGaAZlz/SGdcB5vvTeVe5ylnmnM9 2mOPtzaoi4jmF3879rEqkIuK9fMufbdCAKSy/I6h9M3JNECmE9M0+Dtek6UUDUpxVbDO 8EWgq0OGnpASysqFKnyr5gvbWcPRr31UP1Pdq7sKtdO0MociXU2iAZlj3oqvUyjZ7Kiy nhRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=v/TsY7TUeHjjKKjuzsJGN8fmXHrFAsNNkILKEI0FWYI=; b=hA1ZlTMMIGi5WCY0kYsmKFbcOLu91dk+1fskjEDB2aIZ+GmtipeF6UpT8eXi8kAoDW KJOyxdl20gHd3LlmLS2ggoSxwNiPa5ItiwolS/opd+OIWcKjnsaBltCAXAOKzWLNfYo4 zfvytCer1sfcn6h7dpBIs3TENhMQmX4PlFpZMU8brm43UqEG2fE7OXlOtiH83A6u9h71 UeM4ZUSpToAK52WBD0kgAqch/tQkLKCNSKEjWjouC/KUGb51L90V/7Z7/TvImK25iSTR 0O3l9+VQd4o0FBDKXDfFPoMmPsqxCvCuEAwCTJK5Qx6a0NzF+SLWKMcZi010RDedVsd6 v7oA== X-Gm-Message-State: AOAM532VOpkz029g2eZxwWrNBFBWbytR8geNsRohhVQLOuGCNY0vCaqR HDK6QccmmhT0GnEtCXhRejk5J5CEp+B2Jw== X-Google-Smtp-Source: ABdhPJzbtxaphj68wsORpAEvS4vDRtmaaEqjsmZG3TITxky8WVa0EdK3ORNaU1OUejpORE+NrW0/qA== X-Received: by 2002:a37:b881:: with SMTP id i123mr21390929qkf.207.1624255964252; Sun, 20 Jun 2021 23:12:44 -0700 (PDT) Received: from localhost.localdomain (dsl-148-219.b2b2c.ca. [66.158.148.219]) by smtp.gmail.com with ESMTPSA id i11sm8478663qke.74.2021.06.20.23.12.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Jun 2021 23:12:44 -0700 (PDT) From: Maxim Cournoyer Date: Mon, 21 Jun 2021 02:12:02 -0400 Message-Id: <20210621061205.31878-5-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210621061205.31878-1-maxim.cournoyer@gmail.com> References: <20210621061205.31878-1-maxim.cournoyer@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1624256025; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=lE93Ja790KhJPai24rYO7mzXu037/OFpKAUlfSv7AN8=; b=c8tIQmGlRKt09XV7+QqhqCEXEProwiU5X9tGFQgBvXPDFysTRPyCVNsUCbNPzPjSLGHgmI Ko/U194OMQ/h/Z3vBHTxKiyC+9IrhK8mcLgB/1X8OzKDpyRm7L2iMYw+WrG5Q/uCyCD6pF fM0o3s2lE0TaWzQDKSnA7tKraWi9102Trh+zqgdt0wO8fVk65kpBZR2tOnb4nQVKJZNAVt EiuwAHREF1p/WBM6GMwjjQf7r04LGt31vIakIeorIxqmcON/NOoht8w3av8eR+FokRmq8u GLcZ6whJN1uyiZyA5a9T4p9VO51cPzNJcC2yLB1Mmunjx7kywNGYo0s61eDRhg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624256025; a=rsa-sha256; cv=none; b=KCqrzIBWVEjTuQUzSMOPe4XRVMD08kDzKf7Pin37phdpfuyue48sVUmI1ZxAHazv5YOqLi idC/R5qWSdQu+5fJS898OwzDy6pFUE1TbEktb9enj3CgOmiLwFcb1wRtJMD1Lp6eMKbuci KuFcpWne5XlwCHXNyf5FgzBZP21nKyJ1Jl0ECQk+pXc3n1PCuqMMherz5iW+XgXflbzlDA 3ap7v0y64JbDfbfqIw0ZhuyzkI2RixRh94CYt0G5O3XrbufxQY1tHQQDBhadKwa3ruWgHn 2iYKOWdzocH/76eMOt6LJtjsqQcczUWburspgHcHmBXIL7MB/KiL0HMrRee8uQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20161025 header.b=psYIXNjX; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: 2.68 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20161025 header.b=psYIXNjX; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 9CF531B0EA X-Spam-Score: 2.68 X-Migadu-Scanner: scn1.migadu.com X-TUID: RH9q1NuvQyYf 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 + 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)) + ;;; ;;; 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