mirror of
https://github.com/tuna/tunasync-scripts.git
synced 2025-04-20 04:12:42 +00:00
apt-sync: fix deep pkgidx_file download error: no parent dir
only dist_tmp_dir, comp_tmp_dir and pkgidx_tmp_dir are created and garbage collected, for deep pkgidx_file like main/dep11/by-hash/MD5Sum/0af5c69679a24671cfd7579095a9cb5e, its tmp parent dir (we call it deep_tmp_dir) should be created, at main/dep11/.tmp/by-hash/MD5Sum/0af5c69679a24671cfd7579095a9cb5e
This commit is contained in:
parent
541a6fb68e
commit
2543b0fc0b
10
apt-sync.py
10
apt-sync.py
@ -145,7 +145,17 @@ def apt_mirror(base_url: str, dist: str, repo: str, arch: str, dest_base_dir: Pa
|
||||
filename.startswith(f"{repo}/Contents-{arch}") or \
|
||||
filename.startswith(f"Contents-{arch}"):
|
||||
fn = Path(filename)
|
||||
if len(fn.parts) <= 3:
|
||||
# Contents-amd64.gz
|
||||
# main/Contents-amd64.gz
|
||||
# main/binary-all/Packages
|
||||
pkgidx_file = dist_dir / fn.parent / ".tmp" / fn.name
|
||||
else:
|
||||
# main/dep11/by-hash/MD5Sum/0af5c69679a24671cfd7579095a9cb5e
|
||||
# deep_tmp_dir is in pkgidx_tmp_dir hence no extra garbage collection needed
|
||||
deep_tmp_dir = dist_dir / Path(fn.parts[0]) / Path(fn.parts[1]) / ".tmp" / Path('/'.join(fn.parts[2:-1]))
|
||||
deep_tmp_dir.mkdir(parents=True, exist_ok=True)
|
||||
pkgidx_file = deep_tmp_dir / fn.name
|
||||
else:
|
||||
print(f"Ignore the file {filename}")
|
||||
continue
|
||||
|
Loading…
x
Reference in New Issue
Block a user