From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1S4SP0-0007Ta-1H for garchives@archives.gentoo.org; Mon, 05 Mar 2012 07:32:14 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5B828E06C5; Mon, 5 Mar 2012 07:32:06 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 15672E06C5 for ; Mon, 5 Mar 2012 07:32:06 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7AA771B4007 for ; Mon, 5 Mar 2012 07:32:05 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 3B475E5428 for ; Mon, 5 Mar 2012 07:32:04 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1330932628.32d19be14e22ada479963ba8627452f5f2d89b94.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/util/_dyn_libs/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/util/_dyn_libs/PreservedLibsRegistry.py X-VCS-Directories: pym/portage/util/_dyn_libs/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 32d19be14e22ada479963ba8627452f5f2d89b94 X-VCS-Branch: master Date: Mon, 5 Mar 2012 07:32:04 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 32bd7b93-bcd6-4aba-9090-636b30acfca9 X-Archives-Hash: 034f35a7312afeebdecd20c5f83a9550 commit: 32d19be14e22ada479963ba8627452f5f2d89b94 Author: Zac Medico gentoo org> AuthorDate: Mon Mar 5 07:30:28 2012 +0000 Commit: Zac Medico gentoo org> CommitDate: Mon Mar 5 07:30:28 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D32d19be1 pruneNonExisting: handle eselect-opengl symlinks Only count symlinks as preserved if they still point to a hardink in the same directory, in order to handle cases where a tool such as eselect-opengl has updated the symlink to point to a hardlink in a different directory (see bug #406837). The unused hardlink is automatically found by _find_unused_preserved_libs, since the soname symlink no longer points to it. After the hardlink is removed by _remove_preserved_libs, it calls pruneNonExisting which eliminates the irrelevant symlink from the registry here. --- .../util/_dyn_libs/PreservedLibsRegistry.py | 36 ++++++++++++++= ++++-- 1 files changed, 33 insertions(+), 3 deletions(-) diff --git a/pym/portage/util/_dyn_libs/PreservedLibsRegistry.py b/pym/po= rtage/util/_dyn_libs/PreservedLibsRegistry.py index 405a23a..7d4708b 100644 --- a/pym/portage/util/_dyn_libs/PreservedLibsRegistry.py +++ b/pym/portage/util/_dyn_libs/PreservedLibsRegistry.py @@ -4,6 +4,7 @@ import errno import json import logging +import stat import sys =20 try: @@ -196,9 +197,38 @@ class PreservedLibsRegistry(object): os =3D _os_merge =20 for cps in list(self._data): - cpv, counter, paths =3D self._data[cps] - paths =3D [f for f in paths \ - if os.path.exists(os.path.join(self._root, f.lstrip(os.sep)))] + cpv, counter, _paths =3D self._data[cps] + + paths =3D [] + hardlinks =3D set() + symlinks =3D {} + for f in _paths: + f_abs =3D os.path.join(self._root, f.lstrip(os.sep)) + try: + lst =3D os.lstat(f_abs) + except OSError: + continue + if stat.S_ISLNK(lst.st_mode): + try: + symlinks[f] =3D os.readlink(f_abs) + except OSError: + continue + elif stat.S_ISREG(lst.st_mode): + hardlinks.add(f) + paths.append(f) + + # Only count symlinks as preserved if they still point to a hardink + # in the same directory, in order to handle cases where a tool such + # as eselect-opengl has updated the symlink to point to a hardlink + # in a different directory (see bug #406837). The unused hardlink + # is automatically found by _find_unused_preserved_libs, since the + # soname symlink no longer points to it. After the hardlink is + # removed by _remove_preserved_libs, it calls pruneNonExisting + # which eliminates the irrelevant symlink from the registry here. + for f, target in symlinks.items(): + if os.path.join(os.path.dirname(f), target) in hardlinks: + paths.append(f) + if len(paths) > 0: self._data[cps] =3D (cpv, counter, paths) else: