Clean up some files, no main() sections needed anymore.

This commit is contained in:
jkeating@dhcp83-49.boston.redhat.com 2007-01-08 15:29:15 -05:00 committed by Jesse Keating
parent f447b2c285
commit a97b0d3d15
2 changed files with 0 additions and 120 deletions

View File

@ -224,75 +224,3 @@ class Gather(yum.YumBase):
shutil.copy2(path, local)
os.link(local, os.path.join(pkgdir, os.path.basename(remote)))
def main():
# This is used for testing the module
(opts, args) = get_arguments()
pkglist = get_packagelist(opts.comps)
if not os.path.exists(opts.destdir):
try:
os.makedirs(opts.destdir)
except OSError, e:
print >> sys.stderr, "Error: Cannot create destination dir %s" % opts.destdir
sys.exit(1)
if not os.path.exists(opts.cachedir):
try:
os.makedirs(opts.cachedir)
except OSError, e:
print >> sys.stderr, "Error: Cannot create cache dir %s" % opts.cachedir
sys.exit(1)
mygather = Gather(opts, pkglist)
mygather.getPackageObjects()
mygather.downloadPackages()
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("--destdir", default=".", dest="destdir",
help='destination directory (defaults to current directory)')
parser.add_option("--cachedir", default="./cache", dest="cachedir",
help='cache directory (defaults to cache subdir of current directory)')
parser.add_option("--comps", default="comps.xml", dest="comps",
help='comps file to use')
parser.add_option("--yumconf", default="yum.conf", dest="yumconf",
help='yum config file to use')
parser.add_option("--arch", default="i386", dest="arch",
help='Base arch to use')
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)
def get_packagelist(myComps):
# Get the list of packages from the comps file
try:
compsobj = yum.comps.Comps()
compsobj.add(myComps)
except IOError:
print >> sys.stderr, "gather.py: No such file:\'%s\'" % opts.comps
sys.exit(1)
pkglist = []
for group in compsobj.groups:
pkglist += group.packages
return pkglist
main()

View File

@ -223,51 +223,3 @@ class Pungi:
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'))
def main():
# This is used for testing the module
(opts, args) = get_arguments()
if not os.path.exists(os.path.join(opts.destdir, opts.version, 'os')):
print >> sys.stderr, "Error: Cannot read top dir %s" % os.path.join(opts.destdir, opts.version, 'os')
sys.exit(1)
myPungi = Pungi(opts)
myPungi.doBuildinstall()
myPungi.doPackageorder()
myPungi.doSplittree()
myPungi.doCreateSplitrepo()
myPungi.doCreateIsos()
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("--destdir", default=".", dest="destdir",
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("--discs", default="5", dest="discs",
help='Number of discs 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()