From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id YNk/MeYLyGL1OQEAbAwnHQ (envelope-from ) for ; Fri, 08 Jul 2022 12:50:14 +0200 Received: from aspmx2.migadu.com ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id sE5NMeYLyGKkzAAA9RJhRA (envelope-from ) for ; Fri, 08 Jul 2022 12:50:14 +0200 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 aspmx2.migadu.com (Postfix) with ESMTPS id C9FFD3BAD2 for ; Fri, 8 Jul 2022 12:50:13 +0200 (CEST) Received: from localhost ([::1]:35654 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o9lYq-00081u-LF for larch@yhetil.org; Fri, 08 Jul 2022 06:50:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55616) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9lYg-00081m-HX for bug-guix@gnu.org; Fri, 08 Jul 2022 06:50:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:36835) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o9lYg-0007gl-8v for bug-guix@gnu.org; Fri, 08 Jul 2022 06:50:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o9lYg-0000Jg-4z for bug-guix@gnu.org; Fri, 08 Jul 2022 06:50:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#56441: Time travel doesn't resist profile format changes References: <867d4oq3gr.fsf@gmail.com> In-Reply-To: <867d4oq3gr.fsf@gmail.com> Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Fri, 08 Jul 2022 10:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56441 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 56441@debbugs.gnu.org Received: via spool by 56441-submit@debbugs.gnu.org id=B56441.16572774001204 (code B ref 56441); Fri, 08 Jul 2022 10:50:02 +0000 Received: (at 56441) by debbugs.gnu.org; 8 Jul 2022 10:50:00 +0000 Received: from localhost ([127.0.0.1]:58965 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o9lYd-0000JL-Q8 for submit@debbugs.gnu.org; Fri, 08 Jul 2022 06:50:00 -0400 Received: from sender4-of-o51.zoho.com ([136.143.188.51]:21127) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o9lYZ-0000J2-0C for 56441@debbugs.gnu.org; Fri, 08 Jul 2022 06:49:58 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1657277391; cv=none; d=zohomail.com; s=zohoarc; b=Mu7ICJbqoRcfeWZYjKXwScREThbirHqxedyYr1NIcpbbcdrwvGpwBCzjCnY+d77v4wqwE5H+WHaLl4YJnzn54R/Jy6iNvnXsk6J3nHzt0XZEvgPZPeZdmbadUDqKvW6R96CVlYJPLFJ/8QoyaQpMCnrYYZnWTX/JrAsYb/TujLc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1657277391; h=Content-Type:Date:From:MIME-Version:Message-ID:Subject:To; bh=1SNlLwqaRDJHv9GiJHSKa8X/f3vZuwG6uv5TuvFVxbQ=; b=CQ73JoTMLvzjsjymyjITrz0WzsjQ5UqFkpmwSVE9rwIH28vz2j8sJpJy6LiJvK/UIdZd38yhnw4RGW92S3FzhCf9ljD1OUtNsGcajFX86dHp9+PU6RJX+TwfFwVcOon9WUuCPqBLUT5MEi6p+n52kaPjH8iGeGJM+Z57FMBQcRc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1657277391; s=zoho; d=elephly.net; i=rekado@elephly.net; h=From:From:To:To:Subject:Subject:Date:Date:Message-ID:MIME-Version:Content-Type:Message-Id:Reply-To:Cc; bh=1SNlLwqaRDJHv9GiJHSKa8X/f3vZuwG6uv5TuvFVxbQ=; b=CC9ram/5PA6DkIO9p+5Z+OXYHPMnzWA4oSzd0uAvIyh+W4DV/rJs2ZLG0K816vMF AUxauPHezAZHxCzAfB07UzruSQqSQhPhjQvqGjSR06yf52ZJ8iWtAjOwXmton+kZ8OG vxPCQok2TnAyvcrAuzJOoDfdL6xA3Rb3jEFJYMiY= Received: from localhost (209-110-142-46.pool.kielnet.net [46.142.110.209]) by mx.zohomail.com with SMTPS id 1657277388693550.0392393534541; Fri, 8 Jul 2022 03:49:48 -0700 (PDT) User-agent: mu4e 1.6.11; emacs 28.1 From: Ricardo Wurmus Date: Fri, 08 Jul 2022 12:46:47 +0200 X-URL: https://elephly.net X-PGP-Key: https://elephly.net/rekado.pubkey X-PGP-Fingerprint: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC Message-ID: <87fsjbzxo5.fsf@elephly.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-ZohoMailClient: External X-Zoho-Virus-Status: 1 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1657277414; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: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=1SNlLwqaRDJHv9GiJHSKa8X/f3vZuwG6uv5TuvFVxbQ=; b=bGStAlPkJgmZTdrBrorLiIV27FgCMB2r9FeP7ap9uSRAWCh8ueKpAZzAzSpiyPKjBkbspG jiP0vYV8czQ3djJLE1SDf6Kd4IJykd7Wi+FVM3UQhzrYj6nZtqDtn+Yc4FrWc0tiJUxKB+ XZwq156t5UUfEz+CLqzwscKG79o7tg5ouxmOUjFL7p6aVM/EhbNCAnvFO22k+4hyhYBxXv RvNbbmwN9fH4kyKvVy7wO3W0CzXa1rqBfXkrEconGRRhpOR/QQXFPf1ktompvwPvsnxWts aiR/CK/1dZsFJVZILgppSN0+gGjSOxuAB9DaXw8EuOFQqXhn7YrMFPXBqWwxsQ== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1657277414; a=rsa-sha256; cv=fail; b=goFDUqc2X42uJTPTsguVtxzEBydeBcCY6orBbKGKDprPdKL73Ra8aJf6qI6VnUdv2SpM6U a57OS3FVudCFy7hqVH7Udom5dadZxcDc/2We6dWjRI9beuBwYgw+nCQdeBFj0E2bqXhWaU 7ZYBGwMoOd+jI798Tft9fPS4hkOpBVebkp55pfrJAZOtTCADjzzdQlXfeP79AmxNK3tVNm kr0/EKlgnf5jDa1Igvsr5CwlbwEZnTqYc1IxyWzWoaRBxCqifO/Ibkaytxhoy5LCGaBEDe ZvadumzzkHV8scUSQ8ODkM1BH9n+tNyJX9YqbtwqMCt81lKrNMoeqhXFAgTM9g== ARC-Authentication-Results: i=2; aspmx2.migadu.com; dkim=fail ("headers rsa verify failed") header.d=elephly.net header.s=zoho header.b="CC9ram/5"; arc=reject ("signature check failed: fail, {[1] = sig:zohomail.com:reject}"); dmarc=none; spf=pass (aspmx2.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 0.75 Authentication-Results: aspmx2.migadu.com; dkim=fail ("headers rsa verify failed") header.d=elephly.net header.s=zoho header.b="CC9ram/5"; arc=reject ("signature check failed: fail, {[1] = sig:zohomail.com:reject}"); dmarc=none; spf=pass (aspmx2.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: C9FFD3BAD2 X-Spam-Score: 0.75 X-Migadu-Scanner: scn0.migadu.com X-TUID: JD+9oX2b42hc --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Attached is a patch that attempts to build the manifest in an inferior. This fails because manifest->gexp returns a gexp that we can=E2=80=99t get = out of the inferior to pass to build-profile. So even more of the surrounding code would have to be evaluated in the inferior. @Ludo: your patch looks good to me. It=E2=80=99s a pragmatic, minimally invasive fix, so thumbs up emoji from me! Thank you! --=20 Ricardo --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-channel-stuff.patch >From da3eaeea0d0082138284720dce60f6bdfc796f2b Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Fri, 8 Jul 2022 08:40:27 +0200 Subject: [PATCH] channel stuff --- guix/channels.scm | 17 ++++++++-- guix/profiles.scm | 81 +++++++++++++++++++++++++++++++++++------------ 2 files changed, 75 insertions(+), 23 deletions(-) diff --git a/guix/channels.scm b/guix/channels.scm index ce1a60436f..45fba89685 100644 --- a/guix/channels.scm +++ b/guix/channels.scm @@ -896,6 +896,7 @@ (define (instance->entry instance drv) (define (package-cache-file manifest) "Build a package cache file for the instance in MANIFEST. This is meant to be used as a profile hook." + (pk 'package-cache-file manifest) (let ((profile (profile (content manifest) (hooks '())))) (define build #~(begin @@ -918,7 +919,12 @@ (define build (mkdir #$output)))) (gexp->derivation-in-inferior "guix-package-cache" build - profile + (pk 'guixx (manifest-entry-item + (manifest-lookup + manifest + (manifest-pattern + (name "guix"))))) + ;profile ;; If the Guix in PROFILE is too old and ;; lacks 'guix repl', don't build the cache @@ -936,8 +942,15 @@ (define %channel-profile-hooks (define (channel-instances->derivation instances) "Return the derivation of the profile containing INSTANCES, a list of channel instances." - (mlet %store-monad ((manifest (channel-instances->manifest instances))) + (mlet* %store-monad ((manifest (channel-instances->manifest instances)) + (drv -> (manifest-entry-item + (manifest-lookup + manifest + (manifest-pattern + (name "guix"))))) + (built (built-derivations (list drv)))) (profile-derivation manifest + #:inferior-guix (derivation->output-path drv) #:hooks %channel-profile-hooks))) (define latest-channel-instances* diff --git a/guix/profiles.scm b/guix/profiles.scm index 701852ae98..2d482cf91a 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -38,6 +38,10 @@ (define-module (guix profiles) #:use-module (guix records) #:use-module (guix packages) #:use-module (guix derivations) + #:autoload (guix inferior) (gexp->derivation-in-inferior + open-inferior + close-inferior + inferior-eval) #:use-module (guix search-paths) #:use-module (guix gexp) #:use-module (guix modules) @@ -1946,6 +1950,7 @@ (define* (profile-derivation manifest (allow-unsupported-packages? #f) (allow-collisions? #f) (relative-symlinks? #f) + (inferior-guix #f) system target) "Return a derivation that builds a profile (aka. 'user environment') with the given MANIFEST. The profile includes additional derivations returned by @@ -2013,6 +2018,33 @@ (define set-utf8-locale (package-version glibc-utf8-locales)))) (setlocale LC_ALL "en_US.utf8"))) + (define (manifest-gexp) + (pk 'man-gexp + (if inferior-guix + (let* ((inferior (open-inferior inferior-guix)) + (result + ;; TODO: this doesn't work because we can't lift the + ;; gexp out of the inferior. + (inferior-eval `(begin + (use-modules (guix profiles) + (guix derivations)) + ((@@ (guix profiles) manifest->gexp) + (manifest + (list + ,@(map (lambda (entry) + `(manifest-entry + (name ,(manifest-entry-name entry)) + (version ,(manifest-entry-version entry)) + (output ,(manifest-entry-output entry)) + (item (read-derivation-from-file + ,(derivation-file-name + (manifest-entry-item entry)))))) + (manifest-entries manifest)))))) + inferior))) + (close-inferior inferior) + result) + (manifest->gexp manifest)))) + (define builder (with-imported-modules '((guix build profiles) (guix build union) @@ -2031,32 +2063,39 @@ (define builder #+(if locales? set-utf8-locale #t) - (build-profile #$output '#$(manifest->gexp manifest) + (build-profile #$output '#$(manifest-gexp) #:extra-inputs '#$extra-inputs #:symlink #$(if relative-symlinks? #~symlink-relative #~symlink))))) - (gexp->derivation name builder - #:system system - #:target target - - ;; Don't complain about _IO* on Guile 2.2. - #:env-vars '(("GUILE_WARN_DEPRECATED" . "no")) - - ;; Not worth offloading. - #:local-build? #t - - ;; Disable substitution because it would trigger a - ;; connection to the substitute server, which is likely - ;; to have no substitute to offer. - #:substitutable? #f - - #:properties `((type . profile) - (profile - (count - . ,(length - (manifest-entries manifest)))))))) + (let ((proc (if inferior-guix + (lambda args + (apply gexp->derivation-in-inferior + name builder (pk 'inf inferior-guix) + args)) + (lambda args + (apply gexp->derivation + name builder args))))) + (proc #:system system + #:target target + + ;; Don't complain about _IO* on Guile 2.2. + #:env-vars '(("GUILE_WARN_DEPRECATED" . "no")) + + ;; Not worth offloading. + #:local-build? #t + + ;; Disable substitution because it would trigger a + ;; connection to the substitute server, which is likely + ;; to have no substitute to offer. + #:substitutable? #f + + #:properties `((type . profile) + (profile + (count + . ,(length + (manifest-entries manifest))))))))) ;; Declarative profile. (define-record-type* profile make-profile -- 2.36.1 --=-=-=--