Add langpacks support.
This commit is contained in:
parent
5069eb8b09
commit
cd75bc4875
@ -341,7 +341,6 @@ class Pungi(pypungi.PungiBase):
|
|||||||
def getPackageDeps(self, po):
|
def getPackageDeps(self, po):
|
||||||
"""Add the dependencies for a given package to the
|
"""Add the dependencies for a given package to the
|
||||||
transaction info"""
|
transaction info"""
|
||||||
|
|
||||||
if po in self.seen_pkgs:
|
if po in self.seen_pkgs:
|
||||||
return
|
return
|
||||||
self.seen_pkgs[po] = None
|
self.seen_pkgs[po] = None
|
||||||
@ -352,6 +351,9 @@ class Pungi(pypungi.PungiBase):
|
|||||||
provs = po.provides
|
provs = po.provides
|
||||||
added = []
|
added = []
|
||||||
|
|
||||||
|
# get langpacks for each processed package
|
||||||
|
added.extend(self.getLangpacks(po))
|
||||||
|
|
||||||
for req in reqs:
|
for req in reqs:
|
||||||
if self.resolved_deps.has_key(req):
|
if self.resolved_deps.has_key(req):
|
||||||
continue
|
continue
|
||||||
@ -398,6 +400,34 @@ class Pungi(pypungi.PungiBase):
|
|||||||
for add in added:
|
for add in added:
|
||||||
self.getPackageDeps(add)
|
self.getPackageDeps(add)
|
||||||
|
|
||||||
|
def getLangpacks(self, po):
|
||||||
|
added = []
|
||||||
|
|
||||||
|
# get all langpacks matching the package name
|
||||||
|
langpacks = [ i for i in self.langpacks if i["name"] == po.name ]
|
||||||
|
if not langpacks:
|
||||||
|
return []
|
||||||
|
|
||||||
|
for langpack in langpacks:
|
||||||
|
pattern = langpack["install"] % "*" # replace '%s' with '*'
|
||||||
|
exactmatched, matched, unmatched = yum.packages.parsePackages(self.pkgs, [pattern], casematch=1, pkgdict=self.pkg_refs.copy())
|
||||||
|
matches = filter(self._filtersrcdebug, exactmatched + matched)
|
||||||
|
matches = [ i for i in matches if not i.name.endswith("-devel") and not i.name.endswith("-static") and i.name != "man-pages-overrides" ]
|
||||||
|
matches = [ i for i in matches if fnmatch(i.name, pattern) ]
|
||||||
|
|
||||||
|
packages_by_name = {}
|
||||||
|
for i in matches:
|
||||||
|
packages_by_name.setdefault(i.name, []).append(i)
|
||||||
|
|
||||||
|
for i, pkg_sack in packages_by_name.iteritems():
|
||||||
|
pkg_sack = self.excludePackages(pkg_sack)
|
||||||
|
match = self.ayum._bestPackageFromList(pkg_sack)
|
||||||
|
self.ayum.tsInfo.addInstall(match)
|
||||||
|
added.append(match)
|
||||||
|
self.logger.info('Added langpack %s.%s for package %s (pattern: %s)' % (match.name, match.arch, po.name, pattern))
|
||||||
|
|
||||||
|
return added
|
||||||
|
|
||||||
def getPackagesFromGroup(self, group):
|
def getPackagesFromGroup(self, group):
|
||||||
"""Get a list of package names from a ksparser group object
|
"""Get a list of package names from a ksparser group object
|
||||||
|
|
||||||
@ -468,6 +498,17 @@ class Pungi(pypungi.PungiBase):
|
|||||||
self.pkgs = self.ayum.pkgSack.returnPackages()
|
self.pkgs = self.ayum.pkgSack.returnPackages()
|
||||||
self.pkg_refs = yum.packages.buildPkgRefDict(self.pkgs, casematch=True)
|
self.pkg_refs = yum.packages.buildPkgRefDict(self.pkgs, casematch=True)
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.langpacks = list(self.ayum.comps.langpacks)
|
||||||
|
except AttributeError:
|
||||||
|
# old yum
|
||||||
|
self.logger.warning("Could not get langpacks via yum.comps. You may need to update yum.")
|
||||||
|
self.langpacks = []
|
||||||
|
except yum.Errors.GroupsError:
|
||||||
|
# no groups or no comps at all
|
||||||
|
self.logger.warning("Could not get langpacks due to missing comps in repodata or --ignoregroups=true option.")
|
||||||
|
self.langpacks = []
|
||||||
|
|
||||||
# First remove the excludes
|
# First remove the excludes
|
||||||
self.ayum.excludePackages()
|
self.ayum.excludePackages()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user