Add patch to drop color handling for compatibility with recent archive/raspbian/1.29.0+dfsg1-1+rpi1 raspbian/1.29.0+dfsg1-1+rpi1
authorPeter Michael Green <plugwash@raspbian.org>
Sat, 24 Nov 2018 16:08:00 +0000 (16:08 +0000)
committerPeter Michael Green <plugwash@raspbian.org>
Sat, 24 Nov 2018 16:14:01 +0000 (16:14 +0000)
cargo.

debian/changelog
debian/patches/drop-color-handling.patch [new file with mode: 0644]
debian/patches/series
src/bootstrap/bin/rustc.rs
src/bootstrap/compile.rs

index 403008163c8152bdde675ab8a04cc18e450fceb8..15bec8a3b09d1c82a54822fcdb577fb0904cfcdb 100644 (file)
@@ -4,8 +4,11 @@ rustc (1.29.0+dfsg1-1+rpi1) buster-staging; urgency=medium
   * Build for armv6.
   [changes introduced in 1.18.0+dfsg1-4+rpi1 by Peter Michael Green]
   * Disable testsuite.
+  [changes introduce in 1.29.0+dfsg1-1+rpi1 by Peter Michael Green]
+  * Add upstream patch to disable color handling in rustbuild, it conflicts
+    with newer versions of cargo.
 
- -- Raspbian forward porter <root@raspbian.org>  Thu, 22 Nov 2018 06:15:29 +0000
+ -- Peter Michael Green <plugwash@raspbian.org>  Thu, 22 Nov 2018 06:15:29 +0000
 
 rustc (1.29.0+dfsg1-1) unstable; urgency=medium
 
diff --git a/debian/patches/drop-color-handling.patch b/debian/patches/drop-color-handling.patch
new file mode 100644 (file)
index 0000000..0c862ca
--- /dev/null
@@ -0,0 +1,91 @@
+Modified by Peter michael green for rustc 1.29
+
+commit 2a45057e17082559b4c3a365d9b29cc30105f740
+Author: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
+Date:   Tue Sep 18 14:58:11 2018 +0200
+
+    rustbuild: drop color handling
+    
+    Let cargo handle that for us
+    
+    Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
+
+diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs
+index 7192cae895..675522e596 100644
+--- a/src/bootstrap/bin/rustc.rs
++++ b/src/bootstrap/bin/rustc.rs
+@@ -287,15 +287,6 @@ fn main() {
+         cmd.arg("-Z").arg("verify-llvm-ir");
+     }
+-    let color = match env::var("RUSTC_COLOR") {
+-        Ok(s) => usize::from_str(&s).expect("RUSTC_COLOR should be an integer"),
+-        Err(_) => 0,
+-    };
+-
+-    if color != 0 {
+-        cmd.arg("--color=always");
+-    }
+-
+     if env::var_os("RUSTC_DENY_WARNINGS").is_some() && env::var_os("RUSTC_EXTERNAL_TOOL").is_none()
+     {
+         cmd.arg("-Dwarnings");
+diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
+index 04e8e133b0..7f102b4ed2 100644
+--- a/src/bootstrap/compile.rs
++++ b/src/bootstrap/compile.rs
+@@ -29,7 +29,7 @@ use build_helper::{output, mtime, up_to_date};
+ use filetime::FileTime;
+ use serde_json;
+-use util::{exe, libdir, is_dylib, CiEnv};
++use util::{exe, libdir, is_dylib};
+ use {Compiler, Mode};
+ use native;
+ use tool;
+@@ -1022,29 +1022,6 @@ pub fn add_to_sysroot(builder: &Builder, sysroot_dst: &Path, stamp: &Path) {
+     }
+ }
+-// Avoiding a dependency on winapi to keep compile times down
+-#[cfg(unix)]
+-fn stderr_isatty() -> bool {
+-    use libc;
+-    unsafe { libc::isatty(libc::STDERR_FILENO) != 0 }
+-}
+-#[cfg(windows)]
+-fn stderr_isatty() -> bool {
+-    type DWORD = u32;
+-    type BOOL = i32;
+-    type HANDLE = *mut u8;
+-    const STD_ERROR_HANDLE: DWORD = -12i32 as DWORD;
+-    extern "system" {
+-        fn GetStdHandle(which: DWORD) -> HANDLE;
+-        fn GetConsoleMode(hConsoleHandle: HANDLE, lpMode: *mut DWORD) -> BOOL;
+-    }
+-    unsafe {
+-        let handle = GetStdHandle(STD_ERROR_HANDLE);
+-        let mut out = 0;
+-        GetConsoleMode(handle, &mut out) != 0
+-    }
+-}
+-
+ pub fn run_cargo(builder: &Builder, cargo: &mut Command, stamp: &Path, is_check: bool)
+     -> Vec<PathBuf>
+ {
+@@ -1201,15 +1178,6 @@ pub fn stream_cargo(
+     cargo.arg("--message-format").arg("json")
+          .stdout(Stdio::piped());
+-    if stderr_isatty() && builder.ci_env == CiEnv::None &&
+-        // if the terminal is reported as dumb, then we don't want to enable color for rustc
+-        env::var_os("TERM").map(|t| t != *"dumb").unwrap_or(true) {
+-        // since we pass message-format=json to cargo, we need to tell the rustc
+-        // wrapper to give us colored output if necessary. This is because we
+-        // only want Cargo's JSON output, not rustcs.
+-        cargo.env("RUSTC_COLOR", "1");
+-    }
+-
+     builder.verbose(&format!("running: {:?}", cargo));
+     let mut child = match cargo.spawn() {
+         Ok(child) => child,
index b34749e66bcdf27ad9459bcc190dccb4e8c616af..eacc9df30aff5d245489abc2814137cd06e23420 100644 (file)
@@ -40,3 +40,5 @@ d-i686-baseline.patch
 d-no-web-dependencies-in-doc.patch
 # Work around for some porterboxes, keep this commented
 #d-host-duplicates.patch
+
+drop-color-handling.patch
index 7192cae8956e40b5157ac0ea5a34414f99e6d296..675522e5962d78d595c4b1fae7c9dc2a602faa38 100644 (file)
@@ -287,15 +287,6 @@ fn main() {
         cmd.arg("-Z").arg("verify-llvm-ir");
     }
 
-    let color = match env::var("RUSTC_COLOR") {
-        Ok(s) => usize::from_str(&s).expect("RUSTC_COLOR should be an integer"),
-        Err(_) => 0,
-    };
-
-    if color != 0 {
-        cmd.arg("--color=always");
-    }
-
     if env::var_os("RUSTC_DENY_WARNINGS").is_some() && env::var_os("RUSTC_EXTERNAL_TOOL").is_none()
     {
         cmd.arg("-Dwarnings");
index 04e8e133b03a11ffca2991a1eb639524b413cc41..7f102b4ed2fda866a6dc71b5b9f8a41c811c2920 100644 (file)
@@ -29,7 +29,7 @@ use build_helper::{output, mtime, up_to_date};
 use filetime::FileTime;
 use serde_json;
 
-use util::{exe, libdir, is_dylib, CiEnv};
+use util::{exe, libdir, is_dylib};
 use {Compiler, Mode};
 use native;
 use tool;
@@ -1022,29 +1022,6 @@ pub fn add_to_sysroot(builder: &Builder, sysroot_dst: &Path, stamp: &Path) {
     }
 }
 
-// Avoiding a dependency on winapi to keep compile times down
-#[cfg(unix)]
-fn stderr_isatty() -> bool {
-    use libc;
-    unsafe { libc::isatty(libc::STDERR_FILENO) != 0 }
-}
-#[cfg(windows)]
-fn stderr_isatty() -> bool {
-    type DWORD = u32;
-    type BOOL = i32;
-    type HANDLE = *mut u8;
-    const STD_ERROR_HANDLE: DWORD = -12i32 as DWORD;
-    extern "system" {
-        fn GetStdHandle(which: DWORD) -> HANDLE;
-        fn GetConsoleMode(hConsoleHandle: HANDLE, lpMode: *mut DWORD) -> BOOL;
-    }
-    unsafe {
-        let handle = GetStdHandle(STD_ERROR_HANDLE);
-        let mut out = 0;
-        GetConsoleMode(handle, &mut out) != 0
-    }
-}
-
 pub fn run_cargo(builder: &Builder, cargo: &mut Command, stamp: &Path, is_check: bool)
     -> Vec<PathBuf>
 {
@@ -1201,15 +1178,6 @@ pub fn stream_cargo(
     cargo.arg("--message-format").arg("json")
          .stdout(Stdio::piped());
 
-    if stderr_isatty() && builder.ci_env == CiEnv::None &&
-        // if the terminal is reported as dumb, then we don't want to enable color for rustc
-        env::var_os("TERM").map(|t| t != *"dumb").unwrap_or(true) {
-        // since we pass message-format=json to cargo, we need to tell the rustc
-        // wrapper to give us colored output if necessary. This is because we
-        // only want Cargo's JSON output, not rustcs.
-        cargo.env("RUSTC_COLOR", "1");
-    }
-
     builder.verbose(&format!("running: {:?}", cargo));
     let mut child = match cargo.spawn() {
         Ok(child) => child,