extras-buildsys/server Config.py,1.12,1.13 PackageJob.py,1.43,1.44
Daniel Williams (dcbw)
fedora-extras-commits at redhat.com
Mon Mar 13 03:45:56 UTC 2006
Author: dcbw
Update of /cvs/fedora/extras-buildsys/server
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv5384/server
Modified Files:
Config.py PackageJob.py
Log Message:
2006-03-12 Dan Williams <dcbw at redhat.com>
Fix up kmod support.
* server/Config.py
- Fix splitting of arches for Additonal Package Arches
- Use wildcard matching (*, ?, [...], [!...]) for package names in
Additional Package Arches so we can support kmods easily
* server/PackageJob.py
- Add lots of comments in arch_handling() so people can tell what's
going on
Index: Config.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/server/Config.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- Config.py 1 Dec 2005 03:17:25 -0000 1.12
+++ Config.py 13 Mar 2006 03:45:48 -0000 1.13
@@ -15,6 +15,7 @@
# Copyright 2005 Dan Williams <dcbw at redhat.com> and Red Hat, Inc.
import os
+import fnmatch
from ConfigParser import ConfigParser
from plague import BaseConfig
@@ -166,6 +167,7 @@
self._testing = self.get_bool("General", "testing")
self._mock_configs = self._find_mock_configs()
+ self._addl_pkg_arches = self._get_addl_pkg_arches()
def _find_mock_configs(self):
mock_configs = {}
@@ -215,7 +217,7 @@
def testing(self):
return self._testing
- def addl_pkg_arches(self):
+ def _get_addl_pkg_arches(self):
if not self._config.has_section("Additional Package Arches"):
return {}
items = self._config.items("Additional Package Arches")
@@ -224,12 +226,20 @@
if type(arches) != type("") or not len(arches):
continue
try:
- l = opt.split()
- except Exception:
+ l = arches.split()
+ except Exception, e:
continue
addl_arches[pkg] = l
return addl_arches
+ def addl_arches_for_pkg(self, name):
+ # Match package name against Additional Package Arches
+ # entries, taking wildcards into account
+ for item in self._addl_pkg_arches.keys():
+ if fnmatch.fnmatchcase(name, item):
+ return self._addl_pkg_arches[item]
+ return []
+
def save_default_config(self, filename=None):
self.add_section("General")
self.set_option("General", "distro", "fedora")
Index: PackageJob.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/server/PackageJob.py,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- PackageJob.py 26 Feb 2006 17:00:46 -0000 1.43
+++ PackageJob.py 13 Mar 2006 03:45:48 -0000 1.44
@@ -207,16 +207,15 @@
return self.uid
def arch_handling(self, hdr):
- addl_arches = []
- try:
- addl_arches = self._target_cfg.addl_pkg_arches()[self.name]
- except KeyError:
- pass
+ # Grab additional allowed arches for this package, using
+ # wildcard matching if needed
+ addl_arches = self._target_cfg.addl_arches_for_pkg(self.name)
+ # Grab list of base arches (like i386, ppc, x86_64) that this
+ # buildsys supports. NOT subarch variants like i686, i586, ppc32, etc.
base_arches = self._target_cfg.basearches()
- opt_arches = self._target_cfg.optarches()
- # Remove arches we don't support from addl_arches
+ # Remove arches the buildsys doesn't support from addl_arches
for arch in addl_arches:
# ArchUtils.sub_arches is only used to determine which arches to build on by default,
# so that if we have an Additional Package Arches that specifies
@@ -227,45 +226,63 @@
if master_addl_arch not in base_arches:
addl_arches.remove(arch)
+ # Grab arches the SRPM does/does not want to build for. If the package
+ # does use one or more of these tags in the specfile, hdr['<tag>'] will
+ # return an empty list, and we'll use defaults instead
ba = hdr['buildarchs']
exclusive = hdr['exclusivearch']
exclude = hdr['excludearch']
build_arches = {}
+ # If the SRPM is noarch, there's nothing left to do, since
+ # it can build on any architecture the builders support
if ba == ['noarch']:
build_arches['noarch'] = None
return (build_arches, None, None)
- # default to building all base arches the 'target'
+ # default to building all base arches the target
# supports, and any additional arches from the
# Additional Package Arches file whose "master" arch
# is enabled for this target
- pkg_arches = []
- allowed_arches = []
+ pkg_arches = [] # Arches the package wants to build for
+ allowed_arches = [] # Arches the buildsys allows
+
+ # Add all base architectures the buildsys supports
for arch in base_arches:
pkg_arches.append(arch)
allowed_arches.append(arch)
+
+ # Add additional per-package architectures from Additional
+ # Package Architectures configuration option
for arch in addl_arches:
pkg_arches.append(arch)
allowed_arches.append(arch)
- # Optional arches don't get built by default but are "allowed"
+
+ # Allow building on any optional architectures the buildsystem
+ # supports, but don't build for them unless the package
+ # requests it
+ opt_arches = self._target_cfg.optarches()
for arch in opt_arches:
allowed_arches.append(arch)
if ba:
+ # If the package specifies a set of arches with
+ # BuildArch, use those rather than the default set
pkg_arches = ba
- else:
- if exclusive:
- pkg_arches = exclusive
+ elif exclusive:
+ # If the package specifies a set of arches with
+ # ExclusiveArch, use those rather than the default set
+ pkg_arches = exclusive
+ # Filter out any arches the package explicitly excludes
if exclude:
for arch in exclude:
if arch in pkg_arches:
pkg_arches.remove(arch)
- # we probably need to check the archs, and make sure they are what
- # we can build for
+ # Filter the final list of arches the package will build on
+ # through the list of arches this buildsys allows
for thisarch in pkg_arches:
if thisarch in allowed_arches:
build_arches[thisarch] = None
More information about the fedora-extras-commits
mailing list