From ac5c9e66c62984a644477a2fc59a88762d3abea7 Mon Sep 17 00:00:00 2001 From: Tomas Popela Date: Tue, 20 Jun 2023 14:54:23 +0200 Subject: [PATCH] Fix FTBFS with newer Rust; add BR on git-core; specify bundled content Resolves: RHEL-635 Upgrade to procedural-masquerade 0.1.7 to fix FTBFS with newer Rust Resolves: RHEL-636 librsvg2 is missing Provides: bundled() Resolves: RHEL-637 Add git-core as a BR for autosetup --- ...grade-to-procedural-masquerade-0.1.7.patch | 229 ++++++++++++++++++ librsvg2.spec | 66 ++++- 2 files changed, 294 insertions(+), 1 deletion(-) create mode 100644 0001-Upgrade-to-procedural-masquerade-0.1.7.patch diff --git a/0001-Upgrade-to-procedural-masquerade-0.1.7.patch b/0001-Upgrade-to-procedural-masquerade-0.1.7.patch new file mode 100644 index 0000000..a034e6c --- /dev/null +++ b/0001-Upgrade-to-procedural-masquerade-0.1.7.patch @@ -0,0 +1,229 @@ +From 6aacf7c0e81082dc414396f7059a7a2893c4600b Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Mon, 16 Jan 2023 13:24:17 -0800 +Subject: [PATCH] Upgrade to procedural-masquerade 0.1.7 + +--- + Cargo.lock | 8 +- + .../.cargo-checksum.json | 2 +- + vendor/procedural-masquerade/.cargo-ok | 0 + vendor/procedural-masquerade/Cargo.toml | 4 +- + vendor/procedural-masquerade/lib.rs | 111 ++++++++++++------ + 5 files changed, 79 insertions(+), 46 deletions(-) + delete mode 100644 vendor/procedural-masquerade/.cargo-ok + +diff --git a/Cargo.lock b/Cargo.lock +index c49356d08a6d..a4899a02041d 100644 +--- a/Cargo.lock ++++ b/Cargo.lock +@@ -54,7 +54,7 @@ dependencies = [ + "itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", +- "procedural-masquerade 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ++ "procedural-masquerade 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", +@@ -67,7 +67,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ + "phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +- "procedural-masquerade 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ++ "procedural-masquerade 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)", + ] +@@ -295,7 +295,7 @@ dependencies = [ + + [[package]] + name = "procedural-masquerade" +-version = "0.1.5" ++version = "0.1.7" + source = "registry+https://github.com/rust-lang/crates.io-index" + + [[package]] +@@ -513,7 +513,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" + "checksum phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "07e24b0ca9643bdecd0632f2b3da6b1b89bbb0030e0b992afc1113b23a7bc2f2" + "checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903" + "checksum proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cd07deb3c6d1d9ff827999c7f9b04cdfd66b1b17ae508e14fe47b620f2282ae0" +-"checksum procedural-masquerade 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "dc1bcafee1590f81acb329ae45ec627b318123f085153913620316ae9a144b2a" ++"checksum procedural-masquerade 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8f1383dff4092fe903ac180e391a8d4121cc48f08ccf850614b0290c6673b69d" + "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" + "checksum quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1eca14c727ad12702eb4b6bfb5a232287dcf8385cb8ca83a3eeaf6519c44c408" + "checksum rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "15a732abf9d20f0ad8eeb6f909bf6868722d9a06e1e50802b6a70351f40b4eb1" +diff --git a/vendor/procedural-masquerade/.cargo-checksum.json b/vendor/procedural-masquerade/.cargo-checksum.json +index e5ded3a268ba..d80306902f03 100644 +--- a/vendor/procedural-masquerade/.cargo-checksum.json ++++ b/vendor/procedural-masquerade/.cargo-checksum.json +@@ -1 +1 @@ +-{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"78faf5c70ec7dc8d1e18ccf508a483220b31a4d99ce171083f9df709c6d930b1","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"4bf2f5a98355718dc876a821d76cfc9802c43d3cbdc5b9d46a1cd5dfa5d6b01a","lib.rs":"56dc915a0343a75606bd33056f7bbb1832112683903786e53bac56e855afe380"},"package":"dc1bcafee1590f81acb329ae45ec627b318123f085153913620316ae9a144b2a"} +\ No newline at end of file ++{"files":{"Cargo.toml":"39b050fe906ec0088242ac802f4e8305196f1b0d8543322c17931b219b2e0619","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"4bf2f5a98355718dc876a821d76cfc9802c43d3cbdc5b9d46a1cd5dfa5d6b01a","lib.rs":"d549db3924ec4026718d241f4227c98d17dc6f3a06bdc6a3581cee8cb43f7ac3"},"package":"8f1383dff4092fe903ac180e391a8d4121cc48f08ccf850614b0290c6673b69d"} +\ No newline at end of file +diff --git a/vendor/procedural-masquerade/.cargo-ok b/vendor/procedural-masquerade/.cargo-ok +deleted file mode 100644 +index e69de29bb2d1..000000000000 +diff --git a/vendor/procedural-masquerade/Cargo.toml b/vendor/procedural-masquerade/Cargo.toml +index f8b5f2c57308..9c004599b496 100644 +--- a/vendor/procedural-masquerade/Cargo.toml ++++ b/vendor/procedural-masquerade/Cargo.toml +@@ -3,7 +3,7 @@ + # When uploading crates to the registry Cargo will automatically + # "normalize" Cargo.toml files for maximal compatibility + # with all versions of Cargo and also rewrite `path` dependencies +-# to registry (e.g. crates.io) dependencies ++# to registry (e.g., crates.io) dependencies + # + # If you believe there's an error in this file please file an + # issue against the rust-lang/cargo repository. If you're +@@ -12,7 +12,7 @@ + + [package] + name = "procedural-masquerade" +-version = "0.1.5" ++version = "0.1.7" + authors = ["Simon Sapin "] + description = "macro_rules for making proc_macro_derive pretending to be proc_macro" + documentation = "https://docs.rs/procedural-masquerade/" +diff --git a/vendor/procedural-masquerade/lib.rs b/vendor/procedural-masquerade/lib.rs +index 86e841a084a9..4b51e1497006 100644 +--- a/vendor/procedural-masquerade/lib.rs ++++ b/vendor/procedural-masquerade/lib.rs +@@ -177,8 +177,15 @@ macro_rules! define_proc_macros { + fn wrapped($input: &str) -> String { + $body + } ++ ++ // syn uses a huge amount of stack in debug mode. + let derive_input_string = derive_input.to_string(); +- wrapped($crate::_extract_input(&derive_input_string)).parse().unwrap() ++ let handle = ++ ::std::thread::Builder::new().stack_size(128 * 1024 * 1024).spawn(move || { ++ wrapped($crate::_extract_input(&derive_input_string)) ++ }).unwrap(); ++ ++ handle.join().unwrap().parse().unwrap() + } + )+ + } +@@ -191,18 +198,44 @@ macro_rules! define_proc_macros { + pub fn _extract_input(derive_input: &str) -> &str { + let mut input = derive_input; + +- for expected in &["#[allow(unused)]", "enum", "ProceduralMasqueradeDummyType", "{", +- "Input", "=", "(0,", "stringify!", "("] { +- input = input.trim_left(); +- assert!(input.starts_with(expected), +- "expected prefix {:?} not found in {:?}", expected, derive_input); ++ for expected in &[ ++ "#", ++ "[", ++ "allow", ++ "(", ++ "unused", ++ ")", ++ "]", ++ "enum", ++ "ProceduralMasqueradeDummyType", ++ "{", ++ "Input", ++ "=", ++ "(", ++ "0", ++ ",", ++ "stringify", ++ "!", ++ "(", ++ ] { ++ input = input.trim_start(); ++ assert!( ++ input.starts_with(expected), ++ "expected prefix {:?} not found in {:?}", ++ expected, ++ derive_input ++ ); + input = &input[expected.len()..]; + } + +- for expected in [")", ").0,", "}"].iter().rev() { +- input = input.trim_right(); +- assert!(input.ends_with(expected), +- "expected suffix {:?} not found in {:?}", expected, derive_input); ++ for expected in [")", ")", ".", "0", ",", "}"].iter().rev() { ++ input = input.trim_end(); ++ assert!( ++ input.ends_with(expected), ++ "expected suffix {:?} not found in {:?}", ++ expected, ++ derive_input ++ ); + let end = input.len() - expected.len(); + input = &input[..end]; + } +@@ -220,33 +253,33 @@ macro_rules! define_invoke_proc_macro { + #[doc(hidden)] + #[macro_export] + macro_rules! $macro_name { +- ($proc_macro_name: ident ! $paren: tt) => { +- #[derive($proc_macro_name)] +- #[allow(unused)] +- enum ProceduralMasqueradeDummyType { +- // The magic happens here. +- // +- // We use an `enum` with an explicit discriminant +- // because that is the only case where a type definition +- // can contain a (const) expression. +- // +- // `(0, "foo").0` evalutes to 0, with the `"foo"` part ignored. +- // +- // By the time the `#[proc_macro_derive]` function +- // implementing `#[derive($proc_macro_name)]` is called, +- // `$paren` has already been replaced with the input of this inner macro, +- // but `stringify!` has not been expanded yet. +- // +- // This how arbitrary tokens can be inserted +- // in the input to the `#[proc_macro_derive]` function. +- // +- // Later, `stringify!(...)` is expanded into a string literal +- // which is then ignored. +- // Using `stringify!` enables passing arbitrary tokens +- // rather than only what can be parsed as a const expression. +- Input = (0, stringify! $paren ).0 +- } +- } +- } +- } ++ ($proc_macro_name: ident ! $paren: tt) => { ++ #[derive($proc_macro_name)] ++ #[allow(unused)] ++ enum ProceduralMasqueradeDummyType { ++ // The magic happens here. ++ // ++ // We use an `enum` with an explicit discriminant ++ // because that is the only case where a type definition ++ // can contain a (const) expression. ++ // ++ // `(0, "foo").0` evalutes to 0, with the `"foo"` part ignored. ++ // ++ // By the time the `#[proc_macro_derive]` function ++ // implementing `#[derive($proc_macro_name)]` is called, ++ // `$paren` has already been replaced with the input of this inner macro, ++ // but `stringify!` has not been expanded yet. ++ // ++ // This how arbitrary tokens can be inserted ++ // in the input to the `#[proc_macro_derive]` function. ++ // ++ // Later, `stringify!(...)` is expanded into a string literal ++ // which is then ignored. ++ // Using `stringify!` enables passing arbitrary tokens ++ // rather than only what can be parsed as a const expression. ++ Input = (0, stringify! $paren ).0, ++ } ++ } ++ } ++ }; + } +-- +2.39.0 + diff --git a/librsvg2.spec b/librsvg2.spec index 12283fd..b71e741 100644 --- a/librsvg2.spec +++ b/librsvg2.spec @@ -11,7 +11,7 @@ Name: librsvg2 Summary: An SVG library based on cairo Version: 2.42.7 -Release: 4%{?dist} +Release: 5%{?dist} License: LGPLv2+ URL: https://wiki.gnome.org/Projects/LibRsvg @@ -22,9 +22,12 @@ Source0: https://download.gnome.org/sources/librsvg/2.42/librsvg-%{versio Patch0: CVE-2019-20446.patch # https://github.com/servo/rust-cssparser/pull/245 Patch1: fix-cssparser-build.patch +# https://issues.redhat.com/browse/RHEL-635 +Patch2: 0001-Upgrade-to-procedural-masquerade-0.1.7.patch BuildRequires: chrpath BuildRequires: gcc +BuildRequires: git-core BuildRequires: gobject-introspection-devel BuildRequires: pkgconfig(cairo) BuildRequires: pkgconfig(cairo-png) @@ -62,6 +65,62 @@ BuildRequires: (crate(regex) >= 0.2.1 with crate(regex) < 0.3.0) # We install a gdk-pixbuf svg loader Requires: gdk-pixbuf2%{?_isa} +%if 0%{?bundled_rust_deps} +# Basically everything apart from Windows and Fuchsia specific things +Provides: bundled(crate(aho-corasick)) = 0.6.4 +Provides: bundled(crate(bitflags)) = 0.9.1 +Provides: bundled(crate(bitflags)) = 1.0.1 +Provides: bundled(crate(c_vec)) = 1.2.1 +Provides: bundled(crate(cairo-rs)) = 0.3.0 +Provides: bundled(crate(cairo-sys-rs)) = 0.5.0 +Provides: bundled(crate(cssparser)) = 0.23.2 +Provides: bundled(crate(cssparser-macros)) = 0.3.2 +Provides: bundled(crate(downcast-rs)) = 1.0.1 +Provides: bundled(crate(dtoa)) = 0.4.2 +Provides: bundled(crate(dtoa-short)) = 0.3.2 +Provides: bundled(crate(either)) = 1.4.0 +Provides: bundled(crate(float-cmp)) = 0.4.0 +Provides: bundled(crate(glib)) = 0.4.1 +Provides: bundled(crate(glib-sys)) = 0.5.0 +Provides: bundled(crate(gobject-sys)) = 0.5.0 +Provides: bundled(crate(itertools)) = 0.7.7 +Provides: bundled(crate(itoa)) = 0.3.4 +Provides: bundled(crate(lazy_static)) = 1.0.0 +Provides: bundled(crate(libc)) = 0.2.39 +Provides: bundled(crate(matches)) = 0.1.6 +Provides: bundled(crate(memchr)) = 2.0.1 +Provides: bundled(crate(num-traits)) = 0.2.1 +Provides: bundled(crate(pango)) = 0.3.0 +Provides: bundled(crate(pango-sys)) = 0.5.0 +Provides: bundled(crate(pangocairo)) = 0.4.1 +Provides: bundled(crate(pangocairo-sys)) = 0.6.0 +Provides: bundled(crate(phf)) = 0.7.21 +Provides: bundled(crate(phf_codegen)) = 0.7.21 +Provides: bundled(crate(phf_generator)) = 0.7.21 +Provides: bundled(crate(phf_shared)) = 0.7.21 +Provides: bundled(crate(pkg-config)) = 0.3.9 +Provides: bundled(crate(proc-macro2)) = 0.2.3 +Provides: bundled(crate(procedural-masquerade)) = 0.1.7 +Provides: bundled(crate(quote)) = 0.3.15 +Provides: bundled(crate(quote)) = 0.4.2 +Provides: bundled(crate(rand)) = 0.3.22 +Provides: bundled(crate(rand)) = 0.4.2 +Provides: bundled(crate(regex)) = 0.2.7 +Provides: bundled(crate(regex-syntax)) = 0.5.0 +Provides: bundled(crate(siphasher)) = 0.2.2 +Provides: bundled(crate(smallvec)) = 0.6.0 +Provides: bundled(crate(syn)) = 0.11.11 +Provides: bundled(crate(syn)) = 0.12.14 +Provides: bundled(crate(synom)) = 0.11.3 +Provides: bundled(crate(thread_local)) = 0.3.5 +Provides: bundled(crate(ucd-util)) = 0.1.1 +Provides: bundled(crate(unicode-xid)) = 0.0.4 +Provides: bundled(crate(unicode-xid)) = 0.1.0 +Provides: bundled(crate(unreachable)) = 1.0.0 +Provides: bundled(crate(utf8-ranges)) = 1.0.0 +Provides: bundled(crate(void)) = 1.0.2 +%endif + %description An SVG library based on cairo. @@ -139,6 +198,11 @@ rm -vrf %{buildroot}%{_datadir}/doc %{_mandir}/man1/rsvg-convert.1* %changelog +* Tue Jun 20 2023 Tomas Popela - 2.42.7-5 +- Resolves: RHEL-635 Upgrade to procedural-masquerade 0.1.7 to fix FTBFS with newer Rust +- Resolves: RHEL-636 librsvg2 is missing Provides: bundled() +- Resolves: RHEL-637 Add git-core as a BR for autosetup + * Wed May 13 2020 Michael Catanzaro - 2.42.7-4 - Resolves: rhbz#1804519 Add patch for CVE-2019-20446