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 EI2bDZyYqV/qQAAA0tVLHw (envelope-from ) for ; Mon, 09 Nov 2020 19:29:32 +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 YJVqCZyYqV/OMgAAB5/wlQ (envelope-from ) for ; Mon, 09 Nov 2020 19:29:32 +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 AEBB5940538 for ; Mon, 9 Nov 2020 19:29:31 +0000 (UTC) Received: from localhost ([::1]:34214 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kcCr3-0007Qr-3l for larch@yhetil.org; Mon, 09 Nov 2020 14:29:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36672) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kcCqc-0007Pv-22 for bug-guix@gnu.org; Mon, 09 Nov 2020 14:29:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:52288) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kcCqb-0007wu-OM for bug-guix@gnu.org; Mon, 09 Nov 2020 14:29:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kcCqb-0002pX-K3 for bug-guix@gnu.org; Mon, 09 Nov 2020 14:29:01 -0500 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: Mon, 09 Nov 2020 19:29:01 +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.160495009010822 (code B ref 43893); Mon, 09 Nov 2020 19:29:01 +0000 Received: (at 43893) by debbugs.gnu.org; 9 Nov 2020 19:28:10 +0000 Received: from localhost ([127.0.0.1]:35600 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kcCpm-0002oS-EE for submit@debbugs.gnu.org; Mon, 09 Nov 2020 14:28:10 -0500 Received: from mail-qt1-f175.google.com ([209.85.160.175]:37961) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kcCpk-0002o8-S4 for 43893@debbugs.gnu.org; Mon, 09 Nov 2020 14:28:09 -0500 Received: by mail-qt1-f175.google.com with SMTP id g17so6852139qts.5 for <43893@debbugs.gnu.org>; Mon, 09 Nov 2020 11:28:08 -0800 (PST) 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=6Pw/r/kr1vTV/U7liiSS91jRA0h7cYf13XxVZIyZM0M=; b=NkdJN4wZVP+mU2vSqpJrn/1+fJqMPpeFF9vodhF31J/I6ToTxwtnN/ZcrdXho60As9 +AitDqyoNFBTC762zBTpPUXJzIWjh+Aw01OkCUTQQxWZnk0kB0fMY7QDaZ5QHZjRfwA+ gAhKQyyPOEkQZ7CaspelJEypGqUwsu1HUHzCznGEK+wSFzVB51aMOcPPs6FIHO9Z7uq/ s+1xOBS1rumc3eyPaPkBGWVxWSKs4eQKIww/AQNhHt4Voh67tS2W+wANiKB7KHc5oQ6G OZrqHnJtkz6Q48nupOFHWQTAA+FP6h/0cDwbmrPPn0QPDbyiGy4PW3pP1fHeumKoYXg/ ZbHg== 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=6Pw/r/kr1vTV/U7liiSS91jRA0h7cYf13XxVZIyZM0M=; b=tHVegLQJtnRK96WEOUXbbaT/c2SCdm2CmSyKMQtI7AUV56hOGX4W001twcmu9JUzxn ogK7HsH/VdGm71dPbYr4mfBpdloH0Ou3XdsMeDqTuJwGzzNLiY9vBeG6gA8s3yNvmmLT 5yef7JaIu7HrbFduMgc+VRgXLpLlLpJoJ0E4H0Pz86AP8hd4m0QIXzqCYC6PRmqE3zSJ uFIL593LpjU9eOQkl2VcoAev4doYYeW+QeR1VNmcXdxuaD+LDVfvEg4ZUoMgR1X9vq/K ebOFPK1QF8YX4w+R12N+xmR8NtjopqPcfe+y9b/Ezde0rhV1e7/GQgXiFolKAun5+kCi otNQ== X-Gm-Message-State: AOAM533wX9ux9ab08an3eeA8yFPCQroUjaWWGpob5ouxoikrKipQuKja /9pyl7ibgFpBVmgSPRJdcJOpxyfztJA= X-Google-Smtp-Source: ABdhPJx7V5KfsD/fH1O6+qQ1pua47njE5whqQaDyutzL4vfK7G8Ulo1CpzkmeCmST3qzHdXvqWGLSg== X-Received: by 2002:ac8:5c05:: with SMTP id i5mr14733293qti.34.1604950082861; Mon, 09 Nov 2020 11:28:02 -0800 (PST) Received: from hurd (dsl-153-45.b2b2c.ca. [66.158.153.45]) by smtp.gmail.com with ESMTPSA id j10sm6392012qtq.59.2020.11.09.11.28.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Nov 2020 11:28:01 -0800 (PST) From: Maxim Cournoyer References: <87imbedsko.fsf@gnu.org> <20201014031705.4516-1-maxim.cournoyer@gmail.com> <87lfg0bo9m.fsf@gnu.org> <87v9f44852.fsf@gmail.com> <875z749czt.fsf@gnu.org> <87eelpd0af.fsf@gmail.com> <87k0vhm1fg.fsf@gnu.org> <87d0172adj.fsf@gmail.com> <87k0vefjgv.fsf@gnu.org> <874kmifhn2.fsf@gnu.org> <87d00zyrom.fsf@gmail.com> <871rhevfpp.fsf@gnu.org> Date: Mon, 09 Nov 2020 14:28:00 -0500 In-Reply-To: <871rhevfpp.fsf@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Sat, 31 Oct 2020 11:42:58 +0100") Message-ID: <877dquib3z.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: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=fail (headers rsa verify failed) header.d=gmail.com header.s=20161025 header.b=NkdJN4wZ; 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: 0.09 X-TUID: QQSCRZsJdWEH Hello Ludovic! Ludovic Court=C3=A8s writes: > Hi Maxim, > > Maxim Cournoyer skribis: > >>> +(define (assert-clean-checkout repository) >>> + "Error out if the working directory at REPOSITORY contains local >>> +modifications." >>> + (define description >>> + (let ((format-options (make-describe-format-options >>> + #:dirty-suffix "-dirty"))) >>> + (describe-format (describe-workdir repository) format-options))) >>> + >>> + (when (string-suffix? "-dirty" description) >>> + (leave (G_ "attempt to update 'guix' package from a dirty tree (~a= )~%") >>> + description)) >>> + >>> + (info (G_ "updating 'guix' package to '~a'~%") description)) >> >> Unfortunately this doesn't catch the case where git has explicitly been >> told to '--skip-worktree' on a path or file (the original cause of this >> bug report). See >> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D43893#11. > > Any such issue is caught when one eventually runs =E2=80=98guix build gui= x=E2=80=99 > (wrong commit ID, wrong hash, etc.). > > But you=E2=80=99re right that the above test isn=E2=80=99t fool-proof: it= =E2=80=99s just a way > to catch this common mistake early and report it nicely. Right. I still don't like that it wouldn't work from a checkout where someone would have modified, e.g., the .dir-locals file locally and marked it with 'git --skip-worktree'. Having to revert this kind of 'developer setup' is painful. The current approach makes it unnecessary (only committed changes are taken into account, not just git tracked files). >>> (define (main . args) >>> (match args >>> ((commit version) >>> @@ -113,32 +153,20 @@ COMMIT." >>> (hash (query-path-hash store source)) >>> (location (package-definition-location)) >>> (old-hash (content-hash-value >>> - (origin-hash (package-source guix))))) >>> + (origin-hash (package-source guix))))) >>> + >>> + (unless (getenv "GUIX_ALLOW_ME_TO_USE_PRIVATE_COMMIT") >>> + (let ((repository (repository-open "."))) >>> + (assert-clean-checkout repository) >>> + (repository-close! repository))) >>> + >>> (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 n= ame used >>> - ;; in the 'origin'. This allows us to build the package with= out >>> - ;; having to make a real checkout; thus, it also works when w= orking >>> - ;; on a private branch. >>> - (reload-module >>> - (resolve-module '(gnu packages package-management))) >>> - >>> - (let* ((source (add-to-store store >>> - (origin-file-name (package-sourc= e guix)) >>> - #t "sha256" source)) >>> - (root (store-path-package-name source))) >>> - >>> - ;; Add an indirect GC root for SOURCE in the current direct= ory. >>> - (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))))) >>> + (when (getenv "GUIX_ALLOW_ME_TO_USE_PRIVATE_COMMIT") >>> + (keep-source-in-store store source))))) >> >> That environment variable would now do more than it advertises. I'd >> prefer to keep the behavior consistent in both modes, unless there's a >> very good reason not too? > > Adding the source to the store, under the right name, with a GC root, is > a prerequisite for use cases like =E2=80=98make release=E2=80=99: there y= ou not only > want to update the package definition to refer to your private commit > and corresponding hash, you also want to be able to build it. If the > source isn=E2=80=99t already in the store, =E2=80=98guix build guix=E2=80= =99 tries to look it up > on Savannah, which fails. Thanks for providing a rational for it. I'll git-send a new patch which adds the source to the store using the procedure you shared above, but otherwise keeps the existing mechanism intact. Thank you for you patience! Maxim