From 09d70858d5633c20ca08d6b0ca5261abaccd12c7 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Mon, 8 Jul 2019 21:32:13 +0000 Subject: [PATCH] Add builder architecture check. All available architectures in the current builder are collected and packages for architectures which are not supported in the current builder instance are culled. This is a much easier way to eliminate architectures that depend only on a given debian suite than specifying the dists: key in the package file. The dists keys are still used for packages which have additional restrictions (like kernels too old to compile with newer toolchains, even if the architecture itself is supported). --- tools/onlpm.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tools/onlpm.py b/tools/onlpm.py index 805b7162..8b7806c2 100755 --- a/tools/onlpm.py +++ b/tools/onlpm.py @@ -546,6 +546,12 @@ class OnlPackageGroup(object): return False return True + def buildercheck(self, builder_arches): + for p in self.packages: + if p.arch() not in builder_arches: + return False + return True + def prerequisite_packages(self): rv = [] for e in list(onlu.sflatten(self._pkgs.get('prerequisites', {}).get('packages', []))): @@ -978,9 +984,17 @@ class OnlPackageManager(object): return False + + def __builder_arches(self): + arches = [ 'all', 'amd64' ] + arches = arches + subprocess.check_output(['dpkg', '--print-foreign-architectures']).split() + return arches + def __build_cache(self, basedir): pkgspec = [ 'PKG.yml', 'pkg.yml' ] + builder_arches = self.__builder_arches() + for root, dirs, files in os.walk(basedir): for f in files: if f in pkgspec: @@ -992,7 +1006,7 @@ class OnlPackageManager(object): logger.debug('Loading package file %s...' % os.path.join(root, f)) pg.load(os.path.join(root, f)) logger.debug(' Loaded package file %s' % os.path.join(root, f)) - if pg.distcheck(): + if pg.distcheck() and pg.buildercheck(builder_arches): self.package_groups.append(pg) except OnlPackageError, e: logger.error("%s: " % e)