]> git.proxmox.com Git - debcargo-conf.git/commitdiff
Use tmpdir for tests rather than crate dir to fix permission denied error.
authorPeter Michael Green <plugwash@debian.org>
Fri, 12 Feb 2021 00:58:36 +0000 (00:58 +0000)
committerPeter Michael Green <plugwash@debian.org>
Fri, 12 Feb 2021 01:18:19 +0000 (01:18 +0000)
src/cbindgen/debian/changelog
src/cbindgen/debian/patches/series
src/cbindgen/debian/patches/use-tmpdir-for-tests.patch [new file with mode: 0644]

index 7530e44ee5cc1fefd770efe4fa9ede0ef7c69337..789ceb9adc87abb346581cecf7454d1d6b9a9b1c 100644 (file)
@@ -4,8 +4,10 @@ rust-cbindgen (0.17.0-3) UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO; urgency=medium
   * Package cbindgen 0.17.0 from crates.io using debcargo 2.4.4
   * Change build and test dependencies from cython to cython3
   * Use cython3 for tests
+  * Use tmpdir for tests rather than crate dir to fix permission
+    denied errors.
 
- -- Peter Michael Green <plugwash@debian.org>  Thu, 11 Feb 2021 23:55:22 +0000
+ -- Peter Michael Green <plugwash@debian.org>  Fri, 12 Feb 2021 01:17:33 +0000
 
 rust-cbindgen (0.17.0-2) unstable; urgency=medium
 
index 60128caa178bb58b645fbbcc489506eec7978435..a27e78e8d772c4a3aa8eff4d137cba49c967ca64 100644 (file)
@@ -1 +1,2 @@
 use-cython3-for-tests.patch
+use-tmpdir-for-tests.patch
diff --git a/src/cbindgen/debian/patches/use-tmpdir-for-tests.patch b/src/cbindgen/debian/patches/use-tmpdir-for-tests.patch
new file mode 100644 (file)
index 0000000..5fcd08e
--- /dev/null
@@ -0,0 +1,34 @@
+Index: cbindgen/tests/tests.rs
+===================================================================
+--- cbindgen.orig/tests/tests.rs
++++ cbindgen/tests/tests.rs
+@@ -5,6 +5,7 @@ use std::collections::HashSet;
+ use std::path::Path;
+ use std::process::Command;
+ use std::{env, fs, str};
++use tempfile::tempdir;
+ fn style_str(style: Style) -> &'static str {
+     match style {
+@@ -156,8 +157,9 @@ fn run_compile_test(
+ ) {
+     let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
+     let tests_path = Path::new(&crate_dir).join("tests");
+-    let mut generated_file = tests_path.join("expectations");
+-    fs::create_dir_all(&generated_file).unwrap();
++    //let mut generated_file = tests_path.join("expectations");
++    //fs::create_dir_all(&generated_file).unwrap();
++    let tmpdir = tempdir().unwrap();
+     let style_ext = style
+         .map(|style| match style {
+@@ -181,7 +183,8 @@ fn run_compile_test(
+     let source_file =
+         format!("{}{}{}", name, style_ext, lang_ext).replace(SKIP_WARNING_AS_ERROR_SUFFIX, "");
+-    generated_file.push(source_file);
++    //generated_file.push(source_file);
++    let mut generated_file = tmpdir.path().join(source_file);
+     let cbindgen_output = run_cbindgen(
+         cbindgen_path,