Subject: [PATCH v2 0/4] Add upstream updater for git-fetch origins

From: Maxime Devos <[email-masked]>
Date: Sat, 1 Jan 2022 20:39:36 +0000

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 [email-masked] -- 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