public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Brian Dolbec" <dolsen@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/
Date: Thu, 15 Sep 2016 15:05:16 +0000 (UTC)	[thread overview]
Message-ID: <1473882525.d1becbe15b5b13322b3b88a359e851d0d318aaa2.dolsen@gentoo> (raw)

commit:     d1becbe15b5b13322b3b88a359e851d0d318aaa2
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 14 17:41:49 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> 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())
 


             reply	other threads:[~2016-09-15 15:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-15 15:05 Brian Dolbec [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-07-09  1:49 [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/ Mike Gilbert
2020-02-14 18:13 Zac Medico
2019-08-19  3:41 Zac Medico
2019-08-19  3:41 Zac Medico
2017-05-05 19:38 Paul Varner
2017-03-10 17:31 Zac Medico
2016-12-29 21:36 Jason Donenfeld
2016-09-15 15:05 Brian Dolbec
2016-08-15 21:06 Paul Varner
2016-06-09 19:38 Slawek Lis
2016-05-18 15:41 Brian Dolbec
2016-05-18 15:41 Brian Dolbec
2016-05-18 15:14 Brian Dolbec
2016-05-18  6:10 Brian Dolbec
2016-02-25 21:26 Brian Dolbec
2016-01-18  0:00 Jason Donenfeld
2015-12-20  2:05 Brian Dolbec
2015-12-16 17:53 Brian Dolbec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1473882525.d1becbe15b5b13322b3b88a359e851d0d318aaa2.dolsen@gentoo \
    --to=dolsen@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox