guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#70001] [PATCH] gnu: reprotest: Add missing propogated inputs


From: Skyler Ferris
Subject: [bug#70001] [PATCH] gnu: reprotest: Add missing propogated inputs
Date: Tue, 26 Mar 2024 20:06:41 +0000

Hi again, sorry, it seems like some of my paragraphs and code blocks got 
squashed into one giant paragraph somehow. I'm going to try this again, 
hopefully it works this time. This is the text beneath the "Most of the 
proposed inputs..." quote:

I remember running into this before and it has been a pain point for me 
because it is not clear what the optional dependencies are. I know that 
package managers like apt have the ability to recommend packages which 
are optional dependencies, but the problem that I run into is that if 
I'm looking at a configuration (manifest, operating-system spec, etc) 
it's not clear to me which items are included as "invisible 
dependencies" of other packages and which ones are being included for 
their own sake. So I would like to propose using a different technique 
which I believe addresses both of our concerns.

Basically, the technique is to embed absolute paths into the python 
code. For example, I tried adding this phase to reprotest (it would need 
some polishing before actual submission, for reasons mentioned later in 
this email):

```scheme
(add-after 'adjust-locales 'set-taskset-path
   (lambda _
     (define (quote-surround str)
       (string-append "'" str "'"))

     (let ((util-linux #$(this-package-input "util-linux")))
       (when util-linux
         (substitute* "reprotest/build.py"
           (("'taskset'")
            (quote-surround (string-append util-linux "/bin/taskset")))
           (("setarch")
            (string-append util-linux "/bin/setarch")))))))
```

This let me run the num_cpus test from a pure shell without adding 
util-linux to my explicit inputs. Running taskset from the shell 
resulted in a "command not found" error so the package was not added to 
the profile. Additionally, I built a `guix pack` with only reprotest as 
an input, and util-linux was present. I built a pack with the current 
version of the package and util-linux was not present. So it seems that 
even though Guix sees the hash and is aware of it as a run-time 
dependency, it does not automatically add the package to the profile, 
addressing both of our concerns.

If a user does not want an optional dependency then they can delete the 
input like so (or replace it for a different version, if so desired):

```scheme
(use-modules (guix packages) (gnu packages diffoscope))

(package
     (inherit reprotest)
     (inputs (modify-inputs (package-inputs reprotest)
                            (delete "util-linux"))))
```

Unfortunately I do not see a way to remove an input using the with-input 
option in options->transformation procedure or the analogous 
--with-input command-line flag. If we do go this route then I will look 
at adding "#f" as a valid value for the with-input transformation to 
support this case, but that will be handled in a separate issue.

We could default to not including optional dependencies, but I don't 
think that this would be the most useful thing to do. I would expect 
that most people want all tests to work and that removing the inputs is 
a niche interest. It seems likely that "all of the tests work out of the 
box" is closer to what most people are currently experiencing because 
all of the packages which I added to the propagated inputs, with the 
exception of libfaketime and diffoscope, is in the %base-packages 
variable that Guix recommends people use (and the "normal" diff command 
is provided by %base-packages as well, so the lack of diffoscope would 
not cause a problem for users with the default configuration). If we do 
decide to exclude optional dependencies by default then I will look at 
adding an "add-input" option to the available transformations.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]