forked from adamm/git-importer
Change debug output for downloading files
This commit is contained in:
parent
834cf61634
commit
9114c2fff8
@ -1,6 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from hashlib import md5
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
@ -235,7 +234,6 @@ class DBRevision:
|
||||
If it's None, the repository is empty.
|
||||
"""
|
||||
to_download = []
|
||||
to_delete = []
|
||||
if current_rev:
|
||||
old_files = {
|
||||
e["name"]: f"{e['md5']}-{e['size']}" for e in current_rev.files_list()
|
||||
@ -244,12 +242,9 @@ class DBRevision:
|
||||
old_files = dict()
|
||||
for entry in self.files_list():
|
||||
if old_files.get(entry["name"]) != f"{entry['md5']}-{entry['size']}":
|
||||
logging.debug(f"Download {entry['name']}")
|
||||
to_download.append((Path(entry["name"]), entry["size"], entry["md5"]))
|
||||
old_files.pop(entry["name"], None)
|
||||
for entry in old_files.keys():
|
||||
logging.debug(f"Delete {entry}")
|
||||
to_delete.append(Path(entry))
|
||||
to_delete = [Path(e) for e in old_files.keys()]
|
||||
return to_download, to_delete
|
||||
|
||||
@staticmethod
|
||||
|
@ -168,6 +168,7 @@ class OBS:
|
||||
cached_file = self._path_from_md5(name, cachedir, file_md5)
|
||||
if not self.in_cache(name, cachedir, file_md5):
|
||||
with (dirpath / name).open("wb") as f:
|
||||
logging.debug(f"Download {project}/{package}/{name}")
|
||||
f.write(self._download(project, package, name, revision).read())
|
||||
|
||||
# Validate the MD5 of the downloaded file
|
||||
@ -178,6 +179,7 @@ class OBS:
|
||||
os.rename(cached_file.with_suffix(".new"), cached_file)
|
||||
else:
|
||||
shutil.copy(cached_file, dirpath / name)
|
||||
logging.debug(f"Use cached {project}/{package}/{name}")
|
||||
|
||||
def list(self, project, package, srcmd5, linkrev):
|
||||
params = {"rev": srcmd5, "expand": "1"}
|
||||
|
Loading…
Reference in New Issue
Block a user