From mboxrd@z Thu Jan 1 00:00:00 1970 From: Efraim Flashner Subject: Re: rust-build-system: Unvendor *-sys libraries in phase? Date: Sat, 25 Jan 2020 21:36:15 +0200 Message-ID: <20200125193615.GO1603@E5400> References: <20200125184959.GM1603@E5400> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="R3SAtXwgGp429mN7" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:43119) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ivREe-0000hJ-Pq for guix-devel@gnu.org; Sat, 25 Jan 2020 14:36:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ivREd-0003Nf-F9 for guix-devel@gnu.org; Sat, 25 Jan 2020 14:36:48 -0500 Received: from flashner.co.il ([178.62.234.194]:37076) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ivREd-0003NG-8E for guix-devel@gnu.org; Sat, 25 Jan 2020 14:36:47 -0500 Content-Disposition: inline In-Reply-To: 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-mx.org@gnu.org Sender: "Guix-devel" To: John Soo Cc: Guix-devel --R3SAtXwgGp429mN7 Content-Type: multipart/mixed; boundary="Sr6hGnsCY8KeifOY" Content-Disposition: inline --Sr6hGnsCY8KeifOY Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jan 25, 2020 at 11:01:31AM -0800, John Soo wrote: >=20 > Hi Efraim, >=20 >=20 > > IMO the correct way to do it would be in the crate source that we > > download. We regularly add snippets to remove vendored code, this should > > be no different. >=20 > Totally agree. It seems like a challenge to me to do the other required w= ork since all the building happens only when building the top level package= =2E I will totally defer to you here, since you have the knowledge and expe= rience.=20 >=20 > > The only real difference is that right now the > > cargo-build-system is "too smart" and checks the #:cargo-inputs to make > > sure they actually are crates before untarring them and putting them in > > the guix-vendor dor. Currently the 'patch-and-rezip phase always uses xz > > for compression, and crates always use gzip, so we cannot use patches or > > snippets on crates. >=20 > Can that be fixed in any way? I actually have no idea.=20 >=20 I didn't mean to actually fix it, but it seems that just eliminating directories is enough to make it work. I've attached a simple diff against cargo-build-system and rust-libz-sys and rust-libgit2-sys which removes the bundled source from both crates and builds rust-libgit2-sys without complaints. > > Then the only thing left is to set certain environment variables, some > > of which can probably be moved to the cargo-build-system if they don't > > require an actual path. >=20 > Ahh right. I hadn=E2=80=99t realized that restriction. Though couldn=E2= =80=99t end variables with paths be thunked or g-expressions or be done thr= ough propagated paths? I=E2=80=99m not sure, just thinking aloud. This one I'm not sure about >=20 > Thanks for your maintenance, as always. >=20 > John --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --Sr6hGnsCY8KeifOY Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="allow-patched-cargo-sources.diff" diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm index 8155bd7a94..ff2f9c52ef 100644 --- a/gnu/packages/crates-io.scm +++ b/gnu/packages/crates-io.scm @@ -5603,10 +5603,13 @@ values of all the exported APIs match the platform that libc is compiled for.") (origin (method url-fetch) (uri (crate-uri "libgit2-sys" version)) - (file-name (string-append name "-" version ".crate")) + (file-name (string-append name "-" version ".tar.gz")) (sha256 (base32 - "0l9fvki7qxsl97vgzqwlv75nl213a5vxw7b1jaik97ala356pv6r")))) + "0l9fvki7qxsl97vgzqwlv75nl213a5vxw7b1jaik97ala356pv6r")) + (modules '((guix build utils))) + (snippet + '(begin (delete-file-recursively "libgit2") #t)))) (build-system cargo-build-system) (arguments `(#:cargo-inputs @@ -5623,15 +5626,15 @@ values of all the exported APIs match the platform that libc is compiled for.") (lambda* (#:key inputs #:allow-other-keys) (let ((openssl (assoc-ref inputs "openssl"))) (setenv "OPENSSL_DIR" openssl)) - (delete-file-recursively "libgit2") - (delete-file-recursively - (string-append "guix-vendor/rust-libgit2-sys-" - ,(package-version rust-libgit2-sys-0.10) - ".crate/libgit2")) - (delete-file-recursively - (string-append "guix-vendor/rust-libz-sys-" - ,(package-version rust-libz-sys-1.0) - ".crate/src/zlib")) + ;(delete-file-recursively "libgit2") + ;(delete-file-recursively + ; (string-append "guix-vendor/rust-libgit2-sys-" + ; ,(package-version rust-libgit2-sys-0.10) + ; ".crate/libgit2")) + ;(delete-file-recursively + ; (string-append "guix-vendor/rust-libz-sys-" + ; ,(package-version rust-libz-sys-1.0) + ; ".crate/src/zlib")) (delete-file-recursively (string-append "guix-vendor/rust-libssh2-sys-" ,(package-version rust-libssh2-sys-0.2) @@ -6591,10 +6594,13 @@ types as proposed in RFC 1158.") (origin (method url-fetch) (uri (crate-uri "libz-sys" version)) - (file-name (string-append name "-" version ".crate")) + (file-name (string-append name "-" version ".tar.gz")) (sha256 (base32 - "1gjycyl2283525abks98bhxa4r259m617xfm5z52p3p3c8ry9d9f")))) + "1gjycyl2283525abks98bhxa4r259m617xfm5z52p3p3c8ry9d9f")) + (modules '((guix build utils))) + (snippet + '(begin (delete-file-recursively "src/zlib") #t)))) (build-system cargo-build-system) (arguments `(#:cargo-inputs @@ -6603,16 +6609,17 @@ types as proposed in RFC 1158.") ("rust-cc" ,rust-cc-1.0) ("rust-pkg-config" ,rust-pkg-config-0.3) ("rust-vcpkg" ,rust-vcpkg-0.2)) - #:phases - (modify-phases %standard-phases - (add-after 'configure 'delete-vendored-zlib - (lambda _ - (delete-file-recursively "src/zlib") - (delete-file-recursively - (string-append "guix-vendor/rust-libz-sys-" - ,(package-version rust-libz-sys-1.0) - ".crate/src/zlib")) - #t))))) + ;#:phases + ;(modify-phases %standard-phases + ; (add-after 'configure 'delete-vendored-zlib + ; (lambda _ + ; (delete-file-recursively "src/zlib") + ; (delete-file-recursively + ; (string-append "guix-vendor/rust-libz-sys-" + ; ,(package-version rust-libz-sys-1.0) + ; ".crate/src/zlib")) + ; #t))) + )) (native-inputs `(("pkg-config" ,pkg-config) ("zlib" ,zlib))) diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm index 8a8d74ee1b..c2046e5f5a 100644 --- a/guix/build/cargo-build-system.scm +++ b/guix/build/cargo-build-system.scm @@ -58,7 +58,7 @@ (define (crate-src? path) "Check if PATH refers to a crate source, namely a gzipped tarball with a Cargo.toml file present at its root." - (and (gzip-file? path) + (and (not (directory-exists? path)) ; not a tarball ;; First we print out all file names within the tarball to see if it ;; looks like the source of a crate. However, the tarball will include ;; an extra path component which we would like to ignore (since we're --Sr6hGnsCY8KeifOY-- --R3SAtXwgGp429mN7 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl4smKwACgkQQarn3Mo9 g1FqLg/9GQqoRvC1Lsmf6B85vHot7/aY6DYBxux1Ygw7GTv19vVv0c/hi7VDQowb EHMdnNoXxrl2hnbtQd+bEhJK8HVXtx1jX5w9/kGCl1EqOC5OZiEspItCUiCN/Ga2 NM0keb2pwcdkFIpgqr5odPvDCJOy9UeEWKzSJkuPyTfJ5JY8F3fyOF9beTQn51ET nj79TnQjulrfPka14U2bkxx6hZgaWGTt1IQcPNB/mslyYCI+cD9MAqe5FavQyot9 TSln9SIeUgzu0Wrhm4JhlGgJ91EOZ1jMuRHx1lMoDP3oXZxK2aXtOxrweB5zvMJS S8zvkhFj3Ao8JhJOS7/YfGV1yli6dzfWXN3BtbLmjCjzzepm3TTRhZad+XDWEcYm SwiRGH1b2yW5VXL5oEPaBrUSInkcsTi2XYuOgB8WFgVppxIj6yQPxWUVjf82sEld Mua1eo+77vBUJusmYFe902NAZp95sUusDph6DUVMC69orXahszoAoioFbKx6J4Tb uMLsgpI2E6mBX+3v4NSHH9mvgiRqhCSYAyC8W3E7mI+Edsfc98xl/98Bf2d+q18l 10TgEq8zu1V+IfDbJ4XpMo8zJ2P0UyLBMZC+rxApM6CjLHcqhp7qOsLkqaRIWXOA nhncj5ZobdaVbVAVklLipN5a3/zN+hioQtP2yoWCeQVHTSw4ErM= =qz0K -----END PGP SIGNATURE----- --R3SAtXwgGp429mN7--