all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Proper use of `guix build X --rounds=2`
@ 2024-02-18 19:06 Skyler Ferris
  2024-02-18 23:23 ` Carlo Zancanaro
  0 siblings, 1 reply; 3+ messages in thread
From: Skyler Ferris @ 2024-02-18 19:06 UTC (permalink / raw)
  To: help-guix

Hello,

Checking a package for reproducibility is one important part of patch 
review. Based on the documentation for the `--rounds=N`, I expect that a 
line such as `guix build foo --rounds=2` will build the package at least 
once and at most twice (assuming that, if the output is already present 
in the store, it will only build it once and compare it to the 
previously existing store entry; but if it does not do this optimization 
then the question in this email remains valid). However, this seems not 
to be the case. I tested using this simple package definition:

test.scm
```
(use-modules (guix build-system trivial) (guix gexp) (guix packages))
(package
   (build-system trivial-build-system)
   (arguments (list
     #:builder
     #~(begin
         (mkdir #$output)
         (sleep 60))))

   (name "test")
   (version "0.0")
   (source #f)
   (description #f)
   (synopsis #f)
   (home-page #f)
   (license #f))
```

If I first build using `time guix build -f test.scm`, then it takes more 
than a minute to run as expected. If I run the same command again then 
it takes about a second to run, which is also as expected because guix 
sees that the output has already been built. But if I then run `time 
guix build -f test.scm --rounds=2`, it still takes about a second to run 
which means that it's not building the package a second time.

Interestingly, if I change the package (for example, by changing the 
version number to "0.1") and then run `time guix build -f test.scm 
--rounds=2` (WITHOUT building normally first, so there is no 
pre-existing store entry) then it takes just over 2 minutes to run, 
implying that it built the package twice serially.

Am I using the `--rounds` flag wrong, do I misunderstand this tool, or 
is this actually a bug?

Regards,
Skyler



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Proper use of `guix build X --rounds=2`
  2024-02-18 19:06 Proper use of `guix build X --rounds=2` Skyler Ferris
@ 2024-02-18 23:23 ` Carlo Zancanaro
  2024-02-19 18:48   ` Skyler Ferris
  0 siblings, 1 reply; 3+ messages in thread
From: Carlo Zancanaro @ 2024-02-18 23:23 UTC (permalink / raw)
  To: Skyler Ferris; +Cc: help-guix

Hi Skyler,

On Sun, Feb 18 2024, Skyler Ferris wrote:
> Am I using the `--rounds` flag wrong, do I misunderstand this tool, or 
> is this actually a bug?

I'm not sure if this is considered a bug or not, but the solution to
your problem is to use --check. Using your test file running:

  guix build -f test.scm --check

should run the build one time, and compare the output with what is in
the store. Then:

  guix build -f test.scm --check --rounds=2

should run the build twice, and check against the output that is already
in the store.

It's a bit confusing, but --rounds only applies if there is actually a
build to do, whereas --check forces a build and compares against the
store.

Carlo


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Proper use of `guix build X --rounds=2`
  2024-02-18 23:23 ` Carlo Zancanaro
@ 2024-02-19 18:48   ` Skyler Ferris
  0 siblings, 0 replies; 3+ messages in thread
From: Skyler Ferris @ 2024-02-19 18:48 UTC (permalink / raw)
  To: Carlo Zancanaro; +Cc: help-guix

On 2/18/24 15:23, Carlo Zancanaro wrote:
> I'm not sure if this is considered a bug or not, but the solution to
> your problem is to use --check. Using your test file running:
>
>    guix build -f test.scm --check
>
> should run the build one time, and compare the output with what is in
> the store. Then:
>
>    guix build -f test.scm --check --rounds=2
>
> should run the build twice, and check against the output that is already
> in the store.

Thanks for clarifying! Now that you've pointed out this distinction, it 
makes sense and shouldn't cause significant problems for me moving forward.

> It's a bit confusing, but --rounds only applies if there is actually a
> build to do, whereas --check forces a build and compares against the
> store.
Yeah, the interface does seem a little confusing. There's probably a 
more intuitive way to present this, but I don't know why the options 
ended up this way to begin them or what the implications of a change 
would be. I do see now that the manual notes in the `--check` section 
that one of the uses is to check that a build is deterministic. I have 
some understanding of `guix challenge`, but only thought about it for 
the purpose of checking whether or not the substitute server is 
providing trustworthy builds not for checking the package itself, so my 
mind didn't go there when thinking about this problem.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-19 18:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-18 19:06 Proper use of `guix build X --rounds=2` Skyler Ferris
2024-02-18 23:23 ` Carlo Zancanaro
2024-02-19 18:48   ` Skyler Ferris

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.