- Create a new yum object for source downloads as yum

Fixes a problem where yum object resetting is not currently working
This commit is contained in:
Jesse Keating 2007-08-01 16:38:57 -04:00 committed by Jesse Keating
parent eee5556f50
commit 1b1a81b2c7
5 changed files with 27 additions and 14 deletions

View File

@ -1,3 +1,6 @@
* Wed Aug 01 2007 Jesse Keating <jkeating@redhat.com>
- Create a new yum object for source downloads as yum
* Sat Jul 28 2007 Jesse Keating <jkeating@redhat.com> * Sat Jul 28 2007 Jesse Keating <jkeating@redhat.com>
- Split the createrepo call into it's own function - Split the createrepo call into it's own function
- When raising an error, print the error too. - When raising an error, print the error too.

2
pungi
View File

@ -147,7 +147,7 @@ if __name__ == '__main__':
import sys import sys
def get_arguments(): def get_arguments():
parser = OptionParser(version="%prog 0.4.0") parser = OptionParser(version="%prog 0.4.1")
parser.add_option("--destdir", default="*CONFFILE*", dest="destdir", parser.add_option("--destdir", default="*CONFFILE*", dest="destdir",
help='destination directory (defaults to current directory)') help='destination directory (defaults to current directory)')
parser.add_option("-c", "--conf", default='/etc/pungi/pungi.conf', dest="config", parser.add_option("-c", "--conf", default='/etc/pungi/pungi.conf', dest="config",

View File

@ -1,7 +1,7 @@
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
Name: pungi Name: pungi
Version: 0.4.0 Version: 0.4.1
Release: 1%{?dist} Release: 1%{?dist}
Summary: Distribution compose tool Summary: Distribution compose tool
@ -46,6 +46,9 @@ rm -rf $RPM_BUILD_ROOT
%changelog %changelog
* Wed Aug 01 2007 Jesse Keating <jkeating@redhat.com> - 0.4.1-1
- Create a new yum object for source downloads as yum
* Sat Jul 28 2007 Jesse Keating <jkeating@redhat.com> - 0.4.0-1 * Sat Jul 28 2007 Jesse Keating <jkeating@redhat.com> - 0.4.0-1
- split createrepo call to it's own function. This enables rawhide - split createrepo call to it's own function. This enables rawhide
composes to happen once again. Also breaks API. composes to happen once again. Also breaks API.

View File

@ -335,23 +335,30 @@ class Gather(yum.YumBase):
srpmpolist = [] srpmpolist = []
# Work around for yum bug ## Work around for yum bug
for sack in self.pkgSack.sacks.values(): #for sack in self.pkgSack.sacks.values():
sack.added = {} # sack.added = {}
sack.excludes = {} # sack.excludes = {}
self.pkgSack.excludes = {} #self.pkgSack.excludes = {}
# We need to reset the yum object ## We need to reset the yum object
self.pkgSack = None #self.pkgSack = None
# Setup the sack with just src arch ## Setup the sack with just src arch
self.doSackSetup(archlist=['src']) #self.doSackSetup(archlist=['src'])
# Make a new yum object
ayum = yum.YumBase()
ayum.doConfigSetup(fn=self.config.get('default', 'yumconf'), debuglevel=6, errorlevel=6, root=os.path.join(self.workdir, 'yumroot'))
ayum.doRepoSetup()
ayum._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 = self.pkgSack.searchNevra(name=sname, ver=sver, rel=srel)[0] srpmpo = ayum.pkgSack.searchNevra(name=sname, ver=sver, rel=srel)[0]
if not srpmpo in srpmpolist: if not srpmpo in srpmpolist:
srpmpolist.append(srpmpo) srpmpolist.append(srpmpo)
except IndexError: except IndexError:
@ -366,7 +373,7 @@ class Gather(yum.YumBase):
os.makedirs(pkgdir) os.makedirs(pkgdir)
for pkg in srpmpolist: for pkg in srpmpolist:
repo = self.repos.getRepo(pkg.repoid) repo = 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)

View File

@ -2,7 +2,7 @@ from distutils.core import setup
import glob import glob
setup(name='pungi', setup(name='pungi',
version='0.4.0', version='0.4.1',
description='Distribution compose tool', description='Distribution compose tool',
author='Jesse Keating', author='Jesse Keating',
author_email='jkeating@redhat.com', author_email='jkeating@redhat.com',