From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 9336D138330 for ; Thu, 15 Sep 2016 15:05:22 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D2253E0913; Thu, 15 Sep 2016 15:05:20 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 5EFF3E0913 for ; Thu, 15 Sep 2016 15:05:19 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 4B34E340961 for ; Thu, 15 Sep 2016 15:05:18 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 45922247E for ; Thu, 15 Sep 2016 15:05:16 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1473882525.d1becbe15b5b13322b3b88a359e851d0d318aaa2.dolsen@gentoo> Subject: [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/ X-VCS-Repository: proj/gentoolkit X-VCS-Files: pym/gentoolkit/revdep_rebuild/analyse.py X-VCS-Directories: pym/gentoolkit/revdep_rebuild/ X-VCS-Committer: dolsen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: d1becbe15b5b13322b3b88a359e851d0d318aaa2 X-VCS-Branch: master Date: Thu, 15 Sep 2016 15:05:16 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 596a08e9-7e2e-4e87-bba1-881a257601d3 X-Archives-Hash: 0de967fdb7ad41bd89b100770b54e83e commit: d1becbe15b5b13322b3b88a359e851d0d318aaa2 Author: Brian Dolbec gentoo org> AuthorDate: Wed Sep 14 17:41:49 2016 +0000 Commit: Brian Dolbec gentoo org> CommitDate: Wed Sep 14 19:48:45 2016 +0000 URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=d1becbe1 revdep-rebuild: Fix filename matching for directories (bug 593672) Also fixed all_masks not including lib32 lib64 (were added after all_masks was assigned). Fixed to ensure it does not match on partial directory names by splitting the paths on the os.sep boundaries. Test using realpaths as well. pym/gentoolkit/revdep_rebuild/analyse.py | 33 +++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/pym/gentoolkit/revdep_rebuild/analyse.py b/pym/gentoolkit/revdep_rebuild/analyse.py index 9f018b5..b8fca4b 100644 --- a/pym/gentoolkit/revdep_rebuild/analyse.py +++ b/pym/gentoolkit/revdep_rebuild/analyse.py @@ -120,7 +120,8 @@ def extract_dependencies_from_la(la, libraries, to_check, logger): class LibCheck(object): - def __init__(self, scanned_files, logger, searchlibs=None, searchbits=None, all_masks=None): + def __init__(self, scanned_files, logger, searchlibs=None, searchbits=None, + all_masks=None, masked_dirs=None): '''LibCheck init function. @param scanned_files: optional dictionary if the type created by @@ -135,6 +136,7 @@ class LibCheck(object): self.searchlibs = searchlibs self.searchbits = sorted(searchbits) or ['32', '64'] self.all_masks = all_masks + self.masked_dirs = masked_dirs self.logger.debug("\tLibCheck.__init__(), new searchlibs: %s" %(self.searchbits)) if searchlibs: self.smsg = '\tLibCheck.search(), Checking for %s bit dependants' @@ -221,7 +223,10 @@ class LibCheck(object): if l in self.all_masks: self.logger.debug('\tLibrary %s ignored as it is masked' % l) continue - if filename in self.all_masks: + if (filename in self.all_masks or + os.path.realpath(filename) in self.all_masks or + self.is_masked(os.path.realpath(filename)) + ): self.logger.debug('\tFile %s ignored as it is masked' % filename) continue if not bits in found_libs: @@ -240,6 +245,16 @@ class LibCheck(object): return found_libs + def is_masked(self, filename): + for m in self.masked_dirs: + t = m.split(os.sep) + f = filename.split(os.sep) + # self.logger.debug("\tis_masked(); %s, %s" % (t, f)) + if t == f[:min(len(t), len(f))]: + return True + return False + + def process_results(self, found_libs, scanned_files=None): '''Processes the search results, logs the files found @@ -294,18 +309,17 @@ def analyse(settings, logger, libraries=None, la_libraries=None, ] ) + if '64' not in searchbits: + masked_dirs.update(['/lib64', '/usr/lib64']) + elif '32' not in searchbits: + masked_dirs.update(['/lib32', '/usr/lib32']) + all_masks = masked_dirs.copy() all_masks.update(masked_files) logger.debug("\tall_masks:") for x in sorted(all_masks): logger.debug('\t\t%s' % (x)) - - if '64' not in searchbits: - masked_dirs.update(['/lib64', '/usr/lib64']) - elif '32' not in searchbits: - masked_dirs.update(['/lib32', '/usr/lib32']) - if libraries and la_libraries and libraries_links and binaries: logger.info(blue(' * ') + bold('Found a valid cache, skipping collecting phase')) @@ -371,7 +385,8 @@ def analyse(settings, logger, libraries=None, la_libraries=None, % (len(libs_and_bins), len(libraries)+len(libraries_links)) ) - libcheck = LibCheck(scanned_files, logger, _libs_to_check, searchbits, all_masks) + libcheck = LibCheck(scanned_files, logger, _libs_to_check, searchbits, + all_masks, masked_dirs) broken_pathes = libcheck.process_results(libcheck.search())