Source: dh-cargo
Version: 23
Severity: wishlist
Tags: patch
User: [email protected]
Usertags: buildpath toolchain
X-Debbugs-Cc: [email protected]
Hi,
Whilst working on the Reproducible Builds effort [0] we noticed that
dh-cargo generates/installs non-reproducible output. For example,
here is rust-difference 2.0.0-1:
│ │ │ ├── ./usr/.crates2.json
│ │ │ │ │ @@ -1,10 +1,10 @@
│ │ │ │ │ {
│ │ │ │ │ "installs": {
│ │ │ │ │ - "difference 2.0.0
(path+file:///build/1st/rust-difference-2.0.0)": {
│ │ │ │ │ + "difference 2.0.0
(path+file:///build/2/rust-difference-2.0.0/2nd)": {
Proof-of-concept patch attached that strips all these files. It might
be better to do this elsewhere, up to you.
--- a/cargo.pm
+++ b/cargo.pm
@@ -170,6 +170,7 @@ sub install {
my $destdir = $ENV{'DESTDIR'} || $this->get_sourcepath("debian/" .
$this->{binpkg});
doit("env", "DESTDIR=$destdir",
"/usr/share/cargo/bin/cargo", "install", @_);
+ doit('find', $destdir, '-name', '.crates2.json', '-exec', 'rm',
'{}', '+');
# generate Built-Using fields
Note that this file is being installed to /usr (!) which is likely a
pretty severe bug here or in rust-difference, but I'll leave that
with you.
[0] https://reproducible-builds.org/
Regards,
--
,''`.
: :' : Chris Lamb
`. `'` [email protected] / chris-lamb.co.uk
`-
diff --git a/cargo.pm b/cargo.pm
index 013785e..53507b1 100644
--- a/cargo.pm
+++ b/cargo.pm
@@ -170,6 +170,7 @@ sub install {
my $destdir = $ENV{'DESTDIR'} || $this->get_sourcepath("debian/" .
$this->{binpkg});
doit("env", "DESTDIR=$destdir",
"/usr/share/cargo/bin/cargo", "install", @_);
+ doit('find', $destdir, '-name', '.crates2.json', '-exec', 'rm', '{}',
'+');
# generate Built-Using fields
doit("/usr/share/cargo/bin/dh-cargo-built-using", $this->{binpkg});
}