guix-devel
[Top][All Lists]
Advanced

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

Re: guix weather exit status?


From: Kaelyn
Subject: Re: guix weather exit status?
Date: Sun, 11 Jul 2021 13:23:17 +0000

Hi,

I'm fairly new to Guix and haven't made much use of guix weather, but had a 
thought about the exit status.

On Sunday, July 11th, 2021 at 4:40 AM, zimoun <zimon.toutoune@gmail.com> wrote:

> Hi,
>
> On Sat, 10 Jul 2021 at 18:06, Leo Famulari leo@famulari.name wrote:
>
> > On Sat, Jul 10, 2021 at 04:41:44PM +0200, Ludovic Courtès wrote:
> >
> > > I agree we could change (or rather refine) semantics to exit with
> > >
> > > non-zero when overall coverage is below 100%. In the example above, it
> > >
> > > should return 0.
> >
> > Maybe we could distinguish between various cases like this:
> >
> > 0 means 100% coverage
> >
> > 1 means a substitute is available, but not from all servers
> >
> > 2 means a substitute is not available
> >
> > This would preserve the current meaning of 0, while still allowing `guix 
> > weather` to be used in scripts to "wait for a substitute".
>
> What about two or more packages? “guix weather foo bar” when the
>
> package ’foo’ is available on one server and ’bar’ is not at all. Or if
>
> ’foo’ is available on one server and ’bar’ on the other. Etc.
>
> We could have:
>
> 0 100% all servers
>
> 1 100% from one server
>
> 2 100% from a server mix
>
> 3 one or more substitute is missing

It looks to me like there are two overlapping use cases for guix weather and 
it's exit status (and sorry if they aren't the clearest): checking substitute 
availability for download, and substitute progress/coverage among servers.

There is already a "--coverage" flag to guix weather that the help describes as 
"show substitute coverage for packages with at least COUNT dependents". What if 
a new flag was added, say "-a" / "--available", which specifies the number of 
servers a single substitute must be available from to be considered available, 
possibly with a default of "1". That way guix weather can exit 0 when needed 
for both of the use cases.

For example, with the original output that showed 100% substitute availability 
from ci.guix.gnu.org and 0% availability from bordeaux.guix.gnu.org for a 
single package and exited 1 as a result:
* "guix weather -a 1" would exit 0
* "guix weather -a 2" would exit 1 because it was available from less than 2 
servers.

That way, even when multiple packages are specified at once, guix weather would 
exit 0 as long as all of the packages met the requested minimum availability.

Cheers,
Kaelyn


P.S. If folks like the idea, I'm volunteering to implement it. ;)



reply via email to

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