1 |
commit: f4ef24e29e2968bd581425198220dce7d6a28bc3 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat May 7 03:02:50 2011 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat May 7 03:02:50 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f4ef24e2 |
7 |
|
8 |
preserve-libs: fix linkmap logic for new plibs |
9 |
|
10 |
Together with commit f36b9fa38b5268c2a5579db62acec026625f84a9, |
11 |
hopefully this solves bug #366061. |
12 |
|
13 |
--- |
14 |
pym/portage/dbapi/vartree.py | 18 ++++++++++---- |
15 |
pym/portage/util/_dyn_libs/LinkageMapELF.py | 33 ++++++++++++++++++++++----- |
16 |
2 files changed, 40 insertions(+), 11 deletions(-) |
17 |
|
18 |
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py |
19 |
index 4170d3d..d8fe7b5 100644 |
20 |
--- a/pym/portage/dbapi/vartree.py |
21 |
+++ b/pym/portage/dbapi/vartree.py |
22 |
@@ -1434,7 +1434,7 @@ class dblink(object): |
23 |
return pkgfiles |
24 |
|
25 |
def _prune_plib_registry(self, unmerge=False, others_in_slot=[], |
26 |
- needed=None): |
27 |
+ needed=None, preserve_paths=None): |
28 |
# remove preserved libraries that don't have any consumers left |
29 |
plib_registry = self.vartree.dbapi._plib_registry |
30 |
if plib_registry: |
31 |
@@ -1450,7 +1450,7 @@ class dblink(object): |
32 |
exclude_pkgs = None |
33 |
|
34 |
self._linkmap_rebuild(exclude_pkgs=exclude_pkgs, |
35 |
- include_file=needed) |
36 |
+ include_file=needed, preserve_paths=preserve_paths) |
37 |
|
38 |
cpv_lib_map = self._find_unused_preserved_libs() |
39 |
if cpv_lib_map: |
40 |
@@ -1476,7 +1476,8 @@ class dblink(object): |
41 |
plib_registry.unlock() |
42 |
|
43 |
def unmerge(self, pkgfiles=None, trimworld=None, cleanup=True, |
44 |
- ldpath_mtimes=None, others_in_slot=None, needed=None): |
45 |
+ ldpath_mtimes=None, others_in_slot=None, needed=None, |
46 |
+ preserve_paths=None): |
47 |
""" |
48 |
Calls prerm |
49 |
Unmerges a given package (CPV) |
50 |
@@ -1496,6 +1497,11 @@ class dblink(object): |
51 |
@type others_in_slot: list |
52 |
@param needed: Filename containing libraries needed after unmerge. |
53 |
@type needed: String |
54 |
+ @param preserve_paths: Libraries preserved by a package instance that |
55 |
+ is currently being merged. They need to be explicitly passed to the |
56 |
+ LinkageMap, since they are not registered in the |
57 |
+ PreservedLibsRegistry yet. |
58 |
+ @type preserve_paths: set |
59 |
@rtype: Integer |
60 |
@returns: |
61 |
1. os.EX_OK if everything went well. |
62 |
@@ -1629,7 +1635,8 @@ class dblink(object): |
63 |
level=logging.ERROR, noiselevel=-1) |
64 |
|
65 |
self._prune_plib_registry(unmerge=True, |
66 |
- others_in_slot=others_in_slot, needed=needed) |
67 |
+ others_in_slot=others_in_slot, needed=needed, |
68 |
+ preserve_paths=preserve_paths) |
69 |
finally: |
70 |
self.vartree.dbapi._bump_mtime(self.mycpv) |
71 |
if builddir_lock: |
72 |
@@ -3321,7 +3328,8 @@ class dblink(object): |
73 |
dblnk.settings["REPLACED_BY_VERSION"] = portage.versions.cpv_getversion(self.mycpv) |
74 |
dblnk.settings.backup_changes("REPLACED_BY_VERSION") |
75 |
unmerge_rval = dblnk.unmerge(ldpath_mtimes=prev_mtimes, |
76 |
- others_in_slot=others_in_slot, needed=needed) |
77 |
+ others_in_slot=others_in_slot, needed=needed, |
78 |
+ preserve_paths=preserve_paths) |
79 |
dblnk.settings.pop("REPLACED_BY_VERSION", None) |
80 |
|
81 |
if unmerge_rval == os.EX_OK: |
82 |
|
83 |
diff --git a/pym/portage/util/_dyn_libs/LinkageMapELF.py b/pym/portage/util/_dyn_libs/LinkageMapELF.py |
84 |
index bbfce88..9e79bd8 100644 |
85 |
--- a/pym/portage/util/_dyn_libs/LinkageMapELF.py |
86 |
+++ b/pym/portage/util/_dyn_libs/LinkageMapELF.py |
87 |
@@ -142,10 +142,26 @@ class LinkageMapELF(object): |
88 |
def __str__(self): |
89 |
return str(sorted(self.alt_paths)) |
90 |
|
91 |
- def rebuild(self, exclude_pkgs=None, include_file=None): |
92 |
+ def rebuild(self, exclude_pkgs=None, include_file=None, |
93 |
+ preserve_paths=None): |
94 |
""" |
95 |
Raises CommandNotFound if there are preserved libs |
96 |
and the scanelf binary is not available. |
97 |
+ |
98 |
+ @param exclude_pkgs: A set of packages that should be excluded from |
99 |
+ the LinkageMap, since they are being unmerged and their NEEDED |
100 |
+ entries are therefore irrelevant and would only serve to corrupt |
101 |
+ the LinkageMap. |
102 |
+ @type exclude_pkgs: set |
103 |
+ @param include_file: The path of a file containing NEEDED entries for |
104 |
+ a package which does not exist in the vardbapi yet because it is |
105 |
+ currently being merged. |
106 |
+ @type include_file: String |
107 |
+ @param preserve_paths: Libraries preserved by a package instance that |
108 |
+ is currently being merged. They need to be explicitly passed to the |
109 |
+ LinkageMap, since they are not registered in the |
110 |
+ PreservedLibsRegistry yet. |
111 |
+ @type preserve_paths: set |
112 |
""" |
113 |
|
114 |
os = _os_merge |
115 |
@@ -178,12 +194,17 @@ class LinkageMapELF(object): |
116 |
# have to call scanelf for preserved libs here as they aren't |
117 |
# registered in NEEDED.ELF.2 files |
118 |
plibs = set() |
119 |
- if self._dbapi._plib_registry and self._dbapi._plib_registry.getPreservedLibs(): |
120 |
- args = ["/usr/bin/scanelf", "-qF", "%a;%F;%S;%r;%n"] |
121 |
- for items in self._dbapi._plib_registry.getPreservedLibs().values(): |
122 |
+ if preserve_paths is not None: |
123 |
+ plibs.update(preserve_paths) |
124 |
+ if self._dbapi._plib_registry and \ |
125 |
+ self._dbapi._plib_registry.hasEntries(): |
126 |
+ for items in \ |
127 |
+ self._dbapi._plib_registry.getPreservedLibs().values(): |
128 |
plibs.update(items) |
129 |
- args.extend(os.path.join(root, x.lstrip("." + os.sep)) \ |
130 |
- for x in items) |
131 |
+ if plibs: |
132 |
+ args = ["/usr/bin/scanelf", "-qF", "%a;%F;%S;%r;%n"] |
133 |
+ args.extend(os.path.join(root, x.lstrip("." + os.sep)) \ |
134 |
+ for x in plibs) |
135 |
try: |
136 |
proc = subprocess.Popen(args, stdout=subprocess.PIPE) |
137 |
except EnvironmentError as e: |