Implement %prepopulate config section as an additional package input.

This commit is contained in:
Daniel Mach 2013-09-18 09:50:18 -04:00
parent 43c9185323
commit 8b1c2433c9
2 changed files with 87 additions and 8 deletions

View File

@ -215,7 +215,9 @@ class Pungi(pypungi.PungiBase):
self.sourcerpm_srpmpo_map = {}
# flags
self.input_packages = set() # packages specified in the input list (%packages section in kickstart)
self.input_packages = set() # packages specified in %packages kickstart section including those defined via comps groups
self.comps_packages = set() # packages specified in %packages kickstart section *indirectly* via comps groups
self.prepopulate_packages = set() # packages specified in %prepopulate kickstart section
self.fulltree_packages = set()
self.langpack_packages = set()
self.multilib_packages = set()
@ -697,13 +699,19 @@ class Pungi(pypungi.PungiBase):
for group in self._addDefaultGroups(excludeGroups):
self.ksparser.handler.packages.add(['@%s' % group])
# Get a list of packages from groups
comps_package_names = set()
for group in self.ksparser.handler.packages.groupList:
searchlist.extend(self.getPackagesFromGroup(group))
comps_package_names.update(self.getPackagesFromGroup(group))
searchlist.extend(sorted(comps_package_names))
# Add the adds
# Add packages
searchlist.extend(self.ksparser.handler.packages.packageList)
input_packages = searchlist[:]
# Add prepopulate packages
prepopulate_packages = self.ksparser.handler.prepopulate
searchlist.extend(prepopulate_packages)
# Make the search list unique
searchlist = yum.misc.unique(searchlist)
@ -745,11 +753,17 @@ class Pungi(pypungi.PungiBase):
# works for both "none" and "build" greedy methods
packages = [self.ayum._bestPackageFromList(packages)]
self.input_packages.update(packages)
if name in input_packages:
self.input_packages.update(packages)
if name in comps_package_names:
self.comps_packages.update(packages)
for po in packages:
msg = 'Found %s.%s' % (po.name, po.arch)
self.add_package(po, msg)
name_arch = "%s.%s" % (po.name, po.arch)
if name_arch in prepopulate_packages:
self.prepopulate_packages.add(po)
if not self.po_list:
raise RuntimeError("No packages found")
@ -1113,6 +1127,14 @@ class Pungi(pypungi.PungiBase):
if po in self.input_packages:
flags.append("input")
# comps
if po in self.comps_packages:
flags.append("comps")
# prepopulate
if po in self.prepopulate_packages:
flags.append("prepopulate")
# langpack
if po in self.langpack_packages:
flags.append("langpack")

View File

@ -2,16 +2,58 @@
"""
Kickstart syntax is extended with:
Pungi adds several new sections to kickstarts.
FULLTREE EXCLUDES
-----------------
Fulltree excludes allow us to define SRPM names
we don't want to be part of fulltree processing.
Syntax:
%fulltree-excludes
<srpm_name>
<srpm_name>
...
%end
Fulltree excludes allow us to define SRPM names
we don't want to be part of fulltree processing.
MULTILIB BLACKLIST
------------------
List of RPMs which are prevented from becoming multilib.
Syntax:
%multilib-blacklist
<rpm_name>
<rpm_name>
...
%end
MULTILIB WHITELIST
------------------
List of RPMs which will become multilib (but only if native package is pulled in).
Syntax:
%multilib-whitelist
<rpm_name>
<rpm_name>
...
%end
PREPOPULATE
-----------
To make sure no package is left behind between 2 composes,
we can explicitly add <name>.<arch> records to the %prepopulate section.
These will be added to the input list and marked with 'prepopulate' flag.
Syntax:
%prepopulate
<rpm_name>.<rpm_arch>
<rpm_name>.<rpm_arch>
...
%end
"""
@ -58,12 +100,26 @@ class MultilibWhitelistSection(pykickstart.sections.Section):
self.handler.multilib_whitelist.add(line)
class PrepopulateSection(pykickstart.sections.Section):
sectionOpen = "%prepopulate"
def handleLine(self, line):
if not self.handler:
return
(h, s, t) = line.partition('#')
line = h.rstrip()
self.handler.prepopulate.add(line)
class KickstartParser(pykickstart.parser.KickstartParser):
def setupSections(self):
pykickstart.parser.KickstartParser.setupSections(self)
self.registerSection(FulltreeExcludesSection(self.handler))
self.registerSection(MultilibBlacklistSection(self.handler))
self.registerSection(MultilibWhitelistSection(self.handler))
self.registerSection(PrepopulateSection(self.handler))
HandlerClass = pykickstart.version.returnClassForVersion()
@ -73,6 +129,7 @@ class PungiHandler(HandlerClass):
self.fulltree_excludes = set()
self.multilib_blacklist = set()
self.multilib_whitelist = set()
self.prepopulate = set()
def get_ksparser(ks_path=None):