Subject: bug#54942: Can't run guix upgrade when a package is installed with the --with-git-url transformation

From: Ludovic Courtès <[email-masked]>
Date: Fri, 29 Apr 2022 00:54:25 +0200

Hi,

SeerLite <[email-masked]> skribis:

> I installed a package with --with-git-url and --with-branch to my profile:
>
>     guix install kakoune
>     --with-git-url=kakoune=https://github.com/mawww/kakoune.git 
> --with-branch=kakoune=breaking-cleanups
>
> However, now I can't run `guix upgrade`. I get the following error:
>
>     guix upgrade: error: the source of [email-masked] is not a Git
>     reference

[...]

Maxime Devos <[email-masked]> skribis:

> I guess the problem is that 'with-branch'/'with-commit' come before
> 'with-git-url' in
> <https://git.savannah.gnu.org/cgit/guix.git/tree/guix/transformations.scm?id=237d90a7808cfdced34b34595eba16632cbcb89e#n794>
> (untested!).

My guess is rather than the profile records (or replays) transformations
in the wrong order:

--8<---------------cut here---------------start------------->8---
$ guix shell kakoune --with-git-url=kakoune=https://github.com/mawww/kakoune.git --with-branch=kakoune=breaking-cleanups --export-manifest
;; What follows is a "manifest" equivalent to the command line you gave.
;; You can store it in a file that you may then pass to any 'guix' command
;; that accepts a '--manifest' (or '-m') option.

(use-modules (guix transformations))

(define transform1
  (options->transformation
    '((with-git-url
        .
        "kakoune=https://github.com/mawww/kakoune.git")
      (with-branch . "kakoune=breaking-cleanups"))))

(packages->manifest
  (list (transform1 (specification->package "kakoune"))))
$ guix shell kakoune --with-git-url=kakoune=https://github.com/mawww/kakoune.git --with-branch=kakoune=breaking-cleanups --export-manifest > /tmp/m.scm
$ guix build -m /tmp/m.scm -v1
guix build: error: the source of [email-masked] is not a Git reference
--8<---------------cut here---------------end--------------->8---

If you change the order of both options in the alist passed to
‘options->transformations’, it’s all good.

Now we need to find the place where things are being reversed…

Ludo’.