summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Luther <SebastianLuther@gmx.de>2011-10-16 20:43:17 +0200
committerZac Medico <zmedico@gentoo.org>2011-10-16 11:58:12 -0700
commit2d78dcda11d753a54f821c7fb482b4bb3b511d0b (patch)
tree19ae2e382ef4e47f772f54f7b47008170a98dd82
parentc9e22480dbb1767cc0e59eee5c1c3b358da7a078 (diff)
downloadportage-2d78dcda11d753a54f821c7fb482b4bb3b511d0b.tar.gz
portage-2d78dcda11d753a54f821c7fb482b4bb3b511d0b.tar.bz2
portage-2d78dcda11d753a54f821c7fb482b4bb3b511d0b.zip
Add --binpkg-exclude option
This options disables creation of binary packages, no matter what enabled it in the first place. See bug 386903.
-rw-r--r--man/emerge.15
-rw-r--r--pym/_emerge/EbuildBuild.py3
-rw-r--r--pym/_emerge/Scheduler.py7
-rw-r--r--pym/_emerge/main.py28
4 files changed, 37 insertions, 6 deletions
diff --git a/man/emerge.1 b/man/emerge.1
index 1eab6e50a..0a1ec0371 100644
--- a/man/emerge.1
+++ b/man/emerge.1
@@ -344,6 +344,11 @@ An alternative for already\-merged
packages is to use \fBquickpkg\fR(1) which creates a tbz2 from the
live filesystem.
.TP
+.BR "\-\-buildpkg\-exclude " ATOMS
+A space separated list of package atoms for which
+no binary packages should be built. This option overrides all
+possible ways to enable building of binary packages.
+.TP
.BR "\-\-buildpkgonly " (\fB\-B\fR)
Creates binary packages for all ebuilds processed without actually
merging the packages. This comes with the caveat that all build-time
diff --git a/pym/_emerge/EbuildBuild.py b/pym/_emerge/EbuildBuild.py
index 012a1efc6..d44dcf357 100644
--- a/pym/_emerge/EbuildBuild.py
+++ b/pym/_emerge/EbuildBuild.py
@@ -226,7 +226,8 @@ class EbuildBuild(CompositeTask):
system_set.findAtomForPackage(pkg) and \
not opts.buildpkg
- if opts.buildpkg or "buildpkg" in features or self._issyspkg:
+ if (opts.buildpkg or "buildpkg" in features or self._issyspkg) \
+ and not self.opts.buildpkg_exclude.findAtomForPackage(pkg):
self._buildpkg = True
diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py
index 95cc104e0..3221b8620 100644
--- a/pym/_emerge/Scheduler.py
+++ b/pym/_emerge/Scheduler.py
@@ -96,7 +96,7 @@ class Scheduler(PollScheduler):
("merge", "jobs", "ebuild_locks", "fetch", "unpack"), prefix="")
class _build_opts_class(SlotObject):
- __slots__ = ("buildpkg", "buildpkgonly",
+ __slots__ = ("buildpkg", "buildpkg_exclude", "buildpkgonly",
"fetch_all_uri", "fetchonly", "pretend")
class _binpkg_opts_class(SlotObject):
@@ -159,8 +159,13 @@ class Scheduler(PollScheduler):
self._favorites = favorites
self._args_set = InternalPackageSet(favorites, allow_repo=True)
self._build_opts = self._build_opts_class()
+
for k in self._build_opts.__slots__:
setattr(self._build_opts, k, "--" + k.replace("_", "-") in myopts)
+ self._build_opts.buildpkg_exclude = InternalPackageSet( \
+ initial_atoms=" ".join(myopts.get("--buildpkg-exclude", [])).split(), \
+ allow_wildcard=True, allow_repo=True)
+
self._binpkg_opts = self._binpkg_opts_class()
for k in self._binpkg_opts.__slots__:
setattr(self._binpkg_opts, k, "--" + k.replace("_", "-") in myopts)
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index ed07c092d..26f37667a 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -556,19 +556,25 @@ def insert_optional_args(args):
return new_args
-def _find_bad_atoms(atoms):
+def _find_bad_atoms(atoms, less_strict=False):
+ """
+ Declares all atoms as invalid that have an operator,
+ a use dependency, a blocker or a repo spec.
+ It accepts atoms with wildcards.
+ In less_strict mode it accepts operators and repo specs.
+ """
bad_atoms = []
for x in ' '.join(atoms).split():
bad_atom = False
try:
- atom = portage.dep.Atom(x, allow_wildcard=True)
+ atom = portage.dep.Atom(x, allow_wildcard=True, allow_repo=less_strict)
except portage.exception.InvalidAtom:
try:
- atom = portage.dep.Atom("*/"+x, allow_wildcard=True)
+ atom = portage.dep.Atom("*/"+x, allow_wildcard=True, allow_repo=less_strict)
except portage.exception.InvalidAtom:
bad_atom = True
- if bad_atom or atom.operator or atom.blocker or atom.use:
+ if bad_atom or (atom.operator and not less_strict) or atom.blocker or atom.use:
bad_atoms.append(x)
return bad_atoms
@@ -644,6 +650,14 @@ def parse_opts(tmpcmdline, silent=False):
"choices" : true_y_or_n
},
+ "--buildpkg-exclude": {
+ "help" :"A space separated list of package atoms for which " + \
+ "no binary packages should be built. This option overrides all " + \
+ "possible ways to enable building of binary packages.",
+
+ "action" : "append"
+ },
+
"--config-root": {
"help":"specify the location for portage configuration files",
"action":"store"
@@ -967,6 +981,12 @@ def parse_opts(tmpcmdline, silent=False):
else:
myoptions.buildpkg = None
+ if myoptions.buildpkg_exclude:
+ bad_atoms = _find_bad_atoms(myoptions.buildpkg_exclude, less_strict=True)
+ if bad_atoms and not silent:
+ parser.error("Invalid Atom(s) in --buildpkg-exclude parameter: '%s'\n" % \
+ (",".join(bad_atoms),))
+
if myoptions.changed_use is not False:
myoptions.reinstall = "changed-use"
myoptions.changed_use = False