[Top][All Lists]

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

Re: Setting package name/version using package transformations

From: Csepp
Subject: Re: Setting package name/version using package transformations
Date: Wed, 03 Jan 2024 04:57:56 +0100

Steve George <> writes:

> Hi,
> I’m exploring creating ’package variants’ through the ’package 
> transformation’ options to guix build [0]
> I can’t figure out how to build a package variant and give it a different name
> The most common sort of ’package variant’ I can imagine is where the user 
> wants a different (later) version of the source than is available in Guix. An 
> example is Calcurse where Guix’s archive has 4.5.1 and upstream has 4.8.1. I 
> can use the –with-source package transformation to build the later version 
> from the upstream source location:
>   $ guix shell –container –nesting –network –development calcurse –no-grafts 
> nss-certs
>   [env]$ guix build calcurse 
> –with-source=<> 
> –no-substitutes –no-grafts
> This will create a calcurse package which I can install and it contains 
> calcurse 4.8.1
>     $ guix package –list-installed
>     calcurse        4.8.1   out     
> /gnu/store/af4nwvbcd8rbix4vcvamblmbf3ns9wsz-calcurse-4.8.1
> Maybe it’s due to my previous Linux experiences, but the next thing I wanted 
> to do was give the package a different name and/or different version number 
> so I would know it was a local build. In Debian/Ubuntu I would have named the 
> package <software>-futurile and probably given it a different version number 
> so I could control when it was upgraded. I cannot figure out how to do either 
> of these using a package transformation, rather than defining my own package 
> file etc.
> 1. Can a package be given a different name with a transformation?

Not as far as I know.

> Manual says –with-source=package=source, I tried:
>     # nope - unknown package calcurse-futurile
>     guix build calcurse-futurile 
> –with-source=calcurse=<> 
> –no-substitutes –no-grafts
>     # kinda works
>     guix build calcurse 
> –with-source=calcurse-futurile=<>
>  –no-substitutes –no-grafts
> The second builds the ’calcurse’ package, but it no longer uses the updated 
> source (so I get v4.5.1). I can guess that this is because it has to be a 
> valid package name from the archive and calcurse-futurile isn’t one.

That’s correct.  The transformation can act on packages other than the build 
target, which is why you need to name what package (and optionally what version 
of that package) you are attempting to transform.
For example I might want to run:
guix build –with-latest=ffmpeg vlc
That would build VLC with the latest ffmpeg everywhere in the dependency tree.

> 2. Can a package be given a different version number with a transformation?
> I can give a package a different version number, but the field is 
> constrained. There’s no way to use characters other than hypen and dot, so 
> you can’t use tilde or full colon for example.
>     # this works
>     guix build calcurse 
> –with-source=calcurse@<>
>  –no-substitutes –no-grafts
>     # not allowed colons or tilde in the field so no ’epoch’ ala Debian
>     # it breaks the if you have anything other than
>     guix build calcurse –with-source=calcurse@5:4.8.1
>     guix build calcurse –with-source=calcurse@4.8.1~futurile
> I eventually found a way to to change the package name, byt giving a name as 
> part of the version:
>     # this seems to change the package name?
>     guix build calcurse 
> –with-source=calcurse@futurile-0.1=<>
>  –no-substitutes –no-grafts
>     guix package –list-installed
>     calcurse-futurile       0.1     out     
> /gnu/store/40bprd6gvwf94x42fxdlf739y55p7xip-calcurse-futurile-0.1
> This seems to take the first part of the name after the @, up to a hyphen and 
> make it part of the package name. I’m a bit confused about why this works. 
> The manual says –with-source=package@version=source, but this seems to be 
> package@custom_name-version=source - I guess I don’t understand the formats 
> of the –with-source field?
> Maybe I have a misunderstanding of the scope of usage for ’package 
> transformations’ in the cli - am I twisting it to do something that it 
> shouldn’t be?
> Thanks,
> Futurile
> [0] 
> <>

I think you are only changing the version field in this case

I’m not sure if what you are trying to accomplis is actually needed.  If you 
are worried about accidentally upgrading the transformed package, take a look 
at the output of guix package –export-manifest.

reply via email to

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