[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1052027: bullseye-pu: package cargo-mozilla/0.66.0+ds1-1~deb11u1



Package: release.debian.org
Severity: normal
Tags: bullseye
User: release.debian.org@packages.debian.org
Usertags: pu
X-Debbugs-Cc: pkg-rust-maintainers@alioth-lists.debian.net

Hi,

Following up on #1051051, this updates cargo-mozilla for the upcoming
Firefox ESR 115. Just like for rustc-mozilla, the risk here is small
as this package is only used to build firefox-esr and thunderbird.

I have used the resulting package to successfully build and test
firefox-esr 115.0.2 on bullseye.

Attached is the diff from 0.66 itself so that the changes in the
backport are easier to review. A diff from 0.47 is not attached.

Cheers,
Emilio
diff -ruNp cargo-0.66.0+ds1/debian/cargo.bash-completion cargo-mozilla-0.66.0+ds1/debian/cargo.bash-completion
--- cargo-0.66.0+ds1/debian/cargo.bash-completion	2023-01-11 18:55:09.000000000 +0100
+++ cargo-mozilla-0.66.0+ds1/debian/cargo.bash-completion	1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-src/etc/cargo.bashcomp.sh cargo
diff -ruNp cargo-0.66.0+ds1/debian/cargo.dirs cargo-mozilla-0.66.0+ds1/debian/cargo.dirs
--- cargo-0.66.0+ds1/debian/cargo.dirs	2023-01-11 18:55:09.000000000 +0100
+++ cargo-mozilla-0.66.0+ds1/debian/cargo.dirs	1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-usr/bin
diff -ruNp cargo-0.66.0+ds1/debian/cargo-doc.docs cargo-mozilla-0.66.0+ds1/debian/cargo-doc.docs
--- cargo-0.66.0+ds1/debian/cargo-doc.docs	2023-01-11 18:55:09.000000000 +0100
+++ cargo-mozilla-0.66.0+ds1/debian/cargo-doc.docs	1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-target/doc
diff -ruNp cargo-0.66.0+ds1/debian/cargo.manpages cargo-mozilla-0.66.0+ds1/debian/cargo.manpages
--- cargo-0.66.0+ds1/debian/cargo.manpages	2023-01-11 18:55:09.000000000 +0100
+++ cargo-mozilla-0.66.0+ds1/debian/cargo.manpages	1970-01-01 01:00:00.000000000 +0100
@@ -1,2 +0,0 @@
-src/etc/man/cargo-*.1
-src/etc/man/cargo.1
diff -ruNp cargo-0.66.0+ds1/debian/cargo-mozilla.bash-completion cargo-mozilla-0.66.0+ds1/debian/cargo-mozilla.bash-completion
--- cargo-0.66.0+ds1/debian/cargo-mozilla.bash-completion	1970-01-01 01:00:00.000000000 +0100
+++ cargo-mozilla-0.66.0+ds1/debian/cargo-mozilla.bash-completion	2023-01-11 18:55:09.000000000 +0100
@@ -0,0 +1 @@
+src/etc/cargo.bashcomp.sh cargo
diff -ruNp cargo-0.66.0+ds1/debian/cargo-mozilla.dirs cargo-mozilla-0.66.0+ds1/debian/cargo-mozilla.dirs
--- cargo-0.66.0+ds1/debian/cargo-mozilla.dirs	1970-01-01 01:00:00.000000000 +0100
+++ cargo-mozilla-0.66.0+ds1/debian/cargo-mozilla.dirs	2023-01-11 18:55:09.000000000 +0100
@@ -0,0 +1 @@
+usr/bin
diff -ruNp cargo-0.66.0+ds1/debian/cargo-mozilla-doc.docs cargo-mozilla-0.66.0+ds1/debian/cargo-mozilla-doc.docs
--- cargo-0.66.0+ds1/debian/cargo-mozilla-doc.docs	1970-01-01 01:00:00.000000000 +0100
+++ cargo-mozilla-0.66.0+ds1/debian/cargo-mozilla-doc.docs	2023-01-11 18:55:09.000000000 +0100
@@ -0,0 +1 @@
+target/doc
diff -ruNp cargo-0.66.0+ds1/debian/cargo-mozilla.manpages cargo-mozilla-0.66.0+ds1/debian/cargo-mozilla.manpages
--- cargo-0.66.0+ds1/debian/cargo-mozilla.manpages	1970-01-01 01:00:00.000000000 +0100
+++ cargo-mozilla-0.66.0+ds1/debian/cargo-mozilla.manpages	2023-01-11 18:55:09.000000000 +0100
@@ -0,0 +1,2 @@
+src/etc/man/cargo-*.1
+src/etc/man/cargo.1
diff -ruNp cargo-0.66.0+ds1/debian/changelog cargo-mozilla-0.66.0+ds1/debian/changelog
--- cargo-0.66.0+ds1/debian/changelog	2023-01-11 18:55:09.000000000 +0100
+++ cargo-mozilla-0.66.0+ds1/debian/changelog	2023-07-30 10:37:52.000000000 +0200
@@ -1,3 +1,15 @@
+cargo-mozilla (0.66.0+ds1-1~deb11u1) bullseye; urgency=medium
+
+  * Non-maintainer upload.
+  * Backport to bullseye as cargo-mozilla.
+  * Build-dep on rustc-mozilla.
+  * Don't build the doc package.
+  * Vendor libgit2 1.5.1, the system one is too old.
+  * Build-dep on libpcre3-dev, for libgit2.
+  * Don't use namespaced features.
+
+ -- Emilio Pozuelo Monfort <pochu@debian.org>  Sun, 30 Jul 2023 10:37:52 +0200
+
 cargo (0.66.0+ds1-1) unstable; urgency=medium
 
   [ Fabian Grünbichler ]
diff -ruNp cargo-0.66.0+ds1/debian/control cargo-mozilla-0.66.0+ds1/debian/control
--- cargo-0.66.0+ds1/debian/control	2023-01-11 18:55:09.000000000 +0100
+++ cargo-mozilla-0.66.0+ds1/debian/control	2023-07-30 10:37:52.000000000 +0200
@@ -1,4 +1,4 @@
-Source: cargo
+Source: cargo-mozilla
 Section: devel
 Maintainer: Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
 Uploaders: Luca Bruno <lucab@debian.org>,
@@ -10,17 +10,18 @@ Priority: optional
 Build-Depends:
  debhelper (>= 12~),
  dpkg-dev (>= 1.17.14),
- cargo:native    (>= 0.56.0),
- rustc:native    (>= 1.63),
- libstd-rust-dev (>= 1.63),
+ cargo-mozilla:native    (>= 0.56.0),
+ rustc-mozilla:native    (>= 1.63),
+ libstd-rust-mozilla-dev (>= 1.63),
  pkg-config,
  bash-completion,
  python3:native,
  libcurl4-gnutls-dev | libcurl4-openssl-dev,
  libssh2-1-dev,
- libgit2-dev (>= 1.5.0),
- libgit2-dev (<< 1.6~~),
+# libgit2-dev (>= 1.5.0),
+# libgit2-dev (<< 1.6~~),
  libhttp-parser-dev,
+ libpcre3-dev,
  libssl-dev,
  zlib1g-dev,
  zlib1g-dev:native,
@@ -30,7 +31,7 @@ Standards-Version: 4.2.1
 Vcs-Git: https://salsa.debian.org/rust-team/cargo.git
 Vcs-Browser: https://salsa.debian.org/rust-team/cargo
 
-Package: cargo
+Package: cargo-mozilla
 Architecture: any
 Multi-Arch: allowed
 Depends: ${shlibs:Depends}, ${misc:Depends},
@@ -38,6 +39,9 @@ Depends: ${shlibs:Depends}, ${misc:Depen
          binutils,
          gcc | clang | c-compiler
 Suggests: cargo-doc, python3
+Conflicts: cargo
+Replaces: cargo
+Provides: cargo (= ${binary:Version})
 Description: Rust package manager
  Cargo is a tool that allows Rust projects to declare their various
  dependencies, and ensure that you'll always get a repeatable build.
@@ -52,25 +56,25 @@ Description: Rust package manager
  Cargo downloads your Rust project’s dependencies and compiles your
  project.
 
-Package: cargo-doc
-Section: doc
-Architecture: all
-Build-Profiles: <!nodoc>
-Depends: ${misc:Depends}
-Description: Rust package manager, documentation
- Cargo is a tool that allows Rust projects to declare their various
- dependencies, and ensure that you'll always get a repeatable build.
- .
- To accomplish this goal, Cargo does four things:
-  * Introduces two metadata files with various bits of project information.
-  * Fetches and builds your project's dependencies.
-  * Invokes rustc or another build tool with the correct parameters to build
-    your project.
-  * Introduces conventions, making working with Rust projects easier.
- .
- Cargo downloads your Rust project’s dependencies and compiles your
- project.
- .
- This package contains the documentation.
+#Package: cargo-mozilla-doc
+#Section: doc
+#Architecture: all
+#Build-Profiles: <!nodoc>
+#Depends: ${misc:Depends}
+#Description: Rust package manager, documentation
+# Cargo is a tool that allows Rust projects to declare their various
+# dependencies, and ensure that you'll always get a repeatable build.
+# .
+# To accomplish this goal, Cargo does four things:
+#  * Introduces two metadata files with various bits of project information.
+#  * Fetches and builds your project's dependencies.
+#  * Invokes rustc or another build tool with the correct parameters to build
+#    your project.
+#  * Introduces conventions, making working with Rust projects easier.
+# .
+# Cargo downloads your Rust project’s dependencies and compiles your
+# project.
+# .
+# This package contains the documentation.
 
 # TODO: add a cargo-src package
Binary files cargo-0.66.0+ds1/debian/libgit2_1.5.1+ds.orig.tar.xz and cargo-mozilla-0.66.0+ds1/debian/libgit2_1.5.1+ds.orig.tar.xz differ
diff -ruNp cargo-0.66.0+ds1/debian/patches/cargo-no-namespaced-features.patch cargo-mozilla-0.66.0+ds1/debian/patches/cargo-no-namespaced-features.patch
--- cargo-0.66.0+ds1/debian/patches/cargo-no-namespaced-features.patch	1970-01-01 01:00:00.000000000 +0100
+++ cargo-mozilla-0.66.0+ds1/debian/patches/cargo-no-namespaced-features.patch	2023-07-30 10:37:52.000000000 +0200
@@ -0,0 +1,46 @@
+--- a/vendor/bstr/Cargo.toml
++++ b/vendor/bstr/Cargo.toml
+@@ -102,18 +102,18 @@ version = "0.1.3"
+ version = "1.2.1"
+ 
+ [features]
+-alloc = ["serde?/alloc"]
++alloc = ["serde/alloc"]
+ default = [
+     "std",
+     "unicode",
+ ]
+-serde = ["dep:serde"]
++serde1 = ["serde"]
+ std = [
+     "alloc",
+     "memchr/std",
+-    "serde?/std",
++    "serde/std",
+ ]
+ unicode = [
+-    "dep:once_cell",
+-    "dep:regex-automata",
++    "once_cell",
++    "regex-automata",
+ ]
+--- a/vendor/bstr/src/impls.rs
++++ b/vendor/bstr/src/impls.rs
+@@ -725,7 +725,7 @@ mod bstr {
+     impl_partial_ord!(&'a BStr, String);
+ }
+ 
+-#[cfg(feature = "serde")]
++#[cfg(feature = "serde1")]
+ mod bstr_serde {
+     use core::fmt;
+ 
+@@ -783,7 +783,7 @@ mod bstr_serde {
+     }
+ }
+ 
+-#[cfg(all(feature = "serde", feature = "alloc"))]
++#[cfg(all(feature = "serde1", feature = "alloc"))]
+ mod bstring_serde {
+     use core::{cmp, fmt};
+ 
diff -ruNp cargo-0.66.0+ds1/debian/patches/series cargo-mozilla-0.66.0+ds1/debian/patches/series
--- cargo-0.66.0+ds1/debian/patches/series	2023-01-11 18:55:09.000000000 +0100
+++ cargo-mozilla-0.66.0+ds1/debian/patches/series	2023-07-30 10:37:52.000000000 +0200
@@ -13,3 +13,6 @@ cve/CVE-2022-46176-05-remove-let-else.pa
 cve/CVE-2022-46176-06-add-test-for-config-value-in-toml-array.patch
 cve/CVE-2022-46176-07-support-hashed-hostnames.patch
 cve/CVE-2022-46176-08-eliminate-let-else.patch
+
+use-vendored-libgit.patch
+cargo-no-namespaced-features.patch
diff -ruNp cargo-0.66.0+ds1/debian/patches/use-vendored-libgit.patch cargo-mozilla-0.66.0+ds1/debian/patches/use-vendored-libgit.patch
--- cargo-0.66.0+ds1/debian/patches/use-vendored-libgit.patch	1970-01-01 01:00:00.000000000 +0100
+++ cargo-mozilla-0.66.0+ds1/debian/patches/use-vendored-libgit.patch	2023-07-30 10:37:52.000000000 +0200
@@ -0,0 +1,63 @@
+Author: Emilio Pozuelo Monfort <pochu@debian.org>
+
+Use vendored libgit
+
+--- a/vendor/libgit2-sys/build.rs
++++ b/vendor/libgit2-sys/build.rs
+@@ -11,7 +11,7 @@ fn main() {
+     let zlib_ng_compat = env::var("CARGO_FEATURE_ZLIB_NG_COMPAT").is_ok();
+ 
+     // To use zlib-ng in zlib-compat mode, we have to build libgit2 ourselves.
+-    let try_to_use_system_libgit2 = !vendored && !zlib_ng_compat;
++    let try_to_use_system_libgit2 = false;
+     if try_to_use_system_libgit2 {
+         let mut cfg = pkg_config::Config::new();
+         if let Ok(lib) = cfg.range_version("1.4.4".."1.6.0").probe("libgit2") {
+@@ -22,8 +22,6 @@ fn main() {
+         }
+     }
+ 
+-    panic!("debian build must never use vendored libgit2!");
+-
+     println!("cargo:rustc-cfg=libgit2_vendored");
+ 
+     if !Path::new("libgit2/src").exists() {
+@@ -60,8 +58,8 @@ fn main() {
+     add_c_files(&mut cfg, "libgit2/src/libgit2/streams");
+ 
+     // Always use bundled http-parser for now
+-    cfg.include("libgit2/deps/http-parser")
+-        .file("libgit2/deps/http-parser/http_parser.c");
++    //cfg.include("libgit2/deps/http-parser")
++    //    .file("libgit2/deps/http-parser/http_parser.c");
+ 
+     // Use the included PCRE regex backend.
+     //
+@@ -70,7 +68,7 @@ fn main() {
+     // reasons, just define on the command-line for everything. Perhaps there
+     // is some way with cc to have different instructions per-file?
+     cfg.define("GIT_REGEX_BUILTIN", "1")
+-        .include("libgit2/deps/pcre")
++        //.include("libgit2/deps/pcre")
+         .define("HAVE_STDINT_H", Some("1"))
+         .define("HAVE_MEMMOVE", Some("1"))
+         .define("NO_RECURSE", Some("1"))
+@@ -84,7 +82,8 @@ fn main() {
+         .define("MAX_NAME_COUNT", Some("10000"));
+     // "no symbols" warning on pcre_string_utils.c is because it is only used
+     // when when COMPILE_PCRE8 is not defined, which is the default.
+-    add_c_files(&mut cfg, "libgit2/deps/pcre");
++    //add_c_files(&mut cfg, "libgit2/deps/pcre");
++    println!("cargo:rustc-link-lib=pcre");
+ 
+     cfg.file("libgit2/src/util/allocators/failalloc.c");
+     cfg.file("libgit2/src/util/allocators/stdalloc.c");
+@@ -196,6 +195,8 @@ fn main() {
+ 
+     println!("cargo:root={}", dst.display());
+ 
++    println!("cargo:rustc-link-lib=http_parser");
++
+     if target.contains("windows") {
+         println!("cargo:rustc-link-lib=winhttp");
+         println!("cargo:rustc-link-lib=rpcrt4");
diff -ruNp cargo-0.66.0+ds1/debian/rules cargo-mozilla-0.66.0+ds1/debian/rules
--- cargo-0.66.0+ds1/debian/rules	2023-01-11 18:55:09.000000000 +0100
+++ cargo-mozilla-0.66.0+ds1/debian/rules	2023-07-30 10:37:52.000000000 +0200
@@ -38,11 +38,15 @@ CARGO_TEST_FLAGS =
 override_dh_auto_configure:
 	$(CARGO) prepare-debian $(CURDIR)/vendor
 
+	set -e; \
+		tar xf debian/libgit2_1.5.1+ds.orig.tar.xz; \
+		mv libgit2-1.5.1 vendor/libgit2-sys/libgit2
+
 override_dh_auto_build-arch:
 	$(CARGO) build
 
-override_dh_auto_build-indep:
-	$(CARGO) doc
+#override_dh_auto_build-indep:
+#	$(CARGO) doc
 
 override_dh_auto_test-arch:
 	CFG_DISABLE_CROSS_TESTS=1 $(CARGO) test $(CARGO_TEST_FLAGS)
@@ -51,11 +55,13 @@ override_dh_auto_test-indep:
 	# no arch-indep tests
 
 override_dh_auto_install:
-	DESTDIR=$(CURDIR)/debian/cargo $(CARGO) install
+	DESTDIR=$(CURDIR)/debian/cargo-mozilla $(CARGO) install
 
 override_dh_auto_clean:
 	$(CARGO) clean
 
+	-$(RM) -rf vendor/libgit2-sys/libgit2
+
 override_dh_clean:
 	# Upstream contains a lot of these
 	dh_clean -XCargo.toml.orig
diff -ruNp cargo-0.66.0+ds1/debian/source/include-binaries cargo-mozilla-0.66.0+ds1/debian/source/include-binaries
--- cargo-0.66.0+ds1/debian/source/include-binaries	1970-01-01 01:00:00.000000000 +0100
+++ cargo-mozilla-0.66.0+ds1/debian/source/include-binaries	2023-07-30 10:37:52.000000000 +0200
@@ -0,0 +1 @@
+debian/libgit2_1.5.1+ds.orig.tar.xz

Reply to: