Add --rebuild-ignore flag.
authorDavid James <davidjames@chromium.org>
Tue, 3 May 2011 20:51:30 +0000 (13:51 -0700)
committerZac Medico <zmedico@gentoo.org>
Tue, 3 May 2011 22:51:20 +0000 (15:51 -0700)
A space separated list of package names or slot atoms. Emerge will not rebuild
packages that depend on matching packages due to \fB\-\-rebuild\fR.

Change-Id: Ia58fe632ed06c97a22413da0341d7f8da2d65ba8

Review URL: http://gerrit.chromium.org/gerrit/209

man/emerge.1
pym/_emerge/depgraph.py
pym/_emerge/help.py
pym/_emerge/main.py
pym/portage/tests/resolver/test_rebuild.py

index f7b6043272db5cf41b14f40d8a8478906a1b2d37..2e27e48e36383b08049ce0722eb67f57a59e4bb0 100644 (file)
@@ -493,6 +493,10 @@ matching binary packages.
 A space separated list of package names or slot atoms. Emerge will not rebuild
 matching packages due to \fB\-\-rebuild\fR.
 .TP
+.BR "\-\-rebuild\-ignore " ATOMS
+A space separated list of package names or slot atoms. Emerge will not rebuild
+packages that depend on matching packages due to \fB\-\-rebuild\fR.
+.TP
 .BR "\-\-oneshot " (\fB\-1\fR)
 Emerge as normal, but do not add the packages to the world file
 for later updating.
index 0de443b3db978031913bc83b847b4d10d25cb852..b0b4b070ad428e9809116692674be5a8f20bd455 100644 (file)
@@ -130,6 +130,8 @@ class _frozen_depgraph_config(object):
                self.useoldpkg_atoms = _wildcard_set(atoms)
                atoms = ' '.join(myopts.get("--rebuild-exclude", [])).split()
                self.rebuild_exclude = _wildcard_set(atoms)
+               atoms = ' '.join(myopts.get("--rebuild-ignore", [])).split()
+               self.rebuild_ignore = _wildcard_set(atoms)
 
                self.rebuild = "--rebuild" in myopts
 
@@ -156,10 +158,12 @@ class _rebuild_config(object):
                parent = dep.collapsed_parent
                priority = dep.collapsed_priority
                rebuild_exclude = self._frozen_config.rebuild_exclude
+               rebuild_ignore = self._frozen_config.rebuild_ignore
                if (self._frozen_config.rebuild and isinstance(parent, Package) and
                        parent.built and (priority.buildtime or priority.runtime) and
                        isinstance(dep_pkg, Package) and
-                       not rebuild_exclude.findAtomForPackage(parent)):
+                       not rebuild_exclude.findAtomForPackage(parent) and
+                       not rebuild_ignore.findAtomForPackage(dep_pkg)):
                        self._graph.add(dep_pkg, parent, priority)
 
        def _trigger_rebuild(self, parent, build_deps, runtime_deps):
index 85026ac8203f427e4593e239ed4c68b991ca48a2..35008c4ba3bf8f927178bef99540c5d0743a1eda 100644 (file)
@@ -571,6 +571,13 @@ def help(myopts, havecolor=1):
                for line in wrap(desc, desc_width):
                        print(desc_indent + line)
                print()
+               print("       " + green("--rebuild-ignore") + " " + turquoise("ATOMS"))
+               desc = "A space separated list of package names or slot atoms." + \
+                       " Emerge will not rebuild packages that depend on matching " + \
+                       " packages due to --rebuild."
+               for line in wrap(desc, desc_width):
+                       print(desc_indent + line)
+               print()
                print("       "+green("--oneshot")+" ("+green("-1")+" short option)")
                print("              Emerge as normal, but don't add packages to the world profile.")
                print("              This package will only be updated if it is depended upon by")
index 552ea20823381365dcfd7e0ed4754bf230bd7438..1e06ec15709862d45fa048c7c7f05fe40e7d7f8b 100644 (file)
@@ -750,6 +750,14 @@ def parse_opts(tmpcmdline, silent=False):
                        "action" : "append",
                },
 
+               "--rebuild-ignore": {
+                       "help"   :"A space separated list of package names or slot atoms. " + \
+                               "Emerge will not rebuild packages that depend on matching " + \
+                               "packages due to the --rebuild flag. ",
+
+                       "action" : "append",
+               },
+
                "--package-moves": {
                        "help"     : "perform package moves when necessary",
                        "type"     : "choice",
@@ -932,6 +940,12 @@ def parse_opts(tmpcmdline, silent=False):
                        parser.error("Invalid Atom(s) in --rebuild-exclude parameter: '%s' (only package names and slot atoms (with wildcards) allowed)\n" % \
                                (",".join(bad_atoms),))
 
+       if myoptions.rebuild_ignore:
+               bad_atoms = _find_bad_atoms(myoptions.rebuild_ignore)
+               if bad_atoms and not silent:
+                       parser.error("Invalid Atom(s) in --rebuild-ignore parameter: '%s' (only package names and slot atoms (with wildcards) allowed)\n" % \
+                               (",".join(bad_atoms),))
+
        if myoptions.usepkg_exclude:
                bad_atoms = _find_bad_atoms(myoptions.usepkg_exclude)
                if bad_atoms and not silent:
index fda289c6e16e82c4d136c0c9763f6281f2264712..da2888c1e3098cd28edb221881115c5e6e97cb14 100644 (file)
@@ -61,6 +61,24 @@ class RebuildTestCase(TestCase):
                                                'sys-apps/e-2', 'sys-apps/g-2'],
                                        ignore_mergelist_order = True,
                                        success = True),
+
+                               ResolverPlaygroundTestCase(
+                                       ["sys-libs/x"],
+                                       options = {"--rebuild" : True,
+                                               "--rebuild-ignore" : ["sys-libs/x"]},
+                                       mergelist = ['sys-libs/x-2'],
+                                       ignore_mergelist_order = True,
+                                       success = True),
+
+                               ResolverPlaygroundTestCase(
+                                       ["sys-libs/x"],
+                                       options = {"--rebuild" : True,
+                                               "--rebuild-ignore" : ["sys-apps/b"]},
+                                       mergelist = ['sys-libs/x-2', 'sys-apps/a-2', 'sys-apps/b-2',
+                                               'sys-apps/e-2'],
+                                       ignore_mergelist_order = True,
+                                       success = True),
+
                        )
 
                playground = ResolverPlayground(ebuilds=ebuilds,