From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <guix-devel-bounces+larch=yhetil.org@gnu.org>
Received: from mp10.migadu.com ([2001:41d0:8:6d80::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms5.migadu.com with LMTPS
	id wFHjGck0bmI5GgAAbAwnHQ
	(envelope-from <guix-devel-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Sun, 01 May 2022 09:20:41 +0200
Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp10.migadu.com with LMTPS
	id 2AbgGMk0bmLUFAAAG6o9tA
	(envelope-from <guix-devel-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Sun, 01 May 2022 09:20:41 +0200
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by aspmx1.migadu.com (Postfix) with ESMTPS id D7284234B1
	for <larch@yhetil.org>; Sun,  1 May 2022 09:20:40 +0200 (CEST)
Received: from localhost ([::1]:41950 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <guix-devel-bounces+larch=yhetil.org@gnu.org>)
	id 1nl3sl-0001YD-I7
	for larch@yhetil.org; Sun, 01 May 2022 03:20:39 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:48172)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <all_but_last@163.com>)
 id 1nl3Gz-0001bN-D9
 for guix-devel@gnu.org; Sun, 01 May 2022 02:41:37 -0400
Received: from mail-m973.mail.163.com ([123.126.97.3]:3907)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <all_but_last@163.com>) id 1nl3Gs-0007oh-Bz
 for guix-devel@gnu.org; Sun, 01 May 2022 02:41:34 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com;
 s=s110527; h=From:Subject:Date:Message-ID:MIME-Version; bh=+GuPo
 4puuXy7kWlI1waQTjoMgo98mvt/tPlVUfZNc54=; b=XA9EdOf37GUaUUyn3CWQ9
 GQHYfX8pILg1AFPAHTNyzQyIG6g1WmTmQDe4YwGUPDXlG2uYVcJdCBJJ2cWCHPci
 e/ii739K+UmkD5dhSL+vpUAewuHDKpv0CN1Vmm91BrHu/CfPmMoYmiqFL1swAA2w
 Vj33D5kzCqJzc74zNs2piY=
Received: from asus-laptop (unknown [112.95.114.235])
 by smtp3 (Coremail) with SMTP id G9xpCgDH21yGK25iL4o8AQ--.14829S2;
 Sun, 01 May 2022 14:41:12 +0800 (CST)
References: <20220301182848.26694-1-attila@lendvai.name>
 <20220301184517.13439-1-attila@lendvai.name>
 <992c3326a10e0bb28491f8226ebbe84aa93ad9ca.camel@telenet.be>
 <aJFlM3mC27rhgpJ7Mr5IN7Zyb84HRFfGSJinSMwiKWGxoY8t6gjmUatPyK2y_S8PNSqHgnTUbGJ3NDoiNHDnjN2rHVbi80WbUntglsXEO1s=@lendvai.name>
 <CAJ3okZ1vah5XFy3BVoc=hv0Ke5GxT+3M3uYo2CTNRZyPHz-mAQ@mail.gmail.com>
 <15fbca84-83ed-43cd-9bd4-e187ccadf4ec@www.fastmail.com>
 <5d684728965ec36c604e9b77f650055269e8588e.camel@telenet.be>
 <YiPSbdXBeim+5xfY@jasmine.lan>
 <84e13ef7d437062df5cca51a12e6da54929e0176.camel@telenet.be>
 <87czh0c5xx.fsf@gmail.com>
User-agent: mu4e 1.6.10; emacs 27.2
From: Zhu Zihao <all_but_last@163.com>
To: zimoun <zimon.toutoune@gmail.com>
Subject: Re: gnu: shepherd: patch, snippet or phase
Date: Sun, 01 May 2022 14:34:12 +0800
In-reply-to: <87czh0c5xx.fsf@gmail.com>
Message-ID: <8635htbvrj.fsf@163.com>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
X-CM-TRANSID: G9xpCgDH21yGK25iL4o8AQ--.14829S2
X-Coremail-Antispam: 1Uf129KBjvJXoW3GFyxuF4fZw1ftF15uFy7trb_yoW7XF4rp3
 yrta15tr4kJr4rJwnayw1SqryFyw4Syasxtw1FqwnrZrZ09r1xtr4xKayY9F97uwnruw1a
 qr4ay3s7AFyDZaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2
 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07Uv385UUUUU=
X-Originating-IP: [112.95.114.235]
X-CM-SenderInfo: pdoosuxxwbztlvw6il2tof0z/xtbBaxjzr1et4bRlfAABsY
Received-SPF: pass client-ip=123.126.97.3; envelope-from=all_but_last@163.com;
 helo=mail-m973.mail.163.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-BeenThere: guix-devel@gnu.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Development of GNU Guix and the GNU System distribution."
 <guix-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-devel>,
 <mailto:guix-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/guix-devel>
List-Post: <mailto:guix-devel@gnu.org>
List-Help: <mailto:guix-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-devel>,
 <mailto:guix-devel-request@gnu.org?subject=subscribe>
Cc: guix-devel@gnu.org
Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org
Sender: "Guix-devel" <guix-devel-bounces+larch=yhetil.org@gnu.org>
X-Migadu-Flow: FLOW_IN
X-Migadu-To: larch@yhetil.org
X-Migadu-Country: US
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org;
	s=key1; t=1651389641;
	h=from:from:sender:sender:reply-to:subject:subject:date:date:
	 message-id:message-id:to:to:cc:cc:mime-version:mime-version:
	 content-type:content-type:in-reply-to:in-reply-to:
	 references:references:list-id:list-help:list-unsubscribe:
	 list-subscribe:list-post:dkim-signature;
	bh=+GuPo4puuXy7kWlI1waQTjoMgo98mvt/tPlVUfZNc54=;
	b=eA0y4vkSLeSxa4e7gEhWxNVRTIfB05nYy9jN7E18bEkp56WwBowqHpAnajO8iSaKC4DNd3
	nmDrFJWg3iDjoveSRvmGPzWcbjRSvefKuHWUfEhmc7NT0uQPizzw17R0fsRm50YJiKtWv+
	D7jwm21t/8sAoFpeoOXgJEV1JKndtSohVyE8IihUfzDq82yfdhVPNGx1RFl28Py9fdX5fu
	42K8eeF7vad4ul7VeM02h13fw6IUHDq3E/B8etzXHU8c0SpfSKt5ejhvzVMfJeI9OZSK2x
	HhFIVCC4CCXCunRz5hK/maKeJlDmGkUYXcPKjwRlfck8KwMBfMVjMAgVKQOEgw==
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1651389641; a=rsa-sha256; cv=none;
	b=QyWyH/33Ie9gGZjsA10PIcny5nE32GoHrRcbBR10O6BKkgY++T7krsH2+RCNNei2eY65fC
	1whwRgrlCzEVtQKiZe9ATGq1CigPs5jaNgSRj1y9dW1a0R7JQgp5Zwda06iFMIE9tvehr/
	1IgK6yu8bfkpeSP46GDB9mDj0GzzZmmrRMyGE4tPQ4N++KWq6kttbKwaO4orOgly3m006W
	xTxPK8sszQWOIi661a2hxMVbpWR0MOZxcDuD/oKqrSKlPaf1mQ00REmX+xO5+L1IjWYKxK
	yRpfnCK7eDBFgv6kbUjXzcvt+UnqTSXE2QBBRX1k3SSnBwU7866+oV4Gi6zbrQ==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=pass header.d=163.com header.s=s110527 header.b=XA9EdOf3;
	dmarc=pass (policy=none) header.from=163.com;
	spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"
X-Migadu-Spam-Score: -4.59
Authentication-Results: aspmx1.migadu.com;
	dkim=pass header.d=163.com header.s=s110527 header.b=XA9EdOf3;
	dmarc=pass (policy=none) header.from=163.com;
	spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"
X-Migadu-Queue-Id: D7284234B1
X-Spam-Score: -4.59
X-Migadu-Scanner: scn1.migadu.com
X-TUID: DBpj7Y1qnEnQ

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable



IMO, It's cumbersome to add patches in build phase, you have to add a
new phase, and write something like:

```
(invoke "patch" "-p1" ...)
```

So packager will prefer to add it in the `patches` slot of <origin>
struct. I'd like to see if we have some build procedure like
`apply-patches` to help packager reduce the misnomer of `patches` slot.

Or we can add a new keyword argument #:patches-for-build to
gnu-build-system. For example

```
(package
  (name "XXX")
  (source
   (origin
    ...
    (patches (search-patches "...."))))
  (arguments
   (list
   ;; This patch only used when building the package=20
   #:patches-for-build (search-patches ".....")
   ...
   )))
```=20=20


zimoun <zimon.toutoune@gmail.com> writes:

> Hi Maxime,
>
> On Sat, 05 Mar 2022 at 22:49, Maxime Devos <maximedevos@telenet.be> wrote:
>> (as implied per zimoun's previous mail (=E2=80=98FWIW, it would be unfai=
r for
>> the patch to have the discussion here=E2=80=99), moved to guix-devel)
>
> Thanks. :-)
>
>> 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.
>>> >=20
>>> > Why?=C2=A0 If it's a source code change and it fits an origin snippet,
>>> > why not an origin snippet?=C2=A0 Why would the source in Guix need to
>>> match
>>> > the source upstream?
>>>=20
>>> `guix build --source` is a tool to provide freely licensed source
>>> code
>>> to be used for any purpose, including building on systems besides
>>> Guix.
>>>=20
>>> 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.
>
> Well, the point is the FSDG [1] frame, I guess.  From my understanding,
> when --source had been introduced, it was a countermeasure to be able to
> use hybrid source and still be compliant with an interpretation of: =C2=
=ABA
> free system distribution must not steer users towards obtaining any
> nonfree information for practical use, or encourage them to do so.=C2=BB
>
> Therefore, using Guix tools, e.g., guix build --source, it is not easy
> to reverse what =E2=80=99snippet=E2=80=99 does.
>
> I would not say it is trivial to reverse the transformation because the
> user needs to run =E2=80=9Cguix edit=E2=80=9D, then reassemble the URL, t=
hen fetch.
> Otherwise, yes the user could go to the Guix repo, remove the snippet,
> then run =E2=80=9Cguix shell -D guix=E2=80=9D, do somehow =E2=80=9C./pre-=
inst-env guix =E2=80=A6=E2=80=9D.
>
> Well, I do not consider these steps =E2=80=9Ctrivial=E2=80=9D.  And if on=
e user does
> that, somehow they really want to obtain nonfree information. :-)
>
>
>
> 1: <https://www.gnu.org/distros/free-system-distribution-guidelines.en.ht=
ml>
>
>>> 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 =E2=80=98... using only CLI tools=E2=80=99?
>
> Yes, somehow.
>
>
>> 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.
>
> Well, the question without consensus is what =E2=80=9Cguix build --source=
=E2=80=9D
> should return?
>
>   a) The source of what =E2=80=9Cguix build=E2=80=9D concretely builds?
>   b) The source of upstream (modulo the removal of nonfree part)?
>
> The aim is to be as close as possible as b), IMHO.  The exception of
> patches could be discussed. :-)
>
>
> Back to Shepherd, because the question is originally from patch#54216
> [2], the initial snippet was turning a flag:
>
> +         (snippet
> +          '(begin
> +             ;; Build with -O1 to work around <https://bugs.gnu.org/4836=
8>.
> +             (substitute* "Makefile.am"
> +               (("compile --target")
> +                "compile -O1 --target"))))))
>
> Somehow, the snippet could be considered as a =E2=80=9Cpatch=E2=80=9C.  A=
nd, in the same
> time, the upstream source will not compile without this =E2=80=99-O1=E2=
=80=99, IIUC.
>
> However, since =E2=80=9Cwe=E2=80=9C are in the same time upstream and dow=
nstream, we
> could fix that without introducing this kind of snippet.
>
> Last, because the package is for building with Guix, then it seems more
> appropriate to have the substitution in the =E2=80=99arguments=E2=80=99, =
as v3 [3] is
> doing.
>
>
> 2: <http://issues.guix.gnu.org/issue/54216>
> 3: <https://issues.guix.gnu.org/issue/54216#19>
>
>
>
> Cheers,
> simon


=2D-=20
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iIsEARYIADMWIQRefA5qkqvnKdl/GTlmOX+E92aT+QUCYm4rcBUcYWxsX2J1dF9s
YXN0QDE2My5jb20ACgkQZjl/hPdmk/m6rwD/W4e4oDoLCmZasjJ4ycz5GZ4vzvFB
ZmvTS0HHK61NupIA/2PVxJrgM/5HaEO6/MRJcnzfeSxFCA6WTyYTSB6s1p4I
=xCeI
-----END PGP SIGNATURE-----
--=-=-=--