mirror of
https://gitlab.com/kupfer/kupferbootstrap.git
synced 2025-02-23 05:35:44 -05:00
packages: try_download_package(): check pacman cache if file in db but doesn't exist in db folder
This commit is contained in:
parent
4c5fe2cb1c
commit
a0c4036390
1 changed files with 15 additions and 1 deletions
|
@ -290,7 +290,8 @@ def try_download_package(dest_file_path: str, package: Pkgbuild, arch: Arch) ->
|
||||||
return None
|
return None
|
||||||
repo_pkg: RemotePackage = repo.packages[pkgname]
|
repo_pkg: RemotePackage = repo.packages[pkgname]
|
||||||
if repo_pkg.version != package.version:
|
if repo_pkg.version != package.version:
|
||||||
logging.debug(f"Package {pkgname} versions differ: local: {package.version}, remote: {repo_pkg.version}. Building instead.")
|
logging.debug(f"Package {pkgname} versions differ: local: {package.version}, "
|
||||||
|
f"remote: {repo_pkg.version}. Building instead.")
|
||||||
return None
|
return None
|
||||||
if repo_pkg.filename != filename:
|
if repo_pkg.filename != filename:
|
||||||
versions_str = f"local: {filename}, remote: {repo_pkg.filename}"
|
versions_str = f"local: {filename}, remote: {repo_pkg.filename}"
|
||||||
|
@ -298,6 +299,19 @@ def try_download_package(dest_file_path: str, package: Pkgbuild, arch: Arch) ->
|
||||||
logging.debug(f"package filenames don't match: {versions_str}")
|
logging.debug(f"package filenames don't match: {versions_str}")
|
||||||
return None
|
return None
|
||||||
logging.debug(f"ignoring compression extension difference: {versions_str}")
|
logging.debug(f"ignoring compression extension difference: {versions_str}")
|
||||||
|
cache_file = os.path.join(config.get_path('pacman'), arch, repo_pkg.filename)
|
||||||
|
if os.path.exists(cache_file):
|
||||||
|
if not repo_pkg._desc or 'SHA256SUM' not in repo_pkg._desc:
|
||||||
|
cache_matches = False
|
||||||
|
extra_msg = ". However, we can't validate it, as the https repo doesnt provide a SHA256SUM for it."
|
||||||
|
else:
|
||||||
|
cache_matches = sha256sum(cache_file) == repo_pkg._desc['SHA256SUM']
|
||||||
|
extra_msg = (". However its checksum doesn't match." if not cache_matches else " and its checksum matches.")
|
||||||
|
logging.debug(f"While checking the HTTPS repo DB, we found a matching filename in the pacman cache{extra_msg}")
|
||||||
|
if cache_matches:
|
||||||
|
logging.info(f'copying cache file {cache_file} to repo as verified by remote checksum')
|
||||||
|
shutil.move(cache_file, dest_file_path)
|
||||||
|
return dest_file_path
|
||||||
url = repo_pkg.resolved_url
|
url = repo_pkg.resolved_url
|
||||||
assert url
|
assert url
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Reference in a new issue