summaryrefslogtreecommitdiffstats
path: root/debian/patches/d-bootstrap-read-beta-version-from-file.patch
blob: 15ebb93c8f61bb82b035234be9fe00d1ec8ca8fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
Date: Thu, 14 Jul 2022 13:17:38 +0200
Subject: d-bootstrap-read-beta-version-from-file

===================================================================
---
 src/bootstrap/lib.rs | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -1296,14 +1296,15 @@
             return s;
         }
 
-        // Figure out how many merge commits happened since we branched off master.
-        // That's our beta number!
-        // (Note that we use a `..` range, not the `...` symmetric difference.)
-        let count =
-            output(self.config.git().arg("rev-list").arg("--count").arg("--merges").arg(format!(
-                "refs/remotes/origin/{}..HEAD",
-                self.config.stage0_metadata.config.nightly_branch
-            )));
+        // 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("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();
         self.prerelease_version.set(Some(n));
         n