* [gentoo-commits] proj/portage:master commit in: pym/portage/util/_dyn_libs/, pym/_emerge/
@ 2011-05-08 4:53 Zac Medico
0 siblings, 0 replies; 2+ messages in thread
From: Zac Medico @ 2011-05-08 4:53 UTC (permalink / raw
To: gentoo-commits
commit: 36ad74b36d6d70a21d24ef7cb180ab09a6a327f0
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun May 8 04:46:08 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun May 8 04:46:08 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=36ad74b3
Use EROOT with VDB_PATH in recent changes.
---
pym/_emerge/EbuildPhase.py | 4 ++--
pym/portage/util/_dyn_libs/LinkageMapELF.py | 5 ++---
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/pym/_emerge/EbuildPhase.py b/pym/_emerge/EbuildPhase.py
index e75673c..21d7f47 100644
--- a/pym/_emerge/EbuildPhase.py
+++ b/pym/_emerge/EbuildPhase.py
@@ -146,8 +146,8 @@ class EbuildPhase(CompositeTask):
if (self.phase in self._locked_phases and
"ebuild-locks" in self.settings.features):
- root = self.settings["ROOT"]
- lock_path = os.path.join(root, portage.VDB_PATH + "-ebuild")
+ eroot = self.settings["EROOT"]
+ lock_path = os.path.join(eroot, portage.VDB_PATH + "-ebuild")
if os.access(os.path.dirname(lock_path), os.W_OK):
self._ebuild_lock = lockdir(lock_path)
self._start_task(ebuild_process, self._ebuild_exit)
diff --git a/pym/portage/util/_dyn_libs/LinkageMapELF.py b/pym/portage/util/_dyn_libs/LinkageMapELF.py
index ce77bb4..31aacbb 100644
--- a/pym/portage/util/_dyn_libs/LinkageMapELF.py
+++ b/pym/portage/util/_dyn_libs/LinkageMapELF.py
@@ -183,8 +183,7 @@ class LinkageMapELF(object):
lines.append((include_file, line))
aux_keys = [self._needed_aux_key]
- vdb_path = os.path.join(self._root, portage.VDB_PATH)
- vdb_lock = lockdir(vdb_path)
+ self._dbapi.lock()
try:
for cpv in self._dbapi.cpv_all():
if exclude_pkgs is not None and cpv in exclude_pkgs:
@@ -194,7 +193,7 @@ class LinkageMapELF(object):
for line in self._dbapi.aux_get(cpv, aux_keys)[0].splitlines():
lines.append((needed_file, line))
finally:
- unlockdir(vdb_lock)
+ self._dbapi.unlock()
# have to call scanelf for preserved libs here as they aren't
# registered in NEEDED.ELF.2 files
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/_dyn_libs/, pym/_emerge/
@ 2012-10-14 22:36 Zac Medico
0 siblings, 0 replies; 2+ messages in thread
From: Zac Medico @ 2012-10-14 22:36 UTC (permalink / raw
To: gentoo-commits
commit: ef591ebe40a027a0a54f455b92c1c78578d1d736
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 14 22:36:37 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Oct 14 22:36:37 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ef591ebe
display_preserved_libs: move to separate file
---
pym/_emerge/main.py | 105 +++-----------------
.../util/_dyn_libs/display_preserved_libs.py | 79 +++++++++++++++
2 files changed, 95 insertions(+), 89 deletions(-)
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index adb6327..9fb4275 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -14,6 +14,7 @@ import portage
portage.proxy.lazyimport.lazyimport(globals(),
'portage.news:count_unread_news,display_news_notifications',
'portage.emaint.modules.logs.logs:CleanLogs',
+ 'portage.util._dyn_libs.display_preserved_libs:display_preserved_libs',
)
from portage import os
from portage import _encodings
@@ -240,94 +241,6 @@ def chk_updated_info_files(root, infodirs, prev_mtimes, retval):
if icount > 0 and portage.util.noiselimit >= 0:
out.einfo("Processed %d info files." % (icount,))
-def display_preserved_libs(vardbapi, myopts):
- MAX_DISPLAY = 3
-
- if vardbapi._linkmap is None or \
- vardbapi._plib_registry is None:
- # preserve-libs is entirely disabled
- return
-
- # Explicitly load and prune the PreservedLibsRegistry in order
- # to ensure that we do not display stale data.
- vardbapi._plib_registry.load()
-
- if vardbapi._plib_registry.hasEntries():
- if "--quiet" in myopts:
- print()
- print(colorize("WARN", "!!!") + " existing preserved libs found")
- return
- else:
- print()
- print(colorize("WARN", "!!!") + " existing preserved libs:")
-
- plibdata = vardbapi._plib_registry.getPreservedLibs()
- linkmap = vardbapi._linkmap
- consumer_map = {}
- owners = {}
-
- try:
- linkmap.rebuild()
- except portage.exception.CommandNotFound as e:
- writemsg_level("!!! Command Not Found: %s\n" % (e,),
- level=logging.ERROR, noiselevel=-1)
- del e
- else:
- search_for_owners = set()
- for cpv in plibdata:
- internal_plib_keys = set(linkmap._obj_key(f) \
- for f in plibdata[cpv])
- for f in plibdata[cpv]:
- if f in consumer_map:
- continue
- consumers = []
- for c in linkmap.findConsumers(f):
- # Filter out any consumers that are also preserved libs
- # belonging to the same package as the provider.
- if linkmap._obj_key(c) not in internal_plib_keys:
- consumers.append(c)
- consumers.sort()
- consumer_map[f] = consumers
- search_for_owners.update(consumers[:MAX_DISPLAY+1])
-
- owners = {}
- for f in search_for_owners:
- owner_set = set()
- for owner in linkmap.getOwners(f):
- owner_dblink = vardbapi._dblink(owner)
- if owner_dblink.exists():
- owner_set.add(owner_dblink)
- if owner_set:
- owners[f] = owner_set
-
- for cpv in plibdata:
- print(colorize("WARN", ">>>") + " package: %s" % cpv)
- samefile_map = {}
- for f in plibdata[cpv]:
- obj_key = linkmap._obj_key(f)
- alt_paths = samefile_map.get(obj_key)
- if alt_paths is None:
- alt_paths = set()
- samefile_map[obj_key] = alt_paths
- alt_paths.add(f)
-
- for alt_paths in samefile_map.values():
- alt_paths = sorted(alt_paths)
- for p in alt_paths:
- print(colorize("WARN", " * ") + " - %s" % (p,))
- f = alt_paths[0]
- consumers = consumer_map.get(f, [])
- for c in consumers[:MAX_DISPLAY]:
- print(colorize("WARN", " * ") + " used by %s (%s)" % \
- (c, ", ".join(x.mycpv for x in owners.get(c, []))))
- if len(consumers) == MAX_DISPLAY + 1:
- print(colorize("WARN", " * ") + " used by %s (%s)" % \
- (consumers[MAX_DISPLAY], ", ".join(x.mycpv \
- for x in owners.get(consumers[MAX_DISPLAY], []))))
- elif len(consumers) > MAX_DISPLAY:
- print(colorize("WARN", " * ") + " used by %d other files" % (len(consumers) - MAX_DISPLAY))
- print("Use " + colorize("GOOD", "emerge @preserved-rebuild") + " to rebuild packages using these libraries")
-
def post_emerge(myaction, myopts, myfiles,
target_root, trees, mtimedb, retval):
"""
@@ -404,7 +317,21 @@ def post_emerge(myaction, myopts, myfiles,
if vdb_lock:
vardbapi.unlock()
- display_preserved_libs(vardbapi, myopts)
+ # Explicitly load and prune the PreservedLibsRegistry in order
+ # to ensure that we do not display stale data.
+ vardbapi._plib_registry.load()
+
+ if vardbapi._plib_registry.hasEntries():
+ if "--quiet" in myopts:
+ print()
+ print(colorize("WARN", "!!!") + " existing preserved libs found")
+ else:
+ print()
+ print(colorize("WARN", "!!!") + " existing preserved libs:")
+ display_preserved_libs(vardbapi)
+ print("Use " + colorize("GOOD", "emerge @preserved-rebuild") +
+ " to rebuild packages using these libraries")
+
chk_updated_cfg_files(settings['EROOT'], config_protect)
display_news_notification(root_config, myopts)
diff --git a/pym/portage/util/_dyn_libs/display_preserved_libs.py b/pym/portage/util/_dyn_libs/display_preserved_libs.py
new file mode 100644
index 0000000..bcb7827
--- /dev/null
+++ b/pym/portage/util/_dyn_libs/display_preserved_libs.py
@@ -0,0 +1,79 @@
+# Copyright 2007-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+from __future__ import print_function
+
+import logging
+
+import portage
+from portage.output import colorize
+
+def display_preserved_libs(vardb):
+
+ MAX_DISPLAY = 3
+
+ plibdata = vardb._plib_registry.getPreservedLibs()
+ linkmap = vardb._linkmap
+ consumer_map = {}
+ owners = {}
+
+ try:
+ linkmap.rebuild()
+ except portage.exception.CommandNotFound as e:
+ portage.util.writemsg_level("!!! Command Not Found: %s\n" % (e,),
+ level=logging.ERROR, noiselevel=-1)
+ else:
+ search_for_owners = set()
+ for cpv in plibdata:
+ internal_plib_keys = set(linkmap._obj_key(f) \
+ for f in plibdata[cpv])
+ for f in plibdata[cpv]:
+ if f in consumer_map:
+ continue
+ consumers = []
+ for c in linkmap.findConsumers(f):
+ # Filter out any consumers that are also preserved libs
+ # belonging to the same package as the provider.
+ if linkmap._obj_key(c) not in internal_plib_keys:
+ consumers.append(c)
+ consumers.sort()
+ consumer_map[f] = consumers
+ search_for_owners.update(consumers[:MAX_DISPLAY+1])
+
+ owners = {}
+ for f in search_for_owners:
+ owner_set = set()
+ for owner in linkmap.getOwners(f):
+ owner_dblink = vardb._dblink(owner)
+ if owner_dblink.exists():
+ owner_set.add(owner_dblink)
+ if owner_set:
+ owners[f] = owner_set
+
+ for cpv in plibdata:
+ print(colorize("WARN", ">>>") + " package: %s" % cpv)
+ samefile_map = {}
+ for f in plibdata[cpv]:
+ obj_key = linkmap._obj_key(f)
+ alt_paths = samefile_map.get(obj_key)
+ if alt_paths is None:
+ alt_paths = set()
+ samefile_map[obj_key] = alt_paths
+ alt_paths.add(f)
+
+ for alt_paths in samefile_map.values():
+ alt_paths = sorted(alt_paths)
+ for p in alt_paths:
+ print(colorize("WARN", " * ") + " - %s" % (p,))
+ f = alt_paths[0]
+ consumers = consumer_map.get(f, [])
+ for c in consumers[:MAX_DISPLAY]:
+ print(colorize("WARN", " * ") + " used by %s (%s)" % \
+ (c, ", ".join(x.mycpv for x in owners.get(c, []))))
+ if len(consumers) == MAX_DISPLAY + 1:
+ print(colorize("WARN", " * ") + " used by %s (%s)" % \
+ (consumers[MAX_DISPLAY], ", ".join(x.mycpv \
+ for x in owners.get(consumers[MAX_DISPLAY], []))))
+ elif len(consumers) > MAX_DISPLAY:
+ print(colorize("WARN", " * ") + " used by %d other files" %
+ (len(consumers) - MAX_DISPLAY))
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-10-14 22:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-14 22:36 [gentoo-commits] proj/portage:master commit in: pym/portage/util/_dyn_libs/, pym/_emerge/ Zac Medico
-- strict thread matches above, loose matches on Subject: below --
2011-05-08 4:53 Zac Medico
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox