def main(): config = pypungi.config.Config() (opts, args) = get_arguments(config) # You must be this high to ride if you're going to do root tasks if os.geteuid() != 0 and (opts.do_all or opts.do_buildinstall): print >> sys.stderr, "You must run pungi as root" return 1 if opts.do_all or opts.do_buildinstall: try: selinux = subprocess.Popen( '/usr/sbin/getenforce', stdout=subprocess.PIPE, stderr=open('/dev/null', 'w')).communicate()[0].strip('\n') if selinux == 'Enforcing': print >> sys.stdout, "WARNING: SELinux is enforcing. This may lead to a compose with selinux disabled." print >> sys.stdout, "Consider running with setenforce 0." except: pass # Set up the kickstart parser and pass in the kickstart file we were handed ksparser = pypungi.ks.get_ksparser(ks_path=opts.config) if opts.sourceisos: config.set('pungi', 'arch', 'source') for part in ksparser.handler.partition.partitions: if part.mountpoint == 'iso': config.set('pungi', 'cdsize', str(part.size)) config.set('pungi', 'force', str(opts.force)) if config.get('pungi', 'workdirbase') == '/work': config.set('pungi', 'workdirbase', "%s/work" % config.get('pungi', 'destdir')) # Set up our directories if not os.path.exists(config.get('pungi', 'destdir')): try: os.makedirs(config.get('pungi', 'destdir')) except OSError, e: print >> sys.stderr, "Error: Cannot create destination dir %s" % config.get( 'pungi', 'destdir') sys.exit(1)
def main(): config = pypungi.config.Config() (opts, args) = get_arguments(config) # You must be this high to ride if you're going to do root tasks if os.geteuid () != 0 and (opts.do_all or opts.do_buildinstall): print >> sys.stderr, "You must run pungi as root" return 1 if opts.do_all or opts.do_buildinstall: try: selinux = subprocess.Popen('/usr/sbin/getenforce', stdout=subprocess.PIPE, stderr=open('/dev/null', 'w')).communicate()[0].strip('\n') if selinux == 'Enforcing': print >> sys.stdout, "WARNING: SELinux is enforcing. This may lead to a compose with selinux disabled." print >> sys.stdout, "Consider running with setenforce 0." except: pass # Set up the kickstart parser and pass in the kickstart file we were handed ksparser = pypungi.ks.get_ksparser(ks_path=opts.config) if opts.sourceisos: config.set('pungi', 'arch', 'source') for part in ksparser.handler.partition.partitions: if part.mountpoint == 'iso': config.set('pungi', 'cdsize', str(part.size)) config.set('pungi', 'force', str(opts.force)) if config.get('pungi', 'workdirbase') == '/work': config.set('pungi', 'workdirbase', "%s/work" % config.get('pungi', 'destdir')) # Set up our directories if not os.path.exists(config.get('pungi', 'destdir')): try: os.makedirs(config.get('pungi', 'destdir')) except OSError, e: print >> sys.stderr, "Error: Cannot create destination dir %s" % config.get('pungi', 'destdir') sys.exit(1)
def set_config(option, opt_str, value, parser, config): config.set('pungi', option.dest, value) # When setting name, also set the iso_basename. if option.dest == 'name': config.set('pungi', 'iso_basename', value)
sys.exit(1) else: print >> sys.stdout, "Warning: Reusing existing destination directory." cachedir = config.get('pungi', 'cachedir') if not os.path.exists(cachedir): try: os.makedirs(cachedir) except OSError, e: print >> sys.stderr, "Error: Cannot create cache dir %s" % cachedir sys.exit(1) # Set debuginfo flag if opts.nodebuginfo: config.set('pungi', 'debuginfo', "False") if opts.nogreedy: config.set('pungi', 'alldeps', "False") if opts.isfinal: config.set('pungi', 'isfinal', "True") if opts.nohash: config.set('pungi', 'nohash', "True") if opts.full_archlist: config.set('pungi', 'full_archlist', "True") if opts.arch: config.set('pungi', 'arch', opts.arch) # Actually do work. mypungi = pypungi.Pungi(config, ksparser) if not opts.sourceisos:
sys.exit(1) else: print >> sys.stdout, "Warning: Reusing existing destination directory." cachedir = config.get('pungi', 'cachedir') if not os.path.exists(cachedir): try: os.makedirs(cachedir) except OSError, e: print >> sys.stderr, "Error: Cannot create cache dir %s" % cachedir sys.exit(1) # Set debuginfo flag if opts.nodebuginfo: config.set('pungi', 'debuginfo', "False") # Actually do work. mypungi = pypungi.Pungi(config, ksparser) if not opts.sourceisos: if opts.do_all or opts.do_gather or opts.do_buildinstall: mypungi._inityum() # initialize the yum object for things that need it if opts.do_all or opts.do_gather: mypungi.getPackageObjects() if not opts.nosource or opts.selfhosting or opts.fulltree: mypungi.createSourceHashes() mypungi.getSRPMList() if opts.selfhosting: mypungi.resolvePackageBuildDeps() if opts.fulltree:
sys.exit(1) else: print >> sys.stdout, "Warning: Reusing existing working base directory." cachedir = config.get('pungi', 'cachedir') if not os.path.exists(cachedir): try: os.makedirs(cachedir) except OSError, e: print >> sys.stderr, "Error: Cannot create cache dir %s" % cachedir sys.exit(1) # Set debuginfo flag if opts.nodebuginfo: config.set('pungi', 'debuginfo', "False") if opts.greedy: config.set('pungi', 'greedy', opts.greedy) else: # XXX: compatibility if opts.nogreedy: config.set('pungi', 'greedy', "none") else: config.set('pungi', 'greedy', "all") config.set('pungi', 'resolve_deps', str(bool(opts.resolve_deps))) if opts.isfinal: config.set('pungi', 'isfinal', "True") if opts.nohash: config.set('pungi', 'nohash', "True") if opts.full_archlist: config.set('pungi', 'full_archlist', "True")