diff -Nru rust-socks-0.3.4/debian/changelog rust-socks-0.3.4/debian/changelog --- rust-socks-0.3.4/debian/changelog 2023-02-03 09:44:02.000000000 +0000 +++ rust-socks-0.3.4/debian/changelog 2023-08-20 08:55:19.000000000 +0000 @@ -1,3 +1,10 @@ +rust-socks (0.3.4-4) unstable; urgency=medium + + * update DEP-3 patch headers + * update dh-cargo fork + + -- Jonas Smedegaard Sun, 20 Aug 2023 10:55:19 +0200 + rust-socks (0.3.4-3) unstable; urgency=medium * tighten autopkgtests diff -Nru rust-socks-0.3.4/debian/dh-cargo/bin/cargo rust-socks-0.3.4/debian/dh-cargo/bin/cargo --- rust-socks-0.3.4/debian/dh-cargo/bin/cargo 2023-01-25 15:45:55.000000000 +0000 +++ rust-socks-0.3.4/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-socks-0.3.4/debian/dh-cargo/lib/Debian/Debhelper/Buildsystem/cargo.pm rust-socks-0.3.4/debian/dh-cargo/lib/Debian/Debhelper/Buildsystem/cargo.pm --- rust-socks-0.3.4/debian/dh-cargo/lib/Debian/Debhelper/Buildsystem/cargo.pm 2023-01-25 15:45:55.000000000 +0000 +++ rust-socks-0.3.4/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-socks-0.3.4/debian/dh-cargo/README.md rust-socks-0.3.4/debian/dh-cargo/README.md --- rust-socks-0.3.4/debian/dh-cargo/README.md 2023-01-25 15:45:55.000000000 +0000 +++ rust-socks-0.3.4/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-socks-0.3.4/debian/patches/2001_no_windows.patch rust-socks-0.3.4/debian/patches/2001_no_windows.patch --- rust-socks-0.3.4/debian/patches/2001_no_windows.patch 2022-10-22 16:55:06.000000000 +0000 +++ rust-socks-0.3.4/debian/patches/2001_no_windows.patch 2023-08-14 10:18:17.000000000 +0000 @@ -1,6 +1,7 @@ Description: avoid windows-only crates Author: Jonas Smedegaard -Last-Update: 2022-10-22 +Forwarded: not-needed +Last-Update: 2023-08-14 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ --- a/Cargo.toml