pkgdownload: fixups and typechecks
This commit is contained in:
parent
657ada4c73
commit
ea7df92b7f
2 changed files with 7 additions and 6 deletions
|
@ -47,7 +47,7 @@ def get_base_distro(arch: str) -> Distro:
|
||||||
return Distro(arch=arch, repo_infos=repos, scan=False)
|
return Distro(arch=arch, repo_infos=repos, scan=False)
|
||||||
|
|
||||||
|
|
||||||
def get_kupfer(arch: str, url_template: str) -> Distro:
|
def get_kupfer(arch: str, url_template: str, scan: bool = False) -> Distro:
|
||||||
repos = {name: RepoInfo(url_template=url_template, options={'SigLevel': 'Never'}) for name in REPOSITORIES}
|
repos = {name: RepoInfo(url_template=url_template, options={'SigLevel': 'Never'}) for name in REPOSITORIES}
|
||||||
return Distro(
|
return Distro(
|
||||||
arch=arch,
|
arch=arch,
|
||||||
|
@ -55,8 +55,8 @@ def get_kupfer(arch: str, url_template: str) -> Distro:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_kupfer_https(arch: str) -> Distro:
|
def get_kupfer_https(arch: str, scan: bool = False) -> Distro:
|
||||||
return get_kupfer(arch, KUPFER_HTTPS.replace('%branch%', config.file['pacman']['repo_branch']))
|
return get_kupfer(arch, KUPFER_HTTPS.replace('%branch%', config.file['pacman']['repo_branch']), scan)
|
||||||
|
|
||||||
|
|
||||||
def get_kupfer_local(arch: Optional[str] = None, in_chroot: bool = True) -> Distro:
|
def get_kupfer_local(arch: Optional[str] = None, in_chroot: bool = True) -> Distro:
|
||||||
|
|
|
@ -7,7 +7,7 @@ import subprocess
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from joblib import Parallel, delayed
|
from joblib import Parallel, delayed
|
||||||
from glob import glob
|
from glob import glob
|
||||||
from urllib import HTTPError
|
from urllib.error import HTTPError
|
||||||
from urllib.request import urlopen
|
from urllib.request import urlopen
|
||||||
from shutil import rmtree, copyfileobj
|
from shutil import rmtree, copyfileobj
|
||||||
from typing import Iterable, Iterator, Any, Optional
|
from typing import Iterable, Iterator, Any, Optional
|
||||||
|
@ -375,7 +375,8 @@ def try_download_package(dest_file_path: str, package: Pkgbuild, arch: Arch) ->
|
||||||
logging.debug(f"package filenames don't match: local: {filename}, remote: {repo_pkg.filename}")
|
logging.debug(f"package filenames don't match: local: {filename}, remote: {repo_pkg.filename}")
|
||||||
return False
|
return False
|
||||||
# url = f"{repo.resolve_url()}/{filename}"
|
# url = f"{repo.resolve_url()}/{filename}"
|
||||||
url = repo_pkg.resolved_url()
|
url = repo_pkg.resolved_url
|
||||||
|
assert url
|
||||||
try:
|
try:
|
||||||
logging.debug(f"Trying to retrieve remote package {filename} from {url}")
|
logging.debug(f"Trying to retrieve remote package {filename} from {url}")
|
||||||
with urlopen(url) as fsrc, open(dest_file_path, 'wb') as fdst:
|
with urlopen(url) as fsrc, open(dest_file_path, 'wb') as fdst:
|
||||||
|
@ -423,7 +424,7 @@ def check_package_version_built(package: Pkgbuild, arch: Arch, try_download: boo
|
||||||
if not filename_stripped.endswith('.pkg.tar'):
|
if not filename_stripped.endswith('.pkg.tar'):
|
||||||
logging.debug(f'skipping unknown file extension {basename}')
|
logging.debug(f'skipping unknown file extension {basename}')
|
||||||
continue
|
continue
|
||||||
if os.path.exists(file) or (try_download and try_download_package(file, package.repo, arch)):
|
if os.path.exists(file) or (try_download and try_download_package(file, package, arch)):
|
||||||
missing = False
|
missing = False
|
||||||
add_file_to_repo(file, repo_name=package.repo, arch=arch)
|
add_file_to_repo(file, repo_name=package.repo, arch=arch)
|
||||||
# copy arch=(any) packages to all arches
|
# copy arch=(any) packages to all arches
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue