public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: man/, pym/_emerge/
Date: Sun, 16 Oct 2011 18:58:21 +0000 (UTC)	[thread overview]
Message-ID: <2d78dcda11d753a54f821c7fb482b4bb3b511d0b.zmedico@gentoo> (raw)

commit:     2d78dcda11d753a54f821c7fb482b4bb3b511d0b
Author:     Sebastian Luther <SebastianLuther <AT> gmx <DOT> de>
AuthorDate: Sun Oct 16 18:43:17 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Oct 16 18:58:12 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2d78dcda

Add --binpkg-exclude option

This options disables creation of binary packages, no matter
what enabled it in the first place. See bug 386903.

---
 man/emerge.1               |    5 +++++
 pym/_emerge/EbuildBuild.py |    3 ++-
 pym/_emerge/Scheduler.py   |    7 ++++++-
 pym/_emerge/main.py        |   28 ++++++++++++++++++++++++----
 4 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/man/emerge.1 b/man/emerge.1
index 1eab6e5..0a1ec03 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 012a1ef..d44dcf3 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 95cc104..3221b86 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 ed07c09..26f3766 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



             reply	other threads:[~2011-10-16 18:58 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-16 18:58 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-02-03  3:07 [gentoo-commits] proj/portage:master commit in: man/, pym/_emerge/ Zac Medico
2018-01-30  4:24 Zac Medico
2017-05-14 18:12 Zac Medico
2016-08-08 15:56 Zac Medico
2014-12-07 23:14 Zac Medico
2014-10-21 23:11 Zac Medico
2014-10-20  0:08 Zac Medico
2014-09-24 22:36 Brian Dolbec
2014-06-14 21:46 Alexander Berntsen
2014-06-14 21:46 Alexander Berntsen
2014-06-14 20:58 Alexander Berntsen
2013-07-18 20:25 Zac Medico
2013-07-18 20:23 Zac Medico
2013-02-23 19:17 Zac Medico
2012-12-29 22:35 Zac Medico
2012-12-08  9:25 Zac Medico
2012-11-29  7:53 Zac Medico
2012-10-08 20:30 Zac Medico
2011-12-14  4:47 Zac Medico
2011-10-10 18:05 Zac Medico
2011-09-21 14:00 Zac Medico
2011-09-19 16:03 Zac Medico
2011-09-19 14:15 Zac Medico
2011-09-18 20:16 Zac Medico
2011-07-19  8:38 Zac Medico
2011-06-04 23:32 Zac Medico
2011-06-03  5:40 Zac Medico
2011-05-17  4:31 Zac Medico
2011-05-15 19:20 Zac Medico
2011-05-11 19:04 Zac Medico
2011-04-28 16:16 Zac Medico
2011-04-27 22:07 Zac Medico
2011-04-27 22:03 Zac Medico
2011-04-27 22:00 Zac Medico
2011-03-24 18:18 Zac Medico
2011-03-14 17:52 Zac Medico
2011-02-13  0:24 Zac Medico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2d78dcda11d753a54f821c7fb482b4bb3b511d0b.zmedico@gentoo \
    --to=zmedico@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox