packages: respect package arches before and during building
This commit is contained in:
parent
b6239a45ce
commit
32f5fe643f
2 changed files with 13 additions and 8 deletions
|
@ -85,11 +85,13 @@ def filter_packages(
|
||||||
use_paths=True,
|
use_paths=True,
|
||||||
use_names=True,
|
use_names=True,
|
||||||
) -> Iterable[Pkgbuild]:
|
) -> Iterable[Pkgbuild]:
|
||||||
|
if not (use_names or use_paths):
|
||||||
|
raise Exception('Error: filter_packages instructed to match neither by names nor paths; impossible!')
|
||||||
if not allow_empty_results and not paths:
|
if not allow_empty_results and not paths:
|
||||||
raise Exception("Can't search for packages: no query given")
|
raise Exception("Can't search for packages: no query given")
|
||||||
repo = repo or discover_pkgbuilds()
|
repo = repo or discover_pkgbuilds()
|
||||||
if 'all' in paths:
|
if 'all' in paths:
|
||||||
return list(repo.values())
|
return [pkg for pkg in repo.values() if set([arch, 'any']).intersection(pkg.arches)]
|
||||||
result = []
|
result = []
|
||||||
for pkg in repo.values():
|
for pkg in repo.values():
|
||||||
comparison = set()
|
comparison = set()
|
||||||
|
@ -268,7 +270,7 @@ def strip_compression_extension(filename: str):
|
||||||
for ext in ['zst', 'xz', 'gz', 'bz2']:
|
for ext in ['zst', 'xz', 'gz', 'bz2']:
|
||||||
if filename.endswith(f'.pkg.tar.{ext}'):
|
if filename.endswith(f'.pkg.tar.{ext}'):
|
||||||
return filename[:-(len(ext) + 1)]
|
return filename[:-(len(ext) + 1)]
|
||||||
logging.warning(f"file {filename} matches no known package extension")
|
logging.debug(f"file {filename} matches no known package extension")
|
||||||
return filename
|
return filename
|
||||||
|
|
||||||
|
|
||||||
|
@ -403,9 +405,8 @@ def setup_build_chroot(
|
||||||
chroot.mount_pkgbuilds()
|
chroot.mount_pkgbuilds()
|
||||||
if extra_packages:
|
if extra_packages:
|
||||||
chroot.try_install_packages(extra_packages, allow_fail=False)
|
chroot.try_install_packages(extra_packages, allow_fail=False)
|
||||||
if not os.path.exists(chroot.get_path('/home/kupfer')):
|
assert config.runtime.uid is not None
|
||||||
assert config.runtime.uid is not None
|
chroot.create_user('kupfer', password='12345678', uid=config.runtime.uid, non_unique=True)
|
||||||
chroot.create_user('kupfer', password='12345678', uid=config.runtime.uid, non_unique=True)
|
|
||||||
if not os.path.exists(chroot.get_path('/etc/sudoers.d/kupfer_nopw')):
|
if not os.path.exists(chroot.get_path('/etc/sudoers.d/kupfer_nopw')):
|
||||||
chroot.add_sudo_config('kupfer_nopw', 'kupfer', password_required=False)
|
chroot.add_sudo_config('kupfer_nopw', 'kupfer', password_required=False)
|
||||||
|
|
||||||
|
@ -529,15 +530,19 @@ def build_package(
|
||||||
def get_dependants(
|
def get_dependants(
|
||||||
repo: dict[str, Pkgbuild],
|
repo: dict[str, Pkgbuild],
|
||||||
packages: Iterable[Pkgbuild],
|
packages: Iterable[Pkgbuild],
|
||||||
|
arch: Arch,
|
||||||
recursive: bool = True,
|
recursive: bool = True,
|
||||||
) -> set[Pkgbuild]:
|
) -> set[Pkgbuild]:
|
||||||
names = set([pkg.name for pkg in packages])
|
names = set([pkg.name for pkg in packages])
|
||||||
to_add = set[Pkgbuild]()
|
to_add = set[Pkgbuild]()
|
||||||
for pkg in repo.values():
|
for pkg in repo.values():
|
||||||
if set.intersection(names, set(pkg.depends)):
|
if set.intersection(names, set(pkg.depends)):
|
||||||
|
if not set([arch, 'any']).intersection(pkg.arches):
|
||||||
|
logging.warn(f'get_dependants: skipping matched pkg {pkg.name} due to wrong arch: {pkg.arches}')
|
||||||
|
continue
|
||||||
to_add.add(pkg)
|
to_add.add(pkg)
|
||||||
if recursive and to_add:
|
if recursive and to_add:
|
||||||
to_add.update(get_dependants(repo, to_add))
|
to_add.update(get_dependants(repo, to_add, arch=arch))
|
||||||
return to_add
|
return to_add
|
||||||
|
|
||||||
|
|
||||||
|
@ -552,7 +557,7 @@ def get_unbuilt_package_levels(
|
||||||
repo = repo or discover_pkgbuilds()
|
repo = repo or discover_pkgbuilds()
|
||||||
dependants = set[Pkgbuild]()
|
dependants = set[Pkgbuild]()
|
||||||
if rebuild_dependants:
|
if rebuild_dependants:
|
||||||
dependants = get_dependants(repo, packages)
|
dependants = get_dependants(repo, packages, arch=arch)
|
||||||
package_levels = generate_dependency_chain(repo, set(packages).union(dependants))
|
package_levels = generate_dependency_chain(repo, set(packages).union(dependants))
|
||||||
build_names = set[str]()
|
build_names = set[str]()
|
||||||
build_levels = list[set[Pkgbuild]]()
|
build_levels = list[set[Pkgbuild]]()
|
||||||
|
|
|
@ -327,7 +327,7 @@ def discover_pkgbuilds(parallel: bool = True, lazy: bool = True) -> dict[str, Pk
|
||||||
_pkgbuilds_paths[pkglist[0].path] = pkglist
|
_pkgbuilds_paths[pkglist[0].path] = pkglist
|
||||||
results += pkglist
|
results += pkglist
|
||||||
|
|
||||||
logging.debug('Building package dictionary!')
|
logging.info('Building package dictionary')
|
||||||
for package in results:
|
for package in results:
|
||||||
for name in [package.name] + package.replaces:
|
for name in [package.name] + package.replaces:
|
||||||
if name in packages:
|
if name in packages:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue