- Figure out number of isos on the fly, based on tree size
- Add command line option to disable creation of split media - Remove -S -P options, as splittree and packageorder are now called from createIsos, if needed.
This commit is contained in:
parent
3260c78f53
commit
8733a990ec
@ -1,3 +1,9 @@
|
|||||||
|
* Wed Nov 28 2007 Jesse Keating <jkeating@redhat.com>
|
||||||
|
- Figure out number of isos on the fly, based on tree size
|
||||||
|
- Add command line option to disable creation of split media
|
||||||
|
- Remove -S -P options, as splittree and packageorder are now
|
||||||
|
called from createIsos, if needed.
|
||||||
|
|
||||||
* Tue Nov 27 2007 Jesse Keating <jkeating@redhat.com>
|
* Tue Nov 27 2007 Jesse Keating <jkeating@redhat.com>
|
||||||
- Enable TMPDIR again so that anconda-runtime working files
|
- Enable TMPDIR again so that anconda-runtime working files
|
||||||
go to the working dir.
|
go to the working dir.
|
||||||
|
@ -31,6 +31,8 @@ The URL for your bug reporting system (defaults to http://bugzilla.redhat.com)\&
|
|||||||
The number of discs you want to create (defaults to 1)\&.
|
The number of discs you want to create (defaults to 1)\&.
|
||||||
.IP "\fB\-\-nosource\fP"
|
.IP "\fB\-\-nosource\fP"
|
||||||
Disable gathering of source packages (optional)\&.
|
Disable gathering of source packages (optional)\&.
|
||||||
|
.IP "\fB\-\-nosplitmedia\fP"
|
||||||
|
Disable creation of split media (optional)\&.
|
||||||
.IP "\fB\-\-sourceisos\fP"
|
.IP "\fB\-\-sourceisos\fP"
|
||||||
Create the source media images (other arch runs must be done)\&.
|
Create the source media images (other arch runs must be done)\&.
|
||||||
.IP "\fB\-c ksfile, \-\-config=ksfile\fP"
|
.IP "\fB\-c ksfile, \-\-config=ksfile\fP"
|
||||||
@ -43,10 +45,6 @@ Enable the Gather stage\&.
|
|||||||
Enable the Createrepo stage\&.
|
Enable the Createrepo stage\&.
|
||||||
.IP "\fB\-B\fP"
|
.IP "\fB\-B\fP"
|
||||||
Enable the BuildInstall stage\&.
|
Enable the BuildInstall stage\&.
|
||||||
.IP "\fB\-P\fP"
|
|
||||||
Enable the Package Order stage\&.
|
|
||||||
.IP "\fB\-S\fP"
|
|
||||||
Enable the SplitTree stage\&.
|
|
||||||
.IP "\fB\-I\fP"
|
.IP "\fB\-I\fP"
|
||||||
Enable the CreateISO stage\&.
|
Enable the CreateISO stage\&.
|
||||||
|
|
||||||
|
18
pungi
18
pungi
@ -81,14 +81,7 @@ def main():
|
|||||||
mypungi.doBuildinstall()
|
mypungi.doBuildinstall()
|
||||||
mypungi.doGetRelnotes()
|
mypungi.doGetRelnotes()
|
||||||
|
|
||||||
if opts.do_all or opts.do_packageorder:
|
|
||||||
mypungi.doPackageorder()
|
|
||||||
|
|
||||||
if opts.do_all or opts.do_splittree:
|
|
||||||
mypungi.doSplittree()
|
|
||||||
|
|
||||||
if opts.do_all or opts.do_createiso:
|
if opts.do_all or opts.do_createiso:
|
||||||
mypungi.doCreateSplitrepo()
|
|
||||||
mypungi.doCreateIsos()
|
mypungi.doCreateIsos()
|
||||||
|
|
||||||
# Do things slightly different for src.
|
# Do things slightly different for src.
|
||||||
@ -99,9 +92,6 @@ def main():
|
|||||||
config.get('default', 'version'),
|
config.get('default', 'version'),
|
||||||
config.get('default', 'flavor'),
|
config.get('default', 'flavor'),
|
||||||
'source', 'SRPM')
|
'source', 'SRPM')
|
||||||
if opts.do_all or opts.do_splittree:
|
|
||||||
mypungi.doSplitSRPMs()
|
|
||||||
|
|
||||||
if opts.do_all or opts.do_createiso:
|
if opts.do_all or opts.do_createiso:
|
||||||
mypungi.doCreateIsos()
|
mypungi.doCreateIsos()
|
||||||
|
|
||||||
@ -144,6 +134,8 @@ if __name__ == '__main__':
|
|||||||
help='the number of discs you want to create (defaults to 1)')
|
help='the number of discs you want to create (defaults to 1)')
|
||||||
parser.add_option("--nosource", action="store_true", dest="nosource",
|
parser.add_option("--nosource", action="store_true", dest="nosource",
|
||||||
help='disable gathering of source packages (optional)')
|
help='disable gathering of source packages (optional)')
|
||||||
|
parser.add_option("--nosplitmedia", action="store_true", dest="nosplitmedia",
|
||||||
|
help='disable creation of split media (optional)')
|
||||||
parser.add_option("--sourceisos", default=False, action="store_true", dest="sourceisos",
|
parser.add_option("--sourceisos", default=False, action="store_true", dest="sourceisos",
|
||||||
help='Create the source isos (other arch runs must be done)')
|
help='Create the source isos (other arch runs must be done)')
|
||||||
|
|
||||||
@ -157,10 +149,6 @@ if __name__ == '__main__':
|
|||||||
help="Flag to enable processing the Createrepo stage")
|
help="Flag to enable processing the Createrepo stage")
|
||||||
parser.add_option("-B", action="store_true", default=False, dest="do_buildinstall",
|
parser.add_option("-B", action="store_true", default=False, dest="do_buildinstall",
|
||||||
help="Flag to enable processing the BuildInstall stage")
|
help="Flag to enable processing the BuildInstall stage")
|
||||||
parser.add_option("-P", action="store_true", default=False, dest="do_packageorder",
|
|
||||||
help="Flag to enable processing the Package Order stage")
|
|
||||||
parser.add_option("-S", action="store_true", default=False, dest="do_splittree",
|
|
||||||
help="Flag to enable processing the SplitTree stage")
|
|
||||||
parser.add_option("-I", action="store_true", default=False, dest="do_createiso",
|
parser.add_option("-I", action="store_true", default=False, dest="do_createiso",
|
||||||
help="Flag to enable processing the CreateISO stage")
|
help="Flag to enable processing the CreateISO stage")
|
||||||
|
|
||||||
@ -171,7 +159,7 @@ if __name__ == '__main__':
|
|||||||
parser.print_help()
|
parser.print_help()
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if opts.do_gather or opts.do_createrepo or opts.do_buildinstall or opts.do_packageorder or opts.do_splittree or opts.do_createiso:
|
if opts.do_gather or opts.do_createrepo or opts.do_buildinstall or opts.do_createiso:
|
||||||
opts.do_all = False
|
opts.do_all = False
|
||||||
return (opts, args)
|
return (opts, args)
|
||||||
|
|
||||||
|
178
pypungi/pungi.py
178
pypungi/pungi.py
@ -348,7 +348,7 @@ cost=500
|
|||||||
repofile.close()
|
repofile.close()
|
||||||
|
|
||||||
def doCreateIsos(self):
|
def doCreateIsos(self):
|
||||||
"""Create isos from the various split directories."""
|
"""Create isos of the tree, optionally splitting the tree for split media."""
|
||||||
|
|
||||||
|
|
||||||
isolist=[]
|
isolist=[]
|
||||||
@ -378,6 +378,106 @@ cost=500
|
|||||||
|
|
||||||
sparcbootargs = ['-G', '/boot/isofs.b', '-B', '...', '-s', '/boot/silo.conf', '-sparc-label', '"sparc"']
|
sparcbootargs = ['-G', '/boot/isofs.b', '-B', '...', '-s', '/boot/silo.conf', '-sparc-label', '"sparc"']
|
||||||
|
|
||||||
|
# Check the size of the tree
|
||||||
|
# This size checking method may be bunk, accepting patches...
|
||||||
|
treesize = int(subprocess.Popen(mkisofs + ['-print-size', self.topdir], stdout=subprocess.PIPE).communicate()[0])
|
||||||
|
# Size returned is 2KiB clusters or some such. This translates that to MiB.
|
||||||
|
treesize = treesize * 2048 / 1024 / 1024
|
||||||
|
|
||||||
|
cdsize = self.config.getfloat('default', 'cdsize')
|
||||||
|
|
||||||
|
# Do some math to figure out how many discs we'd need
|
||||||
|
if treesize < cdsize or self.config.has_option('default', 'nosplitmedia'):
|
||||||
|
self.config.set('default', 'discs', '1')
|
||||||
|
else:
|
||||||
|
discs = int(treesize / cdsize + 1)
|
||||||
|
self.config.set('default', 'discs', str(discs))
|
||||||
|
if self.config.get('default', 'arch') == 'source':
|
||||||
|
self.doSplitSRPMS()
|
||||||
|
else:
|
||||||
|
self.doPackageorder()
|
||||||
|
self.doSplittree()
|
||||||
|
|
||||||
|
if not self.config.get('default', 'arch') == 'source':
|
||||||
|
self.doCreateSplitrepo()
|
||||||
|
|
||||||
|
if treesize > 700: # we're larger than a 700meg CD
|
||||||
|
isoname = '%s-%s-%s-DVD.iso' % (self.config.get('default', 'iso_basename'), self.config.get('default', 'version'),
|
||||||
|
self.config.get('default', 'arch'))
|
||||||
|
else:
|
||||||
|
isoname = '%s-%s-%s.iso' % (self.config.get('default', 'iso_basename'), self.config.get('default', 'version'),
|
||||||
|
self.config.get('default', 'arch'))
|
||||||
|
|
||||||
|
isofile = os.path.join(self.isodir, isoname)
|
||||||
|
|
||||||
|
if not self.config.get('default', 'arch') == 'source':
|
||||||
|
# backup the main .discinfo to use a split one. This is an ugly hack :/
|
||||||
|
content = open(discinfofile, 'r').readlines()
|
||||||
|
shutil.move(discinfofile, os.path.join(self.config.get('default', 'destdir'),
|
||||||
|
'.discinfo-%s' % self.config.get('default', 'arch')))
|
||||||
|
content[content.index('ALL\n')] = ','.join([str(x) for x in range(1, self.config.getint('default', 'discs') + 1)]) + '\n'
|
||||||
|
open(discinfofile, 'w').writelines(content)
|
||||||
|
|
||||||
|
# move the main repodata out of the way to use the split repodata
|
||||||
|
shutil.move(os.path.join(self.topdir, 'repodata'), os.path.join(self.config.get('default', 'destdir'),
|
||||||
|
'repodata-%s' % self.config.get('default', 'arch')))
|
||||||
|
shutil.copytree('%s-disc1/repodata' % self.topdir, os.path.join(self.topdir, 'repodata'))
|
||||||
|
|
||||||
|
# setup the extra mkisofs args
|
||||||
|
extraargs = []
|
||||||
|
|
||||||
|
if self.config.get('default', 'arch') == 'i386' or self.config.get('default', 'arch') == 'x86_64':
|
||||||
|
extraargs.extend(x86bootargs)
|
||||||
|
elif self.config.get('default', 'arch') == 'ia64':
|
||||||
|
extraargs.extend(ia64bootargs)
|
||||||
|
elif self.config.get('default', 'arch') == 'ppc':
|
||||||
|
extraargs.extend(ppcbootargs)
|
||||||
|
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"))
|
||||||
|
elif self.config.get('default', 'arch') == 'sparc':
|
||||||
|
extraargs.extend(sparcbootargs)
|
||||||
|
|
||||||
|
extraargs.append('-V')
|
||||||
|
if treesize > 700:
|
||||||
|
extraargs.append('%s %s %s DVD' % (self.config.get('default', 'name'),
|
||||||
|
self.config.get('default', 'version'), self.config.get('default', 'arch')))
|
||||||
|
else:
|
||||||
|
extraargs.append('%s %s %s' % (self.config.get('default', 'name'),
|
||||||
|
self.config.get('default', 'version'), self.config.get('default', 'arch')))
|
||||||
|
|
||||||
|
extraargs.append('-o')
|
||||||
|
extraargs.append(isofile)
|
||||||
|
|
||||||
|
if not self.config.get('default', 'arch') == 'source':
|
||||||
|
extraargs.append(self.topdir)
|
||||||
|
else:
|
||||||
|
extraargs.append(os.path.join(self.archdir, 'SRPMS'))
|
||||||
|
|
||||||
|
# run the command
|
||||||
|
pypungi._doRunCommand(mkisofs + extraargs, self.logger)
|
||||||
|
|
||||||
|
# implant md5 for mediacheck on all but source arches
|
||||||
|
if not self.config.get('default', 'arch') == 'source':
|
||||||
|
pypungi._doRunCommand(['/usr/lib/anaconda-runtime/implantisomd5', isofile], self.logger)
|
||||||
|
|
||||||
|
# shove the sha1sum into a file
|
||||||
|
sha1file = open(os.path.join(self.isodir, 'SHA1SUM'), 'a')
|
||||||
|
pypungi._doRunCommand(['/usr/bin/sha1sum', isoname], self.logger, rundir=self.isodir, output=sha1file)
|
||||||
|
sha1file.close()
|
||||||
|
|
||||||
|
# return the .discinfo file
|
||||||
|
if not self.config.get('default', 'arch') == 'source':
|
||||||
|
shutil.move(os.path.join(self.config.get('default', 'destdir'), '.discinfo-%s' % self.config.get('default', 'arch')), discinfofile)
|
||||||
|
|
||||||
|
shutil.rmtree(os.path.join(self.topdir, 'repodata')) # remove our copied repodata
|
||||||
|
shutil.move(os.path.join(self.config.get('default', 'destdir'),
|
||||||
|
'repodata-%s' % self.config.get('default', 'arch')), os.path.join(self.topdir, 'repodata'))
|
||||||
|
|
||||||
|
# Write out a line describing the media
|
||||||
|
self.writeinfo('media: %s' % isofile)
|
||||||
|
|
||||||
if self.config.getint('default', 'discs') > 1:
|
if self.config.getint('default', 'discs') > 1:
|
||||||
for disc in range(1, self.config.getint('default', 'discs') + 1): # cycle through the CD isos
|
for disc in range(1, self.config.getint('default', 'discs') + 1): # cycle through the CD isos
|
||||||
isoname = '%s-%s-%s-disc%s.iso' % (self.config.get('default', 'iso_basename'), self.config.get('default', 'version'),
|
isoname = '%s-%s-%s-disc%s.iso' % (self.config.get('default', 'iso_basename'), self.config.get('default', 'version'),
|
||||||
@ -422,81 +522,7 @@ cost=500
|
|||||||
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('mediaset: %s' % ' '.join(isolist))
|
||||||
|
|
||||||
isolist=[]
|
|
||||||
# We've asked for one or more discs, so make a DVD image
|
|
||||||
if self.config.getint('default', 'discs') >= 1:
|
|
||||||
isoname = '%s-%s-%s-DVD.iso' % (self.config.get('default', 'iso_basename'), self.config.get('default', 'version'),
|
|
||||||
self.config.get('default', 'arch'))
|
|
||||||
isofile = os.path.join(self.isodir, isoname)
|
|
||||||
|
|
||||||
if not self.config.get('default', 'arch') == 'source':
|
|
||||||
# backup the main .discinfo to use a split one. This is an ugly hack :/
|
|
||||||
content = open(discinfofile, 'r').readlines()
|
|
||||||
shutil.move(discinfofile, os.path.join(self.config.get('default', 'destdir'),
|
|
||||||
'.discinfo-%s' % self.config.get('default', 'arch')))
|
|
||||||
content[content.index('ALL\n')] = ','.join([str(x) for x in range(1, self.config.getint('default', 'discs') + 1)]) + '\n'
|
|
||||||
open(discinfofile, 'w').writelines(content)
|
|
||||||
|
|
||||||
# move the main repodata out of the way to use the split repodata
|
|
||||||
shutil.move(os.path.join(self.topdir, 'repodata'), os.path.join(self.config.get('default', 'destdir'),
|
|
||||||
'repodata-%s' % self.config.get('default', 'arch')))
|
|
||||||
shutil.copytree('%s-disc1/repodata' % self.topdir, os.path.join(self.topdir, 'repodata'))
|
|
||||||
|
|
||||||
# setup the extra mkisofs args
|
|
||||||
extraargs = []
|
|
||||||
|
|
||||||
if self.config.get('default', 'arch') == 'i386' or self.config.get('default', 'arch') == 'x86_64':
|
|
||||||
extraargs.extend(x86bootargs)
|
|
||||||
elif self.config.get('default', 'arch') == 'ia64':
|
|
||||||
extraargs.extend(ia64bootargs)
|
|
||||||
elif self.config.get('default', 'arch') == 'ppc':
|
|
||||||
extraargs.extend(ppcbootargs)
|
|
||||||
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"))
|
|
||||||
elif self.config.get('default', 'arch') == 'sparc':
|
|
||||||
extraargs.extend(sparcbootargs)
|
|
||||||
|
|
||||||
extraargs.append('-V')
|
|
||||||
extraargs.append('%s %s %s DVD' % (self.config.get('default', 'name'),
|
|
||||||
self.config.get('default', 'version'), self.config.get('default', 'arch')))
|
|
||||||
|
|
||||||
extraargs.append('-o')
|
|
||||||
extraargs.append(isofile)
|
|
||||||
|
|
||||||
if not self.config.get('default', 'arch') == 'source':
|
|
||||||
extraargs.append(self.topdir)
|
|
||||||
else:
|
|
||||||
extraargs.append(os.path.join(self.archdir, 'SRPMS'))
|
|
||||||
|
|
||||||
# run the command
|
|
||||||
pypungi._doRunCommand(mkisofs + extraargs, self.logger)
|
|
||||||
|
|
||||||
# implant md5 for mediacheck on all but source arches
|
|
||||||
if not self.config.get('default', 'arch') == 'source':
|
|
||||||
pypungi._doRunCommand(['/usr/lib/anaconda-runtime/implantisomd5', isofile], self.logger)
|
|
||||||
|
|
||||||
# shove the sha1sum into a file
|
|
||||||
sha1file = open(os.path.join(self.isodir, 'SHA1SUM'), 'a')
|
|
||||||
pypungi._doRunCommand(['/usr/bin/sha1sum', isoname], self.logger, rundir=self.isodir, output=sha1file)
|
|
||||||
sha1file.close()
|
|
||||||
|
|
||||||
# return the .discinfo file
|
|
||||||
if not self.config.get('default', 'arch') == 'source':
|
|
||||||
shutil.move(os.path.join(self.config.get('default', 'destdir'), '.discinfo-%s' % self.config.get('default', 'arch')), discinfofile)
|
|
||||||
|
|
||||||
shutil.rmtree(os.path.join(self.topdir, 'repodata')) # remove our copied repodata
|
|
||||||
shutil.move(os.path.join(self.config.get('default', 'destdir'),
|
|
||||||
'repodata-%s' % self.config.get('default', 'arch')), os.path.join(self.topdir, 'repodata'))
|
|
||||||
|
|
||||||
# keep track of the DVD images we've written
|
|
||||||
isolist.append(self.mkrelative(isofile))
|
|
||||||
|
|
||||||
# Write out a line describing the DVD set
|
|
||||||
self.writeinfo('dvdset: %s' % ' '.join(isolist))
|
|
||||||
|
|
||||||
# Now make rescue images
|
# Now make rescue images
|
||||||
if not self.config.get('default', 'arch') == 'source' and \
|
if not self.config.get('default', 'arch') == 'source' and \
|
||||||
|
Loading…
Reference in New Issue
Block a user