Subject: Re: bug#37035: --with-graft tries to download source files and build them

From: <[email-masked]>
Date: Sun, 18 Aug 2019 06:55:08 +0100 (BST)

Hi,

> You asked Guix to build something, so it's not surprising to me that it
> might need to download some source code to do that.
> 
> Can you spell out more clearly what you expected to happen differently,
> and why you think Guix is acting improperly here?
> 
>      Thanks,
>        Mark

Originally I expected it to attempt to graft mesa onto the love package, even though it's the exact same input, however after running `guix build --dry-run --with-graft=subversion=subversion git` I see that it shouldn't output anything (same as running `guix build` with a package you already have all substitutes for).

If I run `guix build --dry-run love` it shows that it will just download the substitute for "love", not build anything else from source, so grafting mesa onto it (even though it's the same input) shouldn't try to build anything from source.

Also just to note, in this example grafting "mesa" onto itself is just as an example, not for a useful reason. An example that doesn't try to build anything is running `guix build --dry-run --with-graft=subversion=subversion git`.

As an example of a graft that works, if you put this in a file and build it with `guix build -f <file>`, it will successfully graft the "hello" package (with the name and version changed) onto the "git" package:

```
(use-modules (guix packages) (gnu packages base) (gnu packages version-control))

(define new-subversion
  (package (inherit hello)
           (name "subversion")
           (version (package-version subversion))))

(define new-subversion-graft
  (package (inherit subversion)
           (replacement new-subversion)))

(define with-new-subversion
  (package-input-rewriting
    `((,subversion . ,new-subversion-graft))))

(with-new-subversion git)
```

You can see that it worked by running `/gnu/store/...-git-2.22.0-svn/libexec/git-core/git-svn`, and it will fail with a bunch of errors, unlike the ungrafted package.