guix-devel
[Top][All Lists]
Advanced

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

gnu: shepherd: patch, snippet or phase


From: Maxime Devos
Subject: gnu: shepherd: patch, snippet or phase
Date: Sat, 05 Mar 2022 22:49:27 +0100
User-agent: Evolution 3.38.3-1

(as implied per zimoun's previous mail (‘FWIW, it would be unfair for
the patch to have the discussion here’), moved to guix-devel)

Leo Famulari schreef op za 05-03-2022 om 16:13 [-0500]:
> On Thu, Mar 03, 2022 at 07:25:22AM +0100, Maxime Devos wrote:
> > Leo Famulari schreef op wo 02-03-2022 om 18:50 [-0500]:
> > > Origin snippets should only be used to remove nonfree things
> > > from the upstream source code. All other changes should use
> > > patch files or a build phase.
> > 
> > Why?  If it's a source code change and it fits an origin snippet,
> > why not an origin snippet?  Why would the source in Guix need to
> match
> > the source upstream?
> 
> `guix build --source` is a tool to provide freely licensed source
> code
> to be used for any purpose, including building on systems besides
> Guix.
> 
> Using the Guix tools, there is no way to access the upstream source
> code
> without applying the snippets. The reason for that is that the origin
> snippet mechanism was introduced specifically to remove non-free
> components without making it easy to reverse the transformation.

It might be introduced for removing non-free components, that doesn't
mean it cannot be used for more.  Also, I don't see the point of ease
of reversing here. It's trivial to reverse the transformation induced
by the snippet: just delete the snippet in a git checkout.

> Compare that to patch files, which are easily reversed,

Removing a patch file by removing it from the 'patches' field is easy,
as easy as removing a snippet.  I assume you meant the additional
condition ‘... using only CLI tools’?

In that case, you have to: (1) run "guix build --source ..." to compute
the patched source (and maybe unpack), then (2) somehow know there's a
patch to revert, (3) clone guix, (4) find the location of the patch in
the git repo, (5) figure out the invocation of 'patch' command, and
possibly (6) repack the depatched source.  

As such, reversing patch files seems rather difficult to me, it seems
much simpler to just delete the patch inside Guix, and then we might as
well have used a snippet originally.

>  and build
> phases, which do not apply to `guix build --source`.
> 
> So, we have to be careful when using snippets, to ensure that the
> result
> of `guix build --source` is useful on any system, not just Guix.
> 
> More info:
> https://guix.gnu.org/manual/en/html_node/Snippets-versus-Phases.html
> 
> Please let me know if these guidelines are still unclear.

I am aware of the guideline of keeping the source usable outside Guix
systems.  AFAICT, in this case, the snippet modifying
Makefile.am/Makefile.in keeps the source usable on non-Guix systems.
In fact, it makes the source _more_ usable, both on Guix and non-Guix,
by working-around a Guile 3.0.5 compiler bug.  So I don't see any
problems here.

Greetings,
Maxime.

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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