public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/
@ 2012-07-12 19:49 Zac Medico
  0 siblings, 0 replies; 9+ messages in thread
From: Zac Medico @ 2012-07-12 19:49 UTC (permalink / raw
  To: gentoo-commits

commit:     63e25313d785f40abff3197fe0f3a3eeaa617f7d
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 12 19:48:49 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Jul 12 19:48:49 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=63e25313

Skip whirlpool digest check when unaccelerated.

If multiple digests are available and whirlpool is unaccelerated, then
skip it. This allows extreme performance problems like bug #425046 to
be avoided whenever practical, especially for cases like stage builds
where acceleration may not be available for some hashes due to
minimization of dependencies.

---
 pym/portage/checksum.py             |   20 ++++++++++++++++++++
 pym/portage/manifest.py             |    6 ++++--
 pym/portage/package/ebuild/fetch.py |   13 +++++++------
 3 files changed, 31 insertions(+), 8 deletions(-)

diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py
index bd416ac..daf4a0c 100644
--- a/pym/portage/checksum.py
+++ b/pym/portage/checksum.py
@@ -137,8 +137,10 @@ try:
 except ImportError:
 	pass
 
+_whirlpool_unaccelerated = False
 if "WHIRLPOOL" not in hashfunc_map:
 	# Bundled WHIRLPOOL implementation
+	_whirlpool_unaccelerated = True
 	from portage.util.whirlpool import new as _new_whirlpool
 	whirlpoolhash = _generate_hash_function("WHIRLPOOL", _new_whirlpool, origin="bundled")
 
@@ -197,6 +199,24 @@ def get_hash_origin(hashtype):
 		raise KeyError(hashtype)
 	return hashorigin_map.get(hashtype, "unknown")
 
+def _filter_unaccelarated_hashes(digests):
+	"""
+	If multiple digests are available and some are unaccelerated,
+	then return a new dict that omits the unaccelerated ones. This
+	allows extreme performance problems like bug #425046 to be
+	avoided whenever practical, especially for cases like stage
+	builds where acceleration may not be available for some hashes
+	due to minimization of dependencies.
+	"""
+	if _whirlpool_unaccelerated and "WHIRLPOOL" in digests:
+		verifiable_hash_types = set(digests).intersection(hashfunc_map)
+		verifiable_hash_types.discard("size")
+		if len(verifiable_hash_types) > 1:
+			digests = dict(digests)
+			digests.pop("WHIRLPOOL")
+
+	return digests
+
 def verify_all(filename, mydict, calc_prelink=0, strict=0):
 	"""
 	Verify all checksums against a file.

diff --git a/pym/portage/manifest.py b/pym/portage/manifest.py
index 90324ee..ab91862 100644
--- a/pym/portage/manifest.py
+++ b/pym/portage/manifest.py
@@ -8,7 +8,8 @@ import warnings
 
 import portage
 portage.proxy.lazyimport.lazyimport(globals(),
-	'portage.checksum:hashfunc_map,perform_multiple_checksums,verify_all',
+	'portage.checksum:hashfunc_map,perform_multiple_checksums,' + \
+		'verify_all,_filter_unaccelarated_hashes',
 	'portage.util:write_atomic',
 )
 
@@ -508,7 +509,8 @@ class Manifest(object):
 	def checkFileHashes(self, ftype, fname, ignoreMissing=False):
 		myhashes = self.fhashdict[ftype][fname]
 		try:
-			ok,reason = verify_all(self._getAbsname(ftype, fname), self.fhashdict[ftype][fname])
+			ok, reason = verify_all(self._getAbsname(ftype, fname),
+				_filter_unaccelarated_hashes(self.fhashdict[ftype][fname]))
 			if not ok:
 				raise DigestException(tuple([self._getAbsname(ftype, fname)]+list(reason)))
 			return ok, reason

diff --git a/pym/portage/package/ebuild/fetch.py b/pym/portage/package/ebuild/fetch.py
index b795b28..60ed04d 100644
--- a/pym/portage/package/ebuild/fetch.py
+++ b/pym/portage/package/ebuild/fetch.py
@@ -25,7 +25,8 @@ portage.proxy.lazyimport.lazyimport(globals(),
 
 from portage import OrderedDict, os, selinux, shutil, _encodings, \
 	_shell_quote, _unicode_encode
-from portage.checksum import hashfunc_map, perform_md5, verify_all
+from portage.checksum import (hashfunc_map, perform_md5, verify_all,
+	_filter_unaccelarated_hashes)
 from portage.const import BASH_BINARY, CUSTOM_MIRRORS_FILE, \
 	GLOBAL_CONFIG_PATH
 from portage.data import portage_gid, portage_uid, secpass, userpriv_groups
@@ -210,6 +211,7 @@ def _check_distfile(filename, digests, eout, show_errors=1):
 			# Zero-byte distfiles are always invalid.
 			return (False, st)
 	else:
+		digests = _filter_unaccelarated_hashes(digests)
 		if _check_digests(filename, digests, show_errors=show_errors):
 			eout.ebegin("%s %s ;-)" % (os.path.basename(filename),
 				" ".join(sorted(digests))))
@@ -793,8 +795,8 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0,
 							eout.eend(0)
 							continue
 						else:
-							verified_ok, reason = verify_all(
-								myfile_path, mydigests[myfile])
+							digests = _filter_unaccelarated_hashes(mydigests[myfile])
+							verified_ok, reason = verify_all(myfile_path, digests)
 							if not verified_ok:
 								writemsg(_("!!! Previously fetched"
 									" file: '%s'\n") % myfile, noiselevel=-1)
@@ -816,7 +818,6 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0,
 								eout = EOutput()
 								eout.quiet = \
 									mysettings.get("PORTAGE_QUIET", None) == "1"
-								digests = mydigests.get(myfile)
 								if digests:
 									digests = list(digests)
 									digests.sort()
@@ -1051,7 +1052,8 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0,
 								# file NOW, for those users who don't have a stable/continuous
 								# net connection. This way we have a chance to try to download
 								# from another mirror...
-								verified_ok,reason = verify_all(mysettings["DISTDIR"]+"/"+myfile, mydigests[myfile])
+								digests = _filter_unaccelarated_hashes(mydigests[myfile])
+								verified_ok, reason = verify_all(myfile_path, digests)
 								if not verified_ok:
 									writemsg(_("!!! Fetched file: %s VERIFY FAILED!\n") % myfile,
 										noiselevel=-1)
@@ -1085,7 +1087,6 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0,
 								else:
 									eout = EOutput()
 									eout.quiet = mysettings.get("PORTAGE_QUIET", None) == "1"
-									digests = mydigests.get(myfile)
 									if digests:
 										eout.ebegin("%s %s ;-)" % \
 											(myfile, " ".join(sorted(digests))))



^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/
@ 2018-03-28  5:50 Zac Medico
  0 siblings, 0 replies; 9+ messages in thread
From: Zac Medico @ 2018-03-28  5:50 UTC (permalink / raw
  To: gentoo-commits

commit:     a9cf08d97beffe90599d29c0d8e39235bc134047
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 26 22:48:03 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Mar 28 05:49:04 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a9cf08d9

eapi: use eapi_allows_package_provided via  _get_eapi_attrs

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

diff --git a/pym/portage/eapi.py b/pym/portage/eapi.py
index d91edcce4..cdbbf07fb 100644
--- a/pym/portage/eapi.py
+++ b/pym/portage/eapi.py
@@ -124,6 +124,7 @@ def eapi_path_variables_end_with_trailing_slash(eapi):
 			"5", "5-progress", "6")
 
 _eapi_attrs = collections.namedtuple('_eapi_attrs',
+	'allows_package_provided '
 	'bdepend dots_in_PN dots_in_use_flags exports_EBUILD_PHASE_FUNC '
 	'exports_PORTDIR exports_ECLASSDIR '
 	'feature_flag_test feature_flag_targetroot '
@@ -152,6 +153,7 @@ def _get_eapi_attrs(eapi):
 		eapi = None
 
 	eapi_attrs = _eapi_attrs(
+		allows_package_provided=(eapi is None or eapi_allows_package_provided(eapi)),
 		bdepend = (eapi is not None and eapi_has_bdepend(eapi)),
 		dots_in_PN = (eapi is None or eapi_allows_dots_in_PN(eapi)),
 		dots_in_use_flags = (eapi is None or eapi_allows_dots_in_use_flags(eapi)),

diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index ef9ec3e88..a32892e94 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -39,8 +39,7 @@ from portage.dbapi import dbapi
 from portage.dbapi.porttree import portdbapi
 from portage.dep import Atom, isvalidatom, match_from_list, use_reduce, _repo_separator, _slot_separator
 from portage.eapi import (eapi_exports_AA, eapi_exports_merge_type,
-	eapi_supports_prefix, eapi_exports_replace_vars, _get_eapi_attrs,
-	eapi_allows_package_provided)
+	eapi_supports_prefix, eapi_exports_replace_vars, _get_eapi_attrs)
 from portage.env.loaders import KeyValuePairFileLoader
 from portage.exception import InvalidDependString, IsADirectory, \
 		PortageException
@@ -805,7 +804,7 @@ class config(object):
 			for x in profiles_complex:
 				provpath = os.path.join(x.location, "package.provided")
 				if os.path.exists(provpath):
-					if x.eapi is None or eapi_allows_package_provided(x.eapi):
+					if _get_eapi_attrs(x.eapi).allows_package_provided:
 						pkgprovidedlines.append(grabfile(provpath,
 							recursive=x.portage1_directories))
 					else:


^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/
@ 2018-03-28  5:50 Zac Medico
  0 siblings, 0 replies; 9+ messages in thread
From: Zac Medico @ 2018-03-28  5:50 UTC (permalink / raw
  To: gentoo-commits

commit:     8621aa9b29e74dabdb426363a96d12ec2e036a15
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 26 16:28:36 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Mar 28 05:49:03 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=8621aa9b

Disallow package.provided in EAPI 7

Bug: https://bugs.gentoo.org/568884
Closes: https://github.com/mgorny/portage/issues/12

 pym/portage/eapi.py                  |  4 ++++
 pym/portage/package/ebuild/config.py | 22 ++++++++++++++++------
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/pym/portage/eapi.py b/pym/portage/eapi.py
index 5f0017b65..d91edcce4 100644
--- a/pym/portage/eapi.py
+++ b/pym/portage/eapi.py
@@ -104,6 +104,10 @@ def eapi_has_automatic_unpack_dependencies(eapi):
 def eapi_has_hdepend(eapi):
 	return eapi in ("5-hdepend",)
 
+def eapi_allows_package_provided(eapi):
+	return eapi in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi",
+			"5", "5-progress", "6")
+
 def eapi_has_bdepend(eapi):
 	return eapi not in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi",
 			"5", "5-progress", "6")

diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index 9d2b34a53..ef9ec3e88 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -38,8 +38,9 @@ from portage.const import CACHE_PATH, \
 from portage.dbapi import dbapi
 from portage.dbapi.porttree import portdbapi
 from portage.dep import Atom, isvalidatom, match_from_list, use_reduce, _repo_separator, _slot_separator
-from portage.eapi import eapi_exports_AA, eapi_exports_merge_type, \
-	eapi_supports_prefix, eapi_exports_replace_vars, _get_eapi_attrs
+from portage.eapi import (eapi_exports_AA, eapi_exports_merge_type,
+	eapi_supports_prefix, eapi_exports_replace_vars, _get_eapi_attrs,
+	eapi_allows_package_provided)
 from portage.env.loaders import KeyValuePairFileLoader
 from portage.exception import InvalidDependString, IsADirectory, \
 		PortageException
@@ -800,10 +801,19 @@ class config(object):
 			archlist = sorted(stack_lists(archlist, incremental=1))
 			self.configdict["conf"]["PORTAGE_ARCHLIST"] = " ".join(archlist)
 
-			pkgprovidedlines = [grabfile(
-				os.path.join(x.location, "package.provided"),
-				recursive=x.portage1_directories)
-				for x in profiles_complex]
+			pkgprovidedlines = []
+			for x in profiles_complex:
+				provpath = os.path.join(x.location, "package.provided")
+				if os.path.exists(provpath):
+					if x.eapi is None or eapi_allows_package_provided(x.eapi):
+						pkgprovidedlines.append(grabfile(provpath,
+							recursive=x.portage1_directories))
+					else:
+						# TODO: bail out?
+						writemsg((_("!!! package.provided not allowed in EAPI %s: ")
+								%x.eapi)+x.location+"\n",
+							noiselevel=-1)
+
 			pkgprovidedlines = stack_lists(pkgprovidedlines, incremental=1)
 			has_invalid_data = False
 			for x in range(len(pkgprovidedlines)-1, -1, -1):


^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/
@ 2015-04-06  5:13 Zac Medico
  0 siblings, 0 replies; 9+ messages in thread
From: Zac Medico @ 2015-04-06  5:13 UTC (permalink / raw
  To: gentoo-commits

commit:     096f55391d3e755e52fb12b7be06716869925539
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Apr  5 07:59:29 2015 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Apr  6 05:10:37 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=096f5539

fetch(): fix support for digest size=None

It seems that the code initially supported fetching without size
'digest' but it got broken over time. Add proper conditionals to avoid
ugly failures in this case.

Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
Acked-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/portage/checksum.py             | 2 +-
 pym/portage/package/ebuild/fetch.py | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py
index f24a90f..642602e 100644
--- a/pym/portage/checksum.py
+++ b/pym/portage/checksum.py
@@ -303,7 +303,7 @@ def verify_all(filename, mydict, calc_prelink=0, strict=0):
 	reason     = "Reason unknown"
 	try:
 		mysize = os.stat(filename)[stat.ST_SIZE]
-		if mydict["size"] != mysize:
+		if mydict.get("size") is not None and mydict["size"] != mysize:
 			return False,(_("Filesize does not match recorded size"), mysize, mydict["size"])
 	except OSError as e:
 		if e.errno == errno.ENOENT:

diff --git a/pym/portage/package/ebuild/fetch.py b/pym/portage/package/ebuild/fetch.py
index 7b856a2..7e4e6fe 100644
--- a/pym/portage/package/ebuild/fetch.py
+++ b/pym/portage/package/ebuild/fetch.py
@@ -700,7 +700,7 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0,
 								os.unlink(myfile_path)
 							except OSError:
 								pass
-					elif distdir_writable:
+					elif distdir_writable and size is not None:
 						if mystat.st_size < fetch_resume_size and \
 							mystat.st_size < size:
 							# If the file already exists and the size does not
@@ -806,8 +806,9 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0,
 						# assume that it is fully downloaded.
 						continue
 					else:
-						if mystat.st_size < mydigests[myfile]["size"] and \
-							not restrict_fetch:
+						if (mydigests[myfile].get("size") is not None
+								and mystat.st_size < mydigests[myfile]["size"]
+								and not restrict_fetch):
 							fetched = 1 # Try to resume this download.
 						elif parallel_fetchonly and \
 							mystat.st_size == mydigests[myfile]["size"]:


^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/
@ 2014-11-15  5:19 Zac Medico
  0 siblings, 0 replies; 9+ messages in thread
From: Zac Medico @ 2014-11-15  5:19 UTC (permalink / raw
  To: gentoo-commits

commit:     690b9deaf22f85a3cc7b366f5bd126b9e603c90d
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Nov  9 23:19:11 2014 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Nov 15 05:12:14 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=690b9dea

unprivileged mode: generate PORTAGE_DEPCACHEDIR

For unprivileged mode, if PORTAGE_DEPCACHEDIR is unset and the default
PORTAGE_DEPCACHEDIR setting does not refer to a writable directory
(or there are not sufficient permissions to create it), then
automatically make PORTAGE_DEPCACHEDIR relative to the current target
root (which should always be writable for unprivileged mode). Also, in
create_trees, propagate the automatically generated PORTAGE_DEPCACHEDIR
setting to the config instance that is instantiated for ROOT = "/".

The result is that unprivileged mode will get a writable
PORTAGE_DEPCACHEDIR by default, and the default can be overridden by
setting the PORTAGE_DEPCACHEDIR variable.

Fixes: 1364fcd89384 ("Support unprivileged mode for bug #433453.")
X-Gentoo-Bug: 433453
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=433453
Acked-by: Alexander Berntsen <bernalex <AT> gentoo.org>

---
 pym/portage/__init__.py              |  3 +++
 pym/portage/package/ebuild/config.py | 39 +++++++++++++++++++++++++++---------
 2 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 66bfeb0..d8046f3 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -570,6 +570,7 @@ def create_trees(config_root=None, target_root=None, trees=None, env=None,
 		env=env, eprefix=eprefix)
 	settings.lock()
 
+	depcachedir = settings.get('PORTAGE_DEPCACHEDIR')
 	trees._target_eroot = settings['EROOT']
 	myroots = [(settings['EROOT'], settings)]
 	if settings["ROOT"] == "/" and settings["EPREFIX"] == const.EPREFIX:
@@ -587,6 +588,8 @@ def create_trees(config_root=None, target_root=None, trees=None, env=None,
 			v = settings.get(k)
 			if v is not None:
 				clean_env[k] = v
+		if depcachedir is not None:
+			clean_env['PORTAGE_DEPCACHEDIR'] = depcachedir
 		settings = config(config_root=None, target_root="/",
 			env=clean_env, eprefix=None)
 		settings.lock()

diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index 2ceb122..c7308a4 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -8,6 +8,7 @@ __all__ = [
 ]
 
 import copy
+import errno
 from itertools import chain
 import grp
 import logging
@@ -826,16 +827,6 @@ class config(object):
 			if "USE_ORDER" not in self:
 				self.backupenv["USE_ORDER"] = "env:pkg:conf:defaults:pkginternal:repo:env.d"
 
-			self.depcachedir = DEPCACHE_PATH
-			if portage.const.EPREFIX:
-				self.depcachedir = os.path.join(portage.const.EPREFIX,
-					DEPCACHE_PATH.lstrip(os.sep))
-
-			if self.get("PORTAGE_DEPCACHEDIR", None):
-				self.depcachedir = self["PORTAGE_DEPCACHEDIR"]
-			self["PORTAGE_DEPCACHEDIR"] = self.depcachedir
-			self.backup_changes("PORTAGE_DEPCACHEDIR")
-
 			if "CBUILD" not in self and "CHOST" in self:
 				self["CBUILD"] = self["CHOST"]
 				self.backup_changes("CBUILD")
@@ -898,6 +889,34 @@ class config(object):
 					self[var] = default_val
 				self.backup_changes(var)
 
+			self.depcachedir = self.get("PORTAGE_DEPCACHEDIR")
+			if self.depcachedir is None:
+				self.depcachedir = os.path.join(os.sep,
+					portage.const.EPREFIX, DEPCACHE_PATH.lstrip(os.sep))
+				if unprivileged and target_root != os.sep:
+					# In unprivileged mode, automatically make
+					# depcachedir relative to target_root if the
+					# default depcachedir is not writable.
+					current_dir = self.depcachedir
+					found_dir = False
+					while current_dir != os.sep and not found_dir:
+						try:
+							os.stat(current_dir)
+							found_dir = True
+						except OSError as e:
+							if e.errno == errno.ENOENT:
+								current_dir = os.path.dirname(
+									current_dir)
+							else:
+								found_dir = True
+
+					if not os.access(current_dir, os.W_OK):
+						self.depcachedir = os.path.join(eroot,
+							DEPCACHE_PATH.lstrip(os.sep))
+
+			self["PORTAGE_DEPCACHEDIR"] = self.depcachedir
+			self.backup_changes("PORTAGE_DEPCACHEDIR")
+
 			if portage._internal_caller:
 				self["PORTAGE_INTERNAL_CALLER"] = "1"
 				self.backup_changes("PORTAGE_INTERNAL_CALLER")


^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/
@ 2014-09-11 23:45 Brian Dolbec
  0 siblings, 0 replies; 9+ messages in thread
From: Brian Dolbec @ 2014-09-11 23:45 UTC (permalink / raw
  To: gentoo-commits

commit:     9fa99206bb6136e0df3105bd2c3fc9122f04fc19
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Aug  8 22:57:27 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Sep 11 23:44:25 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9fa99206

self-update: Copy only relevant packages from PORTAGE_PYM_PATH

Update the self-update code to copy only packages relevant to Portage,
to avoid copying other packages when Portage is installed alongside
them.

---
 pym/portage/const.py                   | 3 +++
 pym/portage/package/ebuild/doebuild.py | 8 ++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/pym/portage/const.py b/pym/portage/const.py
index aab6e8a..4b01ff9 100644
--- a/pym/portage/const.py
+++ b/pym/portage/const.py
@@ -270,6 +270,9 @@ SUPPORTED_BINPKG_FORMATS = ("tar", "rpm")
 # Time formats used in various places like metadata.chk.
 TIMESTAMP_FORMAT = "%a, %d %b %Y %H:%M:%S +0000"	# to be used with time.gmtime()
 
+# Top-level names of Python packages installed by Portage.
+PORTAGE_PYM_PACKAGES = ("_emerge", "portage", "repoman")
+
 # ===========================================================================
 # END OF CONSTANTS -- END OF CONSTANTS -- END OF CONSTANTS -- END OF CONSTANT
 # ===========================================================================

diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index 01707ae..d3e3f5a 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -45,7 +45,7 @@ from portage import auxdbkeys, bsd_chflags, \
 	unmerge, _encodings, _os_merge, \
 	_shell_quote, _unicode_decode, _unicode_encode
 from portage.const import EBUILD_SH_ENV_FILE, EBUILD_SH_ENV_DIR, \
-	EBUILD_SH_BINARY, INVALID_ENV_FILE, MISC_SH_BINARY
+	EBUILD_SH_BINARY, INVALID_ENV_FILE, MISC_SH_BINARY, PORTAGE_PYM_PACKAGES
 from portage.data import portage_gid, portage_uid, secpass, \
 	uid, userpriv_groups
 from portage.dbapi.porttree import _parse_uri_map
@@ -2327,7 +2327,11 @@ def _prepare_self_update(settings):
 
 	orig_pym_path = portage._pym_path
 	portage._pym_path = os.path.join(base_path_tmp, "pym")
-	shutil.copytree(orig_pym_path, portage._pym_path, symlinks=True)
+	os.mkdir(portage._pym_path)
+	for pmod in PORTAGE_PYM_PACKAGES:
+		shutil.copytree(os.path.join(orig_pym_path, pmod),
+			os.path.join(portage._pym_path, pmod),
+			symlinks=True)
 
 	for dir_path in (base_path_tmp, portage._bin_path, portage._pym_path):
 		os.chmod(dir_path, 0o755)


^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/
@ 2014-02-05 18:13 Arfrever Frehtes Taifersar Arahesis
  0 siblings, 0 replies; 9+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2014-02-05 18:13 UTC (permalink / raw
  To: gentoo-commits

commit:     ddea7da749c71a9ee94694a5f742b1ecf82157c3
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Wed Feb  5 18:12:39 2014 +0000
Commit:     Arfrever Frehtes Taifersar Arahesis <arfrever <AT> apache <DOT> org>
CommitDate: Wed Feb  5 18:12:39 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ddea7da7

Use local dispatch-conf.conf and make.globals when using Portage from working copy or unpacked tarball.

---
 pym/portage/dispatch_conf.py         |  7 +++++--
 pym/portage/package/ebuild/config.py | 11 ++++++-----
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/pym/portage/dispatch_conf.py b/pym/portage/dispatch_conf.py
index 0c71e65..f975ccd 100644
--- a/pym/portage/dispatch_conf.py
+++ b/pym/portage/dispatch_conf.py
@@ -1,5 +1,5 @@
 # archive_conf.py -- functionality common to archive-conf and dispatch-conf
-# Copyright 2003-2013 Gentoo Foundation
+# Copyright 2003-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 
@@ -52,7 +52,10 @@ def diffstatusoutput(cmd, file1, file2):
 
 def read_config(mandatory_opts):
 	eprefix = portage.settings["EPREFIX"]
-	config_path = os.path.join(eprefix or os.sep, "etc/dispatch-conf.conf")
+	if portage._not_installed:
+		config_path = os.path.join(portage.PORTAGE_BASE_PATH, "cnf", "dispatch-conf.conf")
+	else:
+		config_path = os.path.join(eprefix or os.sep, "etc/dispatch-conf.conf")
 	loader = KeyValuePairFileLoader(config_path, None)
 	opts, _errors = loader.load()
 	if not opts:

diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index 9e9b3fc..e104501 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -28,7 +28,7 @@ from portage import bsd_chflags, \
 	load_mod, os, selinux, _unicode_decode
 from portage.const import CACHE_PATH, \
 	DEPCACHE_PATH, INCREMENTALS, MAKE_CONF_FILE, \
-	MODULES_FILE_PATH, \
+	MODULES_FILE_PATH, PORTAGE_BASE_PATH, \
 	PRIVATE_PATH, PROFILE_PATH, USER_CONFIG_PATH, \
 	USER_VIRTUALS_FILE
 from portage.dbapi import dbapi
@@ -387,10 +387,11 @@ class config(object):
 			# Allow make.globals to set default paths relative to ${EPREFIX}.
 			expand_map["EPREFIX"] = eprefix
 
-			make_globals_path = os.path.join(
-				self.global_config_path, 'make.globals')
-			old_make_globals = os.path.join(config_root,
-				'etc', 'make.globals')
+			if portage._not_installed:
+				make_globals_path = os.path.join(PORTAGE_BASE_PATH, "cnf", "make.globals")
+			else:
+				make_globals_path = os.path.join(self.global_config_path, "make.globals")
+			old_make_globals = os.path.join(config_root, "etc", "make.globals")
 			if os.path.isfile(old_make_globals) and \
 				not os.path.samefile(make_globals_path, old_make_globals):
 				# Don't warn if they refer to the same path, since


^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/
@ 2012-09-20  3:14 Zac Medico
  0 siblings, 0 replies; 9+ messages in thread
From: Zac Medico @ 2012-09-20  3:14 UTC (permalink / raw
  To: gentoo-commits

commit:     0b80286311ccc4fbbe9e13015541867f7235a3c9
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 20 02:56:41 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Sep 20 02:56:41 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=0b802863

MAKE_CONF_FILE: refer to /etc/portage/make.conf

This is, or will soon soon be the default location of make.conf in
stages:

http://sources.gentoo.org/gitweb/?p=proj/gentoo-news.git;a=blob_plain;f=2012/2012-09-09-make.conf-and-make.profile-move/2012-09-09-make.conf-and-make.profile-move.en.txt

This update is consistent with the PROFILE_PATH update in commit
96b053ac52fa37fdd61cbb76cb44dfb90fb49f86.

---
 pym/portage/const.py                 |    2 +-
 pym/portage/package/ebuild/config.py |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/pym/portage/const.py b/pym/portage/const.py
index 1ebfdc8..fe283f4 100644
--- a/pym/portage/const.py
+++ b/pym/portage/const.py
@@ -27,8 +27,8 @@ import os
 # The variables in this file are grouped by config_root, target_root.
 
 # variables used with config_root (these need to be relative)
-MAKE_CONF_FILE           = "etc/make.conf"
 USER_CONFIG_PATH         = "etc/portage"
+MAKE_CONF_FILE           = USER_CONFIG_PATH + "/make.conf"
 MODULES_FILE_PATH        = USER_CONFIG_PATH + "/modules"
 CUSTOM_PROFILE_PATH      = USER_CONFIG_PATH + "/profile"
 USER_VIRTUALS_FILE       = USER_CONFIG_PATH + "/virtuals"

diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index d2f62ac..2a05904 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -303,11 +303,11 @@ class config(object):
 			abs_user_config = locations_manager.abs_user_config
 
 			make_conf = getconfig(
-				os.path.join(config_root, MAKE_CONF_FILE),
+				os.path.join(config_root, 'etc', 'make.conf'),
 				tolerant=tolerant, allow_sourcing=True) or {}
 
 			make_conf.update(getconfig(
-				os.path.join(abs_user_config, 'make.conf'),
+				os.path.join(config_root, MAKE_CONF_FILE),
 				tolerant=tolerant, allow_sourcing=True,
 				expand=make_conf) or {})
 
@@ -482,12 +482,12 @@ class config(object):
 			self.configdict["defaults"]=self.configlist[-1]
 
 			mygcfg = getconfig(
-				os.path.join(config_root, MAKE_CONF_FILE),
+				os.path.join(config_root, 'etc', 'make.conf'),
 				tolerant=tolerant, allow_sourcing=True,
 				expand=expand_map) or {}
 
 			mygcfg.update(getconfig(
-				os.path.join(abs_user_config, 'make.conf'),
+				os.path.join(config_root, MAKE_CONF_FILE),
 				tolerant=tolerant, allow_sourcing=True,
 				expand=expand_map) or {})
 


^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/
@ 2011-09-12 21:27 Zac Medico
  0 siblings, 0 replies; 9+ messages in thread
From: Zac Medico @ 2011-09-12 21:27 UTC (permalink / raw
  To: gentoo-commits

commit:     69613e420d5be52e413c7c60e571710c2597f58d
Author:     Brian Harring <ferringb <AT> gmail <DOT> com>
AuthorDate: Thu Sep  1 21:36:45 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Sep 12 21:23:10 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=69613e42

add thin manifest support to the Manifest class

'thin' is just distfiles.  This is primarily useful when the ebuild
lives in a vcs- git for example, which already has it's own checksums
to rely on.

---
 pym/portage/manifest.py                   |  149 ++++++++++++++++++----------
 pym/portage/package/ebuild/digestcheck.py |    2 +-
 2 files changed, 97 insertions(+), 54 deletions(-)

diff --git a/pym/portage/manifest.py b/pym/portage/manifest.py
index 13efab7..ef1a552 100644
--- a/pym/portage/manifest.py
+++ b/pym/portage/manifest.py
@@ -49,6 +49,12 @@ def guessManifestFileType(filename):
 	else:
 		return "DIST"
 
+def guessThinManifestFileType(filename):
+	type = guessManifestFileType(filename)
+	if type != "DIST":
+		return None
+	return "DIST"
+
 def parseManifest2(mysplit):
 	myentry = None
 	if len(mysplit) > 4 and mysplit[0] in portage.const.MANIFEST2_IDENTIFIERS:
@@ -93,12 +99,14 @@ class Manifest2Entry(ManifestEntry):
 class Manifest(object):
 	parsers = (parseManifest2,)
 	def __init__(self, pkgdir, distdir, fetchlist_dict=None,
-		manifest1_compat=False, from_scratch=False):
+		manifest1_compat=False, from_scratch=False, thin=False):
 		""" create new Manifest instance for package in pkgdir
 		    and add compability entries for old portage versions if manifest1_compat == True.
 		    Do not parse Manifest file if from_scratch == True (only for internal use)
 			The fetchlist_dict parameter is required only for generation of
-			a Manifest (not needed for parsing and checking sums)."""
+			a Manifest (not needed for parsing and checking sums).
+			If thin is specified, then the manifest carries only info for
+			distfiles."""
 		self.pkgdir = _unicode_decode(pkgdir).rstrip(os.sep) + os.sep
 		self.fhashdict = {}
 		self.hashes = set()
@@ -120,7 +128,11 @@ class Manifest(object):
 		else:
 			self.fetchlist_dict = {}
 		self.distdir = distdir
-		self.guessType = guessManifestFileType
+		self.thin = thin
+		if thin:
+			self.guessType = guessThinManifestFileType
+		else:
+			self.guessType = guessManifestFileType
 
 	def getFullname(self):
 		""" Returns the absolute path to the Manifest file for this instance """
@@ -313,64 +325,20 @@ class Manifest(object):
 			distfilehashes = {}
 		self.__init__(self.pkgdir, self.distdir,
 			fetchlist_dict=self.fetchlist_dict, from_scratch=True,
-			manifest1_compat=False)
-		cpvlist = []
+			manifest1_compat=False, thin=self.thin)
 		pn = os.path.basename(self.pkgdir.rstrip(os.path.sep))
 		cat = self._pkgdir_category()
 
 		pkgdir = self.pkgdir
+		if self.thin:
+			cpvlist = self._update_thin_pkgdir(cat, pn, pkgdir)
+		else:
+			cpvlist = self._update_thick_pkgdir(cat, pn, pkgdir)
 
-		for pkgdir, pkgdir_dirs, pkgdir_files in os.walk(pkgdir):
-			break
-		for f in pkgdir_files:
-			try:
-				f = _unicode_decode(f,
-					encoding=_encodings['fs'], errors='strict')
-			except UnicodeDecodeError:
-				continue
-			if f[:1] == ".":
-				continue
-			pf = None
-			if f[-7:] == '.ebuild':
-				pf = f[:-7]
-			if pf is not None:
-				mytype = "EBUILD"
-				ps = portage.versions._pkgsplit(pf)
-				cpv = "%s/%s" % (cat, pf)
-				if not ps:
-					raise PortagePackageException(
-						_("Invalid package name: '%s'") % cpv)
-				if ps[0] != pn:
-					raise PortagePackageException(
-						_("Package name does not "
-						"match directory name: '%s'") % cpv)
-				cpvlist.append(cpv)
-			elif manifest2MiscfileFilter(f):
-				mytype = "MISC"
-			else:
-				continue
-			self.fhashdict[mytype][f] = perform_multiple_checksums(self.pkgdir+f, self.hashes)
-		recursive_files = []
-
-		pkgdir = self.pkgdir
-		cut_len = len(os.path.join(pkgdir, "files") + os.sep)
-		for parentdir, dirs, files in os.walk(os.path.join(pkgdir, "files")):
-			for f in files:
-				try:
-					f = _unicode_decode(f,
-						encoding=_encodings['fs'], errors='strict')
-				except UnicodeDecodeError:
-					continue
-				full_path = os.path.join(parentdir, f)
-				recursive_files.append(full_path[cut_len:])
-		for f in recursive_files:
-			if not manifest2AuxfileFilter(f):
-				continue
-			self.fhashdict["AUX"][f] = perform_multiple_checksums(
-				os.path.join(self.pkgdir, "files", f.lstrip(os.sep)), self.hashes)
 		distlist = set()
 		for cpv in cpvlist:
 			distlist.update(self._getCpvDistfiles(cpv))
+
 		if requiredDistfiles is None:
 			# This allows us to force removal of stale digests for the
 			# ebuild --force digest option (no distfiles are required).
@@ -404,6 +372,81 @@ class Manifest(object):
 					if f in requiredDistfiles:
 						raise
 
+	def _is_cpv(self, cat, pn, filename):
+		if not filename.endswith(".ebuild"):
+			return None
+		pf = filename[:-7]
+		if pf is None:
+			return None
+		ps = portage.versions._pkgsplit(pf)
+		cpv = "%s/%s" % (cat, pf)
+		if not ps:
+			raise PortagePackageException(
+				_("Invalid package name: '%s'") % cpv)
+		if ps[0] != pn:
+			raise PortagePackageException(
+				_("Package name does not "
+				"match directory name: '%s'") % cpv)
+		return cpv
+
+	def _update_thin_pkgdir(self, cat, pn, pkgdir):
+		for pkgdir, pkgdir_dirs, pkgdir_files in os.walk(pkgdir):
+			break
+		cpvlist = []
+		for f in pkgdir_files:
+			try:
+				f = _unicode_decode(f,
+					encoding=_encodings['fs'], errors='strict')
+			except UnicodeDecodeError:
+				continue
+			if f[:1] == '.':
+				continue
+			pf = self._is_cpv(cat, pn, f)
+			if pf is not None:
+				cpvlist.append(pf)
+		return cpvlist
+
+	def _update_thick_pkgdir(self, cat, pn, pkgdir):
+		cpvlist = []
+		for pkgdir, pkgdir_dirs, pkgdir_files in os.walk(pkgdir):
+			break
+		for f in pkgdir_files:
+			try:
+				f = _unicode_decode(f,
+					encoding=_encodings['fs'], errors='strict')
+			except UnicodeDecodeError:
+				continue
+			if f[:1] == ".":
+				continue
+			pf = self._is_cpv(cat, pn, f)
+			if pf is not None:
+				mytype = "EBUILD"
+				cpvlist.append(pf)
+			elif manifest2MiscfileFilter(f):
+				mytype = "MISC"
+			else:
+				continue
+			self.fhashdict[mytype][f] = perform_multiple_checksums(self.pkgdir+f, self.hashes)
+		recursive_files = []
+
+		pkgdir = self.pkgdir
+		cut_len = len(os.path.join(pkgdir, "files") + os.sep)
+		for parentdir, dirs, files in os.walk(os.path.join(pkgdir, "files")):
+			for f in files:
+				try:
+					f = _unicode_decode(f,
+						encoding=_encodings['fs'], errors='strict')
+				except UnicodeDecodeError:
+					continue
+				full_path = os.path.join(parentdir, f)
+				recursive_files.append(full_path[cut_len:])
+		for f in recursive_files:
+			if not manifest2AuxfileFilter(f):
+				continue
+			self.fhashdict["AUX"][f] = perform_multiple_checksums(
+				os.path.join(self.pkgdir, "files", f.lstrip(os.sep)), self.hashes)
+		return cpvlist
+
 	def _pkgdir_category(self):
 		return self.pkgdir.rstrip(os.sep).split(os.sep)[-2]
 

diff --git a/pym/portage/package/ebuild/digestcheck.py b/pym/portage/package/ebuild/digestcheck.py
index d184301..466fd05 100644
--- a/pym/portage/package/ebuild/digestcheck.py
+++ b/pym/portage/package/ebuild/digestcheck.py
@@ -92,7 +92,7 @@ def digestcheck(myfiles, mysettings, strict=False, justmanifest=None, mf=None):
 		writemsg(_("!!! Got: %s\n") % e.value[2], noiselevel=-1)
 		writemsg(_("!!! Expected: %s\n") % e.value[3], noiselevel=-1)
 		return 0
-	if allow_missing:
+	if allow_missing or mf.thin:
 		# In this case we ignore any missing digests that
 		# would otherwise be detected below.
 		return 1



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

end of thread, other threads:[~2018-03-28  5:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-12 19:49 [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/ Zac Medico
  -- strict thread matches above, loose matches on Subject: below --
2018-03-28  5:50 Zac Medico
2018-03-28  5:50 Zac Medico
2015-04-06  5:13 Zac Medico
2014-11-15  5:19 Zac Medico
2014-09-11 23:45 Brian Dolbec
2014-02-05 18:13 Arfrever Frehtes Taifersar Arahesis
2012-09-20  3:14 Zac Medico
2011-09-12 21:27 Zac Medico

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