From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 0O3XNxqah1/zNwAA0tVLHw (envelope-from ) for ; Thu, 15 Oct 2020 00:38:50 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id INfAMxqah19TaQAA1q6Kng (envelope-from ) for ; Thu, 15 Oct 2020 00:38:50 +0000 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 B4CAD9403EE for ; Thu, 15 Oct 2020 00:38:49 +0000 (UTC) Received: from localhost ([::1]:35980 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kSrI8-0002on-HP for larch@yhetil.org; Wed, 14 Oct 2020 20:38:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52650) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSrHI-0002fG-DD for help-guix@gnu.org; Wed, 14 Oct 2020 20:38:00 -0400 Received: from tobias.gr ([2a02:c205:2020:6054::1]:46374) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSrHC-0000Iq-0x for help-guix@gnu.org; Wed, 14 Oct 2020 20:37:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tobias.gr; s=2018; bh=zotBqLpk0m/6xhaAgrZDMvcGUzbZQNgjDbon8l9F9sA=; h=date:in-reply-to: references:subject:cc:to:from; b=owhSIGd5llwuRH1bJvE2U5X3JgQ2l8Q8AnM6p UzwlSYjx3oSZEhvFeo6xo50DS1eCswkCnQrK/yq6JLWEcSHkICMRSpYKpkLVTgzut/Fdl7 QWRoJ6OkUDcm+UO8hZ8I2uKvetI6//l32UrrnNt3FF4+XQRg9cv5g5H0eymAqGfYUbpHUH b583Q01zELJD7jCmYrcNmlh+sXgH6sgk+VEGCxiGKEZgEqIm2HmXvA33NnXU8JlYhzQiYl AcgMzwSZqsQ4MU8aATnRMn6Ti4AfO2JOlI5LDYn4q+oCQKsdoZmr66xOk18pLvPEcwQWB0 /aFNiEAjQHXE5UNe9AnAOljyg== Received: by submission.tobias.gr (OpenSMTPD) with ESMTPSA id 11e686c8 (TLSv1.2:ECDHE-ECDSA-AES256-GCM-SHA384:256:NO); Thu, 15 Oct 2020 00:37:57 +0000 (UTC) BIMI-Selector: v=BIMI1; s=default; From: Tobias Geerinckx-Rice To: Simon South Cc: help-guix@gnu.org Subject: Re: Specifying dependencies among package outputs? References: <87eem0l9qc.fsf@simonsouth.net> In-reply-to: <87eem0l9qc.fsf@simonsouth.net> Date: Thu, 15 Oct 2020 02:37:46 +0200 Message-ID: <87y2k8mihx.fsf@nckx> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Received-SPF: pass client-ip=2a02:c205:2020:6054::1; envelope-from=me@tobias.gr; helo=tobias.gr X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, SPF_HELO_PASS=-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.23 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" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=tobias.gr header.s=2018 header.b=owhSIGd5; dmarc=pass (policy=reject) header.from=tobias.gr; spf=pass (aspmx1.migadu.com: domain of help-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=help-guix-bounces@gnu.org X-Spam-Score: -2.31 X-TUID: WswU5OtwzMkl --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Simon, Simon South =E5=86=99=E9=81=93=EF=BC=9A > Am I right in thinking there is no way to specify dependencies=20 > among the > outputs of a single package? Well, yes, but probably not in the way you mean: they aren't=20 specified at all. Oh dear, nckx's responding to a question about=20 =E2=80=98dependencies=E2=80=99. Apologies to those who know what's coming. I avoid the word dependency when discussing Guix and urge you to=20 do the same. It's too ambiguous to be useful. Some distributions=20 use terms like =E2=80=98run-time dependency=E2=80=99 or =E2=80=98build depe= ndency=E2=80=99 as if=20 they're similar, but to me Guix/Nix prove that they're unrelated=20 by treating them very differently. We have inputs, which are=20 specified by humans (or implicitly by the build system), and=20 references -- which are not[0]. Inputs are built or downloaded when building a package, but only=20 references -- the actual occurence of the string=20 /gnu/store/-- in another=20 /gnu/store/ -- determine which of those inputs are=20 actually relevant after the build has finished. Only referenced=20 store items will be kept around during the next GC or downloaded=20 when installing pre-built substitutes. > To specify that a package's "out" output depends on its "lib"=20 > output, for instance. So it's the build process itself that specifies this: when it's=20 complete, /gnu/store/<...>-knot-3.0.1 (:out) may or may not retain=20 a reference to /gnu/store/<...>-knot-3.0.1-lib (:lib), and that's=20 what determines whether or not :out depends on :lib. I suspect the majority of packages with a :lib output do so. If you apply the patch below you'll see (e.g., with =E2=80=98guix size=E2= =80=99)=20 that installing only knot:tools will pull in knot{:out,:lib}=20 without any human-made hints to that effect. > I ask because the Knot package (in gnu/package/dns.scm) builds a=20 > number > of logically distinct targets---daemon, libraries,=20 > administrative > utilities, general-purpose utilities, and documentation---and it=20 > would > be nice to separate at least some of these into individual=20 > outputs Separating tools into administrative vs. general-purpose goes too=20 far. Attached patch: $ guix size /gnu/store/...-knot-3.0.1-doc total: 0.2 MiB (no references) $ guix size /gnu/store/...-knot-3.0.1-lib total: 145.0 MiB (self: 2.4 MiB) $ guix size /gnu/store/...-knot-3.0.1 total: 171.1 MiB (self: 5.2 MiB; refers to :lib) $ guix size /gnu/store/...-knot-3.0.1-tools total: 164.9 MiB (self: 0.4 MiB; refers to :lib) Old monolithic knot: $ guix size /gnu/store/...-knot-3.0.1 total: 171.5 MiB (self: 8.0 MiB) > [only the libraries end up a dependency of] Knot Resolver. Correct. Building knot-resolver with only ("knot:lib" ,knot=20 "lib"): $ guix size /gnu/store/...-knot-resolver-5.1.3 total: 169.1 MiB Old monolithic knot: $ guix size /gnu/store/...-knot-resolver-5.1.3 total: 183.0 MiB A saving of 13.9 MiB or <10% is not considered impressive. Some=20 might say it's not worth the complexity although I'm OK with it. > However, Knot's daemon and utilities have the same dependency on=20 > its own > libraries, so pulling those into a separate "lib" output would=20 > be liable > to break everything else. Why? > I've searched and can't find an example of this being done, nor=20 > can I > find any mention of it in the documentation. So I assume it's=20 > simply not > possible, and you would need to define an entirely separate=20 > package that > builds from the same source code---right? Which other examples or documentation have you read? How would=20 you consider Knot more complex or problematic? Kind regards, T G-R [0]: I'm ignoring propagated-inputs, both to simplify things and=20 because it makes me happy. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-gnu-knot-Build-separate-outputs.patch Content-Transfer-Encoding: quoted-printable From=2038ae89365b9bff6676d771c74589af391e53283b Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Thu, 15 Oct 2020 02:36:02 +0200 Subject: [PATCH] gnu: knot: Build separate outputs. MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit * gnu/packages/dns.scm (knot)[outputs]: New field adding :doc, :lib, and :tools outputs. [arguments]: Add #:configure-flags to install into :doc and :lib. Add a new =E2=80=98split-:tools=E2=80=99 phase to install into :tools. Add a new =E2=80=98break-circular-:lib->:out-reference=E2=80=99 phase to do= just that. =2D-- gnu/packages/dns.scm | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/gnu/packages/dns.scm b/gnu/packages/dns.scm index 1775660162..c566e7260e 100644 =2D-- a/gnu/packages/dns.scm +++ b/gnu/packages/dns.scm @@ -827,13 +827,21 @@ Extensions} (DNSSEC).") (delete-file-recursively "src/contrib/libbpf") #t)))) (build-system gnu-build-system) + (outputs (list "out" "doc" "lib" "tools")) (arguments `(#:configure-flags =2D (list "--sysconfdir=3D/etc" + (list (string-append "--docdir=3D" (assoc-ref %outputs "doc") + "/share/" ,name "-" ,version) + (string-append "--mandir=3D" (assoc-ref %outputs "doc") + "/share/man") + (string-append "--infodir=3D" (assoc-ref %outputs "doc") + "/share/info") + (string-append "--libdir=3D" (assoc-ref %outputs "lib") "/lib= ") + "--sysconfdir=3D/etc" "--localstatedir=3D/var" =2D "--enable-dnstap" ; let tools read/write capture f= iles =2D "--enable-fastparser" ; disabled by default when .git/= exists =2D "--enable-xdp=3Dauto" ; XXX [=3Dyes] currently means= =3Dembedded + "--enable-dnstap" ; let tools read/write capture files + "--enable-fastparser" ; disabled by default when .git/ ex= ists + "--enable-xdp=3Dauto" ; XXX [=3Dyes] currently means = =3Dembedded "--with-module-dnstap=3Dyes") ; detailed query capturing & lo= gging #:phases (modify-phases %standard-phases @@ -868,7 +876,27 @@ Extensions} (DNSSEC).") "install")))) (add-after 'install 'install-info (lambda _ =2D (invoke "make" "install-info")))))) + (invoke "make" "install-info"))) + (add-after 'install 'break-circular-:lib->:out-reference + (lambda* (#:key outputs #:allow-other-keys) + (let ((lib (assoc-ref outputs "lib"))) + (for-each (lambda (file) + (substitute* file + (("(prefix=3D).*" _ assign) + (string-append assign lib "\n")))) + (find-files lib "\\.pc$")) + #t))) + (add-after 'install 'split-:tools + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (tools (assoc-ref outputs "tools"))) + (for-each (lambda (command) + (mkdir-p (string-append tools (dirname command)= )) + (rename-file (string-append out command) + (string-append tools command))) + (list "/bin/kdig" + "/bin/khost")) + #t)))))) (native-inputs `(("autoconf" ,autoconf) ("automake" ,automake) =2D-=20 2.28.0 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iIMEARYKACsWIQT12iAyS4c9C3o4dnINsP+IT1VteQUCX4eZ2g0cbWVAdG9iaWFz LmdyAAoJEA2w/4hPVW15ABgBAK4dQlt/90002jU6iBzUZcYjQj4uSgUyfvvgKCz/ 5vuDAQCcklpO7AFoyQwJpZguMKhP75QQlKMAx1eq/sJgYIFNCQ== =1ZSi -----END PGP SIGNATURE----- --==-=-=--