* [gentoo-commits] portage r15300 - in main/branches/prefix: bin pym/portage pym/portage/dbapi
@ 2010-01-31 9:41 Fabian Groffen (grobian)
0 siblings, 0 replies; only message in thread
From: Fabian Groffen (grobian) @ 2010-01-31 9:41 UTC (permalink / raw
To: gentoo-commits
Author: grobian
Date: 2010-01-31 09:41:21 +0000 (Sun, 31 Jan 2010)
New Revision: 15300
Modified:
main/branches/prefix/bin/egencache
main/branches/prefix/pym/portage/__init__.py
main/branches/prefix/pym/portage/const.py
main/branches/prefix/pym/portage/dbapi/porttree.py
Log:
Merged from trunk -r15280:15285
| 15281 | Deprecate the first parameter of the portdbapi constructor |
| zmedico | since it is always the same as mysettings['PORTDIR']. |
| 15282 | Use tuples instead of lists for immutability. |
| zmedico | |
| 15283 | For immutable config attributes, use shallow copy for speed |
| zmedico | and memory conservation. |
| 15284 | For immutable config attributes, use shallow copy for speed |
| zmedico | and memory conservation. |
| 15285 | For immutable config attributes, use shallow copy for speed |
| zmedico | and memory conservation. |
Modified: main/branches/prefix/bin/egencache
===================================================================
--- main/branches/prefix/bin/egencache 2010-01-31 09:40:03 UTC (rev 15299)
+++ main/branches/prefix/bin/egencache 2010-01-31 09:41:21 UTC (rev 15300)
@@ -326,7 +326,7 @@
settings.lock()
- portdb = portage.portdbapi(settings["PORTDIR"], mysettings=settings)
+ portdb = portage.portdbapi(mysettings=settings)
if options.repo is not None:
repo_path = portdb.getRepositoryPath(options.repo)
if repo_path is None:
Modified: main/branches/prefix/pym/portage/__init__.py
===================================================================
--- main/branches/prefix/pym/portage/__init__.py 2010-01-31 09:40:03 UTC (rev 15299)
+++ main/branches/prefix/pym/portage/__init__.py 2010-01-31 09:41:21 UTC (rev 15300)
@@ -1605,23 +1605,26 @@
self._local_repo_conf_path = None
if clone:
- self.incrementals = copy.deepcopy(clone.incrementals)
- self.profile_path = copy.deepcopy(clone.profile_path)
+ # For immutable attributes, use shallow copy for
+ # speed and memory conservation.
+ self.categories = clone.categories
+ self.depcachedir = clone.depcachedir
+ self.incrementals = clone.incrementals
+ self.module_priority = clone.module_priority
+ self.profile_path = clone.profile_path
+ self.profiles = clone.profiles
+ self.packages = clone.packages
+ self.useforce_list = clone.useforce_list
+ self.usemask_list = clone.usemask_list
+
self.user_profile_dir = copy.deepcopy(clone.user_profile_dir)
self.local_config = copy.deepcopy(clone.local_config)
self._local_repo_configs = \
copy.deepcopy(clone._local_repo_configs)
self._local_repo_conf_path = \
copy.deepcopy(clone._local_repo_conf_path)
-
- self.module_priority = copy.deepcopy(clone.module_priority)
self.modules = copy.deepcopy(clone.modules)
-
- self.depcachedir = copy.deepcopy(clone.depcachedir)
-
- self.packages = copy.deepcopy(clone.packages)
self.virtuals = copy.deepcopy(clone.virtuals)
-
self.dirVirtuals = copy.deepcopy(clone.dirVirtuals)
self.treeVirtuals = copy.deepcopy(clone.treeVirtuals)
self.userVirtuals = copy.deepcopy(clone.userVirtuals)
@@ -1630,10 +1633,8 @@
self.use_defs = copy.deepcopy(clone.use_defs)
self.usemask = copy.deepcopy(clone.usemask)
- self.usemask_list = copy.deepcopy(clone.usemask_list)
self.pusemask_list = copy.deepcopy(clone.pusemask_list)
self.useforce = copy.deepcopy(clone.useforce)
- self.useforce_list = copy.deepcopy(clone.useforce_list)
self.puseforce_list = copy.deepcopy(clone.puseforce_list)
self.puse = copy.deepcopy(clone.puse)
self.make_defaults_use = copy.deepcopy(clone.make_defaults_use)
@@ -1655,10 +1656,8 @@
self.lookuplist = self.configlist[:]
self.lookuplist.reverse()
self._use_expand_dict = copy.deepcopy(clone._use_expand_dict)
- self.profiles = copy.deepcopy(clone.profiles)
self.backupenv = self.configdict["backupenv"]
self.pusedict = copy.deepcopy(clone.pusedict)
- self.categories = copy.deepcopy(clone.categories)
self.pkeywordsdict = copy.deepcopy(clone.pkeywordsdict)
self._pkeywords_list = copy.deepcopy(clone._pkeywords_list)
self.pmaskdict = copy.deepcopy(clone.pmaskdict)
@@ -1699,14 +1698,16 @@
else:
self.profile_path = None
else:
- self.profile_path = config_profile_path[:]
+ self.profile_path = config_profile_path
if config_incrementals is None:
- self.incrementals = copy.deepcopy(portage.const.INCREMENTALS)
+ self.incrementals = portage.const.INCREMENTALS
else:
- self.incrementals = copy.deepcopy(config_incrementals)
+ self.incrementals = config_incrementals
+ if not isinstance(self.incrementals, tuple):
+ self.incrementals = tuple(self.incrementals)
- self.module_priority = ["user","default"]
+ self.module_priority = ("user", "default")
self.modules = {}
modules_loader = portage.env.loaders.KeyValuePairFileLoader(
os.path.join(config_root, MODULES_FILE_PATH), None, None)
@@ -1784,8 +1785,9 @@
self.profiles.append(custom_prof)
del custom_prof
+ self.profiles = tuple(self.profiles)
self.packages_list = [grabfile_package(os.path.join(x, "packages")) for x in self.profiles]
- self.packages = stack_lists(self.packages_list, incremental=1)
+ self.packages = tuple(stack_lists(self.packages_list, incremental=1))
del self.packages_list
#self.packages = grab_stacked("packages", self.profiles, grabfile, incremental_lines=1)
@@ -1808,8 +1810,9 @@
self._pkeywords_list.append(cpdict)
# get profile-masked use flags -- INCREMENTAL Child over parent
- self.usemask_list = [grabfile(os.path.join(x, "use.mask"),
- recursive=1) for x in self.profiles]
+ self.usemask_list = tuple(
+ tuple(grabfile(os.path.join(x, "use.mask"), recursive=1))
+ for x in self.profiles)
self.usemask = set(stack_lists(
self.usemask_list, incremental=True))
use_defs_lists = [grabdict(os.path.join(x, "use.defaults")) for x in self.profiles]
@@ -1836,8 +1839,9 @@
self.pkgprofileuse.append(cpdict)
del rawprofileuse
- self.useforce_list = [grabfile(os.path.join(x, "use.force"),
- recursive=1) for x in self.profiles]
+ self.useforce_list = tuple(
+ tuple(grabfile(os.path.join(x, "use.force"), recursive=1))
+ for x in self.profiles)
self.useforce = set(stack_lists(
self.useforce_list, incremental=True))
Modified: main/branches/prefix/pym/portage/const.py
===================================================================
--- main/branches/prefix/pym/portage/const.py 2010-01-31 09:40:03 UTC (rev 15299)
+++ main/branches/prefix/pym/portage/const.py 2010-01-31 09:41:21 UTC (rev 15300)
@@ -85,26 +85,26 @@
PORTAGE_PACKAGE_ATOM = "sys-apps/portage"
-INCREMENTALS = ["USE", "USE_EXPAND", "USE_EXPAND_HIDDEN",
+INCREMENTALS = ("USE", "USE_EXPAND", "USE_EXPAND_HIDDEN",
"FEATURES", "ACCEPT_KEYWORDS",
"CONFIG_PROTECT_MASK", "CONFIG_PROTECT",
"PRELINK_PATH", "PRELINK_PATH_MASK",
- "PROFILE_ONLY_VARIABLES"]
-EBUILD_PHASES = ["setup", "unpack", "prepare", "configure",
+ "PROFILE_ONLY_VARIABLES")
+EBUILD_PHASES = ("setup", "unpack", "prepare", "configure",
"compile", "test", "install",
"package", "preinst", "postinst","prerm", "postrm",
- "nofetch", "config", "info", "other"]
+ "nofetch", "config", "info", "other")
EAPI = 3
HASHING_BLOCKSIZE = 32768
-MANIFEST1_HASH_FUNCTIONS = ["MD5", "SHA256", "RMD160"]
-MANIFEST2_HASH_FUNCTIONS = ["SHA1", "SHA256", "RMD160"]
+MANIFEST1_HASH_FUNCTIONS = ("MD5", "SHA256", "RMD160")
+MANIFEST2_HASH_FUNCTIONS = ("SHA1", "SHA256", "RMD160")
MANIFEST1_REQUIRED_HASH = "MD5"
MANIFEST2_REQUIRED_HASH = "SHA1"
-MANIFEST2_IDENTIFIERS = ["AUX", "MISC", "DIST", "EBUILD"]
+MANIFEST2_IDENTIFIERS = ("AUX", "MISC", "DIST", "EBUILD")
# ===========================================================================
# END OF CONSTANTS -- END OF CONSTANTS -- END OF CONSTANTS -- END OF CONSTANT
# ===========================================================================
Modified: main/branches/prefix/pym/portage/dbapi/porttree.py
===================================================================
--- main/branches/prefix/pym/portage/dbapi/porttree.py 2010-01-31 09:40:03 UTC (rev 15299)
+++ main/branches/prefix/pym/portage/dbapi/porttree.py 2010-01-31 09:41:21 UTC (rev 15300)
@@ -141,7 +141,13 @@
def _categories(self):
return self.settings.categories
- def __init__(self, porttree_root, mysettings=None):
+ def __init__(self, _unused_param=None, mysettings=None):
+ """
+ @param _unused_param: deprecated
+ @type _unused_param: None
+ @param mysettings: an immutable config instance
+ @type mysettings: portage.config
+ """
portdbapi.portdbapi_instances.append(self)
from portage import config
@@ -151,6 +157,15 @@
from portage import settings
self.mysettings = config(clone=settings)
+ if _unused_param is not None:
+ warnings.warn("The first parameter of the " + \
+ "portage.dbapi.porttree.portdbapi" + \
+ " constructor is now unused. Use " + \
+ "mysettings['PORTDIR'] instead.",
+ DeprecationWarning)
+
+ porttree_root = self.mysettings['PORTDIR']
+
# This is strictly for use in aux_get() doebuild calls when metadata
# is generated by the depend phase. It's safest to use a clone for
# this purpose because doebuild makes many changes to the config
@@ -1182,8 +1197,7 @@
self.settings = settings
self.portroot = settings["PORTDIR"]
self.virtual = virtual
- self.dbapi = portdbapi(
- settings["PORTDIR"], mysettings=settings)
+ self.dbapi = portdbapi(mysettings=settings)
def dep_bestmatch(self,mydep):
"compatibility method"
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-01-31 9:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-31 9:41 [gentoo-commits] portage r15300 - in main/branches/prefix: bin pym/portage pym/portage/dbapi Fabian Groffen (grobian)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox