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).
This commit is contained in:
Jeffrey Townsend
2019-07-08 21:32:13 +00:00
parent 631b1f88b4
commit 09d70858d5

View File

@@ -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)