diff --git a/Sequence/cargo.pm b/Sequence/cargo.pm new file mode 100644 index 0000000..22b975c --- /dev/null +++ b/Sequence/cargo.pm @@ -0,0 +1,11 @@ +#!/usr/bin/perl +# debhelper sequence file for packaging Rust crates with cargo + +use warnings; +use strict; +use Debian::Debhelper::Dh_Lib; + +# See https://bugs.debian.org/1023413 +add_command_options('dh_clean', '-XCargo.toml.orig'); + +1; diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..e094b0d --- /dev/null +++ b/debian/changelog @@ -0,0 +1,276 @@ +dh-cargo (31ubuntu1) noble; urgency=medium + + * Merge with Debian unstable. Remaining changes: + - Add support for using vendored sources, including checking the validity of + XS-Vendored-Sources-Rust field via the new dh-cargo-vendored-sources + script, and shipping the Cargo.lock file if available. + * Split out the dh-cargo-vendored-sources into its own package to be able + to use it with non-default rustc (e.g. rustc-1.74) + + -- Simon Chopin Thu, 08 Feb 2024 16:27:41 +0100 + +dh-cargo (31) unstable; urgency=medium + + * Team upload. + + [ Alexander Kjäll ] + * Generate Static-Built-Using substvar. (Closes: #1053096) + + -- James McCoy Fri, 22 Dec 2023 21:09:29 -0500 + +dh-cargo (30ubuntu1) mantic; urgency=medium + + * Merge with Debian unstable (LP: #2008689). Remaining changes: + - Add support for using vendored sources, including checking the validity of + XS-Vendored-Sources-Rust field via the new dh-cargo-vendored-sources + script, and shipping the Cargo.lock file if available. + + -- Simon Chopin Tue, 02 May 2023 09:47:04 +0200 + +dh-cargo (30) unstable; urgency=medium + + * wrap-and-sort -ast + * Add Provides: dh-sequence-cargo + * Avoid stripping Cargo.toml.orig (Closes: #1023413) + * Declare Rules-Requires-Root: no + * Clarify package description, clearing using-first-person-in-description + * d/copyright: correct Source URL to point explicitly to salsa + * d/copyright: update dates, include other contributors + * Add myself to uploaders + + -- Daniel Kahn Gillmor Sat, 26 Nov 2022 09:45:44 +0700 + +dh-cargo (29) unstable; urgency=medium + + [ Rob Shearman ] + * dh-cargo-built-using: avoid varying package order if LC_ALL is set + + [ Sylvestre Ledru ] + * Update standards version to 4.6.1, no changes needed. + + -- Sylvestre Ledru Thu, 24 Nov 2022 14:12:27 +0100 + +dh-cargo (28ubuntu1) kinetic; urgency=medium + + * Add support for using vendored sources, including checking the validity of + XS-Vendored-Sources-Rust field via the new dh-cargo-vendored-sources + script, and shipping the Cargo.lock file if available. (LP: #1987515) + + -- Simon Chopin Thu, 25 Aug 2022 16:26:43 +0200 + +dh-cargo (28) unstable; urgency=medium + + * Support packages with ruzt-* prefix to help with debcargo testing. + + -- Ximin Luo Sun, 07 Nov 2021 12:59:57 +0000 + +dh-cargo (27) unstable; urgency=medium + + * Minor tweak to help with debcargo testing; no behavioural changes. + + -- Ximin Luo Fri, 05 Nov 2021 20:45:58 +0000 + +dh-cargo (26) unstable; urgency=medium + + * Move the touch step at the pre_building step to make sure it is also updating the changelog + (Closes: #993216) + + [ Debian Janitor ] + * Bump debhelper dependency to >= 10, since that's what is used in + debian/compat. + * Bump debhelper from old 10 to 13. + * Set debhelper-compat version in Build-Depends. + + -- Sylvestre Ledru Sun, 29 Aug 2021 11:07:21 +0200 + +dh-cargo (25) unstable; urgency=medium + + * Team upload + * Touch all the old files to address an auto reject from ftpmasters + * Replace doit() by perl function usage (Thanks to Niels Thykier) + * Use (correct) debhelper features for locating directories + (Thanks to Niels Thykier) + * Update of the Standards-Version to 4.5.1 + + [ Debian Janitor ] + * Remove constraints unnecessary since stretch: + + Build-Depends: Drop versioned constraint on debhelper. + + dh-cargo: Drop versioned constraint on debhelper in Depends. + + -- Sylvestre Ledru Sun, 22 Aug 2021 21:46:33 +0200 + +dh-cargo (24) unstable; urgency=medium + + * Install pre-release versions in the right place so autopkgtest finds them. + * Add some brief documentation for cargo.pm + + -- Ximin Luo Mon, 20 Apr 2020 21:30:03 +0100 + +dh-cargo (23) unstable; urgency=medium + + * cargo-auto-test: ignore some false positive test failures + * Drop support for dh_auto_test --destdir, it doesn't meet our requirements. + Instead, offer DESTDIR as an alternative. + + -- Ximin Luo Tue, 07 Jan 2020 21:33:41 +0000 + +dh-cargo (22) unstable; urgency=medium + + * Drop DEB_CARGO_PACKAGE in favour of DESTDIR. (Closes: #946616) + + -- Ximin Luo Mon, 06 Jan 2020 21:37:09 +0000 + +dh-cargo (21) unstable; urgency=medium + + * Use source versions (without rebuild +bX suffixes) in Built-Using. + (Closes: #939016) + + -- Ximin Luo Thu, 05 Sep 2019 00:43:33 -0700 + +dh-cargo (20) unstable; urgency=medium + + * Remove Cargo.lock since this prevents us from upgrading stuff. + * Add the version of rustc to *Built-Using d/control fields. + + -- Ximin Luo Thu, 15 Aug 2019 18:17:00 -0700 + +dh-cargo (19) unstable; urgency=medium + + * Team upload + + [ Gianfranco Costamagna ] + * Apply fix from Ximin Luo to use SOURCE_DATE_EPOCH for the touch command, to + avoid breaking reproducible builds + + [ Dimitri John Ledkov ] + * Touch .cargo_vcs_info.json to update timestamp, as otherwise the file + has unix creation time of 0 which is rejected by the archive in the + .deb.s (Closes: #932172) + + -- Sylvestre Ledru Tue, 16 Jul 2019 10:39:05 +0200 + +dh-cargo (18) unstable; urgency=medium + + * Add cargo-auto-test to prepare for running autopkgtests. + + -- Ximin Luo Sun, 17 Mar 2019 21:09:30 -0700 + +dh-cargo (17) unstable; urgency=medium + + * Use --link-from-system from the newer debian-cargo-wrapper. + + -- Ximin Luo Thu, 24 Jan 2019 01:28:43 -0800 + +dh-cargo (16) unstable; urgency=medium + + * Make detection of rust_libs in dh-cargo-built-using work again. + + -- Ximin Luo Mon, 21 Jan 2019 00:05:53 -0800 + +dh-cargo (15) unstable; urgency=medium + + * Use source package names in *Built-Using. + + -- Ximin Luo Sun, 20 Jan 2019 17:40:12 -0800 + +dh-cargo (14) unstable; urgency=medium + + * Use absolute path when dpkg-searching for libs. + + -- Ximin Luo Tue, 18 Dec 2018 17:57:24 -0800 + +dh-cargo (13) unstable; urgency=medium + + * Make debian/cargo_registry behaviour more robust. + * Make dh-cargo-built-using behaviour more robust. + + -- Ximin Luo Sun, 02 Dec 2018 09:29:06 -0800 + +dh-cargo (12) unstable; urgency=medium + + * Fix typo that broke installation of binary crates. + + -- Ximin Luo Thu, 29 Nov 2018 21:58:26 -0800 + +dh-cargo (11) unstable; urgency=medium + + * Reimplement in terms of /usr/share/cargo/bin/cargo wrapper script. + * dh-cargo-built-using: fix bug with crates that build >1 static lib. + + -- Ximin Luo Thu, 29 Nov 2018 19:04:39 -0800 + +dh-cargo (10) unstable; urgency=medium + + * Fix usage of "sub install", it takes an extra destdir param. + + -- Ximin Luo Wed, 12 Sep 2018 22:47:25 -0700 + +dh-cargo (9) unstable; urgency=medium + + * Set remap-path-prefix for reproducible builds. + * Support adding extra flags to dh_auto_test / dh_auto_install. + + -- Ximin Luo Wed, 12 Sep 2018 22:37:52 -0700 + +dh-cargo (8) unstable; urgency=medium + + * Generate ${cargo:Built-Using} and ${cargo:X-Cargo-Built-Using} substvars. + + -- Ximin Luo Tue, 14 Aug 2018 02:17:08 -0700 + +dh-cargo (7) unstable; urgency=medium + + * Be more verbose, as recommended by Policy. + * Update to latest Standards-Version. + * Set CARGO_TARGET_DIR so build products are saved. + * If there was a custom build output, symlink it to cargo_out_dir. + + -- Ximin Luo Sat, 04 Aug 2018 12:59:35 -0700 + +dh-cargo (6) unstable; urgency=medium + + * Don't add .pc directories to binary package, but do add debian/patches. + (Closes: #880689) + + -- Ximin Luo Sat, 30 Jun 2018 17:16:36 -0700 + +dh-cargo (5) unstable; urgency=medium + + * Pass `--cap-lints warn` in rustflags to avoid builds breaking when rustc + adds new warnings. + * Work around a stupid ftpmaster rule about files with old dates. + + -- Ximin Luo Mon, 18 Jun 2018 00:58:48 -0700 + +dh-cargo (4) unstable; urgency=medium + + * Pass cargo-version not Debian-version to `cargo install`. + * Pass debuginfo=2 and LDFLAGS when building. + * Add other flags to support cross-compiling. + + -- Ximin Luo Fri, 08 Jun 2018 00:18:42 -0700 + +dh-cargo (3) unstable; urgency=medium + + * Update to latest Standards-Version; no changes required. + * Run `cargo build` during dh_auto_test to check that each library package + actually builds, e.g. to ensure that any non-rust system dependencies were + correctly expressed. + + -- Ximin Luo Mon, 26 Mar 2018 23:20:40 +0200 + +dh-cargo (2) unstable; urgency=medium + + [ Josh Triplett ] + * Update package description with additional documentation. + + [ Ximin Luo ] + * Upload to unstable. + + -- Ximin Luo Sat, 10 Jun 2017 22:33:08 +0200 + +dh-cargo (1) experimental; urgency=medium + + * Initial Release. + + -- Josh Triplett Mon, 21 Nov 2016 06:24:51 -0800 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..a322aae --- /dev/null +++ b/debian/control @@ -0,0 +1,62 @@ +Source: dh-cargo +Section: devel +Priority: optional +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Rust Maintainers +Uploaders: + Josh Triplett , + Ximin Luo , + Daniel Kahn Gillmor , +Build-Depends: + debhelper-compat (= 13), +Standards-Version: 4.6.1 +Vcs-Git: https://salsa.debian.org/rust-team/dh-cargo.git +Vcs-Browser: https://salsa.debian.org/rust-team/dh-cargo +Rules-Requires-Root: no + +Package: dh-cargo +Architecture: all +Multi-Arch: foreign +Provides: + dh-sequence-cargo, +Depends: + cargo (>= 0.40.0-3~~), + debhelper, + dh-cargo-tools (= ${source:Version}), + python3, + ${misc:Depends}, + ${perl:Depends}, +Description: debhelper buildsystem for Rust crates using Cargo + dh-cargo provides a debhelper buildsystem to build Rust crates using Cargo. + . + This builds Debian rust crates to be installed into a system-level crate + registry in /usr/share/cargo/registry containing crates that can be used and + Build-Depended upon by other Debian packages. + . + Debian packages generated by debcargo use this buildsystem; packagers are not + expected to use this directly. If you have a multi-language program such as + firefox or librsvg that includes private Rust crates not exposed to others, + you should instead use Debian's cargo wrapper /usr/share/cargo/bin/cargo in + the cargo package, and Build-Depends on that instead of this package. + +Package: dh-cargo-tools +Architecture: all +Multi-Arch: foreign +Depends: + ${misc:Depends}, + ${perl:Depends}, +Description: debhelper buildsystem for Rust crates using Cargo - tools + dh-cargo provides a debhelper buildsystem to build Rust crates using Cargo. + . + This builds Debian rust crates to be installed into a system-level crate + registry in /usr/share/cargo/registry containing crates that can be used and + Build-Depended upon by other Debian packages. + . + Debian packages generated by debcargo use this buildsystem; packagers are not + expected to use this directly. If you have a multi-language program such as + firefox or librsvg that includes private Rust crates not exposed to others, + you should instead use Debian's cargo wrapper /usr/share/cargo/bin/cargo in + the cargo package, and Build-Depends on that instead of this package. + . + This package contains various scripts that can be used standalone outside of the + standard dh-cargo context. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..6120bbf --- /dev/null +++ b/debian/copyright @@ -0,0 +1,31 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: dh-cargo +Upstream-Contact: Josh Triplett +Source: https://salsa.debian.org/rust-team/dh-cargo + +Files: * +Copyright: + 2016 Josh Triplett + 2018-2021 Ximin Luo + 2019-2021 Sylvestre Ledru + 2022 Daniel Kahn Gillmor +License: MIT + +License: MIT + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. diff --git a/debian/dh-cargo-tools.install b/debian/dh-cargo-tools.install new file mode 100644 index 0000000..360670c --- /dev/null +++ b/debian/dh-cargo-tools.install @@ -0,0 +1 @@ +dh-cargo-vendored-sources /usr/share/cargo/bin diff --git a/debian/dh-cargo.install b/debian/dh-cargo.install new file mode 100644 index 0000000..3a8c779 --- /dev/null +++ b/debian/dh-cargo.install @@ -0,0 +1,4 @@ +Sequence/cargo.pm /usr/share/perl5/Debian/Debhelper/Sequence/ +cargo-auto-test /usr/share/cargo/bin +cargo.pm /usr/share/perl5/Debian/Debhelper/Buildsystem/ +dh-cargo-built-using /usr/share/cargo/bin diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..cbe925d --- /dev/null +++ b/debian/rules @@ -0,0 +1,3 @@ +#!/usr/bin/make -f +%: + dh $@ diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..cf809e7 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,3 @@ +Tests: vendor-tests.sh +Depends: @, build-essential +Restrictions: allow-stderr diff --git a/debian/tests/dh-cargo-vendor-test_0.0.1-1.debian.tar.xz b/debian/tests/dh-cargo-vendor-test_0.0.1-1.debian.tar.xz new file mode 100644 index 0000000..f1427e7 Binary files /dev/null and b/debian/tests/dh-cargo-vendor-test_0.0.1-1.debian.tar.xz differ diff --git a/debian/tests/dh-cargo-vendor-test_0.0.1-1.dsc b/debian/tests/dh-cargo-vendor-test_0.0.1-1.dsc new file mode 100644 index 0000000..235c634 --- /dev/null +++ b/debian/tests/dh-cargo-vendor-test_0.0.1-1.dsc @@ -0,0 +1,20 @@ +Format: 3.0 (quilt) +Source: dh-cargo-vendor-test +Binary: dh-cargo-vendor-test +Architecture: any +Version: 0.0.1-1 +Maintainer: Simon Chopin +Standards-Version: 4.5.1 +Build-Depends: debhelper (>= 12), dh-cargo (>= 25), cargo:native, rustc:native +Package-List: + dh-cargo-vendor-test deb utils optional arch=any +Checksums-Sha1: + 53b2aea773e41de00efe54b6b913bf47b57912c5 1116 dh-cargo-vendor-test_0.0.1.orig.tar.xz + 5f9ca9c4647424f4aed56257cefad9418efc579c 940 dh-cargo-vendor-test_0.0.1-1.debian.tar.xz +Checksums-Sha256: + b24897219884dd105d0087f9b77c827106dc25cba832a40121cb0902bbb0a90d 1116 dh-cargo-vendor-test_0.0.1.orig.tar.xz + 2346e50307d217446a78701c2821bf9a98785788186ee2ec124b3541f1849b5e 940 dh-cargo-vendor-test_0.0.1-1.debian.tar.xz +Files: + b66e07d61eb85e555ffed0da6be153d9 1116 dh-cargo-vendor-test_0.0.1.orig.tar.xz + 83612654e319df4f6469a5a446abfa76 940 dh-cargo-vendor-test_0.0.1-1.debian.tar.xz +Vendored-Sources-Rust: boguscrate2@1.0.3, boguscrate@42.0.3 diff --git a/debian/tests/dh-cargo-vendor-test_0.0.1.orig.tar.xz b/debian/tests/dh-cargo-vendor-test_0.0.1.orig.tar.xz new file mode 100644 index 0000000..be65f3b Binary files /dev/null and b/debian/tests/dh-cargo-vendor-test_0.0.1.orig.tar.xz differ diff --git a/debian/tests/vendor-tests.sh b/debian/tests/vendor-tests.sh new file mode 100755 index 0000000..a0b7921 --- /dev/null +++ b/debian/tests/vendor-tests.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +set -e + +cp debian/tests/dh-cargo-vendor-test* $AUTOPKGTEST_TMP +cd $AUTOPKGTEST_TMP +dpkg-source --no-check -x dh-cargo-vendor-test_0.0.1-1.dsc + +cd dh-cargo-vendor-test-0.0.1 +cp debian/control.valid-field debian/control + +dpkg-buildpackage + +cp debian/control.no-field debian/control +if dpkg-buildpackage 2> ../error_logs; then + echo "This test should have failed!" + exit 1 +fi +grep -q "XS-Vendored-Sources-Rust" ../error_logs + +cp debian/control.bad-version debian/control +if dpkg-buildpackage 2> ../error_logs; then + echo "This test should have failed!" + exit 1 +fi +grep -q "XS-Vendored-Sources-Rust" ../error_logs diff --git a/dh-cargo-built-using b/dh-cargo-built-using index eef2061..33a641f 100755 --- a/dh-cargo-built-using +++ b/dh-cargo-built-using @@ -163,6 +163,7 @@ output() { done echo "cargo:Built-Using=${built_using%, }" >> "debian/$binpkg.substvars" echo "cargo:X-Cargo-Built-Using=${built_using_x%, }" >> "debian/$binpkg.substvars" + echo "cargo:Static-Built-Using=${built_using_x%, }" >> "debian/$binpkg.substvars" fi } @@ -170,4 +171,4 @@ native_libs="$(native_libs)" # capture output outside of pipe so set -e works { rust_libs test -z "$native_libs" || echo "$native_libs" -} | LC_COLLATE=C.utf-8 sort -u | output "$@" +} | LC_ALL=C.utf-8 sort -u | output "$@"