From patchwork Sat Jan 1 20:39:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: M X-Patchwork-Id: 533 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 9D7E427BBE9; Sat, 1 Jan 2022 20:40:50 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 50DD927BBE9 for ; Sat, 1 Jan 2022 20:40:50 +0000 (GMT) Received: from localhost ([::1]:57196 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n3lBJ-0007a5-En for patchwork@mira.cbaines.net; Sat, 01 Jan 2022 15:40:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45616) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n3lAZ-0007ZH-DG for guix-patches@gnu.org; Sat, 01 Jan 2022 15:40:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:47924) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n3lAY-0003vv-Uc for guix-patches@gnu.org; Sat, 01 Jan 2022 15:40:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n3lAY-0003CK-T0 for guix-patches@gnu.org; Sat, 01 Jan 2022 15:40:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#50072] [PATCH v2 0/4] Add upstream updater for git-fetch origins References: In-Reply-To: Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 01 Jan 2022 20:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50072 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 50072@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , Sarah Morgensen , Maxime Devos Received: via spool by 50072-submit@debbugs.gnu.org id=B50072.164106959212238 (code B ref 50072); Sat, 01 Jan 2022 20:40:02 +0000 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 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 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches 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