__save_ebuild_env: filter __repo_key
[portage.git] / bin / egencache
index 59d5c3bd7a48f63f5dc843b5b2c59a6af2668406..2c5dddce9a7a53813326513976e350976c75ea70 100755 (executable)
@@ -82,7 +82,7 @@ def parse_args(args):
        actions = optparse.OptionGroup(parser, 'Actions')
        actions.add_option("--update",
                action="store_true",
-               help="update metadata/cache/ (generate as necessary)")
+               help="update metadata/md5-cache/ (generate as necessary)")
        actions.add_option("--update-use-local-desc",
                action="store_true",
                help="update the use.local.desc file from metadata.xml")
@@ -108,11 +108,14 @@ def parse_args(args):
                help="override the PORTAGE_GPG_KEY variable",
                dest="gpg_key")
        common.add_option("--portdir",
-               help="override the portage tree location",
+               help="override the portage tree location (deprecated in favor of --repositories-configuration)",
                dest="portdir")
        common.add_option("--portdir-overlay",
-               help="override the PORTDIR_OVERLAY variable (requires that --repo is also specified)",
+               help="override the PORTDIR_OVERLAY variable (requires that --repo is also specified) (deprecated in favor of --repositories-configuration)",
                dest="portdir_overlay")
+       common.add_option("--repositories-configuration",
+               help="override configuration of repositories (in format of repos.conf) (requires that --repo is also specified)",
+               dest="repositories_configuration")
        common.add_option("--sign-manifests",
                type="choice",
                choices=('y', 'n'),
@@ -209,9 +212,11 @@ def parse_args(args):
                        parser.error("Write access denied: --cache-dir='%s'" % \
                                (options.cache_dir,))
 
-       if options.portdir_overlay is not None and \
-               options.repo is None:
-               parser.error("--portdir-overlay option requires --repo option")
+       if options.repo is None:
+               if options.repositories_configuration is not None:
+                       parser.error("--repositories-configuration option requires --repo option")
+               if options.portdir_overlay is not None:
+                       parser.error("--portdir-overlay option requires --repo option")
 
        for atom in args:
                try:
@@ -387,8 +392,8 @@ class GenCache(object):
                                self.returncode |= 1
                                writemsg_level(
                                        "Error listing cache entries for " + \
-                                       "'%s/metadata/cache': %s, continuing...\n" % \
-                                       (self._portdb.porttree_root, ce),
+                                       "'%s': %s, continuing...\n" % \
+                                       (trg_cache.location, ce),
                                        level=logging.ERROR, noiselevel=-1)
 
                else:
@@ -409,8 +414,8 @@ class GenCache(object):
                                self.returncode |= 1
                                writemsg_level(
                                        "Error listing cache entries for " + \
-                                       "'%s/metadata/cache': %s, continuing...\n" % \
-                                       (self._portdb.porttree_root, ce),
+                                       "'%s': %s, continuing...\n" % \
+                                       (trg_cache.location, ce),
                                        level=logging.ERROR, noiselevel=-1)
 
                if cp_missing:
@@ -859,6 +864,8 @@ def egencache_main(args):
 
        if options.repo is None:
                env['PORTDIR_OVERLAY'] = ''
+       elif options.repositories_configuration is not None:
+               env['PORTAGE_REPOSITORIES'] = options.repositories_configuration
        elif options.portdir_overlay:
                env['PORTDIR_OVERLAY'] = options.portdir_overlay
 
@@ -873,7 +880,8 @@ def egencache_main(args):
 
        default_opts = None
        if not options.ignore_default_opts:
-               default_opts = settings.get('EGENCACHE_DEFAULT_OPTS', '').split()
+               default_opts = portage.util.shlex_split(
+                       settings.get('EGENCACHE_DEFAULT_OPTS', ''))
 
        if default_opts:
                parser, options, args = parse_args(default_opts + args)