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 0F0JChSfj180JgAA0tVLHw (envelope-from ) for ; Wed, 21 Oct 2020 02:38:12 +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 qITrBRSfj1+XQAAAB5/wlQ (envelope-from ) for ; Wed, 21 Oct 2020 02:38:12 +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 BD4A4940538 for ; Wed, 21 Oct 2020 02:38:11 +0000 (UTC) Received: from localhost ([::1]:36794 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kV40w-0004Zz-Oj for larch@yhetil.org; Tue, 20 Oct 2020 22:38:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60566) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kV40o-0004Wk-GU for bug-guix@gnu.org; Tue, 20 Oct 2020 22:38:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35732) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kV40o-0006yI-6U for bug-guix@gnu.org; Tue, 20 Oct 2020 22:38:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kV40o-0006wg-4p for bug-guix@gnu.org; Tue, 20 Oct 2020 22:38:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#43893: [PATCH v3] maint: update-guix-package: Prevent accidentally breaking guix pull. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Wed, 21 Oct 2020 02:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43893 X-GNU-PR-Package: guix X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 43893-submit@debbugs.gnu.org id=B43893.160324782726629 (code B ref 43893); Wed, 21 Oct 2020 02:38:02 +0000 Received: (at 43893) by debbugs.gnu.org; 21 Oct 2020 02:37:07 +0000 Received: from localhost ([127.0.0.1]:47277 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kV3zv-0006vQ-E1 for submit@debbugs.gnu.org; Tue, 20 Oct 2020 22:37:07 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:37808) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kV3zt-0006uw-HR for 43893@debbugs.gnu.org; Tue, 20 Oct 2020 22:37:06 -0400 Received: by mail-qt1-f195.google.com with SMTP id h19so916187qtq.4 for <43893@debbugs.gnu.org>; Tue, 20 Oct 2020 19:37:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=Bac20wdnbyLrkxSedTJZVYqQuIwr3O+tR4fYV2Dbc6Y=; b=sU8d1SJOJ30lSULw/pdBPqWpa00l3avr078NDx5ffMz2joSt+C5V5hLwOIwxAC0OfD l/GCm2+DyZ29qaBZhF1gp3Dl0CFMbAh2oy/WSy0eIFO7aQDONUpgQIeDbzq5IbVWiSFR +hYiqCBXwLlm3W9etoezpR6AYoTFiPrb7FwgpFQx3DIuz6Z5YxPqSHQbW5EoTCqt5iGR ukUdZW3wkhCOxNt/bDg0NXPwjiD5yXLU8Jk0vmFAO2wZ09El1l4HOHUdqowa/PRQS0eE ekLbwlnWdbKYLcQwMnwj1c3eGraCA8Fn0xPOZ35iPtE+KV03HJ1Juhss+mpmipbauiya Gx3Q== 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:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=Bac20wdnbyLrkxSedTJZVYqQuIwr3O+tR4fYV2Dbc6Y=; b=TOGWSJGLzzLA/M2uKmdgKt/MOeoFQ3SHvrXDbwMxgxgqhEk6Rk61v+5ykLdK13X6KN YEQ9N+3RCl3PdVdWaMuN/kI38hir6SvX/rj1vgHdv/MDvRQSjmqkosOM2FbRunmqHRoq VJO9RHRiSEZkvlqTIgQg9dIUXa7ITsxTGExPaawJ+4ksVQSvRodAdpZTfOtBNYwJa9M4 Xf7ob2d4Z11DGofrvqy1UGbSrwqATKRVf/gSjdS1wb0QLGoiuiM+NbfniQV4NXl6IkK0 ZTpHdTw2bqOJ2+lrNZrbu2DdqoMWgYtoG6a00DmhbflBAVq7L1LQMV7nZJ/srRBPor5h PdQQ== X-Gm-Message-State: AOAM530dIlT7qg9uG693z6Xak2e8tn50cSJrrjH3Mc9EiUPHK0FPoTuU v/A2fTGgCYnovObP5k6yKIs= X-Google-Smtp-Source: ABdhPJz0k7keOfssajYfJifNrl0J/t9O8pVf2HoYeoMxKdIFF29RVDWUXRqiZEEWXaFmfgHOeGcinA== X-Received: by 2002:ac8:8c7:: with SMTP id y7mr1122499qth.278.1603247819866; Tue, 20 Oct 2020 19:36:59 -0700 (PDT) Received: from hurd (dsl-141-39.b2b2c.ca. [66.158.141.39]) by smtp.gmail.com with ESMTPSA id 128sm514129qkm.76.2020.10.20.19.36.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2020 19:36:58 -0700 (PDT) From: Maxim Cournoyer References: <87imbedsko.fsf@gnu.org> <20201014031705.4516-1-maxim.cournoyer@gmail.com> <87lfg0bo9m.fsf@gnu.org> Date: Tue, 20 Oct 2020 22:36:57 -0400 In-Reply-To: <87lfg0bo9m.fsf@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Tue, 20 Oct 2020 23:06:45 +0200") Message-ID: <87v9f44852.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.0 (-) X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 43893@debbugs.gnu.org Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=sU8d1SJO; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Spam-Score: 1.59 X-TUID: 61XfzUOe+fTN Hello Ludovic, Ludovic Court=C3=A8s writes: > Hi Maxim, > > Maxim Cournoyer skribis: > >> (define (main . args) >> (match args >> ((commit version) >> - (with-store store >> - (let* ((source (add-to-store store >> - "guix-checkout" ;dummy name >> - #t "sha256" %top-srcdir >> - #:select? version-controlled?)) >> - (hash (query-path-hash store source)) >> + (with-directory-excursion %top-srcdir >> + (or (getenv "GUIX_ALLOW_ME_TO_USE_PRIVATE_COMMIT") >> + (commit-already-pushed? (find-origin-remote) commit) >> + (leave (G_ "Commit ~a is not pushed upstream. Aborting.~%")= commit)) >> + (let* ((hash (with-temporary-git-worktree commit >> + (nix-base32-string->bytevector >> + (string-trim-both >> + (with-output-to-string >> + (lambda () >> + (guix-hash "-rx" "."))))))) >> (location (package-definition-location)) >> (old-hash (content-hash-value >> - (origin-hash (package-source guix))))) >> + (origin-hash (package-source guix))))) >> (edit-expression location >> (update-definition commit hash >> #:old-hash old-hash >> - #:version version)) >> - >> - ;; Re-add SOURCE to the store, but this time under the real na= me used >> - ;; in the 'origin'. This allows us to build the package witho= ut >> - ;; having to make a real checkout; thus, it also works when wo= rking >> - ;; on a private branch. >> - (reload-module >> - (resolve-module '(gnu packages package-management))) >> - >> - (let* ((source (add-to-store store >> - (origin-file-name (package-source= guix)) >> - #t "sha256" source)) >> - (root (store-path-package-name source))) >> - >> - ;; Add an indirect GC root for SOURCE in the current directo= ry. >> - (false-if-exception (delete-file root)) >> - (symlink source root) >> - (add-indirect-root store >> - (string-append (getcwd) "/" root)) >> - >> - (format #t "source code for commit ~a: ~a (GC root: ~a)~%" >> - commit source root))))) > > I realize it was maybe enough to wrap this whole portion (starting from > =E2=80=9CRe-add SOURCE=E2=80=9D) in (unless (getenv > "GUIX_ALLOW_ME_TO_USE_PRIVATE_COMMIT") =E2=80=A6)? Running =E2=80=98guix= build guix=E2=80=99 > would have forced the source derivation to be built. > > Anyhow, thanks for working on it! Sorry, I'm a bit lost. Are you suggesting that we should restore the code following the ;; Re-add SOURCE [...], but wrapped with unless to make it conditional to GUIX_ALLOW_ME_TO_USE_PRIVATE_COMMIT being defined? That part depends on SOURCE, a store file name, which we don't have anymore since we no longer add the sources to the store to compute the hash. We could add the sources to the store from the clean checkout, but I thought one great thing about the patch was that it removed interactions with the store, allowing for the source derivations to happen normally when testing with 'guix build guix' (previously you'd have had to 'guix build guix --check', as the store had silently been pre-populated with the sources). I see value in using the usual mechanism to get the source rather than a side-channel, optimization hack, as it will help ensuring correctness. Perhaps I misunderstood your point? Thank you, Maxim