Restrict tag-update for version generation to cached git repos.
authormachenbach <machenbach@chromium.org>
Wed, 21 Jan 2015 13:02:23 +0000 (05:02 -0800)
committerCommit bot <commit-bot@chromium.org>
Wed, 21 Jan 2015 13:02:39 +0000 (13:02 +0000)
Otherwise it's impossible to compile v8 without internet
connection.

BUG=chromium:446166
LOG=n
NOTRY=true

Review URL: https://codereview.chromium.org/856323002

Cr-Commit-Position: refs/heads/master@{#26186}

build/generate_version.py

index 7852842..3f11378 100755 (executable)
@@ -28,11 +28,16 @@ VERSION_GEN_CC = os.path.join(CWD, "src", "version_gen.cc")
 
 
 def generate_version_file():
-  # Make sure the tags are fetched.
-  subprocess.check_output(
-      "git fetch origin +refs/tags/*:refs/tags/*",
+  # Make sure the tags are fetched from cached git repos.
+  url = subprocess.check_output(
+      "git config --get remote.origin.url",
       shell=True,
-      cwd=CWD)
+      cwd=CWD).strip()
+  if not url.startswith("http"):
+    subprocess.check_output(
+        "git fetch origin +refs/tags/*:refs/tags/*",
+        shell=True,
+        cwd=CWD)
   tag = subprocess.check_output(
       "git describe --tags",
       shell=True,