From b917c363cc13b13ed553051844095469e1d6fc82 Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Fri, 3 Nov 2017 18:44:11 +0000 Subject: Add scripts/baserock-release-metadata This was meant to be added as part of MR !58, but of course I forgot to `git add`. --- scripts/baserock-release-metadata | 66 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 scripts/baserock-release-metadata (limited to 'scripts') diff --git a/scripts/baserock-release-metadata b/scripts/baserock-release-metadata new file mode 100755 index 00000000..1b429671 --- /dev/null +++ b/scripts/baserock-release-metadata @@ -0,0 +1,66 @@ +#!/usr/bin/env python3 +# Copyright (C) 2017 Codethink Limited +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., + + +'''baserock-release-metadata + +Generates a YAML document with some simple metadata that should be included +in release binaries + +This expects to be run inside the definitions repo so that it can figure +out the Git commit being built. + +''' + +import collections +import subprocess + + +def git_show_commit(): + return subprocess.check_output( + ['git', 'rev-parse', 'HEAD']).decode('unicode-escape').strip() + + +def buildstream_version(): + return subprocess.check_output( + ['bst', '--version']).decode('unicode-escape').strip() + + +def main(): + repo = "https://www.gitlab.com/baserock/definitions" + commit = git_show_commit() + build_tool = "Buildstream" + # This marks the version of BuildStream that checked out the sysroot + # artifact; the artifact may have pulled it from a cache though so + # we don't know what version of BuildStream actually built anything. + build_tool_version = buildstream_version() + + # Here we produce a YAML document with specific ordering and formatting + # to ensure readability. + print("description: |\n" + " This sysroot was produced by the Baserock project.\n" + " See for more information.\n") + print("project-repo: %s" % repo) + print("project-commit: %s" % commit) + print() + print("build-tool: %s" % build_tool) + print("build-tool-version: %s" % build_tool_version) + + +try: + main() +except RuntimeError as e: + sys.stderr.write("%s\n" % e) + sys.exit(1) -- cgit v1.2.1