Page MenuHomePhorge

D251.1765197072.diff
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

D251.1765197072.diff

diff --git a/lilybuild/lilybuild/ci_steps.py b/lilybuild/lilybuild/ci_steps.py
--- a/lilybuild/lilybuild/ci_steps.py
+++ b/lilybuild/lilybuild/ci_steps.py
@@ -137,6 +137,7 @@
'base_dir': base_dir,
'content': paths,
'items_to_exclude': exclude,
+ 'compression': 'gz',
}),
workdir=self.work_root_dir,
doStepIf=doStepIf,
@@ -214,6 +215,8 @@
doStepIf=on_success,
haltOnFailure=False,
flunkOnFailure=False,
+ # https://github.com/buildbot/buildbot/issues/3709
+ blocksize=256 * 1024,
)
unarchive_job = steps.ShellCommand(
diff --git a/lilybuild/lilybuild/safetar.py b/lilybuild/lilybuild/safetar.py
--- a/lilybuild/lilybuild/safetar.py
+++ b/lilybuild/lilybuild/safetar.py
@@ -179,10 +179,14 @@
# as the data_filter seems intended only for extraction.
return member
-def create(archive_file, base_dir, content, limit_bytes, items_to_exclude):
+def create(archive_file, base_dir, content, limit_bytes, items_to_exclude, compression=None):
base_dir = os.path.abspath(base_dir)
+ open_mode = 'w'
+ if compression == 'gz':
+ open_mode = 'w:gz'
+
try:
- with tarfile.open(archive_file, 'w') as tf:
+ with tarfile.open(archive_file, open_mode) as tf:
tf.errorlevel = 1
archive_filter = ArchiveFilter(
base_dir,
@@ -225,7 +229,8 @@
a['base_dir'],
a['content'],
a.get('limit_bytes'),
- a.get('items_to_exclude')
+ a.get('items_to_exclude'),
+ a.get('compression'),
)
except RuntimeError as e:
print('Cannot create archive:', e)
diff --git a/lilybuild/lilybuild/tests/safetar_test_worker.py b/lilybuild/lilybuild/tests/safetar_test_worker.py
--- a/lilybuild/lilybuild/tests/safetar_test_worker.py
+++ b/lilybuild/lilybuild/tests/safetar_test_worker.py
@@ -53,6 +53,21 @@
os.makedirs(target)
extract(target, archive)
+ def test_create_compression(self):
+ with tempfile.TemporaryDirectory() as dir_name:
+ make_artifact_dir(dir_name)
+ archive = os.path.join(dir_name, 'artifacts.tar')
+ create(archive, dir_name, ['public', 'other'], None, None, 'gz')
+ with tarfile.open(archive, 'r:gz') as f:
+ f.getmember('public/a')
+ f.getmember('other/a')
+ with tarfile.open(archive, 'r') as f:
+ f.getmember('public/a')
+ f.getmember('other/a')
+ target = os.path.join(dir_name, 'extracts')
+ os.makedirs(target)
+ extract(target, archive)
+
def test_create_glob(self):
with tempfile.TemporaryDirectory() as dir_name:
make_artifact_dir(dir_name)

File Metadata

Mime Type
text/plain
Expires
Mon, Dec 8, 4:31 AM (5 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
703805
Default Alt Text
D251.1765197072.diff (2 KB)

Event Timeline