- Do things faster/smarter if we've only asked for one disc

This commit is contained in:
Jesse Keating 2007-03-14 17:57:09 -04:00 committed by Jesse Keating
parent eae5edcb56
commit e2c43c0a93
2 changed files with 64 additions and 39 deletions

View File

@ -1,3 +1,6 @@
* Tue Mar 14 2007 Jesse Keating <jkeating@redhat.com>
- Do things faster/smarter if we've only asked for one disc
* Tue Mar 13 2007 Jesse Keating <jkeating@redhat.com> * Tue Mar 13 2007 Jesse Keating <jkeating@redhat.com>
- log the rpm2cpio stuff for release notes - log the rpm2cpio stuff for release notes
- correctly capture errors from subprocess - correctly capture errors from subprocess

View File

@ -126,6 +126,10 @@ class Pungi:
"""Run anaconda-runtime's pkgorder on the tree, used for splitting media.""" """Run anaconda-runtime's pkgorder on the tree, used for splitting media."""
# non-op for only one disc
if self.config.getint('default', 'discs') == 1:
return
pkgorderfile = open(os.path.join(self.workdir, 'pkgorder-%s' % self.config.get('default', 'arch')), 'w') pkgorderfile = open(os.path.join(self.workdir, 'pkgorder-%s' % self.config.get('default', 'arch')), 'w')
# setup the command # setup the command
pkgorder = ['/usr/lib/anaconda-runtime/pkgorder'] pkgorder = ['/usr/lib/anaconda-runtime/pkgorder']
@ -201,6 +205,10 @@ class Pungi:
sized chunks.""" sized chunks."""
# non-op for only one disc
if self.config.getint('default', 'discs') == 1:
return
timber = splittree.Timber() timber = splittree.Timber()
timber.arch = self.config.get('default', 'arch') timber.arch = self.config.get('default', 'arch')
timber.target_size = float(self.config.get('default', 'cdsize')) * 1024 * 1024 timber.target_size = float(self.config.get('default', 'cdsize')) * 1024 * 1024
@ -256,7 +264,10 @@ class Pungi:
"""Create the split metadata for the isos""" """Create the split metadata for the isos"""
discinfo = open('%s-disc1/.discinfo' % self.topdir, 'r').readlines() if self.config.getint('default', 'discs') > 1:
discinfo = open('%s-disc1/.discinfo' % self.topdir, 'r').readlines()
else:
discinfo = open(os.path.join(self.topdir, '.discinfo'), 'r').readlines()
mediaid = discinfo[0].rstrip('\n') mediaid = discinfo[0].rstrip('\n')
# set up the process # set up the process
@ -270,15 +281,22 @@ class Pungi:
createrepo.append('media://%s' % mediaid) createrepo.append('media://%s' % mediaid)
createrepo.append('--outputdir') createrepo.append('--outputdir')
if self.config.getint('default', 'discs') == 1:
os.makedirs('%s-disc1' % self.topdir)
createrepo.append('%s-disc1' % self.topdir) createrepo.append('%s-disc1' % self.topdir)
createrepo.append('--basedir') createrepo.append('--basedir')
createrepo.append('%s-disc1' % self.topdir) if self.config.getint('default', 'discs') == 1:
createrepo.append(self.topdir)
createrepo.append(self.topdir)
else:
createrepo.append('%s-disc1' % self.topdir)
createrepo.append('--split') if self.config.getint('default', 'discs') > 1:
createrepo.append('--split')
for disc in range(1, self.config.getint('default', 'discs') + 1): for disc in range(1, self.config.getint('default', 'discs') + 1):
createrepo.append('%s-disc%s' % (self.topdir, disc)) createrepo.append('%s-disc%s' % (self.topdir, disc))
# run the command # run the command
self._doRunCommand(createrepo) self._doRunCommand(createrepo)
@ -312,52 +330,53 @@ class Pungi:
ppcbootargs.append('-hfs-bless') # must be last ppcbootargs.append('-hfs-bless') # must be last
for disc in range(1, self.config.getint('default', 'discs') + 1): # cycle through the CD isos if self.config.getint('default', 'discs') > 1:
isoname = '%s-%s-%s-disc%s.iso' % (self.config.get('default', 'iso_basename'), self.config.get('default', 'version'), for disc in range(1, self.config.getint('default', 'discs') + 1): # cycle through the CD isos
self.config.get('default', 'arch'), disc) isoname = '%s-%s-%s-disc%s.iso' % (self.config.get('default', 'iso_basename'), self.config.get('default', 'version'),
isofile = os.path.join(self.isodir, isoname) self.config.get('default', 'arch'), disc)
isofile = os.path.join(self.isodir, isoname)
extraargs = [] extraargs = []
if disc == 1: # if this is the first disc, we want to set boot flags if disc == 1: # if this is the first disc, we want to set boot flags
if self.config.get('default', 'arch') == 'i386' or self.config.get('default', 'arch') == 'x86_64': if self.config.get('default', 'arch') == 'i386' or self.config.get('default', 'arch') == 'x86_64':
extraargs.extend(x86bootargs) extraargs.extend(x86bootargs)
elif self.config.get('default', 'arch') == 'ia64': elif self.config.get('default', 'arch') == 'ia64':
extraargs.extend(ia64bootargs) extraargs.extend(ia64bootargs)
elif self.config.get('default', 'arch') == 'ppc': elif self.config.get('default', 'arch') == 'ppc':
extraargs.extend(ppcbootargs) extraargs.extend(ppcbootargs)
extraargs.append(os.path.join('%s-disc%s' % (self.topdir, disc), "ppc/mac")) extraargs.append(os.path.join('%s-disc%s' % (self.topdir, disc), "ppc/mac"))
extraargs.append('-V') extraargs.append('-V')
extraargs.append('"%s %s %s Disc %s"' % (self.config.get('default', 'product_name'), extraargs.append('"%s %s %s Disc %s"' % (self.config.get('default', 'product_name'),
self.config.get('default', 'version'), self.config.get('default', 'arch'), disc)) self.config.get('default', 'version'), self.config.get('default', 'arch'), disc))
extraargs.append('-o') extraargs.append('-o')
extraargs.append(isofile) extraargs.append(isofile)
extraargs.append(os.path.join('%s-disc%s' % (self.topdir, disc))) extraargs.append(os.path.join('%s-disc%s' % (self.topdir, disc)))
# run the command # run the command
self._doRunCommand(mkisofs + extraargs) self._doRunCommand(mkisofs + extraargs)
# implant md5 for mediacheck on all but source arches # implant md5 for mediacheck on all but source arches
if not self.config.get('default', 'arch') == 'source': if not self.config.get('default', 'arch') == 'source':
self._doRunCommand(['/usr/lib/anaconda-runtime/implantisomd5', isofile]) self._doRunCommand(['/usr/lib/anaconda-runtime/implantisomd5', isofile])
# shove the sha1sum into a file # shove the sha1sum into a file
sha1file = open(os.path.join(self.isodir, 'SHA1SUM'), 'a') sha1file = open(os.path.join(self.isodir, 'SHA1SUM'), 'a')
self._doRunCommand(['/usr/bin/sha1sum', isoname], rundir=self.isodir, output=sha1file) self._doRunCommand(['/usr/bin/sha1sum', isoname], rundir=self.isodir, output=sha1file)
sha1file.close() sha1file.close()
# keep track of the CD images we've written # keep track of the CD images we've written
isolist.append(self.mkrelative(isofile)) isolist.append(self.mkrelative(isofile))
# Write out a line describing the CD set # Write out a line describing the CD set
self.writeinfo('cdset: %s' % ' '.join(isolist)) self.writeinfo('cdset: %s' % ' '.join(isolist))
isolist=[] isolist=[]
# We've asked for more than one disc, and we're not srpms, so make a DVD image # We've asked for more than one disc, and we're not srpms, so make a DVD image
if self.config.getint('default', 'discs') > 1 and not self.config.get('default', 'arch') == 'source': if self.config.getint('default', 'discs') >= 1 and not self.config.get('default', 'arch') == 'source':
isoname = '%s-%s-%s-DVD.iso' % (self.config.get('default', 'iso_basename'), self.config.get('default', 'version'), isoname = '%s-%s-%s-DVD.iso' % (self.config.get('default', 'iso_basename'), self.config.get('default', 'version'),
self.config.get('default', 'arch')) self.config.get('default', 'arch'))
isofile = os.path.join(self.isodir, isoname) isofile = os.path.join(self.isodir, isoname)
@ -383,7 +402,10 @@ class Pungi:
extraargs.extend(ia64bootargs) extraargs.extend(ia64bootargs)
elif self.config.get('default', 'arch') == 'ppc': elif self.config.get('default', 'arch') == 'ppc':
extraargs.extend(ppcbootargs) extraargs.extend(ppcbootargs)
extraargs.append(os.path.join('%s-disc%s' % (self.topdir, disc), "ppc/mac")) if self.config.getint('default', 'discs') == 1:
extraargs.append(os.path.join(self.topdir, "ppc/mac")) # this may work for both cases.. test
else:
extraargs.append(os.path.join('%s-disc%s' % (self.topdir, disc), "ppc/mac"))
extraargs.append('-V') extraargs.append('-V')
extraargs.append('"%s %s %s DVD"' % (self.config.get('default', 'product_name'), extraargs.append('"%s %s %s DVD"' % (self.config.get('default', 'product_name'),