Create pungi, the tool to run anaconda tools
This commit is contained in:
parent
c2b14f3bad
commit
4d568ae728
16
pungi/PLAN
Normal file
16
pungi/PLAN
Normal file
@ -0,0 +1,16 @@
|
||||
This is the "pungi" module. This module is used to run anaconda tools on
|
||||
downloaded packages. Options for anaconda tools will come from the
|
||||
main interface.
|
||||
|
||||
ROADMAP
|
||||
|
||||
a) Create repodata for the package sets, using comps
|
||||
b) Run buildinstall
|
||||
c) Run pkgorder
|
||||
d) Run splittree
|
||||
|
||||
CONSIDERATIONS
|
||||
|
||||
QUESTIONS
|
||||
|
||||
do we make isos here or somewhere else?
|
87
pungi/pungi.py
Executable file
87
pungi/pungi.py
Executable file
@ -0,0 +1,87 @@
|
||||
#!/usr/bin/python -tt
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
import os
|
||||
|
||||
class Pungi:
|
||||
def __init__(self, opts):
|
||||
self.opts = opts
|
||||
self.prodpath = 'Fedora' # Probably should be defined elsewhere
|
||||
self.basedir = os.path.join(self.opts.topdir, self.prodpath, 'base') # Probably should be defined elsewhere
|
||||
os.mkdir(self.basedir)
|
||||
os.link(self.opts.comps, os.path.join(self.basedir, 'comps.xml'))
|
||||
|
||||
def doCreaterepo(self):
|
||||
os.system('/usr/bin/createrepo -g %s %s' % (self.opts.comps, self.prodpath))
|
||||
|
||||
# def doCreateSplitrepo(self):
|
||||
# for disc in seq
|
||||
# os.system('/usr/bin/createrepo -g %s --baseurl=media://%s --split %s' % (self.opts.comps, self.prodpath, 'Fedora-%s' % self.opts.version, os.path.join)
|
||||
|
||||
def doBuildinstall(self):
|
||||
args = '--product "Fedora" --version %s --release "%s" --prodpath %s %s' % (self.opts.version, 'Fedora %s' % self.opts.version, self.prodpath, self.opts.topdir)
|
||||
os.system('/usr/lib/anaconda-runtime/buildinstall %s' % args)
|
||||
|
||||
def doPackageorder(self):
|
||||
os.system('/usr/lib/anaconda-runtime/pkgorder %s %s %s' % (self.opts.topdir, self.opts.arch, self.prodpath))
|
||||
|
||||
# def doSplittree(self):
|
||||
|
||||
def main():
|
||||
# This is used for testing the module
|
||||
(opts, args) = get_arguments()
|
||||
|
||||
if not os.path.exists(opts.topdir):
|
||||
print >> sys.stderr, "Error: Cannot read top dir %s" % opts.topdir
|
||||
sys.exit(1)
|
||||
|
||||
myPungi = Pungi(opts)
|
||||
myPungi.doCreaterepo()
|
||||
myPungi.doBuildinstall()
|
||||
myPungi.doPackageorder()
|
||||
#myPungi.doSplittree()
|
||||
#myPungi.doCreateSplitrepo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from optparse import OptionParser
|
||||
import sys
|
||||
|
||||
def get_arguments():
|
||||
# hack job for now, I'm sure this could be better for our uses
|
||||
usage = "usage: %s [options]" % sys.argv[0]
|
||||
parser = OptionParser(usage=usage)
|
||||
parser.add_option("--topdir", default=".", dest="topdir",
|
||||
help='Directory that contains the package set')
|
||||
parser.add_option("--comps", default="comps.xml", dest="comps",
|
||||
help='comps file to use')
|
||||
parser.add_option("--arch", default="i386", dest="arch",
|
||||
help='Base arch to use')
|
||||
parser.add_option("--version", default="test", dest="version",
|
||||
help='Version of the spin')
|
||||
parser.add_option("--disks", default="5", dest="discs",
|
||||
help='Number of disks to spin')
|
||||
parser.add_option("-q", "--quiet", default=False, action="store_true",
|
||||
help="Output as little as possible")
|
||||
|
||||
|
||||
|
||||
(opts, args) = parser.parse_args()
|
||||
#if len(opts) < 1:
|
||||
# parser.print_help()
|
||||
# sys.exit(0)
|
||||
return (opts, args)
|
||||
|
||||
main()
|
Loading…
Reference in New Issue
Block a user