print package count

This commit is contained in:
z4yx 2020-04-19 20:00:34 +08:00
parent eb26bf3f4f
commit 518d14334b

View File

@ -168,6 +168,7 @@ def apt_mirror(base_url: str, dist: str, repo: str, arch: str, dest_base_dir: Pa
# Download packages # Download packages
err = 0 err = 0
deb_count = 0 deb_count = 0
deb_size = 0
for pkg in pkgidx_content.split('\n\n'): for pkg in pkgidx_content.split('\n\n'):
if len(pkg) < 10: # ignore blanks if len(pkg) < 10: # ignore blanks
continue continue
@ -209,6 +210,7 @@ def apt_mirror(base_url: str, dist: str, repo: str, arch: str, dest_base_dir: Pa
print(f"Failed to download {dest_filename}") print(f"Failed to download {dest_filename}")
err = 1 err = 1
deb_count += 1 deb_count += 1
deb_size += pkg_size
# if deb_count == 2: # if deb_count == 2:
# break # break
try: try:
@ -224,6 +226,7 @@ def apt_mirror(base_url: str, dist: str, repo: str, arch: str, dest_base_dir: Pa
return 1 return 1
print(f"Mirroring {base_url} {dist}, {repo}, {arch} done!") print(f"Mirroring {base_url} {dist}, {repo}, {arch} done!")
print(f"{deb_count} packages, {deb_size} bytes in total")
return err return err
def main(): def main():