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

populate-depot: Pre-create files/.ref in runtimes' files content


pressure-vessel will create this lock file automatically, but if we
don't include it in the depot content, then Steam will never clean
it up.

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent 9c65addc
No related branches found
No related tags found
1 merge request!47populate-depot: Improve handling of depots containing unpacked files
......@@ -37,6 +37,7 @@ import os
import re
import shlex
import shutil
import stat
import subprocess
import sys
import tarfile
......@@ -626,6 +627,27 @@ class Main:
self.write_component_versions()
def ensure_ref(self, path: str) -> None:
'''
Create $path/files/.ref as an empty regular file.
This is useful because pressure-vessel would create this file
during processing. If it gets committed to the depot, then Steampipe
will remove it when superseded.
'''
ref = os.path.join(path, 'files', '.ref')
try:
statinfo = os.stat(ref, follow_symlinks=False)
except FileNotFoundError:
with open(ref, 'x'):
pass
else:
if statinfo.st_size > 0 or not stat.S_ISREG(statinfo.st_mode):
raise RuntimeError(
'Expected {} to be an empty regular file'.format(path)
)
def do_container_runtime(self) -> None:
pv_version = ComponentVersion('pressure-vessel')
......@@ -783,6 +805,7 @@ class Main:
os.path.join(self.cache, runtime.tarball),
dest,
)
self.ensure_ref(dest)
if runtime.include_sdk:
if self.versioned_directories:
......@@ -814,6 +837,7 @@ class Main:
os.path.join(self.cache, runtime.sdk_tarball),
dest,
)
self.ensure_ref(dest)
argv = [
'tar',
......@@ -1293,6 +1317,9 @@ class Main:
writer.write(' '.join(fields) + '\n')
if '.ref' not in lc_names:
writer.write('./.ref type=file size=0 mode=644\n')
if differ_only_by_case:
writer.write('\n')
writer.write('# Files whose names differ only by case:\n')
......
......@@ -214,6 +214,11 @@ for dir in depots/test-soldier-local/soldier*; do
fi
done
if ! [ -f "depots/test-soldier-local/$run_dir/files/.ref" ]; then
echo "Bail out! files/.ref not created"
exit 1
fi
echo "ok 3 - soldier, running from local builds"
rm -fr depots/test-soldier-unversioned
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment