aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2023-07-28 07:03:06 +0200
committerGitHub <noreply@github.com>2023-07-28 05:03:06 +0000
commit2ecdb8f45e1b9c556ad5e0d9ee67da6b52b84342 (patch)
tree41ca2c67fdba827c6591b75adbf67c8d363ccace /python
parent17a5b9200d09e50850155c71919b99bf8e322798 (diff)
downloadservo-2ecdb8f45e1b9c556ad5e0d9ee67da6b52b84342.tar.gz
servo-2ecdb8f45e1b9c556ad5e0d9ee67da6b52b84342.zip
Embed git hash using vergen instead of mach (#30030)
Embed the git hash into the servo binary using vergen instead of using custom Python code in mach. The benefit here is ones less difference between a normal cargo run and building via mach in addition to removing a bunch of code.
Diffstat (limited to 'python')
-rw-r--r--python/servo/command_base.py36
1 files changed, 0 insertions, 36 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py
index e712b92412d..63911e01c4a 100644
--- a/python/servo/command_base.py
+++ b/python/servo/command_base.py
@@ -32,7 +32,6 @@ from os import path
from subprocess import PIPE
from xml.etree.ElementTree import XML
-import six
import toml
from mach_bootstrap import _get_exec_path
@@ -578,41 +577,6 @@ class CommandBase(object):
env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " -W unused-extern-crates"
env["CARGO_TARGET_DIR"] = servo.util.get_target_dir()
- git_info = []
- if os.path.isdir('.git') and is_build:
- # Get the subject of the commit
- git_commit_subject = subprocess.check_output([
- 'git', 'show', '-s', '--format=%s', 'HEAD'
- ]).strip()
-
- git_sha = None
- # Check if it's a bundle commit
- if git_commit_subject.startswith(b"Shallow version of commit "):
- # This is a bundle commit
- # Get the SHA-1 from the bundle subject: "Shallow version of commit {sha1}"
- git_sha = git_commit_subject.split(b' ')[-1].strip()
- # Shorten hash
- # NOTE: Partially verifies the hash, but it will still pass if it's, e.g., a tree
- git_sha = subprocess.check_output([
- 'git', 'rev-parse', '--short', git_sha.decode('ascii')
- ])
- else:
- # This is a regular commit
- git_sha = subprocess.check_output([
- 'git', 'rev-parse', '--short', 'HEAD'
- ]).strip()
-
- git_is_dirty = bool(subprocess.check_output([
- 'git', 'status', '--porcelain'
- ]).strip())
-
- git_info.append('')
- git_info.append(six.ensure_str(git_sha))
- if git_is_dirty:
- git_info.append('dirty')
-
- env['GIT_INFO'] = '-'.join(git_info)
-
if self.config["build"]["thinlto"]:
env['RUSTFLAGS'] += " -Z thinlto"