From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id +OfnMu0b6l/rLQAA0tVLHw (envelope-from ) for ; Mon, 28 Dec 2020 17:54:53 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id sHnALu0b6l8CFQAAB5/wlQ (envelope-from ) for ; Mon, 28 Dec 2020 17:54:53 +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 B299994030E for ; Mon, 28 Dec 2020 17:54:52 +0000 (UTC) Received: from localhost ([::1]:52874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ktwjL-0004Ho-J5 for larch@yhetil.org; Mon, 28 Dec 2020 12:54:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54328) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktwhU-00032s-5U for help-guix@gnu.org; Mon, 28 Dec 2020 12:52:56 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:38463) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ktwhS-00044q-0I for help-guix@gnu.org; Mon, 28 Dec 2020 12:52:55 -0500 Received: by mail-wr1-x435.google.com with SMTP id r7so12004181wrc.5 for ; Mon, 28 Dec 2020 09:52:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beadling-co-uk.20150623.gappssmtp.com; s=20150623; h=user-agent:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=UjzSSGYkwfxN7FjUERfSfG79oyZi/Xu6ZTQb9DSKpXM=; b=JP5hS+2i2zSf83MchwU/VyTrlzUKXm0AS75ie4HviKZTcgGbT/mufdfCZL7Y26mPaX 2gvgnwLP+kyM5LH6FuG6FFX4PYSjnnbnonrRv4z9SiUxmfPCOtwYnm15j5eEPkgvH+zk 1IAeenB+DM5qB32hR5wzw12/C/xQWIl8pcsmjtGUbV+6EX/HAX2JOPn4vE7zWr7qGv/O JwjZn3i8a5CDtGqTV7doeXp9UVKRQXAB2pyCpsuKdxkNGlX/i8Tr4I05TFzfdK+KkSPp NNraxR21Red0MYdI+5cCsqqxhSHLgdN8CBtR+riydvuh3agtti9SjKGZiSIDESi/pYz8 P/Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:user-agent:from:to:subject:date:message-id :mime-version:content-transfer-encoding; bh=UjzSSGYkwfxN7FjUERfSfG79oyZi/Xu6ZTQb9DSKpXM=; b=WuytOmy3xzloq+5FWnheUFcb9xGbhsplve7IDxCwW64tC67zUwNL/v8SIt2GuE4pK+ Z67I6BLfCfH8LACAcpraepbfpp2Lljfb36uh9T8INBL96JnPkMmQZt9n5s31cMrkGrk1 g6jHd0a8oO0+j4gNoUnDqoWw0PI5UiMlKlwfiMqH2XTdiCuJco2zUGKsPawN729+bkbj W6jMhovqdSLtoqi68OUMlw53gG7nkdZ15bEmggnfrkd31wz1mc5dimSU6JnD9FaPTIXc z+hsBMazRHMSpqVp3m6qHEc1G5zA2afG8JjiTppE3/V/MWXbolhqDOPC0FvsbIZ40lpW acTg== X-Gm-Message-State: AOAM532H2b3ke+kwuZfJoVHRXqt9f9pCcVX/gta50O7HAPuyREhurU6m 7GlRp8NOGuuId4woh6F2zmGh9kHFrkDsjV31GAE= X-Google-Smtp-Source: ABdhPJzZ39C5vTrQQDaaQxgjfnCpXOLyLMRYCYYVjDM+3hXpz/+gBbQo2vGg+vFDOQJNTEPdy95pvA== X-Received: by 2002:adf:a3c1:: with SMTP id m1mr53750071wrb.28.1609177971049; Mon, 28 Dec 2020 09:52:51 -0800 (PST) Received: from phil-XPS-13-9360 (host-78-147-225-8.as13285.net. [78.147.225.8]) by smtp.gmail.com with ESMTPSA id h16sm56351701wrq.29.2020.12.28.09.52.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Dec 2020 09:52:49 -0800 (PST) User-agent: mu4e 1.2.0; emacs 26.3 From: Phil To: help-guix@gnu.org Subject: Channel details of profile generation Date: Mon, 28 Dec 2020 17:52:48 +0000 Message-ID: <857dp1yg0f.fsf@beadling.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: none client-ip=2a00:1450:4864:20::435; envelope-from=phil@beadling.co.uk; helo=mail-wr1-x435.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: "Help-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -2.52 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=beadling-co-uk.20150623.gappssmtp.com header.s=20150623 header.b=JP5hS+2i; dmarc=none; spf=pass (aspmx1.migadu.com: domain of help-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=help-guix-bounces@gnu.org X-Migadu-Queue-Id: B299994030E X-Spam-Score: -2.52 X-Migadu-Scanner: scn0.migadu.com X-TUID: nX2yoqczKuNf Hi all, I've been writing a script that given a date/time and a profile will return the details of that profile at that date/time, including the channels used to create the profile. Initially I though this would be as easy as: guix pull -p my-profile -l But this seems to crash: ________________________________ blah@phil:~$ guix pull -p my-profile -l \Generation 1 Dec 22 2020 17:24:53\ my-test-repo 1.49-3.f08de71 \Generation 2 Dec 22 2020 17:50:28\ guix 13d532a repository URL: https://git.savannah.gnu.org/git/guix.git branch: master commit: \13d532a91178be7b6919b85685b150f941116dfc\ foo-packages 8fc6134 repository URL: ssh://git@localgit:7999/foo/foo-packages.git branch: master commit: 3dc613449f59ba8a8fdc35cadb7667ddaaf7fd9b Backtrace: 11 (primitive-load "/home/blah/.config/guix/current/bin/=E2=80=A6= ") In guix/ui.scm: 2127:12 10 (run-guix-command _ . _) In ice-9/boot-9.scm: 1736:10 9 (with-exception-handler _ _ #:unwind? _ # _) 1731:15 8 (with-exception-handler # =E2=80=A6) 1731:15 7 (with-exception-handler # =E2=80=A6) 1731:15 6 (with-exception-handler # =E2=80=A6) In guix/scripts/pull.scm: 636:4 5 (_) In guix/memoization.scm: 100:0 4 (_ # "guix-profiles/py-t=E2=80= =A6" =E2=80=A6) In guix/scripts/pull.scm: 538:21 3 (_) In guix/inferior.scm: 256:2 2 (inferior-available-packages #f) 251:13 1 (send-inferior-request (defined? (quote #)) #f) In ice-9/boot-9.scm: 1669:16 0 (raise-exception _ #:continuable? _) ice-9/boot-9.scm:1669:16: In procedure raise-exception: In procedure struct-vtable: Wrong type argument in position 1 (expecting st= ruct): #f blah@phil:~$=20 ________________________________ This was a bit unexpected as you can call 'guix describe' with a profile (although you only get channel infomation if you leave off the -p switch). So instead I decided to write my own script. I've left how I work out the generation running on a given profile at a given datetime - but this is easy enough to do (look for nearest generation-time less than the provided datetime). Armed with this, the following looked like a good starting place: (display-profile-content my-profile generation-number) With me providing a profile and generation I want details on. There are 2 versions of the display-profile-content function; one in (guix ui) and one in (guix scripts describe). https://github.com/guix-mirror/guix/blob/d482569c2289647e666228cad238552b18= f09410/guix/scripts/describe.scm#L232 https://github.com/guix-mirror/guix/blob/d482569c2289647e666228cad238552b18= f09410/guix/ui.scm#L1947 The ui.scm version doesn't have the details I want, but the describe.scm one looked promising. However the match sequence in display-profile-content in describe.scm is looking for 'source not 'provenance - which if I look at the manifest under the profile won't match? Also it only seemed to match against the first 'repository - which is no good if a private channel is used by the pr= ofile. So whilst display-profile-content correctly displays information from display-generation, the for-each over the manifest entries doesn't yield any url/branch/commit info - at least for what I want to do. I also looked at the profile-channels function but drew a blank there too. The code at describe.scm was close enough that I could fairly easily repurpose it (see below). However my questions are: Os there not already a cannonical way to do this in Guix? If yes, what is = it? If no is my approach below sane, or is what I'm trying to achieve ill-conceived in any way? Finally, what's the intended difference between 'source and 'provenance? To my mind - If a profile generation has a manifest which contains branch/commit details of the branches packages were created with - it seems reasonable and useful to report that information? Thanks, Phil. ________________________________ (format #t "~%~%Package/Channel Details:~%") (define my-manifest (manifest-entries (profile-manifest (generation-file-name my-profile generation-number)))) (for-each (lambda (entry) (format #t " ~a ~a~%" (manifest-entry-name entry) (manifest-entry-version entry)) (match (assq 'provenance (manifest-entry-properties entry)) (('provenance ('repository ('version 0) ('url url) ('branch branch) ('commit commit) _ ...) ...) (let ((repo-triples (zip url branch commit))) (map (lambda (triple) (apply format (append (list #t " URL: ~a~% Branch:= ~a~% Commit: ~a~%~%") triple))) repo-triples))) (_ #f))) (reverse my-manifest)) ________________________________