d-read-beta-version-from-file
authorDebian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
Tue, 8 Sep 2020 16:38:19 +0000 (17:38 +0100)
committerEmilio Pozuelo Monfort <pochu@debian.org>
Tue, 8 Sep 2020 16:38:19 +0000 (17:38 +0100)
Gbp-Pq: Name d-read-beta-version-from-file.patch

src/bootstrap/lib.rs

index 080bef6853a20ce39fdd22ff0011f6918188bd34..64499329391cfb01a6bb22bc4de86d515ea7036f 100644 (file)
@@ -922,41 +922,13 @@ impl Build {
             return s
         }
 
-        let beta = output(
-            Command::new("git")
-                .arg("ls-remote")
-                .arg("origin")
-                .arg("beta")
-                .current_dir(&self.src)
-        );
-        let beta = beta.trim().split_whitespace().next().unwrap();
-        let master = output(
-            Command::new("git")
-                .arg("ls-remote")
-                .arg("origin")
-                .arg("master")
-                .current_dir(&self.src)
-        );
-        let master = master.trim().split_whitespace().next().unwrap();
-
-        // Figure out where the current beta branch started.
-        let base = output(
-            Command::new("git")
-                .arg("merge-base")
-                .arg(beta)
-                .arg(master)
-                .current_dir(&self.src),
-        );
-        let base = base.trim();
-
-        // Next figure out how many merge commits happened since we branched off
-        // beta. That's our beta number!
+        // Debian: read beta number from "version" file, this is only available
+        // in the rustc upstream tarballs and not their git
         let count = output(
-            Command::new("git")
-                .arg("rev-list")
-                .arg("--count")
-                .arg("--merges")
-                .arg(format!("{}...HEAD", base))
+            Command::new("sed")
+                .arg("-re")
+                .arg(r"s/[0-9]+.[0-9]+.[0-9]+-beta.([0-9]+) \(.*\)/\1/g")
+                .arg("version")
                 .current_dir(&self.src),
         );
         let n = count.trim().parse().unwrap();