mirror of
https://github.com/tuna/tunasync-scripts.git
synced 2025-04-20 04:12:42 +00:00
skip invalid package index files (tuna/issues#844)
This commit is contained in:
parent
8337721aee
commit
924403f204
10
apt-sync.py
10
apt-sync.py
@ -150,11 +150,13 @@ def apt_mirror(base_url: str, dist: str, repo: str, arch: str, dest_base_dir: Pa
|
|||||||
|
|
||||||
with pkgidx_file.open('rb') as t: content = t.read()
|
with pkgidx_file.open('rb') as t: content = t.read()
|
||||||
if len(content) != int(filesize):
|
if len(content) != int(filesize):
|
||||||
print(f"Invalid size of {pkgidx_file}, expected {filesize}")
|
print(f"Invalid size of {pkgidx_file}, expected {filesize}, skipped")
|
||||||
return 1
|
pkgidx_file.unlink()
|
||||||
|
continue
|
||||||
if hashlib.sha256(content).hexdigest() != checksum:
|
if hashlib.sha256(content).hexdigest() != checksum:
|
||||||
print(f"Invalid checksum of {pkgidx_file}, expected {checksum}")
|
print(f"Invalid checksum of {pkgidx_file}, expected {checksum}, skipped")
|
||||||
return 1
|
pkgidx_file.unlink()
|
||||||
|
continue
|
||||||
if pkgidx_content is None and pkgidx_file.stem == 'Packages':
|
if pkgidx_content is None and pkgidx_file.stem == 'Packages':
|
||||||
print(f"getting packages index content from {pkgidx_file.name}", flush=True)
|
print(f"getting packages index content from {pkgidx_file.name}", flush=True)
|
||||||
suffix = pkgidx_file.suffix
|
suffix = pkgidx_file.suffix
|
||||||
|
Loading…
x
Reference in New Issue
Block a user