Exemple #1
0
def add_query(*args, **kwds):
    _query_items.append(kwds["dest"])
    kwds.setdefault('final_priority', 50)
    kwds.setdefault('default', [])
    if not kwds.pop('suppress_nargs', False):
        if kwds.get('action', None) != 'append':
            kwds.setdefault('nargs', 1)
    commandline.make_query(query, *args, **kwds)
Exemple #2
0
def add_query(*args, **kwds):
    _query_items.append(kwds["dest"])
    kwds.setdefault('final_priority', 50)
    kwds.setdefault('default', [])
    if not kwds.pop('suppress_nargs', False):
        if kwds.get('action', None) != 'append':
            kwds.setdefault('nargs', 1)
    commandline.make_query(query, *args, **kwds)
Exemple #3
0
def add_query(*args, **kwds):
    if "dest" not in kwds:
        # auto-determine destination name from long option(s)
        dest = [x for x in args if x.startswith(argparser.prefix_chars * 2) and len(x) > 2]
        if not dest:
            raise ValueError("no valid options for query dest names: %s" % ", ".join(args))
        dest = dest[0].lstrip(argparser.prefix_chars)
        kwds["dest"] = dest.replace("-", "_")
    _query_items.append(kwds["dest"])
    kwds.setdefault("final_priority", 50)
    if kwds.get("action", None) == "append":
        kwds.setdefault("default", [])
    commandline.make_query(query, *args, **kwds)
Exemple #4
0
def add_query(*args, **kwds):
    if 'dest' not in kwds:
        # auto-determine destination name from long option(s)
        dest = [x for x in args if x.startswith(argparser.prefix_chars * 2) and len(x) > 2]
        if not dest:
            raise ValueError(f"no valid options for query dest names: {', '.join(args)}")
        dest = dest[0].lstrip(argparser.prefix_chars)
        kwds['dest'] = dest.replace('-', '_')
    _query_items.append(kwds['dest'])
    kwds.setdefault('final_priority', 50)
    if kwds.get('action', None) == 'append':
        kwds.setdefault('default', [])
    commandline.make_query(query, *args, **kwds)
Exemple #5
0
def add_query(*args, **kwds):
    if 'dest' not in kwds:
        # auto-determine destination name from long option(s)
        dest = [
            x for x in args
            if x.startswith(argparser.prefix_chars * 2) and len(x) > 2
        ]
        if not dest:
            raise ValueError(
                f"no valid options for query dest names: {', '.join(args)}")
        dest = dest[0].lstrip(argparser.prefix_chars)
        kwds['dest'] = dest.replace('-', '_')
    _query_items.append(kwds['dest'])
    kwds.setdefault('final_priority', 50)
    if kwds.get('action', None) == 'append':
        kwds.setdefault('default', [])
    commandline.make_query(query, *args, **kwds)
Exemple #6
0
        out.write(out.bold, s)
        out.write(out.bold, '*' * len(s))
        out.write()
        for name, section in sorted(source.iteritems()):
            out.write('%s' % (name,))
            out.write('=' * len(name))
            _dump_uncollapsed_section(options.config, out, err, section)
            out.write()

shared_options_domain = (commandline.mk_argparser(
    config=False, color=False, version=False, add_help=False),)
package = subparsers.add_parser(
    "package", parents=shared_options_domain,
    description="invoke a packages custom configuration scripts")
commandline.make_query(
    package, nargs='+', dest='query',
    help="restrictions/atoms; matching installed packages will be configured")
@package.bind_main_func
def package_func(options, out, err):
    matched = True
    domain = options.domain
    for pkg in domain.installed_repos.combined.itermatch(options.query):
        matched = True
        ops = domain.pkg_operations(pkg)
        if not ops.supports("configure"):
            out.write("package %s: nothing to configure, ignoring" % (pkg,))
            continue
        out.write("package %s: configuring..." % (pkg,))
        ops.configure()
    if not matched:
        out.write("no packages matched")
Exemple #7
0
        out.write(out.bold, '*' * len(s))
        out.write()
        for name, section in sorted(source.iteritems()):
            out.write('%s' % (name, ))
            out.write('=' * len(name))
            _dump_uncollapsed_section(options.config, out, err, section)
            out.write()


package = subparsers.add_parser(
    "package",
    parents=(commandline.mk_argparser(add_help=False), ),
    description="invoke a packages custom configuration scripts")
commandline.make_query(
    package,
    nargs='+',
    dest='query',
    help="restrictions/atoms; matching installed packages will be configured")


@package.bind_main_func
def package_func(options, out, err):
    matched = True
    domain = options.domain
    for pkg in domain.installed_repositories.combined.itermatch(options.query):
        matched = True
        ops = domain.pkg_operations(pkg)
        if not ops.supports("configure"):
            out.write("package %s: nothing to configure, ignoring" % (pkg, ))
            continue
        out.write("package %s: configuring..." % (pkg, ))
Exemple #8
0

copy = subparsers.add_parser(
    "copy", parents=shared_options,
    description="copy binpkgs between repositories; primarily useful for "
    "quickpkging a livefs pkg")
copy.add_argument(
    'target_repo', action=commandline.StoreRepoObject,
    writable=True, help="repository to add packages to")
copy.add_argument(
    '-s', '--source-repo', default=None,
    action=commandline.StoreRepoObject,
    help="copy strictly from the supplied repository; else it copies from "
    "wherever a match is found")
commandline.make_query(
    copy, nargs='+', dest='query',
    help="packages matching any of these restrictions will be selected "
    "for copying")
copy.add_argument(
    '-i', '--ignore-existing', default=False, action='store_true',
    help="if a matching pkg already exists in the target, don't update it")

@copy.bind_main_func
def copy_main(options, out, err):
    """Copy pkgs between repositories."""

    src_repo = options.source_repo
    if src_repo is None:
        src_repo = multiplex.tree(*options.config.repo.values())
    trg_repo = options.target_repo
    src_repo = options.source_repo
Exemple #9
0

# TODO: restrict to required repo types
copy = subparsers.add_parser(
    "copy",
    parents=shared_options_domain,
    description="copy binpkgs between repos; primarily useful for "
    "quickpkging a livefs pkg")
copy.add_argument('target_repo',
                  action=commandline.StoreRepoObject,
                  repo_type='binary-raw',
                  writable=True,
                  help="repository to add packages to")
commandline.make_query(
    copy,
    nargs='+',
    dest='query',
    help="packages matching any of these restrictions will be selected "
    "for copying")
copy_opts = copy.add_argument_group("subcommand options")
copy_opts.add_argument(
    '-s',
    '--source-repo',
    default=None,
    repo_type='installed',
    action=commandline.StoreRepoObject,
    help="copy strictly from the supplied repository; else it copies from "
    "wherever a match is found")
copy_opts.add_argument(
    '-i',
    '--ignore-existing',
    default=False,