From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id CA+KGCM7MmRyNgAASxT56A (envelope-from ) for ; Sun, 09 Apr 2023 06:12:19 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id iIprGCM7MmS7awEAauVa8A (envelope-from ) for ; Sun, 09 Apr 2023 06:12:19 +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 CD6B01A1BE for ; Sun, 9 Apr 2023 06:12:18 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1plMP7-0004ZH-Nd; Sun, 09 Apr 2023 00:11:49 -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 ) id 1plMP5-0004Z5-KE for help-guix@gnu.org; Sun, 09 Apr 2023 00:11:47 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1plMP3-00044Z-Fi for help-guix@gnu.org; Sun, 09 Apr 2023 00:11:47 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 507D22400AA for ; Sun, 9 Apr 2023 06:11:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1681013503; bh=EhF4Q2cjHTwHCALxlXs29AySINYtdJtCu807L1xt2SQ=; h=From:To:Cc:Subject:Date:From; b=je1s52L9WmmF0Q9DxBK2F4zBFpNfMD/Ijtej13d0lGts3IfGFNUBekFuHpOESlWGE TrrqEG3xLWSi46QHOqOjKDE0KJiReA10R4VDCbRZoJQIQKQ1i5rMBgIeXRnJIeu2lI gSJtv59GSBKknYjeeOugii8aOZul54Jm0AhU3b5lv5V/OYafTDzhpk+tLYldia04a1 3jB+jtXa5GTax53A6jleT3T0mEl/pSq/R1clBPk7BYK/PdSKtoHSScWhIGQok44Xzx wa2d+Nb2LncVA1XEXcngE69zZw4oO365OzVMRBxwDzqaRE+xZ4yoecJ1VBp/C2haQB xExhcNOATqfwA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PvJZk2FVSz6tv5; Sun, 9 Apr 2023 06:11:41 +0200 (CEST) References: <87lejczclp.fsf@posteo.net> <87zg7jk753.fsf@gmail.com> From: Kyle Andrews To: Simon Tournier Cc: help-guix Subject: Re: How to copy a file to the package /bin folder using the r-build-system? Date: Sun, 09 Apr 2023 03:15:46 +0000 In-reply-to: <87zg7jk753.fsf@gmail.com> Message-ID: <87sfd9wv7o.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=kyle@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: help-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1681013539; a=rsa-sha256; cv=none; b=bADgoJhq706cLzJzxpj6/BVGeuZ+ew2hfIfZhUAp40qbn/HEli/qE58fGBjffLFMBdFzuo 7OKa4eYMAVot74NdE5T0m3radVhjNb8tYi2C+W78lyaajWXFZalh6oBDf3jLtPdfHx8aHV GPImwgZ9rulN/u31YPv6bU6T5s99HxfAochka5L792cXBOFlqu6sVPdP99uFhlXeNvm6IQ 1tluU76ytbrrOcAcNX7/f6NXiTFqk9nQear9OwT9SgTxFmdBNe6kmgcq1kM3j8bU/w98DJ wx+HkbAVUu/zdrO1dXJs91FYhjisS4QM6nEiL+NpDDyq+KpDJPJnmNhD7BWurw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=je1s52L9; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1681013539; 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=uYdDMKzlT/KkRKvJ/6w4APvcGZ5ncxvgPuMR2zLl7PM=; b=NsdE1/SW6NXtTFi14jJg7Q/XwrGwS77liBRHSFc9IwNY3bcW0FLnqoVhr/0q3DOzasREYw OrKdN2ZSBV8k4BfWKorbjlIkShu1gCy8nolbHBWDEcWkt3Uuj4FOePXzFhGIBlfLtpuIZz oiZtBJECh+q2+2ltE8gX6b37Cg75N6GlsRPumhWXPx9WaroG/D/ES3jt4u9P4daSJaWbvw Uxa8aQ9tlGJ0RtCJ6giuZDqeMzGJ1y7cn8a7rivEt76xGUpr9axyVEq5a4ap5sk/Qk4fex x9w1KbTHHc/3vNguegH/K6E+D8Q+dEBBKjhuTS2Uz1SokNNxB5N2g0PK+ivzzw== Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=je1s52L9; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Scanner: scn0.migadu.com X-Migadu-Spam-Score: -6.01 X-Spam-Score: -6.01 X-Migadu-Queue-Id: CD6B01A1BE X-TUID: Exz+7peKAxka Simon Tournier writes: > Hi, > > On ven., 31 mars 2023 at 23:21, Kyle Andrews wrote: > >> (let ((out (assoc-ref outputs "out"))) >> ;;; TODO: this doesn't work! >> ;; copy site-library/littler/bin/r to bin/r >> (copy-file >> (string-append out "site-library/littler/src/r") >> (string-append out "/bin/r")))))))) > > I guess what you want is: > > --8<---------------cut here---------------start------------->8--- > (let* ((out (assoc-ref outputs "out")) > (out/bin (string-append out "/bin"))) > (mkdir out/bin) > (copy-file "inst/bin/r" > (string-append out/bin "/r")))))))) > --8<---------------cut here---------------end--------------->8--- Gotcha. That must mean my mental model should be that "out" refers to the directory in the store, while the working directory is inside of the decompressed source directory. I probably should have inferred that would almost always be the case since most build-systems will (re-)use 'unpack. I also made the mistake of now always starting my path strings with a forward slash. > > And I would write, > > (lambda _ > (mkdir (string-append #$output "/bin")) > (copy-file "inst/bin/r" > (string-append #$output "/bin/r"))) This perfect makes sense now and is much more concise. > > > Well, using one or the other, I get: > > --8<---------------cut here---------------start------------->8--- > $ guix shell -L /tmp/foo r-littler -C -- r --help > > Usage: r [options] [-|file] > > Launch GNU R to execute the R commands supplied in the specified file, or > from stdin if '-' is used. Suitable for so-called shebang '#!/'-line scripts. > > Options: > -h, --help Give this help list > --usage Give a short usage message > -V, --version Show the version number > -v, --vanilla Pass the '--vanilla' option to R > -t, --rtemp Use per-session temporary directory as R does > -i, --interactive Let interactive() return 'true' rather than 'false' > -q, --quick Skip autoload / delayed assign of default libraries > -p, --verbose Print the value of expressions to the console > -l, --packages list Load the R packages from the comma-separated 'list' > -d, --datastdin Prepend command to load 'X' as csv from stdin > -L, --libpath dir Add directory to library path via '.libPaths(dir)' > -e, --eval expr Let R evaluate 'expr' > > --8<---------------cut here---------------end--------------->8--- > Thanks! I had been "toggling" back and forth between (packages->manifest (list r-littler)) and r-littler. In other words, the former gets uncommented when running guix shell -m littler.scm while the latter gets uncommented when used with guix build -f r-littler with the former getting commented. I can see from your example how writing a module would obviate the need to edit the source file over and over with the promise that alternatives can be illustrated at the same level. Sadly, when I tried to take that idea and run with it I got an unexpected error. ``` $ guix build -L dev r-littler ... ld: cannot find -lz collect2: error: ld returned 1 exit status ... ``` I know I have seen that error before, but I thought it was fixed by importing compression, prefixing (guix licenses) to prevent a namespace collision, and including zlib in the package inputs. ``` $ diff littler.scm dev/littler.scm 1,11c1,11 < (use-modules < (guix packages) < (guix download) < (gnu packages statistics) < (gnu packages compression) < (gnu packages icu4c) < (guix gexp) < (guix build-system r) < (gnu packages cran) < (gnu packages autotools) < ((guix licenses) #:prefix license:)) --- > (define-module (littler) > #:use-module (guix packages) > #:use-module (guix download) > #:use-module (gnu packages statistics) > #:use-module (gnu packages compression) > #:use-module (gnu packages icu4c) > #:use-module (guix gexp) > #:use-module (guix build-system r) > #:use-module (gnu packages cran) > #:use-module (gnu packages autotools) > #:use-module ((guix licenses) #:prefix license:)) 47,50d46 < < ;; (packages->manifest (list r r-littler)) < < r-littler ``` Meanwhile, your command ran the same for me as it did for you. ``` guix shell -L dev r-littler -C -- r --help ``` What am I missing?