- Rework how source rpms are pulled in
Always pull in 'src' packages, filter when not needed
This commit is contained in:
parent
6612ec39ba
commit
c7e5e94eac
@ -1,3 +1,8 @@
|
|||||||
|
* Tue Aug 21 2007 Jesse Keating <jkeating@redhat.com>
|
||||||
|
- Rework how source rpms are pulled in
|
||||||
|
Always pull in 'src' arch packages, just filter them
|
||||||
|
when not needed. Saves having to reset or create new
|
||||||
|
yum objects.
|
||||||
* Wed Aug 15 2007 Jesse Keating <jkeating@redhat.com>
|
* Wed Aug 15 2007 Jesse Keating <jkeating@redhat.com>
|
||||||
- Create a base pungi class that sets logging
|
- Create a base pungi class that sets logging
|
||||||
- Inherit this class in Gather and Pungi
|
- Inherit this class in Gather and Pungi
|
||||||
|
@ -93,8 +93,17 @@ class Gather(pypungi.PungiBase):
|
|||||||
#self.doSackSetup(arches)
|
#self.doSackSetup(arches)
|
||||||
#self.doSackSetup(archlist=arches) # work around temp break in yum api
|
#self.doSackSetup(archlist=arches) # work around temp break in yum api
|
||||||
#self.doSackFilelistPopulate()
|
#self.doSackFilelistPopulate()
|
||||||
|
arches.append('src') # throw source in there, filter it later
|
||||||
self.ayum._getSacks(archlist=arches)
|
self.ayum._getSacks(archlist=arches)
|
||||||
|
|
||||||
|
def _filtersrc(self, po):
|
||||||
|
"""Filter out package objects that are of 'src' arch."""
|
||||||
|
|
||||||
|
if po.arch == 'src':
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def verifyCachePkg(self, po, path): # Stolen from yum
|
def verifyCachePkg(self, po, path): # Stolen from yum
|
||||||
"""check the package checksum vs the cache
|
"""check the package checksum vs the cache
|
||||||
return True if pkg is good, False if not"""
|
return True if pkg is good, False if not"""
|
||||||
@ -188,7 +197,7 @@ class Gather(pypungi.PungiBase):
|
|||||||
for condreq, cond in groupobj.conditional_packages.iteritems():
|
for condreq, cond in groupobj.conditional_packages.iteritems():
|
||||||
pkgs = self.ayum.pkgSack.searchNevra(name=condreq)
|
pkgs = self.ayum.pkgSack.searchNevra(name=condreq)
|
||||||
if pkgs:
|
if pkgs:
|
||||||
pkgs = self.ayum.bestPackagesFromList(pkgs)
|
pkgs = self.ayum.bestPackagesFromList(pkgs, arch=self.ayum.compatarch)
|
||||||
if self.ayum.tsInfo.conditionals.has_key(cond):
|
if self.ayum.tsInfo.conditionals.has_key(cond):
|
||||||
self.ayum.tsInfo.conditionals[cond].extend(pkgs)
|
self.ayum.tsInfo.conditionals[cond].extend(pkgs)
|
||||||
else:
|
else:
|
||||||
@ -245,7 +254,7 @@ class Gather(pypungi.PungiBase):
|
|||||||
|
|
||||||
# Search repos for things in our searchlist, supports globs
|
# Search repos for things in our searchlist, supports globs
|
||||||
(exactmatched, matched, unmatched) = yum.packages.parsePackages(self.ayum.pkgSack.returnPackages(), searchlist, casematch=1)
|
(exactmatched, matched, unmatched) = yum.packages.parsePackages(self.ayum.pkgSack.returnPackages(), searchlist, casematch=1)
|
||||||
matches = exactmatched + matched
|
matches = filter(self._filtersrc, exactmatched + matched)
|
||||||
|
|
||||||
# Populate a dict of package objects to their names
|
# Populate a dict of package objects to their names
|
||||||
for match in matches:
|
for match in matches:
|
||||||
@ -358,16 +367,17 @@ class Gather(pypungi.PungiBase):
|
|||||||
#self.doSackSetup(archlist=['src'])
|
#self.doSackSetup(archlist=['src'])
|
||||||
|
|
||||||
# Make a new yum object
|
# Make a new yum object
|
||||||
syum = yum.YumBase()
|
#syum = yum.YumBase()
|
||||||
syum.doConfigSetup(fn=self.config.get('default', 'yumconf'), debuglevel=6, errorlevel=6, root=os.path.join(self.workdir, 'yumroot'))
|
#syum.doConfigSetup(fn=self.config.get('default', 'yumconf'), debuglevel=6, errorlevel=6, root=os.path.join(self.workdir, 'yumroot'))
|
||||||
syum.doRepoSetup()
|
#syum.doRepoSetup()
|
||||||
|
|
||||||
syum._getSacks(archlist=['src'])
|
#syum._getSacks(archlist=['src'])
|
||||||
|
|
||||||
for srpm in self.srpmlist:
|
for srpm in self.srpmlist:
|
||||||
(sname, sver, srel) = srpm.rsplit('-', 2)
|
(sname, sver, srel) = srpm.rsplit('-', 2)
|
||||||
try:
|
try:
|
||||||
srpmpo = syum.pkgSack.searchNevra(name=sname, ver=sver, rel=srel)[0]
|
#srpmpo = syum.pkgSack.searchNevra(name=sname, ver=sver, rel=srel)[0]
|
||||||
|
srpmpo = self.ayum.pkgSack.searchNevra(name=sname, ver=sver, rel=srel, arch='src')[0]
|
||||||
if not srpmpo in srpmpolist:
|
if not srpmpo in srpmpolist:
|
||||||
srpmpolist.append(srpmpo)
|
srpmpolist.append(srpmpo)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
@ -382,7 +392,8 @@ class Gather(pypungi.PungiBase):
|
|||||||
os.makedirs(pkgdir)
|
os.makedirs(pkgdir)
|
||||||
|
|
||||||
for pkg in srpmpolist:
|
for pkg in srpmpolist:
|
||||||
repo = syum.repos.getRepo(pkg.repoid)
|
#repo = syum.repos.getRepo(pkg.repoid)
|
||||||
|
repo = self.ayum.repos.getRepo(pkg.repoid)
|
||||||
remote = pkg.relativepath
|
remote = pkg.relativepath
|
||||||
local = os.path.basename(remote)
|
local = os.path.basename(remote)
|
||||||
local = os.path.join(self.config.get('default', 'cachedir'), local)
|
local = os.path.join(self.config.get('default', 'cachedir'), local)
|
||||||
|
Loading…
Reference in New Issue
Block a user