Пример #1
0
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)
Пример #2
0
Файл: pungi.py Проект: bcl/pungi
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)
Пример #3
0
    def get_arguments(config):
        parser = OptionParser("%prog [--help] [options]", version="%prog 2.9")

        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)

        # Pulled in from config file to be cli options as part of pykickstart conversion
        parser.add_option("--name", dest="name", type="string",
          action="callback", callback=set_config, callback_args=(config, ),
          help='the name for your distribution (defaults to "Fedora")')
        parser.add_option("--ver", dest="version", type="string",
          action="callback", callback=set_config, callback_args=(config, ),
          help='the version of your distribution (defaults to datestamp)')
        parser.add_option("--flavor", dest="flavor", type="string",
          action="callback", callback=set_config, callback_args=(config, ),
          help='the flavor of your distribution spin (optional)')
        parser.add_option("--destdir", dest="destdir", type="string",
          action="callback", callback=set_config, callback_args=(config, ),
          help='destination directory (defaults to current directory)')
        parser.add_option("--cachedir", dest="cachedir", type="string",
          action="callback", callback=set_config, callback_args=(config, ),
          help='package cache directory (defaults to /var/cache/pungi)')
        parser.add_option("--bugurl", dest="bugurl", type="string",
          action="callback", callback=set_config, callback_args=(config, ),
          help='the url for your bug system (defaults to http://bugzilla.redhat.com)')
        parser.add_option("--selfhosting", action="store_true", dest="selfhosting",
          help='build a self-hosting tree by following build dependencies (optional)')
        parser.add_option("--fulltree", action="store_true", dest="fulltree",
          help='build a tree that includes all packages built from corresponding source rpms (optional)')
        parser.add_option("--nosource", action="store_true", dest="nosource",
          help='disable gathering of source packages (optional)')
        parser.add_option("--nodebuginfo", action="store_true", dest="nodebuginfo",
          help='disable gathering of debuginfo packages (optional)')
        parser.add_option("--nodownload", action="store_true", dest="nodownload",
          help='disable downloading of packages. instead, print the package URLs (optional)')
        parser.add_option("--norelnotes", action="store_true", dest="norelnotes",
          help='disable gathering of release notes (optional)')
        parser.add_option("--nogreedy", action="store_true", dest="nogreedy",
          help='disable pulling of all providers of package dependencies (optional)')
        parser.add_option("--sourceisos", default=False, action="store_true", dest="sourceisos",
          help='Create the source isos (other arch runs must be done)')
        parser.add_option("--force", default=False, action="store_true",
          help='Force reuse of an existing destination directory (will overwrite files)')
        parser.add_option("--isfinal", default=False, action="store_true", 	
          help='Specify this is a GA tree, which causes betanag to be turned off during install')
        parser.add_option("--nohash", default=False, action="store_true",
          help='disable hashing the Packages trees')
        parser.add_option("--full-archlist", action="store_true",
          help='Use the full arch list for x86_64 (include i686, i386, etc.)')
        parser.add_option("--arch",
          help='Override default (uname based) arch')

        parser.add_option("-c", "--config", dest="config",
          help='Path to kickstart config file')
        parser.add_option("--all-stages", action="store_true", default=True, dest="do_all",
          help="Enable ALL stages")
        parser.add_option("-G", action="store_true", default=False, dest="do_gather",
          help="Flag to enable processing the Gather stage")
        parser.add_option("-C", action="store_true", default=False, dest="do_createrepo",
          help="Flag to enable processing the Createrepo stage")
        parser.add_option("-B", action="store_true", default=False, dest="do_buildinstall",
          help="Flag to enable processing the BuildInstall stage")
        parser.add_option("-I", action="store_true", default=False, dest="do_createiso",
          help="Flag to enable processing the CreateISO stage")


        (opts, args) = parser.parse_args()

        if not opts.config:
            parser.error("Please specify a config file")

        if not config.get('pungi', 'flavor').isalnum() and not config.get('pungi', 'flavor') == '':
            parser.error("Flavor must be alphanumeric")

        if opts.do_gather or opts.do_createrepo or opts.do_buildinstall or opts.do_createiso:
            opts.do_all = False

        if opts.arch and (opts.do_all or opts.do_buildinstall):
            parser.error("Cannot override arch while the BuildInstall stage is enabled")

        return (opts, args)
Пример #4
0
        if part.mountpoint == 'iso':
            config.set('pungi', 'cdsize', str(part.size))
            
    config.set('pungi', 'force', str(opts.force))

    # 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)
    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")
Пример #5
0
    def get_arguments(config):
        parser = OptionParser(version="%prog 2.0.22")

        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)

        # Pulled in from config file to be cli options as part of pykickstart conversion
        parser.add_option("--name", dest="name", type="string",
          action="callback", callback=set_config, callback_args=(config, ),
          help='the name for your distribution (defaults to "Fedora")')
        parser.add_option("--ver", dest="version", type="string",
          action="callback", callback=set_config, callback_args=(config, ),
          help='the version of your distribution (defaults to datestamp)')
        parser.add_option("--flavor", dest="flavor", type="string",
          action="callback", callback=set_config, callback_args=(config, ),
          help='the flavor of your distribution spin (optional)')
        parser.add_option("--destdir", dest="destdir", type="string",
          action="callback", callback=set_config, callback_args=(config, ),
          help='destination directory (defaults to current directory)')
        parser.add_option("--cachedir", dest="cachedir", type="string",
          action="callback", callback=set_config, callback_args=(config, ),
          help='package cache directory (defaults to /var/cache/pungi)')
        parser.add_option("--bugurl", dest="bugurl", type="string",
          action="callback", callback=set_config, callback_args=(config, ),
          help='the url for your bug system (defaults to http://bugzilla.redhat.com)')
        parser.add_option("--selfhosting", action="store_true", dest="selfhosting",
          help='build a self-hosting tree by following build dependencies (optional)')
        parser.add_option("--fulltree", action="store_true", dest="fulltree",
          help='build a tree that includes all packages built from corresponding source rpms (optional)')
        parser.add_option("--nosource", action="store_true", dest="nosource",
          help='disable gathering of source packages (optional)')
        parser.add_option("--nodebuginfo", action="store_true", dest="nodebuginfo",
          help='disable gathering of debuginfo packages (optional)')
        parser.add_option("--nosplitmedia", action="store_false", dest="nosplitmedia", default=True,
          help='disable creation of split media (optional)')
        parser.add_option("--sourceisos", default=False, action="store_true", dest="sourceisos",
          help='Create the source isos (other arch runs must be done)')
        parser.add_option("--force", default=False, action="store_true",
          help='Force reuse of an existing destination directory (will overwrite files)')

        parser.add_option("-c", "--config", dest="config",
          help='Path to kickstart config file')
        parser.add_option("--all-stages", action="store_true", default=True, dest="do_all",
          help="Enable ALL stages")
        parser.add_option("-G", action="store_true", default=False, dest="do_gather",
          help="Flag to enable processing the Gather stage")
        parser.add_option("-C", action="store_true", default=False, dest="do_createrepo",
          help="Flag to enable processing the Createrepo stage")
        parser.add_option("-B", action="store_true", default=False, dest="do_buildinstall",
          help="Flag to enable processing the BuildInstall stage")
        parser.add_option("-I", action="store_true", default=False, dest="do_createiso",
          help="Flag to enable processing the CreateISO stage")


        (opts, args) = parser.parse_args()

        if not opts.config:
            parser.print_help()
            sys.exit(0)

        if not config.get('pungi', 'flavor').isalnum() and not config.get('pungi', 'flavor') == '':
            print >> sys.stderr, "Flavor must be alphanumeric."
            sys.exit(1)

        if opts.do_gather or opts.do_createrepo or opts.do_buildinstall or opts.do_createiso:
            opts.do_all = False
        return (opts, args)
Пример #6
0
Файл: pungi.py Проект: bcl/pungi
    def get_arguments(config):
        parser = OptionParser("%prog [--help] [options]", version="%prog 3.13")

        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)

        # Pulled in from config file to be cli options as part of pykickstart conversion
        parser.add_option("--name", dest="name", type="string",
          action="callback", callback=set_config, callback_args=(config, ),
          help='the name for your distribution (defaults to "Fedora")')
        parser.add_option("--ver", dest="version", type="string",
          action="callback", callback=set_config, callback_args=(config, ),
          help='the version of your distribution (defaults to datestamp)')
        parser.add_option("--flavor", dest="flavor", type="string",
          action="callback", callback=set_config, callback_args=(config, ),
          help='the flavor of your distribution spin (optional)')
        parser.add_option("--destdir", dest="destdir", type="string",
          action="callback", callback=set_config, callback_args=(config, ),
          help='destination directory (defaults to current directory)')
        parser.add_option("--cachedir", dest="cachedir", type="string",
          action="callback", callback=set_config, callback_args=(config, ),
          help='package cache directory (defaults to /var/cache/pungi)')
        parser.add_option("--bugurl", dest="bugurl", type="string",
          action="callback", callback=set_config, callback_args=(config, ),
          help='the url for your bug system (defaults to http://bugzilla.redhat.com)')
        parser.add_option("--selfhosting", action="store_true", dest="selfhosting",
          help='build a self-hosting tree by following build dependencies (optional)')
        parser.add_option("--fulltree", action="store_true", dest="fulltree",
          help='build a tree that includes all packages built from corresponding source rpms (optional)')
        parser.add_option("--nosource", action="store_true", dest="nosource",
          help='disable gathering of source packages (optional)')
        parser.add_option("--nodebuginfo", action="store_true", dest="nodebuginfo",
          help='disable gathering of debuginfo packages (optional)')
        parser.add_option("--nodownload", action="store_true", dest="nodownload",
          help='disable downloading of packages. instead, print the package URLs (optional)')
        parser.add_option("--norelnotes", action="store_true", dest="norelnotes",
          help='disable gathering of release notes (optional); DEPRECATED')
        parser.add_option("--nogreedy", action="store_true", dest="nogreedy",
          help='disable pulling of all providers of package dependencies (optional)')
        parser.add_option("--nodeps", action="store_false", dest="resolve_deps", default=True,
          help='disable resolving dependencies')
        parser.add_option("--sourceisos", default=False, action="store_true", dest="sourceisos",
          help='Create the source isos (other arch runs must be done)')
        parser.add_option("--force", default=False, action="store_true",
          help='Force reuse of an existing destination directory (will overwrite files)')
        parser.add_option("--isfinal", default=False, action="store_true", 	
          help='Specify this is a GA tree, which causes betanag to be turned off during install')
        parser.add_option("--nohash", default=False, action="store_true",
          help='disable hashing the Packages trees')
        parser.add_option("--full-archlist", action="store_true",
          help='Use the full arch list for x86_64 (include i686, i386, etc.)')
        parser.add_option("--arch",
          help='Override default (uname based) arch')
        parser.add_option("--greedy", metavar="METHOD",
          help='Greedy method; none, all, build')
        parser.add_option("--multilib", action="append", metavar="METHOD",
          help='Multilib method; can be specified multiple times; recommended: devel, runtime')
        parser.add_option("--lookaside-repo", action="append", dest="lookaside_repos", metavar="NAME",
          help='Specify lookaside repo name(s) (packages will used for depsolving but not be included in the output)')
        parser.add_option("--workdirbase", dest="workdirbase", type="string",
          action="callback", callback=set_config, callback_args=(config, ),
          help='base working directory (defaults to destdir + /work)')
        parser.add_option("--no-dvd", default=False, action="store_true", dest="no_dvd",
          help='Do not make a install DVD/CD only the netinstall image and the tree')
        parser.add_option("--lorax-conf", type="string",
          help='Path to lorax.conf file (optional)')
        parser.add_option("-i", "--installpkgs", default=[],
            action="append", metavar="STRING",
            help="Package glob for lorax to install before runtime-install.tmpl runs. (may be listed multiple times)")

        parser.add_option("-c", "--config", dest="config",
          help='Path to kickstart config file')
        parser.add_option("--all-stages", action="store_true", default=True, dest="do_all",
          help="Enable ALL stages")
        parser.add_option("-G", action="store_true", default=False, dest="do_gather",
          help="Flag to enable processing the Gather stage")
        parser.add_option("-C", action="store_true", default=False, dest="do_createrepo",
          help="Flag to enable processing the Createrepo stage")
        parser.add_option("-B", action="store_true", default=False, dest="do_buildinstall",
          help="Flag to enable processing the BuildInstall stage")
        parser.add_option("-I", action="store_true", default=False, dest="do_createiso",
          help="Flag to enable processing the CreateISO stage")
        parser.add_option("--relnotepkgs", dest="relnotepkgs", type="string",
          action="callback", callback=set_config, callback_args=(config, ),
          help='Rpms which contain the release notes')
        parser.add_option("--relnotefilere", dest="relnotefilere", type="string",
          action="callback", callback=set_config, callback_args=(config, ),
          help='Which files are the release notes -- GPL EULA')
        parser.add_option("--nomacboot", action="store_true", dest="nomacboot",           help='disable setting up macboot as no hfs support ')


        (opts, args) = parser.parse_args()

        if not opts.config:
            parser.error("Please specify a config file")

        if not config.get('pungi', 'flavor').isalnum() and not config.get('pungi', 'flavor') == '':
            parser.error("Flavor must be alphanumeric")

        if opts.do_gather or opts.do_createrepo or opts.do_buildinstall or opts.do_createiso:
            opts.do_all = False

        if opts.arch and (opts.do_all or opts.do_buildinstall):
            parser.error("Cannot override arch while the BuildInstall stage is enabled")

        return (opts, args)
Пример #7
0
Файл: pungi.py Проект: bcl/pungi
            
    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)
    else:
        print >> sys.stdout, "Warning: Reusing existing destination directory."

    if not os.path.exists(config.get('pungi', 'workdirbase')):
        try:
            os.makedirs(config.get('pungi', 'workdirbase'))
        except OSError, e:
            print >> sys.stderr, "Error: Cannot create working base dir %s" % config.get('pungi', 'workdirbase')
            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
Пример #8
0
    def get_arguments(config):
        parser = OptionParser("%prog [--help] [options]", version="%prog 2.9")

        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)

        # Pulled in from config file to be cli options as part of pykickstart conversion
        parser.add_option(
            "--name",
            dest="name",
            type="string",
            action="callback",
            callback=set_config,
            callback_args=(config, ),
            help='the name for your distribution (defaults to "Fedora")')
        parser.add_option(
            "--ver",
            dest="version",
            type="string",
            action="callback",
            callback=set_config,
            callback_args=(config, ),
            help='the version of your distribution (defaults to datestamp)')
        parser.add_option(
            "--flavor",
            dest="flavor",
            type="string",
            action="callback",
            callback=set_config,
            callback_args=(config, ),
            help='the flavor of your distribution spin (optional)')
        parser.add_option(
            "--destdir",
            dest="destdir",
            type="string",
            action="callback",
            callback=set_config,
            callback_args=(config, ),
            help='destination directory (defaults to current directory)')
        parser.add_option(
            "--cachedir",
            dest="cachedir",
            type="string",
            action="callback",
            callback=set_config,
            callback_args=(config, ),
            help='package cache directory (defaults to /var/cache/pungi)')
        parser.add_option(
            "--bugurl",
            dest="bugurl",
            type="string",
            action="callback",
            callback=set_config,
            callback_args=(config, ),
            help=
            'the url for your bug system (defaults to http://bugzilla.redhat.com)'
        )
        parser.add_option(
            "--selfhosting",
            action="store_true",
            dest="selfhosting",
            help=
            'build a self-hosting tree by following build dependencies (optional)'
        )
        parser.add_option(
            "--fulltree",
            action="store_true",
            dest="fulltree",
            help=
            'build a tree that includes all packages built from corresponding source rpms (optional)'
        )
        parser.add_option(
            "--nosource",
            action="store_true",
            dest="nosource",
            help='disable gathering of source packages (optional)')
        parser.add_option(
            "--nodebuginfo",
            action="store_true",
            dest="nodebuginfo",
            help='disable gathering of debuginfo packages (optional)')
        parser.add_option(
            "--nodownload",
            action="store_true",
            dest="nodownload",
            help=
            'disable downloading of packages. instead, print the package URLs (optional)'
        )
        parser.add_option("--norelnotes",
                          action="store_true",
                          dest="norelnotes",
                          help='disable gathering of release notes (optional)')
        parser.add_option(
            "--nogreedy",
            action="store_true",
            dest="nogreedy",
            help=
            'disable pulling of all providers of package dependencies (optional)'
        )
        parser.add_option(
            "--sourceisos",
            default=False,
            action="store_true",
            dest="sourceisos",
            help='Create the source isos (other arch runs must be done)')
        parser.add_option(
            "--force",
            default=False,
            action="store_true",
            help=
            'Force reuse of an existing destination directory (will overwrite files)'
        )
        parser.add_option(
            "--isfinal",
            default=False,
            action="store_true",
            help=
            'Specify this is a GA tree, which causes betanag to be turned off during install'
        )
        parser.add_option("--nohash",
                          default=False,
                          action="store_true",
                          help='disable hashing the Packages trees')
        parser.add_option(
            "--full-archlist",
            action="store_true",
            help='Use the full arch list for x86_64 (include i686, i386, etc.)'
        )
        parser.add_option("--arch", help='Override default (uname based) arch')

        parser.add_option("-c",
                          "--config",
                          dest="config",
                          help='Path to kickstart config file')
        parser.add_option("--all-stages",
                          action="store_true",
                          default=True,
                          dest="do_all",
                          help="Enable ALL stages")
        parser.add_option("-G",
                          action="store_true",
                          default=False,
                          dest="do_gather",
                          help="Flag to enable processing the Gather stage")
        parser.add_option(
            "-C",
            action="store_true",
            default=False,
            dest="do_createrepo",
            help="Flag to enable processing the Createrepo stage")
        parser.add_option(
            "-B",
            action="store_true",
            default=False,
            dest="do_buildinstall",
            help="Flag to enable processing the BuildInstall stage")
        parser.add_option("-I",
                          action="store_true",
                          default=False,
                          dest="do_createiso",
                          help="Flag to enable processing the CreateISO stage")

        (opts, args) = parser.parse_args()

        if not opts.config:
            parser.error("Please specify a config file")

        if not config.get('pungi', 'flavor').isalnum() and not config.get(
                'pungi', 'flavor') == '':
            parser.error("Flavor must be alphanumeric")

        if opts.do_gather or opts.do_createrepo or opts.do_buildinstall or opts.do_createiso:
            opts.do_all = False

        if opts.arch and (opts.do_all or opts.do_buildinstall):
            parser.error(
                "Cannot override arch while the BuildInstall stage is enabled")

        return (opts, args)
Пример #9
0
            config.set('pungi', 'cdsize', str(part.size))

    config.set('pungi', 'force', str(opts.force))

    # 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)
    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")
Пример #10
0
    def get_arguments(config):
        parser = OptionParser("%prog [--help] [options]", version="%prog 3.13")

        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)

        # Pulled in from config file to be cli options as part of pykickstart conversion
        parser.add_option(
            "--name",
            dest="name",
            type="string",
            action="callback",
            callback=set_config,
            callback_args=(config, ),
            help='the name for your distribution (defaults to "Fedora")')
        parser.add_option(
            "--ver",
            dest="version",
            type="string",
            action="callback",
            callback=set_config,
            callback_args=(config, ),
            help='the version of your distribution (defaults to datestamp)')
        parser.add_option(
            "--flavor",
            dest="flavor",
            type="string",
            action="callback",
            callback=set_config,
            callback_args=(config, ),
            help='the flavor of your distribution spin (optional)')
        parser.add_option(
            "--destdir",
            dest="destdir",
            type="string",
            action="callback",
            callback=set_config,
            callback_args=(config, ),
            help='destination directory (defaults to current directory)')
        parser.add_option(
            "--cachedir",
            dest="cachedir",
            type="string",
            action="callback",
            callback=set_config,
            callback_args=(config, ),
            help='package cache directory (defaults to /var/cache/pungi)')
        parser.add_option(
            "--bugurl",
            dest="bugurl",
            type="string",
            action="callback",
            callback=set_config,
            callback_args=(config, ),
            help=
            'the url for your bug system (defaults to http://bugzilla.redhat.com)'
        )
        parser.add_option(
            "--selfhosting",
            action="store_true",
            dest="selfhosting",
            help=
            'build a self-hosting tree by following build dependencies (optional)'
        )
        parser.add_option(
            "--fulltree",
            action="store_true",
            dest="fulltree",
            help=
            'build a tree that includes all packages built from corresponding source rpms (optional)'
        )
        parser.add_option(
            "--nosource",
            action="store_true",
            dest="nosource",
            help='disable gathering of source packages (optional)')
        parser.add_option(
            "--nodebuginfo",
            action="store_true",
            dest="nodebuginfo",
            help='disable gathering of debuginfo packages (optional)')
        parser.add_option(
            "--nodownload",
            action="store_true",
            dest="nodownload",
            help=
            'disable downloading of packages. instead, print the package URLs (optional)'
        )
        parser.add_option(
            "--norelnotes",
            action="store_true",
            dest="norelnotes",
            help='disable gathering of release notes (optional); DEPRECATED')
        parser.add_option(
            "--nogreedy",
            action="store_true",
            dest="nogreedy",
            help=
            'disable pulling of all providers of package dependencies (optional)'
        )
        parser.add_option("--nodeps",
                          action="store_false",
                          dest="resolve_deps",
                          default=True,
                          help='disable resolving dependencies')
        parser.add_option(
            "--sourceisos",
            default=False,
            action="store_true",
            dest="sourceisos",
            help='Create the source isos (other arch runs must be done)')
        parser.add_option(
            "--force",
            default=False,
            action="store_true",
            help=
            'Force reuse of an existing destination directory (will overwrite files)'
        )
        parser.add_option(
            "--isfinal",
            default=False,
            action="store_true",
            help=
            'Specify this is a GA tree, which causes betanag to be turned off during install'
        )
        parser.add_option("--nohash",
                          default=False,
                          action="store_true",
                          help='disable hashing the Packages trees')
        parser.add_option(
            "--full-archlist",
            action="store_true",
            help='Use the full arch list for x86_64 (include i686, i386, etc.)'
        )
        parser.add_option("--arch", help='Override default (uname based) arch')
        parser.add_option("--greedy",
                          metavar="METHOD",
                          help='Greedy method; none, all, build')
        parser.add_option(
            "--multilib",
            action="append",
            metavar="METHOD",
            help=
            'Multilib method; can be specified multiple times; recommended: devel, runtime'
        )
        parser.add_option(
            "--lookaside-repo",
            action="append",
            dest="lookaside_repos",
            metavar="NAME",
            help=
            'Specify lookaside repo name(s) (packages will used for depsolving but not be included in the output)'
        )
        parser.add_option(
            "--workdirbase",
            dest="workdirbase",
            type="string",
            action="callback",
            callback=set_config,
            callback_args=(config, ),
            help='base working directory (defaults to destdir + /work)')
        parser.add_option(
            "--no-dvd",
            default=False,
            action="store_true",
            dest="no_dvd",
            help=
            'Do not make a install DVD/CD only the netinstall image and the tree'
        )
        parser.add_option("--lorax-conf",
                          type="string",
                          help='Path to lorax.conf file (optional)')
        parser.add_option(
            "-i",
            "--installpkgs",
            default=[],
            action="append",
            metavar="STRING",
            help=
            "Package glob for lorax to install before runtime-install.tmpl runs. (may be listed multiple times)"
        )

        parser.add_option("-c",
                          "--config",
                          dest="config",
                          help='Path to kickstart config file')
        parser.add_option("--all-stages",
                          action="store_true",
                          default=True,
                          dest="do_all",
                          help="Enable ALL stages")
        parser.add_option("-G",
                          action="store_true",
                          default=False,
                          dest="do_gather",
                          help="Flag to enable processing the Gather stage")
        parser.add_option(
            "-C",
            action="store_true",
            default=False,
            dest="do_createrepo",
            help="Flag to enable processing the Createrepo stage")
        parser.add_option(
            "-B",
            action="store_true",
            default=False,
            dest="do_buildinstall",
            help="Flag to enable processing the BuildInstall stage")
        parser.add_option("-I",
                          action="store_true",
                          default=False,
                          dest="do_createiso",
                          help="Flag to enable processing the CreateISO stage")
        parser.add_option("--relnotepkgs",
                          dest="relnotepkgs",
                          type="string",
                          action="callback",
                          callback=set_config,
                          callback_args=(config, ),
                          help='Rpms which contain the release notes')
        parser.add_option("--relnotefilere",
                          dest="relnotefilere",
                          type="string",
                          action="callback",
                          callback=set_config,
                          callback_args=(config, ),
                          help='Which files are the release notes -- GPL EULA')
        parser.add_option("--nomacboot",
                          action="store_true",
                          dest="nomacboot",
                          help='disable setting up macboot as no hfs support ')

        (opts, args) = parser.parse_args()

        if not opts.config:
            parser.error("Please specify a config file")

        if not config.get('pungi', 'flavor').isalnum() and not config.get(
                'pungi', 'flavor') == '':
            parser.error("Flavor must be alphanumeric")

        if opts.do_gather or opts.do_createrepo or opts.do_buildinstall or opts.do_createiso:
            opts.do_all = False

        if opts.arch and (opts.do_all or opts.do_buildinstall):
            parser.error(
                "Cannot override arch while the BuildInstall stage is enabled")

        return (opts, args)
Пример #11
0
    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)
    else:
        print >> sys.stdout, "Warning: Reusing existing destination directory."

    if not os.path.exists(config.get('pungi', 'workdirbase')):
        try:
            os.makedirs(config.get('pungi', 'workdirbase'))
        except OSError, e:
            print >> sys.stderr, "Error: Cannot create working base dir %s" % config.get(
                'pungi', 'workdirbase')
            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: