From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id wKtYBLc2NGD9MAAA0tVLHw (envelope-from ) for ; Mon, 22 Feb 2021 22:56:55 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 4HaGO7Y2NGAsWgAAbx9fmQ (envelope-from ) for ; Mon, 22 Feb 2021 22:56:54 +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 884A327EDA for ; Mon, 22 Feb 2021 23:56:54 +0100 (CET) Received: from localhost ([::1]:56542 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lEK8L-00017m-MP for larch@yhetil.org; Mon, 22 Feb 2021 17:56:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45874) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lEJtc-0003uF-Cf for guix-devel@gnu.org; Mon, 22 Feb 2021 17:41:40 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:36426) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lEJtc-0006Zq-5m; Mon, 22 Feb 2021 17:41:40 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=35532 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lEJtb-0004WU-Lg; Mon, 22 Feb 2021 17:41:39 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: zimoun Subject: Re: Unexpected --export-manifest with simple transformations References: <868s7wbt6d.fsf@gmail.com> <87sg63zfvp.fsf@gnu.org> <86k0rf9nie.fsf@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 4 =?utf-8?Q?Vent=C3=B4se?= an 229 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Mon, 22 Feb 2021 23:41:37 +0100 In-Reply-To: <86k0rf9nie.fsf@gmail.com> (zimoun's message of "Thu, 11 Feb 2021 06:33:45 +0100") Message-ID: <87o8gb913y.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Guix Devel Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -2.87 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Queue-Id: 884A327EDA X-Spam-Score: -2.87 X-Migadu-Scanner: scn1.migadu.com X-TUID: xHnBTQuFPpY2 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, zimoun skribis: > Hi Ludo, > > On Thu, 11 Feb 2021 at 00:01, Ludovic Court=C3=A8s wrote: > >> That=E2=80=99s because when using =E2=80=98-m=E2=80=99, transformations = are not recorded. > > Yes. The question is: is it a conscientious choice or a missing > feature? [...] > For example, =E2=80=99package->manifest-entry*=E2=80=99 is "Like > 'package->manifest-entry', but attach PACKAGE provenance meta-data to > the resulting manifest entry." (I have not tried.) Therefore, we could > have something similar with =E2=80=99options->transform=E2=80=99, i.e., a= ttach somehow > meta-data. > > Well, because the feature is missing, the story about #2 is incomplete. > And I would like to have a self-reproducible Docker image produced by > =E2=80=98guix pack=E2=80=99. > > This =E2=80=9Cmissing feature=E2=80=9C, is it a conscientious choice or a= n use-case not > thought yet? I looked into it more closely. It wasn=E2=80=99t really conscious. As you point out, we can have the =E2=80=98transformations=E2=80=99 propert= y of manifest entries created automatically by default; the patch below does that. That way, the =E2=80=98transformations=E2=80=99 property is saved by defaul= t whether you use a manifest or the imperative model, and =E2=80=98--export-manifest=E2= =80=99 and =E2=80=98-m=E2=80=99 are dual. How does that sound? Thanks, Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable diff --git a/guix/profiles.scm b/guix/profiles.scm index ea8bc6e593..f942ae38d8 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -362,9 +362,14 @@ file name." #t lst))) =20 +(define (default-properties package) + (match (assq-ref (package-properties package) 'transformations) + (#f '()) + (transformations `((transformations . ,transformations))))) + (define* (package->manifest-entry package #:optional (output "out") #:key (parent (delay #f)) - (properties '())) + (properties (default-properties package)= )) "Return a manifest entry for the OUTPUT of package PACKAGE." ;; For each dependency, keep a promise pointing to its "parent" entry. (letrec* ((deps (map (match-lambda diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index 8ecdcb823f..b653138f2c 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright =C2=A9 2015, 2017, 2018, 2019, 2020 Ludovic Court=C3=A8s +;;; Copyright =C2=A9 2015, 2017, 2018, 2019, 2020, 2021 Ludovic Court=C3= =A8s ;;; Copyright =C2=A9 2017, 2018 Ricardo Wurmus ;;; Copyright =C2=A9 2018 Konrad Hinsen ;;; Copyright =C2=A9 2018 Chris Marusich @@ -1170,24 +1170,19 @@ Create a bundle of PACKAGE.\n")) manifest)) identity)) =20 - (define (with-transformations manifest) - (map-manifest-entries manifest-entry-with-transformations - manifest)) - (with-provenance - (with-transformations - (cond - ((and (not (null? manifests)) (not (null? packages))) - (leave (G_ "both a manifest and a package list were given~%"))) - ((not (null? manifests)) - (concatenate-manifests - (map (lambda (file) - (let ((user-module (make-user-module - '((guix profiles) (gnu))))) - (load* file user-module))) - manifests))) - (else - (packages->manifest packages))))))) + (cond + ((and (not (null? manifests)) (not (null? packages))) + (leave (G_ "both a manifest and a package list were given~%"))) + ((not (null? manifests)) + (concatenate-manifests + (map (lambda (file) + (let ((user-module (make-user-module + '((guix profiles) (gnu))))) + (load* file user-module))) + manifests))) + (else + (packages->manifest packages)))))) =20 (with-error-handling (with-store store diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 8234a1703d..fc5bf8137b 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -235,14 +235,12 @@ non-zero relevance score." (case (version-compare candidate-version version) ((>) (manifest-transaction-install-entry - (manifest-entry-with-transformations - (package->manifest-entry* pkg output)) + (package->manifest-entry* pkg output) transaction)) ((<) transaction) ((=3D) - (let* ((new (manifest-entry-with-transformations - (package->manifest-entry* pkg output)))) + (let* ((new (package->manifest-entry* pkg output))) ;; Here we want to determine whether the NEW actually ;; differs from ENTRY, but we need to intercept ;; 'build-things' calls because they would prevent us = from diff --git a/tests/transformations.scm b/tests/transformations.scm index 7877029486..902bd45a6a 100644 --- a/tests/transformations.scm +++ b/tests/transformations.scm @@ -20,6 +20,9 @@ #:use-module (guix tests) #:use-module (guix store) #:use-module ((guix gexp) #:select (lower-object)) + #:use-module ((guix profiles) + #:select (package->manifest-entry + manifest-entry-properties)) #:use-module (guix derivations) #:use-module (guix packages) #:use-module (guix git-download) @@ -413,6 +416,13 @@ `((with-latest . "foo"))))) (package-version (t p))))) =20 +(test-equal "options->transformation + package->manifest-entry" + '((transformations . ((without-tests . "foo")))) + (let* ((p (dummy-package "foo")) + (t (options->transformation '((without-tests . "foo")))) + (e (package->manifest-entry (t p)))) + (manifest-entry-properties e))) + (test-end) =20 ;;; Local Variables: --=-=-=--