From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <guix-devel-bounces+larch=yhetil.org@gnu.org>
Received: from mp11.migadu.com ([2001:41d0:303:e16b::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms8.migadu.com with LMTPS
	id aGOwAac5QWVYngAA9RJhRA:P1
	(envelope-from <guix-devel-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Tue, 31 Oct 2023 18:30:15 +0100
Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp11.migadu.com with LMTPS
	id aGOwAac5QWVYngAA9RJhRA
	(envelope-from <guix-devel-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Tue, 31 Oct 2023 18:30:15 +0100
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 A25FB59030
	for <larch@yhetil.org>; Tue, 31 Oct 2023 18:30:14 +0100 (CET)
Authentication-Results: aspmx1.migadu.com;
	dkim=pass header.d=greghogan-com.20230601.gappssmtp.com header.s=20230601 header.b=pamjBVjj;
	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";
	dmarc=none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org;
	s=key1; t=1698773414;
	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:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references:list-id:list-help:
	 list-unsubscribe:list-subscribe:list-post:dkim-signature;
	bh=InI/TBOK9Zd0gDmTvSTq58sSWMVmVCqjSwOCQ8+bK1k=;
	b=p0N925YB4OzEA80QEfSf+gqkJC4hhSQejvZoquVVMdZxRw/KDdz+SusBskLsJyJrdZj4Qj
	0rr85H+d/Wt1rl49a6jGXWScD0sKYa9bfsAF4ByhgO1qeUytDFWBIwSo+sSwiOoCAKYeUP
	AolImGbHxl6n4lDYORifwU1lKcS2WqsDTYKhlQu1/fm/i6Fo3iWOQR/UhyzR2Rw9rJztSu
	mDzP2AM77z2h4MLZwW3+I/lAzsyF0ENlcrazXOFFYwquiba5iuP7BiUc3CFmSKmEC8q+MS
	aGxwnQZ8cZCaDXhVvb1GmXS9XOqExXE2R5HI6mx8r6uudPgZUS+ApBSUJOqN7A==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=pass header.d=greghogan-com.20230601.gappssmtp.com header.s=20230601 header.b=pamjBVjj;
	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";
	dmarc=none
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1698773414; a=rsa-sha256; cv=none;
	b=ZgAsW12EGbLv9cP3P6mr2PJaPKuBSPMJSdsgPGY8PBNqFzCU/ZNrLh1Pb5fNrVrtQRpXF7
	bz5Pj6nVGhikqqA8oJiKEbKMLnD5p29jmRVQwxRNonouNZdmFr/8/Vri1nVxdErLwbKBm/
	IIIvSH7+S3WvftfZP8va0efWe5v3MD+XcGCCMpyXSSFlxLNJcc87eFvJz6iAJpQ89tBsaX
	Xu8Xy2DlyL16kmmThC1L08Q4H1SnWmI4ZgnKyBWkbg5XilCWlmAUclmZ/6FYj1YOAOOvZa
	QZix5ZETWZPfJ1LwSFeKPXKY+diw+RQ7J0D9dZhwea/FfI1Lg7UPAmvLlo6MKA==
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <guix-devel-bounces@gnu.org>)
	id 1qxsYl-0005fh-IF; Tue, 31 Oct 2023 13:29:47 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <code@greghogan.com>)
 id 1qxsYj-0005fQ-Pv
 for guix-devel@gnu.org; Tue, 31 Oct 2023 13:29:45 -0400
Received: from mail-yw1-x112a.google.com ([2607:f8b0:4864:20::112a])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <code@greghogan.com>)
 id 1qxsYh-0006e5-JF
 for guix-devel@gnu.org; Tue, 31 Oct 2023 13:29:45 -0400
Received: by mail-yw1-x112a.google.com with SMTP id
 00721157ae682-5a877e0f0d8so380917b3.1
 for <guix-devel@gnu.org>; Tue, 31 Oct 2023 10:29:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=greghogan-com.20230601.gappssmtp.com; s=20230601; t=1698773382; x=1699378182;
 darn=gnu.org; 
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=InI/TBOK9Zd0gDmTvSTq58sSWMVmVCqjSwOCQ8+bK1k=;
 b=pamjBVjjpVRP7s5cOXfqsWnhDALeoBcbB38SHZajYonF36Zka/7C6km4qewglvmcXe
 bxmnGH/7jFsFOyDLbugkGWoP74Djs1EtixJG/AyrTyXX5nWOtW6eD1Q7RBemTWm5A8iU
 mxBihxh0M2NmedIPqsII2Zz5YBq+YY6PzcUgcXjToHdzvKKXBlAAjLhHSTS7AkZ6MoT4
 x2LtJ0vgI23MZ84vdJH6iY9r1uLcYN4zAuV9DhbOgcEjYpEaVOJ3ZIao/DYyPhLzMUV+
 v6kP0S6rCefSHs1vvN97v8bwuwkxWlITCc0yj7ifHOQZA3nRy1Bv9Voz6JGZ8RRWmLoA
 2KMw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1698773382; x=1699378182;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=InI/TBOK9Zd0gDmTvSTq58sSWMVmVCqjSwOCQ8+bK1k=;
 b=tO3OAPAaRQXz4c6Z2d+jQBrt4Ih4YmhGFp3FnPjJ2UD3oniYHdJ0XSI3zQTdyoL6ft
 KSkFmvxOocucfbWV7XWykwSBL7QGfU2XHXiFNILymYgUaqtxZlh/7h+e1A2eoEis1jRn
 BKULYFpJVZnLKdMIzhTY1pYq/BAMlmoO0v9Lkf/7Qi2ojlh6yfHaaB9W5Glc7oqoIr6R
 GyA6hRB/iq7yWz4hmNcH8EedPhf57gdcS4KN0p0/xWiISYjjH2t+7I5Ajo8DjIAneZTd
 m3OqeKTDWnGYUhx89xiS8DqpW0+s+t+C/d/v9+eY4rxwrWgCAcAv1ugIfgz7Wxm1RaTQ
 0/QA==
X-Gm-Message-State: AOJu0Yz4ylw8pPdcAHa9Avl4pxMW2UohyuWAjB+0BiEWSe37SNlkb6ZY
 D2zMjVka5MX2sBEYKcohRzdhCPwxjRKD85ICJ/Z9qA==
X-Google-Smtp-Source: AGHT+IHZEYZbCvlFPQvsAtbceK/6qykTl8SobEj80YRxJXA59oz2cQ9wKe1ODWq+tpXrttoh6EdObW+eA5jcp4UE7Es=
X-Received: by 2002:a81:8b50:0:b0:5a7:fcaf:c1c0 with SMTP id
 e16-20020a818b50000000b005a7fcafc1c0mr2496612ywk.8.1698773381828; Tue, 31 Oct
 2023 10:29:41 -0700 (PDT)
MIME-Version: 1.0
References: <CA+3U0ZmuH9d7jjbYb5CVrBgvZExrPCBgOH-Z6oPjRE3yj_0KDg@mail.gmail.com>
 <87edngkndl.fsf@riseup.net>
 <CA+3U0ZkdFZePdUU7CAYbgoT3bJrdcmySLdPL2PuyMF7kLsrcwA@mail.gmail.com>
 <USSh_PFytN1UF_eQ2gjlez2dMICRNAlOAwa7qxdpxqDD1iFOBKjk-gGfBJGsIuSYgi0Cks2HpdUgTlv9EbHHGLPO9NqJrjPROCS7RUZaWEw=@protonmail.com>
In-Reply-To: <USSh_PFytN1UF_eQ2gjlez2dMICRNAlOAwa7qxdpxqDD1iFOBKjk-gGfBJGsIuSYgi0Cks2HpdUgTlv9EbHHGLPO9NqJrjPROCS7RUZaWEw=@protonmail.com>
From: Greg Hogan <code@greghogan.com>
Date: Tue, 31 Oct 2023 13:29:30 -0400
Message-ID: <CA+3U0ZngChxfx_GMi64ATE5BomXWcVhJiO_6xAFoR_pF1nMQXA@mail.gmail.com>
Subject: Re: Order of manifest and overlapping binaries
To: Kaelyn <kaelyn.alexi@protonmail.com>
Cc: Csepp <raingloom@riseup.net>, guix-devel@gnu.org
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Received-SPF: none client-ip=2607:f8b0:4864:20::112a;
 envelope-from=code@greghogan.com; helo=mail-yw1-x112a.google.com
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_NONE=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>
Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org
Sender: guix-devel-bounces+larch=yhetil.org@gnu.org
X-Migadu-Flow: FLOW_IN
X-Migadu-Country: US
X-Migadu-Spam-Score: -8.73
X-Spam-Score: -8.73
X-Migadu-Queue-Id: A25FB59030
X-Migadu-Scanner: mx13.migadu.com
X-TUID: Tue641v2dV6t

On Mon, Oct 23, 2023 at 10:39=E2=80=AFAM Kaelyn <kaelyn.alexi@protonmail.co=
m> wrote:
>
> Hi,
>
> ------- Original Message -------
> On Monday, October 23rd, 2023 at 6:18 AM, Greg Hogan <code@greghogan.com>=
 wrote:
>
> >
> > On Tue, May 16, 2023 at 4:55=E2=80=AFPM Csepp raingloom@riseup.net wrot=
e:
> >
> > > Greg Hogan code@greghogan.com writes:
> > >
> > > > I could not find documentation on this circumstance or how to resol=
ve.
> > > > Both 'parallel' and 'moreutils' produce a 'bin/parallel' and only o=
ne
> > > > can go in the $GUIX_PROFILE.
> > > >
> > > > Creating a container, the latter package overshadows the former
> > > > package, as below. Unclear if this is consistent. In my manifest th=
e
> > > > former package overshadows the latter (I'd prefer to have parallel'=
s
> > > > parallel, but by default I have sorted the listing alphabetically).=
 Is
> > > > there a better way to fix this?
> > > >
> > > > Greg
> > > >
> > > > --8<---------------cut here---------------start------------->8---
> > > > $ guix shell --container moreutils parallel which coreutils
> > > > [env]$ readlink -f `which parallel`
> > > > /gnu/store/xd9kbadmrrbpkjs9vl1v9rhgayfxwgbc-parallel-20230422/bin/p=
arallel
> > > >
> > > > guix shell --container parallel moreutils which coreutils
> > > > [env]$ readlink -f $(which parallel)
> > > > /gnu/store/60zdm9zm0nqm5d97vs30sf4plb2ib5p9-moreutils-0.67/bin/para=
llel
> > > > --8<---------------cut here---------------end--------------->8---
> > > >
> > > > This is operating from a recent guix pull:
> > > >
> > > > --8<---------------cut here---------------start------------->8---
> > > > $ guix describe
> > > > Generation 44 May 11 2023 17:02:53 (current)
> > > > guix d6f6b57
> > > > repository URL: https://git.savannah.gnu.org/git/guix.git
> > > > branch: master
> > > > commit: d6f6b57766e95d2fa8af63d4460a2b303ca4d867
> > > > --8<---------------cut here---------------end--------------->8---
> > >
> > > You could create a package that just copies the contents of moreutils
> > > to $output, but renames some files, then include the resulting packag=
e
> > > in your manifest. If moreutils is not propagated from any other
> > > package, then you don't even have to do an input rewrite.
> >
> >
> > I'm still cutting my teeth on Scheme, and this looks like a simple
> > error, but the following from my manifest results in the error below.
> > The function accepts a package to inherit from and a list of files to
> > rename by appending the package name. This works if I change to pass
> > in a single string and create the list within the for-each argument.
> >
> > (define (rename-files parent-package files)
> > (package/inherit parent-package
> > (arguments
> > (substitute-keyword-arguments (package-arguments parent-package)
> > ((#:phases phases #~%standard-phases)
> > #~(modify-phases #$phases
> > (add-after 'install 'rename-files
> > (lambda* (#:key outputs #:allow-other-keys)
> > (let ((out #$output) (name #$(package-name parent-package)))
> > (for-each
> > (lambda (file)
> > (rename-file (string-append out "/" file)
> > (string-append out "/" file "-" name)))
> > #$files))))))))))
> >
> > (define moreutils-decollide
> > (rename-files moreutils (list "bin/parallel")))
> >
> > --8<---------------cut here---------------start------------->8---
> >
> > starting phase `rename-files' error: in phase 'rename-files': uncaught =
exception: wrong-type-arg #f "Wrong type to apply: ~S" ("bin/parallel") ("b=
in/parallel") phase` rename-files' failed after 0.0 seconds
>
> This error is because using gexps adds an extra layer of expansion on top=
 of normal scheme. The error is coming from the use of "#$files"... specifi=
cally in the subform "(for-each (lambda (file) ...) #$files)", #$files is r=
eplaced--in the usage example--with exactly ("bin/parallel"), resulting in:
>    (for-each (lambda (file) ...) ("bin/parallel"))
>
> Because it is a gexp, #$file is replaced with ("bin/parallel") and then t=
he resulting form is evaluated on the builder. Since ("bin/parallel") now l=
ooks like a function call, it tries to treat it as one. The three main opti=
ons that I know of are to
> 1) quote the argument when calling rename-files so that "list" is first i=
n the literal list:
>     (rename-files moreutils '(list "bin/parallel"))
> 2) quote the list within the gexp:
>     (for-each (lambda (file) ...) '#$files)
> 3) build the list within the gexp:
>     (for-each (lambda (file) ...) (list #@$files)
>
> In my opinion the second option is probably the easiest and safest to wor=
k with. #1 and #3 both suffer from needing to specially craft the incoming =
argument to handle being evaluated twice. For #1, the argument has to be a =
list after being evaluated twice (the first evaluation is of the quote, the=
 second occurs after the gexp was expanded and calls list with the string a=
rguments). For #3, the expectation of a list is more explicit, but the argu=
ment has to evaluate to a list where all of the elements have to then evalu=
ate to something meaningful (not too much of an issue for this case as stri=
ngs evaluate to themselves). #2 should only require that the evaluated argu=
ment has a printable representation that can be read back in, which at leas=
t to me feels more natural to work with.
>
> Hope my early morning explanation helps!
>
> Cheers,
> Kaelyn
>
> > Backtrace:
> > 9 (primitive-load "/gnu/store/qrj9l194a552vpg2234xx55k76j=E2=80=A6")
> > In guix/build/gnu-build-system.scm:
> > 908:2 8 (gnu-build #:source _ #:outputs _ #:inputs _ #:phases . #)
> > In ice-9/boot-9.scm:
> > 1752:10 7 (with-exception-handler _ _ #:unwind? _ # _)
> > In srfi/srfi-1.scm:
> > 634:9 6 (for-each #<procedure 7ffff5b0b140 at guix/build/gnu-b=E2=80=A6=
> =E2=80=A6)
> >
> > In ice-9/boot-9.scm:
> > 1752:10 5 (with-exception-handler _ _ #:unwind? _ # )
> > In guix/build/gnu-build-system.scm:
> > 929:23 4 ()
> > In ice-9/eval.scm:
> > 159:9 3 (_ #(#(#(#<directory (guile-user) 7ffff77f7c80>) (#)) =E2=80=A6=
))
> >
> > 159:9 2 (_ _)
> > In ice-9/boot-9.scm:
> > 1685:16 1 (raise-exception _ #:continuable? _)
> > 1685:16 0 (raise-exception _ #:continuable? _)
> >
> > ice-9/boot-9.scm:1685:16: In procedure raise-exception:
> > Wrong type to apply: "bin/parallel"
> > --8<---------------cut here---------------end--------------->8---

Kaelyn,

Thank you for the detailed explanation. I went with #2 as recommended.
  https://github.com/greghogan/guix-manifest/blob/main/manifest/library.scm=
#L33

Greg