diff -Nru rust-rio-0.8.3/debian/changelog rust-rio-0.8.3/debian/changelog --- rust-rio-0.8.3/debian/changelog 2023-06-20 18:37:03.000000000 +0000 +++ rust-rio-0.8.3/debian/changelog 2023-08-19 21:59:37.000000000 +0000 @@ -1,3 +1,11 @@ +rust-rio (0.8.3-3) unstable; urgency=medium + + * update dh-cargo fork; + closes: bug#1045904, thanks to Lucas Nussbaum + * update DEP-3 patch headers + + -- Jonas Smedegaard Sat, 19 Aug 2023 23:59:37 +0200 + rust-rio (0.8.3-2) unstable; urgency=medium * fix: mangle Cargo.toml to strip same-workspace path diff -Nru rust-rio-0.8.3/debian/dh-cargo/bin/cargo rust-rio-0.8.3/debian/dh-cargo/bin/cargo --- rust-rio-0.8.3/debian/dh-cargo/bin/cargo 2023-01-25 15:45:55.000000000 +0000 +++ rust-rio-0.8.3/debian/dh-cargo/bin/cargo 2023-08-19 20:37:44.000000000 +0000 @@ -222,11 +222,14 @@ newargs.append("--release") elif noopt and subcmd == "install": newargs.append("--debug") - elif (subcmd is None) and (a in ("check", "clean", "run")): + elif (subcmd is None) and (a in ("check", "run")): subcmd = a newargs.extend([a] + verbose) if not noopt: newargs.append("--release") + elif (subcmd is None) and (a == "clean"): + subcmd = a + newargs.extend([a] + verbose) else: newargs.append(a) diff -Nru rust-rio-0.8.3/debian/dh-cargo/lib/Debian/Debhelper/Buildsystem/cargo.pm rust-rio-0.8.3/debian/dh-cargo/lib/Debian/Debhelper/Buildsystem/cargo.pm --- rust-rio-0.8.3/debian/dh-cargo/lib/Debian/Debhelper/Buildsystem/cargo.pm 2023-01-25 15:45:55.000000000 +0000 +++ rust-rio-0.8.3/debian/dh-cargo/lib/Debian/Debhelper/Buildsystem/cargo.pm 2023-08-19 20:37:44.000000000 +0000 @@ -50,24 +50,35 @@ my $json = JSON::PP->new; my $manifest = $json->decode(); my %crates; - for ( @{ $manifest->{packages} } ) { - my $pkg_longstem = "$_->{name}-$_->{version}" =~ s/_/-/gr; + for my $key ( @{ $manifest->{packages} } ) { my %object = ( - cratespec => "$_->{name}_$_->{version}", - systempath => CARGO_SYSTEM_REGISTRY . "/$_->{name}-$_->{version}", - sourcepath => File::Spec->abs2rel( $_->{manifest_path} =~ s{/Cargo\.toml$}{}r, $root ), + cratename => join( '-', $key->{name}, $key->{version} ), + cratespec => join( '_', $key->{name}, $key->{version} ), + pkgid => join( '@', $key->{name}, $key->{version} ), ); + $object{sourcepath} = File::Spec->abs2rel( + $key->{manifest_path} =~ s{/Cargo\.toml$}{}r, + $root, + ); + $object{packagepath} = 'target/package/' . $object{cratename} . '.crate'; + $object{systempath} = CARGO_SYSTEM_REGISTRY . '/' . $object{cratename}; # resolve crate from dh-cargo cratespec $crates{ $object{cratespec} } = \%object; # resolve topmost declared crate from package stems + my $pkg_longstem = $object{cratename} =~ tr/_/-/r; $crates{$_} //= \%object for ( $pkg_longstem =~ /^(((([^+]+?)-[^+.-]+)?\.[^+.]+)?\.[^+]+)?$/ ); # resolve topmost declared crate from crate name $crates{_default} //= \%object - if $_->{name} eq $default; + if $key->{name} eq $default; + } + # resolve amount of local dependencies + # TODO: use Graph to compute an always reliable order instead + for my $key ( @{ $manifest->{packages} } ) { + $crates{ $key->{name} =~ tr/_/-/r }{depcount} = grep { exists $crates{ $_->{name} =~ tr/_/-/r } } @{ $key->{dependencies} }; } return \%crates; } @@ -227,14 +238,6 @@ $this->SUPER::pre_building_step($step); } -sub get_sources { - my ( $this, $sourcedir ) = @_; - opendir(my $dirhandle, $sourcedir); - my @sources = grep { !/^(\.(\.|git.*|pc)?|debian|Cargo\.lock|COPYING.*|LICENSE.*)$/ } readdir($dirhandle); - closedir($dirhandle); - @sources -} - sub configure { my $this=shift; # use Cargo.lock if it exists, or debian/Cargo.lock if that also exists @@ -251,8 +254,11 @@ "$_->{cratespec}=$_->{systempath}", )} map { @{ $this->{libpkg}{$_}{crates} } } sort keys %{ $this->{libpkg} }; push @rustflags, "--remap-path-prefix", "$registry_path=" . CARGO_SYSTEM_REGISTRY; + my $rustflags = shell_quote(@rustflags); + $rustflags .= " $ENV{RUSTFLAGS}" + if $ENV{RUSTFLAGS}; $this->doit_in_sourcedir( - "env", 'RUSTFLAGS=' . shell_quote(@rustflags), + "env", "RUSTFLAGS=$rustflags", $this->{cargo_command}, "prepare-debian", $registry_path, "--link-from-system"); @@ -281,30 +287,34 @@ # this additional information to debcargo. $this->doit_in_sourcedir($this->{cargo_command}, "test", @_); # test generating Built-Using fields - doit("env", "CARGO_CHANNEL=debug", "/usr/share/cargo/bin/dh-cargo-built-using"); + my $channel = get_buildoption("noopt") ? 'debug' : 'release'; + doit("env", "CARGO_CHANNEL=$channel", "/usr/share/cargo/bin/dh-cargo-built-using"); } sub install { my $this=shift; my $destdir=shift; - foreach my $crate ( map { @{ $_->{crates} } } sort values %{ $this->{libpkg} } ) { + foreach my $crate ( sort { $a->{depcount} cmp $b->{depcount} } map { @{ $_->{crates} } } sort values %{ $this->{libpkg} } ) { my $target = tmpdir( $crate->{libpkg}{name} ) . $crate->{systempath}; - my @sources = $this->get_sources( $crate->{sourcepath} ); install_dir($target); + $this->doit_in_sourcedir( + qw(cargo package --offline --allow-dirty --no-verify --package), $crate->{pkgid} ); $this->doit_in_somedir( - $crate->{sourcepath}, - "env", "DEB_CARGO_CRATE=$crate->{cratespec}", - "cp", "--parents", - "-at", $this->_rel2rel($target, $crate->{sourcepath}), - @sources); - doit("rm", "-rf", "$target/target"); + "$target/..", + 'tar', map( { ( '--exclude', $_ ) } qw(debian/* debian Cargo.toml.orig Cargo.lock COPYING* LICENSE*) ), '-xvf', + $this->_rel2rel( $crate->{packagepath}, "$target/.." ), + $crate->{cratename} ); complex_doit( qw(perl -MDigest::SHA=sha256_hex -0777 -nE 'say sprintf), 'q<{"package":"%s","files":{}}>,', "sha256_hex($_)'", - "<", "$crate->{sourcepath}/Cargo.toml", + "<", "$target/Cargo.toml", ">", "$target/.cargo-checksum.json"); # prevent an ftpmaster auto-reject regarding files with old dates. doit("touch", "-d@" . $ENV{SOURCE_DATE_EPOCH}, "$target/Cargo.toml"); + # add crate to local registry, needed by some multi-crate workspaces + # maybe related: + complex_doit( + qw(ln --symbolic --relative --target-directory=debian/cargo_registry), $target ); } foreach my $featurepkg (@{$this->{featurepkg}}) { my $target = tmpdir( $featurepkg->{name} ) . "/usr/share/doc"; diff -Nru rust-rio-0.8.3/debian/dh-cargo/README.md rust-rio-0.8.3/debian/dh-cargo/README.md --- rust-rio-0.8.3/debian/dh-cargo/README.md 2023-01-25 15:45:55.000000000 +0000 +++ rust-rio-0.8.3/debian/dh-cargo/README.md 2023-08-19 20:37:44.000000000 +0000 @@ -15,13 +15,10 @@ * generate cargo-checksum during install * pass cargo --remap-path-prefix option sets in RUSTFLAGS * allow overriding CARGO_HOME - * use regex (not strings) for matching files to omit from install - * omit installing crate metadata in binary library packages: - * omit any .git* files or directories - * omit license files - * omit debian/patches - (see bug#880689) - * use debian/Cargo.lock or Cargo.lock (in that order), + * install crate contents using "cargo package" + * omit license files, Cargo.toml.orig, and debian/patches + (see bug#880689) + * use debian/Cargo.lock or Cargo.lock (in that order) during build, if Cargo.lock exists * use crates below debian/vendorlibs when available * use dh_auto_build @@ -65,4 +62,4 @@ ``` - -- Jonas Smedegaard Wed, 25 Jan 2023 16:45:34 +0100 + -- Jonas Smedegaard Sat, 19 Aug 2023 22:37:28 +0200 diff -Nru rust-rio-0.8.3/debian/patches/2001_quick-xml.patch rust-rio-0.8.3/debian/patches/2001_quick-xml.patch --- rust-rio-0.8.3/debian/patches/2001_quick-xml.patch 2023-06-20 18:34:59.000000000 +0000 +++ rust-rio-0.8.3/debian/patches/2001_quick-xml.patch 2023-08-13 15:50:00.000000000 +0000 @@ -1,7 +1,7 @@ -Description: downgrade dependency on crate quick-xml - Needed to match Debian-packaged quick-xml v0.27.1. +Description: relax dependency to match older system crate quick-xml 0.27.1 Author: Jonas Smedegaard -Last-Update: 2023-06-20 +Forwarded: not-needed +Last-Update: 2023-08-13 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ --- a/xml/Cargo.toml diff -Nru rust-rio-0.8.3/debian/patches/2002_testsuite.patch rust-rio-0.8.3/debian/patches/2002_testsuite.patch --- rust-rio-0.8.3/debian/patches/2002_testsuite.patch 2023-05-26 19:32:10.000000000 +0000 +++ rust-rio-0.8.3/debian/patches/2002_testsuite.patch 2023-08-13 15:50:39.000000000 +0000 @@ -1,7 +1,8 @@ Description: avoid crate rio_testsuite Requires non-Debian-packaged crate permutohedron. Author: Jonas Smedegaard -Last-Update: 2023-05-26 +Forwarded: not-needed +Last-Update: 2023-08-13 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ --- a/Cargo.toml diff -Nru rust-rio-0.8.3/debian/rules rust-rio-0.8.3/debian/rules --- rust-rio-0.8.3/debian/rules 2023-05-26 20:26:49.000000000 +0000 +++ rust-rio-0.8.3/debian/rules 2023-08-19 21:57:01.000000000 +0000 @@ -7,9 +7,3 @@ %: dh $@ --buildsystem cargo - -# TODO: teach dh-cargo to mangle Cargo.toml to strip same-workspace path -execute_after_dh_auto_install: - perl -p -i \ - -e 's!\Q, path="../api"!!;' \ - debian/librust-rio-*-dev/usr/share/cargo/registry/rio_*/Cargo.toml