Ejemplo n.º 1
0
def main(argv):
    if argv is None:
        argv = sys.argv[1:]

    # Extract the args ourselves.  This is to allow things like -hppa
    # without tripping over the -h/--help flags.  We can't use the
    # parse_known_args function either.
    # This sucks and really wish we didn't need to do this ...
    parse_args = []
    work_args = []
    while argv:
        arg = argv.pop(0)
        if arg.startswith("--"):
            if arg == "--":
                work_args += argv
                break
            else:
                parse_args.append(arg)
            # Handle flags that take arguments.
            if arg in ("--format",):
                if argv:
                    parse_args.append(argv.pop(0))
        elif len(arg) == 2 and arg[0] == "-":
            parse_args.append(arg)
        else:
            work_args.append(arg)

    parser = get_parser()
    opts = parser.parse_args(parse_args)
    if not work_args:
        parser.error("need ebuilds to process")

    if opts.style == "auto":
        if not portage_settings().get("NOCOLOR", "false").lower() in ("no", "false"):
            nocolor()
            opts.style = "short"
        else:
            opts.style = "color-inline"

    arch_status = load_profile_data()
    try:
        work = args_to_work(work_args, arch_status=arch_status, quiet=opts.quiet)
    except ValueError as e:
        parser.error(e)

    for ebuild, ops in work:
        process_ebuild(
            ebuild,
            ops,
            arch_status=arch_status,
            verbose=opts.verbose,
            quiet=opts.quiet,
            dry_run=opts.dry_run,
            style=opts.style,
            manifest=opts.manifest,
        )

    return os.EX_OK
Ejemplo n.º 2
0
def gen_arch_list(status):
    _arch_status = load_profile_data()
    if status == "stable":
        return [
            arch for arch in _arch_status if _arch_status[arch][0] == "stable"
        ]
    elif status == "dev":
        return [
            arch for arch in _arch_status if _arch_status[arch][0] == "dev"
        ]
    elif status == "exp":
        return [
            arch for arch in _arch_status if _arch_status[arch][0] == "exp"
        ]
    elif status == "arch":
        return [
            arch for arch in _arch_status if _arch_status[arch][1] == "arch"
        ]
    elif status == "~arch":
        return [
            arch for arch in _arch_status if _arch_status[arch][1] == "~arch"
        ]
    else:
        raise TypeError
Ejemplo n.º 3
0
 def _test(self, subdir):
     portdir = os.path.join(TESTDIR, "profiles", subdir)
     return load_profile_data(portdir=portdir)