summaryrefslogtreecommitdiff
path: root/scripts/make-version-file
diff options
context:
space:
mode:
authorRunar Borge <runar@borge.nu>2019-07-22 21:54:20 +0200
committerRunar Borge <runar@borge.nu>2019-07-22 21:54:20 +0200
commit6056acfa06c2b79ee8981b9f36a1ced2dac29111 (patch)
tree613944f1de089105950a86501507b6aa2151380d /scripts/make-version-file
parentb229f0bd958a42c6faa345c91500c2ed8ccdc919 (diff)
parent8c22ceead487b745d6b7c058c4d1c0a0eaa051c8 (diff)
downloadvyos-build-6056acfa06c2b79ee8981b9f36a1ced2dac29111.tar.gz
vyos-build-6056acfa06c2b79ee8981b9f36a1ced2dac29111.zip
Merge remote-tracking branch 'origin/current' into equuleus
fixed merge errors in: * scripts/live-build-config - kernel parameters * scripts/build-packages - fixed list of packages to compile
Diffstat (limited to 'scripts/make-version-file')
-rwxr-xr-xscripts/make-version-file16
1 files changed, 12 insertions, 4 deletions
diff --git a/scripts/make-version-file b/scripts/make-version-file
index 95574722..4df2cb6c 100755
--- a/scripts/make-version-file
+++ b/scripts/make-version-file
@@ -43,7 +43,16 @@ build_timestamp = now.strftime("%Y%m%d%H%M")
build_date = now.strftime("%a %d %b %Y %H:%M UTC")
# Assign a (hopefully) unique identifier to the build (UUID)
-build_id = str(uuid.uuid4())
+build_uuid = str(uuid.uuid4())
+
+# Initialize Git object from our repository
+repo = git.Repo('.')
+
+# Retrieve the Git commit ID of the repository, 14 charaters will be sufficient
+build_git = repo.head.object.hexsha[:14]
+# If somone played around with the source tree and the build is "dirty", mark it
+if repo.is_dirty():
+ build_git += "-dirty"
# Create a build version
if build_config['build_type'] == 'development':
@@ -52,7 +61,6 @@ if build_config['build_type'] == 'development':
with open('data/versions') as f:
version_mapping = json.load(f)
- repo = git.Repo('.')
git_branch = repo.active_branch.name
branch_version = version_mapping[git_branch]
@@ -68,10 +76,10 @@ version_data = {
'version': version,
'built_by': build_config['build_by'],
'built_on': build_date,
- 'build_id': build_id
+ 'build_uuid': build_uuid,
+ 'build_git': build_git
}
-
os.makedirs(os.path.join(defaults.CHROOT_INCLUDES_DIR, 'usr/share/vyos'), exist_ok=True)
with open(os.path.join(defaults.CHROOT_INCLUDES_DIR, 'usr/share/vyos/version.json'), 'w') as f:
json.dump(version_data, f)