Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
25.3.1
* Create target folder before extracting tar files
* Work around Debian sometimes keeping around files

25.3.0
* Unpack or copy over additional folders besides __root__ in layer-update
* Allow switching over to using tars for layer source without changing the
Expand Down
10 changes: 9 additions & 1 deletion perfact/zodbsync/subcommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,27 @@ def unpack_source(src, tgt):
unpacked, both removing superfluous files in the target.
"""
targetitems = []
for entry in os.listdir(src):
srcitems = os.listdir(src)
for entry in srcitems:
if entry.startswith('.'):
continue
path = f'{src}/{entry}'
if os.path.isdir(path):
# p.e. __root__ or __schema__ as folders
# Sometimes, there might be some residual folder with .dpkg-new
# files or similar, even though this is now supplied as file.
other = [other for other in srcitems
if other.startswith(entry) and other != entry]
if other:
continue
targetitems.append(entry)
cmd = ['rsync', '-a', '--delete-during',
f'{path}/', f'{tgt}/{entry}/']
else:
# p.e. __root__.tar.gz -> Unpack to __root__/
basename = entry.split('.')[0]
targetitems.append(basename)
os.makedirs(f'{tgt}/{basename}', exist_ok=True)
cmd = ['tar', 'xf', path, '-C', f'{tgt}/{basename}/',
'--recursive-unlink']
subprocess.run(cmd, check=True)
Expand Down