From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 01 15:39:52 2022 Received: (at 50072) by debbugs.gnu.org; 1 Jan 2022 20:39:52 +0000 Received: from localhost ([127.0.0.1]:59463 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n3lAN-0003BD-TB for submit@debbugs.gnu.org; Sat, 01 Jan 2022 15:39:52 -0500 Received: from michel.telenet-ops.be ([195.130.137.88]:42626) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n3lAL-0003Aj-Bi for 50072@debbugs.gnu.org; Sat, 01 Jan 2022 15:39:50 -0500 Received: from localhost.localdomain ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a]) by michel.telenet-ops.be with bizsmtp id dYfm2600C4UW6Th06Yfmk4; Sat, 01 Jan 2022 21:39:47 +0100 From: Maxime Devos To: 50072@debbugs.gnu.org Subject: [PATCH v2 0/4] Add upstream updater for git-fetch origins Date: Sat, 1 Jan 2022 20:39:36 +0000 Message-Id: <20220101203940.149517-1-maximedevos@telenet.be> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r21; t=1641069587; bh=4TR2TRkDnZZ5VrHGZQLlq3IsEXRDkWwR3rnuo+l5pM4=; h=From:To:Cc:Subject:Date; b=EKz3jyQIGL1h9TrTuVwG+5Nt2gTDhPTj64K2T3OuB0/xMDDE85Thv/VnHiUY8Zn6r gGxte6EgHUGA9cG9scota+zGk4IRKo3A2MTQhcOb8GTQxPVtu8ZSebVyyuX2VS7EPL UqZUsGlwV40LjNAIXUNgyCJJerEEeHnFdBTOz/4vbDTpVM2Psjaf7R28sGPQjb9tNJ AYEiB1a51Ei4/u+QRdySwA3zQUQyo7PlW577iReZbhGZ866/pMfm396gcvlIe6qcpV YLsNM+XFp//zDx1pxES82sAE6Mq4lqM+fgLevmvoKccCa8MsXwum9GQHuVtzj6gdM0 8DiGmoVPUkl4g== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 50072 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= , Sarah Morgensen , Maxime Devos X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi, This is a combination of Sarah's patches and the patch I wrote. Some differences: 'guix/hash.scm' is added to Makefile.am. I modified the 'generic-git' and 'minetest' updater to return 'git-reference' objects. There's no guess-version-transform procedure. Due to letting updaters return git-reference objects, guessing isn't necessary. This also allows using commits. In contrast to my original version, it not only supports commits, but also tags (using 'tag-or-commit'), like in Sarah's version. I didn't use checkout-to-store, because it is used in only a single location and is only a basic wrapper around latest-repository-commit. I didn't look at testing if (let ((commit ...) (revision ...)) (package ...)) works. If it doesn't, that could be implemented in a separate patch. '--with-latest' with a git source fails with a nice error message. Some tests: $ make check # no failures $ ./pre-inst-env guix refresh minetest-mobs-animal -u --type=generic-git The result seems largely reasonable: the version changed, and the commit changed to a new tag. However, the URL changed from mixed case to lowercase. Maybe a todo for later: use the original URL if it only changed in case. Also, the version switched from YYYY-MM-DD to YYYY.MM.DD. Maybe change the minetest importer to use the latter, to keep minetest and generic-git consistent? TODO for later! A bug: the sha256 hash isn't updated. I don't know why. I investigated a little, and it turns out that 'latest-repository-commit' is called with the new tag, but the store item corresponds the old commit. Weird! $ # undo the update $ ./pre-inst-env guix refresh minetest-mobs-animal -u --type=minetest No problems at all (except the mixed case -> lowercase). The commit and sha256/base32 are updated! $ ./pre-inst-env guix build minetest-mobs-animal This builds successfully. $ # undo changes $ ./pre-inst-env guix build minetest-mobs-animal --with-latest=minetest-mobs-animal It fails gracefully with: guix build: error: git origins are unsupported by --with-latest Also, do tarball origins still function? They do: $ # move GNU "hello" to an earlier version, then do $ ./pre-inst-env guix build hello --with-latest=hello This build hello@2.10 -- the output path is the same as before moving 'hello' to an earlier version. $ ./pre-inst-env guix refresh -u hello The version is updated to @2.10, but sha256 isn't changed? Seems like a bug, but it doesn't appear to be a regression. Sarah Morgensen (4): guix hash: Extract file hashing procedures. import: Factorize file hashing. refresh: Support non-tarball sources. upstream: Support updating 'git-fetch' origins. Makefile.am | 1 + guix/hash.scm | 51 ++++++++++++++++++++++++++++++++++ guix/import/cran.scm | 32 ++------------------- guix/import/elpa.scm | 29 +++---------------- guix/import/git.scm | 22 +++++++++------ guix/import/go.scm | 25 ++--------------- guix/import/minetest.scm | 24 +++++++--------- guix/scripts/hash.scm | 18 ++---------- guix/scripts/refresh.scm | 10 +++---- guix/upstream.scm | 60 ++++++++++++++++++++++++++++++++++++---- tests/minetest.scm | 7 ++--- 11 files changed, 151 insertions(+), 128 deletions(-) create mode 100644 guix/hash.scm base-commit: 9708681f1a9f221ae6cad64625ba8309b6742653 -- 2.30.2