public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: pym/portage/, pym/portage/package/ebuild/
@ 2016-01-25  8:40 Zac Medico
  0 siblings, 0 replies; 2+ messages in thread
From: Zac Medico @ 2016-01-25  8:40 UTC (permalink / raw
  To: gentoo-commits

commit:     34f4f163eaadbccb0e37dbb780278bfacb8e8edb
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 25 08:38:44 2016 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Jan 25 08:39:26 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=34f4f163

Fix KeyError for ACCEPT_KEYWORDS and ARCH (bug 572826)

Use the "get" method to avoid triggering a KeyError when the profile is
invalid.

Fixes: 39d81c514c33 ("[...]config.__getitem__(): Partially drop backward compatibility for nonexistent keys.")
X-Gentoo-Bug: 572826
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=572826

 pym/portage/_legacy_globals.py       | 2 +-
 pym/portage/news.py                  | 2 +-
 pym/portage/package/ebuild/config.py | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/pym/portage/_legacy_globals.py b/pym/portage/_legacy_globals.py
index bb9691a..f916cc6 100644
--- a/pym/portage/_legacy_globals.py
+++ b/pym/portage/_legacy_globals.py
@@ -56,7 +56,7 @@ def _get_legacy_global(name):
 	portage.features = settings.features
 	constructed.add('features')
 
-	portage.groups = settings["ACCEPT_KEYWORDS"].split()
+	portage.groups = settings.get("ACCEPT_KEYWORDS", "").split()
 	constructed.add('groups')
 
 	portage.pkglines = settings.packages

diff --git a/pym/portage/news.py b/pym/portage/news.py
index 54d4dc9..784ba70 100644
--- a/pym/portage/news.py
+++ b/pym/portage/news.py
@@ -338,7 +338,7 @@ class DisplayKeywordRestriction(DisplayRestriction):
 		self.keyword = keyword
 
 	def checkRestriction(self, **kwargs):
-		if kwargs['config']['ARCH'] == self.keyword:
+		if kwargs['config'].get('ARCH', '') == self.keyword:
 			return True
 		return False
 

diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index 0bae55b..45b7d08 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -1082,7 +1082,7 @@ class config(object):
 		"""Validate miscellaneous settings and display warnings if necessary.
 		(This code was previously in the global scope of portage.py)"""
 
-		groups = self["ACCEPT_KEYWORDS"].split()
+		groups = self.get("ACCEPT_KEYWORDS", "").split()
 		archlist = self.archlist()
 		if not archlist:
 			writemsg(_("--- 'profiles/arch.list' is empty or "
@@ -1976,7 +1976,7 @@ class config(object):
 		# doesn't work properly as negative values are lost in the config
 		# object (bug #139600)
 		backuped_accept_keywords = self.configdict["backupenv"].get("ACCEPT_KEYWORDS", "")
-		global_accept_keywords = self["ACCEPT_KEYWORDS"]
+		global_accept_keywords = self.get("ACCEPT_KEYWORDS", "")
 
 		return self._keywords_manager.getMissingKeywords(cpv, metadata["SLOT"], \
 			metadata.get("KEYWORDS", ""), metadata.get('repository'), \


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/, pym/portage/package/ebuild/
@ 2018-03-12 20:12 Michał Górny
  0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2018-03-12 20:12 UTC (permalink / raw
  To: gentoo-commits

commit:     6cb70f9ef0e790050b1d85b2f41d5c1988e5d57d
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 21 08:55:11 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Mar 12 20:12:18 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=6cb70f9e

Strip trailing slash from D, ED, ROOT, EROOT in EAPI 7

Bug: https://bugs.gentoo.org/465772
Reviewed-by: Zac Medico <zmedico <AT> gentoo.org>

 pym/portage/eapi.py                  | 7 +++++++
 pym/portage/package/ebuild/config.py | 5 +++++
 2 files changed, 12 insertions(+)

diff --git a/pym/portage/eapi.py b/pym/portage/eapi.py
index 5613fb5d2..d1ca299f5 100644
--- a/pym/portage/eapi.py
+++ b/pym/portage/eapi.py
@@ -111,11 +111,16 @@ def eapi_empty_groups_always_true(eapi):
 	return eapi in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi",
 			"5", "5-progress", "6")
 
+def eapi_path_variables_end_with_trailing_slash(eapi):
+	return eapi in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi",
+			"5", "5-progress", "6")
+
 _eapi_attrs = collections.namedtuple('_eapi_attrs',
 	'dots_in_PN dots_in_use_flags exports_EBUILD_PHASE_FUNC '
 	'exports_PORTDIR exports_ECLASSDIR '
 	'feature_flag_test feature_flag_targetroot '
 	'hdepend iuse_defaults iuse_effective posixish_locale '
+	'path_variables_end_with_trailing_slash '
 	'repo_deps required_use required_use_at_most_one_of slot_operator slot_deps '
 	'src_uri_arrows strong_blocks use_deps use_dep_defaults '
 	'empty_groups_always_true')
@@ -150,6 +155,8 @@ def _get_eapi_attrs(eapi):
 		hdepend = (eapi is not None and eapi_has_hdepend(eapi)),
 		iuse_defaults = (eapi is None or eapi_has_iuse_defaults(eapi)),
 		iuse_effective = (eapi is not None and eapi_has_iuse_effective(eapi)),
+		path_variables_end_with_trailing_slash = (eapi is not None and
+			eapi_path_variables_end_with_trailing_slash(eapi)),
 		posixish_locale = (eapi is not None and eapi_requires_posixish_locale(eapi)),
 		repo_deps = (eapi is None or eapi_has_repo_deps(eapi)),
 		required_use = (eapi is None or eapi_has_required_use(eapi)),

diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index 10250cf46..898626ecc 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -2804,6 +2804,11 @@ class config(object):
 		if not eapi_attrs.exports_ECLASSDIR:
 			mydict.pop("ECLASSDIR", None)
 
+		if not eapi_attrs.path_variables_end_with_trailing_slash:
+			for v in ("D", "ED", "ROOT", "EROOT"):
+				if v in mydict:
+					mydict[v] = mydict[v].rstrip(os.path.sep)
+
 		try:
 			builddir = mydict["PORTAGE_BUILDDIR"]
 			distdir = mydict["DISTDIR"]


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-12 20:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-12 20:12 [gentoo-commits] proj/portage:master commit in: pym/portage/, pym/portage/package/ebuild/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2016-01-25  8:40 Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox