]> git.proxmox.com Git - rustc.git/commitdiff
Read beta version from "version" file
authorXimin Luo <infinity0@debian.org>
Wed, 25 Jul 2018 08:57:39 +0000 (01:57 -0700)
committerXimin Luo <infinity0@debian.org>
Wed, 25 Jul 2018 09:54:21 +0000 (02:54 -0700)
debian/patches/d-read-beta-version-from-file.patch [new file with mode: 0644]
debian/patches/series

diff --git a/debian/patches/d-read-beta-version-from-file.patch b/debian/patches/d-read-beta-version-from-file.patch
new file mode 100644 (file)
index 0000000..8ebe485
--- /dev/null
@@ -0,0 +1,50 @@
+--- a/src/bootstrap/lib.rs
++++ b/src/bootstrap/lib.rs
+@@ -883,41 +883,13 @@
+             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();
index 48a5171a4b3dbd30b0608fa66a064b0d0ced4531..726bb76501f97aea30d81355b5656f9c76d73c2f 100644 (file)
@@ -33,3 +33,4 @@ d-no-web-dependencies-in-doc.patch
 
 # Work around for some porterboxes, keep this commented
 #d-host-duplicates.patch
+d-read-beta-version-from-file.patch