all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Setting package name/version using package transformations
@ 2024-01-02 21:37 Steve George
  2024-01-03  3:57 ` Csepp
  0 siblings, 1 reply; 2+ messages in thread
From: Steve George @ 2024-01-02 21:37 UTC (permalink / raw)
  To: help-guix

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=https://calcurse.org/files/calcurse-4.8.1.tar.gz --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?
Manual says --with-source=package=source, I tried: 

    # nope - unknown package calcurse-futurile
    guix build calcurse-futurile --with-source=calcurse=https://calcurse.org/files/calcurse-4.8.1.tar.gz --no-substitutes --no-grafts

    # kinda works
    guix build calcurse --with-source=calcurse-futurile=https://calcurse.org/files/calcurse-4.8.1.tar.gz --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.

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@5.4.8.1=https://calcurse.org/files/calcurse-4.8.1.tar.gz --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 .xx.xxx
    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=https://calcurse.org/files/calcurse-4.8.1.tar.gz --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] https://guix.gnu.org/manual/en/html_node/Package-Transformation-Options.html


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

* Re: Setting package name/version using package transformations
  2024-01-02 21:37 Setting package name/version using package transformations Steve George
@ 2024-01-03  3:57 ` Csepp
  0 siblings, 0 replies; 2+ messages in thread
From: Csepp @ 2024-01-03  3:57 UTC (permalink / raw)
  To: Steve George; +Cc: help-guix

Steve George <steve@futurile.net> 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=<https://calcurse.org/files/calcurse-4.8.1.tar.gz> –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=<https://calcurse.org/files/calcurse-4.8.1.tar.gz> –no-substitutes –no-grafts
>
>     # kinda works
>     guix build calcurse –with-source=calcurse-futurile=<https://calcurse.org/files/calcurse-4.8.1.tar.gz> –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@5.4.8.1=<https://calcurse.org/files/calcurse-4.8.1.tar.gz> –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 .xx.xxx
>     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=<https://calcurse.org/files/calcurse-4.8.1.tar.gz> –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] <https://guix.gnu.org/manual/en/html_node/Package-Transformation-Options.html>

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.

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

end of thread, other threads:[~2024-01-03  4:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-02 21:37 Setting package name/version using package transformations Steve George
2024-01-03  3:57 ` Csepp

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.