Skip to content
Snippets Groups Projects
Commit e6d81d46 authored by Simon McVittie's avatar Simon McVittie
Browse files

populate-depot.py: Allow setting a specific scripts version


In CI builds, we often know better than `git describe` does. Change the
precedence so a new --scripts-version is highest priority, then a
.tarball-version file, and finally a version guessed from `git describe`.

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent 6155e114
No related branches found
No related tags found
No related merge requests found
......@@ -548,6 +548,7 @@ class Main:
pressure_vessel_uri: str = DEFAULT_PRESSURE_VESSEL_URI,
pressure_vessel_version: str = '',
runtime: str = 'scout',
scripts_version: str = '',
source_dir: str = str(HERE),
ssh_host: str = '',
ssh_path: str = '',
......@@ -617,6 +618,7 @@ class Main:
self.pressure_vessel_ssh_host = pressure_vessel_ssh_host or ssh_host
self.pressure_vessel_ssh_path = pressure_vessel_ssh_path
self.pressure_vessel_uri = pressure_vessel_uri
self.scripts_version = scripts_version
self.source_dir = source_dir
self.ssh_host = ssh_host
self.ssh_path = ssh_path
......@@ -1213,12 +1215,6 @@ class Main:
self.write_component_versions()
def write_component_versions(self) -> None:
try:
with open(HERE / '.tarball-version', 'r') as reader:
version = reader.read().strip()
except OSError:
version = 'unknown'
try:
with subprocess.Popen(
[
......@@ -1233,12 +1229,21 @@ class Main:
) as describe:
stdout = describe.stdout
assert stdout is not None
version = stdout.read().strip() or version
version = stdout.read().strip()
# Deliberately ignoring exit status:
# if git is missing or old we'll use 'unknown'
except (OSError, subprocess.SubprocessError):
version = ''
try:
with open(HERE / '.tarball-version', 'r') as reader:
version = reader.read().strip()
except OSError:
pass
if self.scripts_version:
version = self.scripts_version
if self.depot_version:
component_version = ComponentVersion('depot', sort_weight=-1)
component_version.version = self.depot_version
......@@ -1246,8 +1251,8 @@ class Main:
self.versions.append(component_version)
component_version = ComponentVersion('scripts')
component_version.version = version
component_version.comment = 'Entry point scripts, etc.'
component_version.version = version or 'unknown'
component_version.comment = 'from steam-runtime-tools'
self.versions.append(component_version)
with open(os.path.join(self.depot, 'VERSIONS.txt'), 'w') as writer:
......@@ -1767,6 +1772,12 @@ def main() -> None:
'Set an overall version number for the depot contents'
)
)
parser.add_argument(
'--scripts-version', default='',
help=(
'Set a version number for the scripts from steam-runtime-tools'
)
)
parser.add_argument(
'--pressure-vessel-uri',
......
......@@ -9,7 +9,10 @@ if [ -n "${TESTS_ONLY-}" ]; then
exit 0
fi
populate_depot_args=("--steam-app-id=1628350")
populate_depot_args=( \
"--scripts-version=test test" \
"--steam-app-id=1628350" \
)
if [ -n "${IMAGES_DOWNLOAD_CREDENTIAL-}" ]; then
populate_depot_args=( \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment