Add a split option to the iso creation function

Fix a SRPMS SRPMs typo
Handle source iso creation better
This commit is contained in:
Jesse Keating 2007-11-29 17:46:58 -05:00 committed by Jesse Keating
parent 1116fcc4b0
commit f499bc4f8d
3 changed files with 15 additions and 7 deletions

View File

@ -1,3 +1,6 @@
* Thu Nov 29 2007 Jesse Keating <jkeating@redhat.com>
- Add a split option to the doCreateIsos call
* Wed Nov 28 2007 Jesse Keating <jkeating@redhat.com> * Wed Nov 28 2007 Jesse Keating <jkeating@redhat.com>
- Figure out number of isos on the fly, based on tree size - Figure out number of isos on the fly, based on tree size
- Add command line option to disable creation of split media - Add command line option to disable creation of split media

6
pungi
View File

@ -82,7 +82,7 @@ def main():
mypungi.doGetRelnotes() mypungi.doGetRelnotes()
if opts.do_all or opts.do_createiso: if opts.do_all or opts.do_createiso:
mypungi.doCreateIsos() mypungi.doCreateIsos(split=opts.nosplitmedia)
# Do things slightly different for src. # Do things slightly different for src.
if opts.sourceisos: if opts.sourceisos:
@ -93,7 +93,7 @@ def main():
config.get('default', 'flavor'), config.get('default', 'flavor'),
'source', 'SRPM') 'source', 'SRPM')
if opts.do_all or opts.do_createiso: if opts.do_all or opts.do_createiso:
mypungi.doCreateIsos() mypungi.doCreateIsos(split=opts.nosplitmedia)
print "All done!" print "All done!"
@ -134,7 +134,7 @@ 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", parser.add_option("--nosplitmedia", action="store_true", dest="nosplitmedia", default=False,
help='disable creation of split media (optional)') 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)')

View File

@ -336,7 +336,7 @@ cost=500
repofile.write(repocontent) repofile.write(repocontent)
repofile.close() repofile.close()
def doCreateIsos(self): def doCreateIsos(self, split=True):
"""Create isos of the tree, optionally splitting the tree for split media.""" """Create isos of the tree, optionally splitting the tree for split media."""
@ -369,20 +369,25 @@ cost=500
# Check the size of the tree # Check the size of the tree
# This size checking method may be bunk, accepting patches... # This size checking method may be bunk, accepting patches...
if not self.config.get('default', 'arch') == 'source':
treesize = int(subprocess.Popen(mkisofs + ['-print-size', '-quiet', self.topdir], stdout=subprocess.PIPE).communicate()[0]) treesize = int(subprocess.Popen(mkisofs + ['-print-size', '-quiet', self.topdir], stdout=subprocess.PIPE).communicate()[0])
else:
srcdir = os.path.join(self.config.get('default', 'destdir'), self.config.get('default', 'version'), 'source', 'SRPMS')
treesize = int(subprocess.Popen(mkisofs + ['-print-size', '-quiet', srcdir], stdout=subprocess.PIPE).communicate()[0])
# Size returned is 2KiB clusters or some such. This translates that to MiB. # Size returned is 2KiB clusters or some such. This translates that to MiB.
treesize = treesize * 2048 / 1024 / 1024 treesize = treesize * 2048 / 1024 / 1024
cdsize = self.config.getfloat('default', 'cdsize') cdsize = self.config.getfloat('default', 'cdsize')
# Do some math to figure out how many discs we'd need # Do some math to figure out how many discs we'd need
if treesize < cdsize or self.config.has_option('default', 'nosplitmedia'): if treesize < cdsize or not split:
self.config.set('default', 'discs', '1') self.config.set('default', 'discs', '1')
else: else:
discs = int(treesize / cdsize + 1) discs = int(treesize / cdsize + 1)
self.config.set('default', 'discs', str(discs)) self.config.set('default', 'discs', str(discs))
if self.config.get('default', 'arch') == 'source': if self.config.get('default', 'arch') == 'source':
self.doSplitSRPMS() self.doSplitSRPMs()
else: else:
self.doPackageorder() self.doPackageorder()
self.doSplittree() self.doSplittree()