Add the file_md5 to the download function so it can cache and verify
This commit is contained in:
parent
a1ead29734
commit
05cf792b26
@ -216,8 +216,7 @@ class DBRevision:
|
||||
to_delete = []
|
||||
if current_rev:
|
||||
old_files = {
|
||||
e["name"]: f"{entry['md5']}-{entry['size']}"
|
||||
for e in current_rev.files_list(db)
|
||||
e["name"]: f"{e['md5']}-{e['size']}" for e in current_rev.files_list(db)
|
||||
}
|
||||
else:
|
||||
old_files = dict()
|
||||
|
@ -66,6 +66,7 @@ class GitExporter:
|
||||
name,
|
||||
revision.srcmd5,
|
||||
self.git.path,
|
||||
file_md5=file_md5,
|
||||
)
|
||||
# Validate the MD5 of the downloaded file
|
||||
if md5(self.git.path / name) != file_md5:
|
||||
@ -137,7 +138,7 @@ class GitExporter:
|
||||
if not self.limit_download(file):
|
||||
continue
|
||||
self.git.remove(file)
|
||||
for file in to_download:
|
||||
for file, md5 in to_download:
|
||||
if not self.limit_download(file):
|
||||
continue
|
||||
self.obs.download(
|
||||
@ -146,6 +147,7 @@ class GitExporter:
|
||||
file,
|
||||
flat.commit.expanded_srcmd5,
|
||||
self.git.path,
|
||||
file_md5=md5,
|
||||
)
|
||||
self.git.add(file)
|
||||
|
||||
|
@ -152,7 +152,13 @@ class OBS:
|
||||
return osc.core.http_GET(url)
|
||||
|
||||
def download(
|
||||
self, project: str, package: str, name: str, revision: str, dirpath: str
|
||||
self,
|
||||
project: str,
|
||||
package: str,
|
||||
name: str,
|
||||
revision: str,
|
||||
dirpath: str,
|
||||
file_md5: str,
|
||||
) -> None:
|
||||
with (dirpath / name).open("wb") as f:
|
||||
f.write(self._download(project, package, name, revision).read())
|
||||
|
Loading…
Reference in New Issue
Block a user