From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christopher Baines Subject: Re: Problem with `direnv` package definition Date: Sun, 21 Apr 2019 10:54:19 +0100 Message-ID: <87mukju1is.fsf@cbaines.net> References: <20190420132019.priud6wucj5l2rn6@melmoth> <87o950txsa.fsf@cbaines.net> <20190421083426.6snly2v4xmlneb32@melmoth> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:55189) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hI9B5-0007qE-OH for guix-devel@gnu.org; Sun, 21 Apr 2019 05:54:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hI9B4-0004X5-CE for guix-devel@gnu.org; Sun, 21 Apr 2019 05:54:27 -0400 Received: from mira.cbaines.net ([2a01:7e00::f03c:91ff:fe69:8da9]:58430) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hI9B4-0004Vn-3L for guix-devel@gnu.org; Sun, 21 Apr 2019 05:54:26 -0400 In-reply-to: <20190421083426.6snly2v4xmlneb32@melmoth> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Tanguy Le Carrour Cc: guix-devel@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Tanguy Le Carrour writes: > Le 04/20, Christopher Baines a =C3=A9crit : >> Tanguy Le Carrour writes: >> > However, in the package definition [2], 3 Go packages are listed as >> > "inputs" whereas they should be listed as "native-inputs". Is this >> > correct? >> That sounds right to me, although there have been issues with binaries >> generated with Go [=E2=80=A6] >> There's also an important aspect of cross-compilation to these fields, >> which you can read about here: >> >> https://www.gnu.org/software/guix/manual/en/html_node/package-Referenc= e.html > > Thanks for the link. > > I do realize that, so close to the release of Guix System 1.0, > this can sound trivial, but I find it a little annoying to have > `guix size direnv` reporting 594 MiB when the actual binary size is > 2.9M. :-( So, in contrast to some other package management systems, the runtime dependencies, or references of the output(s) in the case of Guix are not explicitly set in the package definition. This is still something I have a little difficulty understanding, but the inputs/native-inputs distinction is more about architecture than runtime references. That's not to say that making the inputs, native-inputs in this case is wrong, quite the opposite. But, to reduce the size of the package, all that's required is to remove the reference from the direnv binary to the go compiler. It turns out that there's a specific phase of the go-build-system in Guix that does this. Currently the direnv package is using the gnu-build-system, as it's one of the older go packages in Guix, however it does now pull in some phases from the go-build-system. I've just pushed a commit that pulls in the relevant phase, and makes the inputs, native-inputs [1]. With that change, the size of the package does drop [2]. 1: http://git.savannah.gnu.org/cgit/guix.git/commit/?id=3D9729b6ea2fe89d5b8= cfd180ef2dfca367c7417e5 2: =E2=86=92 guix size /gnu/store/64m1v6smprhzmsbdvrwvd5gsrc5lirr5-direnv-2.15= .2 store item total s= elf /gnu/store/64m1v6smprhzmsbdvrwvd5gsrc5lirr5-direnv-2.15.2 4.9 = 2.9 59.0% /gnu/store/izyk3kppj42pa8i2cq29bw3bnr1607ps-tzdata-2018i 2.0 = 2.0 41.0% total: 4.9 MiB >> > As I said, I'm still learning. But I've tried, and here is what I've >> > done so far [=E2=80=A6] >> >> I tried changing the inputs to native-inputs, and the package built for >> me. Could you share the exact changes you made? > > I haven't done much: > > --- a/gnu/packages/shellutils.scm > +++ b/gnu/packages/shellutils.scm > @@ -129,12 +129,11 @@ are already there.") > ;; Help the build scripts find the Go language dependencies. > (add-before 'unpack 'setup-go-environment > (assoc-ref go:%standard-phases 'setup-go-environment))))) > - (inputs > - `(("go" ,go) > - ("go-github-com-burntsushi-toml" ,go-github-com-burntsushi-toml) > - ("go-github-com-direnv-go-dotenv" ,go-github-com-direnv-go-dotenv= ))) > (native-inputs > - `(("which" ,which))) > + `(("go" ,go) > + ("go-github-com-burntsushi-toml" ,go-github-com-burntsushi-toml) > + ("go-github-com-direnv-go-dotenv" ,go-github-com-direnv-go-doten= v) > + ("which" ,which))) > (home-page "https://direnv.net/") > (synopsis "Environment switcher for the shell") > (description > > > Thanks again for your time! What you've put above looks ok, I'm unsure why that wouldn't work... Anyway, while the size of direnv should now be improved, there's still more improvements to be made to the direnv package if you're interested! I think it would be better to switch to using the go build system, and the package in Guix is quite a few versions behind. Chris --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAly8PctfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE 9XedDg//azP3znG0dPJ6IC4hzM+59TfAgkMHAtsZ54Ek6U6Xk3RPmcaDRl+clpqD RuJ1TyhAMgMpm4ZhaiAa1qcv7v1Z5uo5uO6poUQcfbhnmjOvxRuUUMDcFcOko9In N7Ciimgncs50dsGTvvlgQl/h8LC1AhGSH/tFA1i2xAlaLr12rigdZpv1Yudr/HMg 7AdSTEMtwe8kszHIrmvWD4hS9WXIeCxu2Y83g55p5dJKZq1MUbx6gayFmUIWXXRK 8ZMvlSFB8Pt0b4PCfVxSL7AhXMNzgaj82pH+khc776GRZYlRBLdY+iCcaQV8t09Q /TKgkmyxX5hayFEiiSVEOzQ7mIu2YY6hcKVc8w5J/MDkndWXT0dafukpdqVXpJva sDKIXlqE4f33vw55nQhC1fNOI+eZFfbHR2ljAlp++vbpFtCR/8hFoqW71B54hACF qLr/v5oSC2I/q8SXqEv/A29vX/PXsUW7PJai8pCnNWTLGROqJsCdWl9OGHSSpkhu vN5mzsE8d6IeD6JOti1MO6ze2ZMqxhRou1q4zDxBo9nY+1qAfziTglCG97ckRXcF HGrHwNNOexHZ6Jw8OZ5WCpqtbSP569KreDEGaORUC7Ew9yFNEBZqrKWe7u6g5LKj GH1G9fSUo4LLN7uz38MxXuf2WiwsctjDCvwcNBWOnOiHWR48+W8= =VgtU -----END PGP SIGNATURE----- --=-=-=--