[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/

2022-07-08 Thread Mike Gilbert
commit: 635e0b9f8b96217070eb48a6888ac5e1c46f8822
Author: Mike Gilbert  gentoo  org>
AuthorDate: Sat Jul  9 01:26:19 2022 +
Commit: Mike Gilbert  gentoo  org>
CommitDate: Sat Jul  9 01:26:19 2022 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=635e0b9f

revdep-rebuild: set up a child logger with propagate = False

This prevents log messages from being emitted more than once, especially
by the root level loggger.

Bug: https://bugs.gentoo.org/838406
Signed-off-by: Mike Gilbert  gentoo.org>

 pym/gentoolkit/revdep_rebuild/rebuild.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pym/gentoolkit/revdep_rebuild/rebuild.py 
b/pym/gentoolkit/revdep_rebuild/rebuild.py
index 75e209d..16d07b8 100644
--- a/pym/gentoolkit/revdep_rebuild/rebuild.py
+++ b/pym/gentoolkit/revdep_rebuild/rebuild.py
@@ -44,7 +44,8 @@ __productname__ = "revdep-ng"
 
 def init_logger(settings):
 """Creates and iitializes our logger according to the settings"""
-logger = logging.getLogger()
+logger = logging.getLogger(__name__)
+logger.propagate = False
 log_handler = logging.StreamHandler(sys.stdout)
 log_fmt = logging.Formatter("%(msg)s")
 log_handler.setFormatter(log_fmt)



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/, pym/gentoolkit/enalyze/, pym/gentoolkit/, ...

2020-12-21 Thread Matt Turner
commit: aa28f4aa9a12bedce5a5834b009260d132706de5
Author: Matt Turner  gentoo  org>
AuthorDate: Mon Dec 21 01:37:15 2020 +
Commit: Matt Turner  gentoo  org>
CommitDate: Mon Dec 21 01:38:18 2020 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=aa28f4aa

Remove unused sys imports

Reported by flake8.

Signed-off-by: Matt Turner  gentoo.org>

 pym/gentoolkit/eclean/exclude.py | 1 -
 pym/gentoolkit/enalyze/rebuild.py| 1 -
 pym/gentoolkit/helpers.py| 1 -
 pym/gentoolkit/revdep_rebuild/analyse.py | 1 -
 pym/gentoolkit/revdep_rebuild/cache.py   | 1 -
 pym/gentoolkit/revdep_rebuild/collect.py | 1 -
 pym/gentoolkit/test/test_keyword.py  | 1 -
 7 files changed, 7 deletions(-)

diff --git a/pym/gentoolkit/eclean/exclude.py b/pym/gentoolkit/eclean/exclude.py
index 45ecd52..1da9523 100644
--- a/pym/gentoolkit/eclean/exclude.py
+++ b/pym/gentoolkit/eclean/exclude.py
@@ -5,7 +5,6 @@
 
 
 import os
-import sys
 import re
 import portage
 from portage import _encodings, _unicode_encode

diff --git a/pym/gentoolkit/enalyze/rebuild.py 
b/pym/gentoolkit/enalyze/rebuild.py
index 3f3f4fd..c0ac8cb 100644
--- a/pym/gentoolkit/enalyze/rebuild.py
+++ b/pym/gentoolkit/enalyze/rebuild.py
@@ -11,7 +11,6 @@ what packages according to the Installed package database"""
 
 
 import os
-import sys
 
 import gentoolkit
 from gentoolkit.module_base import ModuleBase

diff --git a/pym/gentoolkit/helpers.py b/pym/gentoolkit/helpers.py
index a979ca7..e7185c3 100644
--- a/pym/gentoolkit/helpers.py
+++ b/pym/gentoolkit/helpers.py
@@ -24,7 +24,6 @@ __docformat__ = 'epytext'
 # ===
 
 import os
-import sys
 import re
 from functools import partial
 from itertools import chain

diff --git a/pym/gentoolkit/revdep_rebuild/analyse.py 
b/pym/gentoolkit/revdep_rebuild/analyse.py
index 3e46a51..bdd8306 100644
--- a/pym/gentoolkit/revdep_rebuild/analyse.py
+++ b/pym/gentoolkit/revdep_rebuild/analyse.py
@@ -5,7 +5,6 @@
 import os
 import re
 import time
-import sys
 
 from portage import _encodings, _unicode_encode
 from portage.output import bold, blue, yellow, green

diff --git a/pym/gentoolkit/revdep_rebuild/cache.py 
b/pym/gentoolkit/revdep_rebuild/cache.py
index f8b7841..ab0b7d7 100644
--- a/pym/gentoolkit/revdep_rebuild/cache.py
+++ b/pym/gentoolkit/revdep_rebuild/cache.py
@@ -5,7 +5,6 @@ Functions for reading, saving and verifying the data caches
 
 from portage import os
 import time
-import sys
 
 from portage import _encodings, _unicode_encode
 from portage.output import red

diff --git a/pym/gentoolkit/revdep_rebuild/collect.py 
b/pym/gentoolkit/revdep_rebuild/collect.py
index 74a44f7..38ff48e 100644
--- a/pym/gentoolkit/revdep_rebuild/collect.py
+++ b/pym/gentoolkit/revdep_rebuild/collect.py
@@ -6,7 +6,6 @@ import re
 from portage import os
 import glob
 import stat
-import sys
 
 import portage
 from portage import _encodings, _unicode_encode

diff --git a/pym/gentoolkit/test/test_keyword.py 
b/pym/gentoolkit/test/test_keyword.py
index 99a79b5..8ba5e30 100644
--- a/pym/gentoolkit/test/test_keyword.py
+++ b/pym/gentoolkit/test/test_keyword.py
@@ -1,4 +1,3 @@
-import sys
 import unittest
 
 from gentoolkit import keyword



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/

2020-02-14 Thread Zac Medico
commit: c6d2400dccc2b5334bfab5f82f1a8bf1ab38f06c
Author: Zac Medico  gentoo  org>
AuthorDate: Fri Feb 14 18:04:53 2020 +
Commit: Zac Medico  gentoo  org>
CommitDate: Fri Feb 14 18:09:43 2020 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=c6d2400d

revdep-rebuild: encode Popen args as utf-8 bytes (bug 709610)

Prevent this Popen exception:

UnicodeEncodeError: 'ascii' codec can't encode character '\xe8' in position 20: 
ordinal not in range(128)

Bug: https://bugs.gentoo.org/709610#c0
Signed-off-by: Zac Medico  gentoo.org>

 pym/gentoolkit/revdep_rebuild/stuff.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pym/gentoolkit/revdep_rebuild/stuff.py 
b/pym/gentoolkit/revdep_rebuild/stuff.py
index 3b0a980..002eb4b 100644
--- a/pym/gentoolkit/revdep_rebuild/stuff.py
+++ b/pym/gentoolkit/revdep_rebuild/stuff.py
@@ -19,6 +19,7 @@ def call_program(args):
@param, args: arument list to pass to subprocess
@return str
'''
+   args = [arg if isinstance(arg, bytes) else arg.encode('utf-8') for arg 
in args]
subp = subprocess.Popen(args, stdout=subprocess.PIPE, 
stderr=subprocess.PIPE)
stdout, stderr = subp.communicate()
stdout = stdout.decode('utf-8')



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/, pym/gentoolkit/test/, pym/gentoolkit/, ...

2020-01-26 Thread Michał Górny
commit: cd4584ed5934381ff967f4a031b31b8c2e55b530
Author: Michał Górny  gentoo  org>
AuthorDate: Sun Jan 26 15:15:02 2020 +
Commit: Michał Górny  gentoo  org>
CommitDate: Sun Jan 26 15:15:02 2020 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=cd4584ed

Modernize test assertions

Signed-off-by: Michał Górny  gentoo.org>

 pym/gentoolkit/cpv.py |  4 ++--
 pym/gentoolkit/revdep_rebuild/settings.py |  6 +++---
 pym/gentoolkit/test/eclean/test_search.py | 10 +-
 pym/gentoolkit/test/equery/test_init.py   |  8 
 pym/gentoolkit/test/test_cpv.py   |  8 
 pym/gentoolkit/test/test_helpers.py   | 16 
 pym/gentoolkit/test/test_keyword.py   | 10 +-
 pym/gentoolkit/test/test_query.py | 14 +++---
 8 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/pym/gentoolkit/cpv.py b/pym/gentoolkit/cpv.py
index 169c833..2e8e167 100644
--- a/pym/gentoolkit/cpv.py
+++ b/pym/gentoolkit/cpv.py
@@ -28,8 +28,8 @@ from gentoolkit import errors
 # Globals
 # ===
 
-isvalid_version_re = re.compile(r"^(?:cvs\\.)?(?:\\d+)(?:\\.\\d+)*[a-z]?"
-   r"(?:_(p(?:re)?|beta|alpha|rc)\\d*)*$")
+isvalid_version_re = re.compile(r"^(?:cvs\.)?(?:\d+)(?:\.\d+)*[a-z]?"
+   r"(?:_(p(?:re)?|beta|alpha|rc)\d*)*$")
 isvalid_cat_re = re.compile(r"^(?:[a-zA-Z0-9][-a-zA-Z0-9+._]*(?:/(?!$))?)+$")
 _pkg_re = re.compile(r"^[a-zA-Z0-9+._]+$")
 # Prefix specific revision is of the form -r0+.+

diff --git a/pym/gentoolkit/revdep_rebuild/settings.py 
b/pym/gentoolkit/revdep_rebuild/settings.py
index ca8d5fa..718fee7 100644
--- a/pym/gentoolkit/revdep_rebuild/settings.py
+++ b/pym/gentoolkit/revdep_rebuild/settings.py
@@ -151,15 +151,15 @@ def parse_revdep_config(revdep_confdir):
line = line.strip()
#first check for comment, we do not want to regex all 
lines
if not line.startswith('#'):
-   match = 
re.match(r'LD_LIBRARY_MASK=\\"([^"]+)\\"', line)
+   match = re.match(r'LD_LIBRARY_MASK=\"([^"]+)"', 
line)
if match is not None:
masked_files += ' ' + match.group(1)
continue
-   match = 
re.match(r'SEARCH_DIRS_MASK=\\"([^"]+)\\"', line)
+   match = 
re.match(r'SEARCH_DIRS_MASK=\"([^"]+)"', line)
if match is not None:
masked_dirs += ' ' + match.group(1)
continue
-   match = re.match(r'SEARCH_DIRS=\\"([^"]+)\\"', 
line)
+   match = re.match(r'SEARCH_DIRS="([^"]+)"', line)
if match is not None:
search_dirs += ' ' + match.group(1)
continue

diff --git a/pym/gentoolkit/test/eclean/test_search.py 
b/pym/gentoolkit/test/eclean/test_search.py
index 4533909..6dc26a2 100755
--- a/pym/gentoolkit/test/eclean/test_search.py
+++ b/pym/gentoolkit/test/eclean/test_search.py
@@ -166,12 +166,12 @@ class TestCheckLimits(unittest.TestCase):
test['results'].sort()
#print("actual=", run_results[i])
#print("should-be=", test['results'])
-   self.failUnlessEqual(run_results[i], test["results"],
+   self.assertEqual(run_results[i], test["results"],
"/ntest_check_limits, test# %d, test=%s, 
diff=%s"
%(i, test['test'], 
str(set(run_results[i]).difference(test['results'])))
)
test['output'].sort()
-   self.failUnlessEqual(run_callbacks[i], test['output'])
+   self.assertEqual(run_callbacks[i], test['output'])
 
 
 class TestFetchRestricted(unittest.TestCase):
@@ -290,7 +290,7 @@ class TestFetchRestricted(unittest.TestCase):
else:
test = "FAILED"
print("comparing %s, %s" %(key, item), test)
-   self.failUnlessEqual(sorted(testdata[item]), 
sorted(results[item]),
+   self.assertEqual(sorted(testdata[item]), 
sorted(results[item]),
"\n%s: %s %s data does not 
match\nresult=" %(test_name, key, item) +\
str(results[item]) + "\ntestdata=" + 
str(testdata[item]))
 
@@ -530,7 +530,7 @@ class TestNonDestructive(unittest.TestCase):
print("comparing %s, %s..." %(key, item), test)
if test == "FAILED":

[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/

2019-08-18 Thread Zac Medico
commit: 1bc0206dc67c40cabdef63dd18ec3fe499c4e6eb
Author: cvkbtzx  users  noreply  github  com>
AuthorDate: Sun Sep 16 13:51:04 2018 +
Commit: Zac Medico  gentoo  org>
CommitDate: Mon Aug 19 03:40:03 2019 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=1bc0206d

revdep-rebuild: Fix pass_through_options to handle args containing spaces

Signed-off-by: Zac Medico  gentoo.org>

 pym/gentoolkit/revdep_rebuild/rebuild.py  | 21 ++---
 pym/gentoolkit/revdep_rebuild/settings.py |  4 ++--
 2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/pym/gentoolkit/revdep_rebuild/rebuild.py 
b/pym/gentoolkit/revdep_rebuild/rebuild.py
index 5408298..3f152e7 100644
--- a/pym/gentoolkit/revdep_rebuild/rebuild.py
+++ b/pym/gentoolkit/revdep_rebuild/rebuild.py
@@ -65,34 +65,33 @@ def init_logger(settings):
 def rebuild(logger, assigned, settings):
"""rebuilds the assigned pkgs"""
 
-   args = settings['pass_through_options']
+   args = list(settings['pass_through_options'])
if settings['EXACT']:
_assigned = filter_masked(assigned, logger)
-   emerge_command = '=' + ' ='.join(_assigned)
+   emerge_command = ['='+a for a in _assigned]
else:
_assigned = get_slotted_cps(assigned, logger)
-   emerge_command = ' '.join(_assigned)
+   emerge_command = [a for a in _assigned]
if settings['PRETEND']:
-   args += ' --pretend'
+   args.append('--pretend')
if settings['VERBOSITY'] >= 2:
-   args += ' --verbose'
+   args.append('--verbose')
elif settings['VERBOSITY'] < 1:
-   args += ' --quiet'
+   args.append('--quiet')
if settings['nocolor']:
-   args += ' --color n'
+   args.extend(['--color', 'n'])
 
if len(emerge_command) == 0:
logger.warning(bold('\nThere is nothing to emerge. Exiting.'))
return 0
 
logger.warning(yellow(
-   '\nemerge') + args +
+   '\nemerge') +  ' ' + ' '.join(args) +
' --oneshot --complete-graph=y ' +
-   bold(emerge_command))
+   bold(' '.join(emerge_command)))
 
stime = current_milli_time()
-   _args = 'emerge ' + args + ' --oneshot --complete-graph=y ' + 
emerge_command
-   _args = _args.split()
+   _args = ['emerge'] + args + ['--oneshot', '--complete-graph=y'] + 
emerge_command
success = subprocess.call(_args)
ftime = current_milli_time()
logger.debug("\trebuild(); emerge call for %d ebuilds took: %s seconds"

diff --git a/pym/gentoolkit/revdep_rebuild/settings.py 
b/pym/gentoolkit/revdep_rebuild/settings.py
index 81e9c64..b0a9f61 100644
--- a/pym/gentoolkit/revdep_rebuild/settings.py
+++ b/pym/gentoolkit/revdep_rebuild/settings.py
@@ -46,7 +46,7 @@ DEFAULTS = {
'debug': False,
'no-ld-path': False,
'no-order': False,
-   'pass_through_options': '',
+   'pass_through_options': [],
'stdout': sys.stdout,
'stdin': sys.stdin,
'stderr': sys.stderr
@@ -121,7 +121,7 @@ def parse_options():
if args.library:
settings['library'].update(set(args.library))
settings['USE_TMP_FILES'] = not args.ignore
-   settings['pass_through_options'] = " " + " ".join(args.portage_options)
+   settings['pass_through_options'].extend(args.portage_options)
 
return settings
 



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/

2019-08-18 Thread Zac Medico
commit: accf36f00070427170a4b46b2e3522de7b33d5b0
Author: cvkbtzx  users  noreply  github  com>
AuthorDate: Wed Sep 26 23:05:33 2018 +
Commit: Zac Medico  gentoo  org>
CommitDate: Mon Aug 19 03:40:28 2019 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=accf36f0

revdep-rebuild: Fix DEFAULTS beeing modified when changing settings

Closes: https://github.com/gentoo/gentoolkit/pull/4
Signed-off-by: Zac Medico  gentoo.org>

 pym/gentoolkit/revdep_rebuild/settings.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pym/gentoolkit/revdep_rebuild/settings.py 
b/pym/gentoolkit/revdep_rebuild/settings.py
index b0a9f61..7438594 100644
--- a/pym/gentoolkit/revdep_rebuild/settings.py
+++ b/pym/gentoolkit/revdep_rebuild/settings.py
@@ -119,9 +119,9 @@ def parse_options():
settings['PRETEND'] = args.pretend
settings['nocolor'] = args.nocolor
if args.library:
-   settings['library'].update(set(args.library))
+   settings['library'] = set(settings['library']) | 
set(args.library)
settings['USE_TMP_FILES'] = not args.ignore
-   settings['pass_through_options'].extend(args.portage_options)
+   settings['pass_through_options'] = 
list(settings['pass_through_options']) + args.portage_options
 
return settings
 



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/

2017-05-05 Thread Paul Varner
commit: d3ef9ef1bebc7604db0e8c5c49e167e18300c9e9
Author: Paul Varner  gentoo  org>
AuthorDate: Fri May  5 19:31:25 2017 +
Commit: Paul Varner  gentoo  org>
CommitDate: Fri May  5 19:31:25 2017 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=d3ef9ef1

revdep_rebuild/settings.py: Fix traceback error with Python3.6 (bug 617498)

The portage.root variable is using late binding. This breaks in Python3.6
where the type is being checked before use in os.path.join(). This fix
creates a new variable of the correct type from the value of portage.root
instead of using portage.root directly.

X-Gentoo-bug: 617498
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=617498
Acked-by: Brian Dolbec  gentoo.org>

 pym/gentoolkit/revdep_rebuild/settings.py | 17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/pym/gentoolkit/revdep_rebuild/settings.py 
b/pym/gentoolkit/revdep_rebuild/settings.py
index 589ea29..9a00f45 100644
--- a/pym/gentoolkit/revdep_rebuild/settings.py
+++ b/pym/gentoolkit/revdep_rebuild/settings.py
@@ -15,12 +15,19 @@ import glob
 import portage
 from portage import _encodings, _unicode_decode, _unicode_encode
 
+if sys.version_info[0] >= 3:
+   _unicode = str
+else:
+   _unicode = unicode
+
+portage_root = _unicode(portage.root)
+
 DEFAULTS = {
-   'DEFAULT_LD_FILE': os.path.join(portage.root, 'etc/ld.so.conf'),
-   'DEFAULT_ENV_FILE': os.path.join(portage.root, 
'etc/profile.env'),
-   'REVDEP_CONFDIR': os.path.join(portage.root, 
'etc/revdep-rebuild/'),
-   'PKG_DIR': os.path.join(portage.root, 'var/db/pkg/'),
-   'DEFAULT_TMP_DIR': os.path.join(portage.root, 
'/tmp/revdep-rebuild' if os.getgid() else '/var/cache/revdep-rebuild'), #cache 
default location
+   'DEFAULT_LD_FILE': os.path.join(portage_root, 'etc/ld.so.conf'),
+   'DEFAULT_ENV_FILE': os.path.join(portage_root, 
'etc/profile.env'),
+   'REVDEP_CONFDIR': os.path.join(portage_root, 
'etc/revdep-rebuild/'),
+   'PKG_DIR': os.path.join(portage_root, 'var/db/pkg/'),
+   'DEFAULT_TMP_DIR': os.path.join(portage_root, 
'/tmp/revdep-rebuild' if os.getgid() else '/var/cache/revdep-rebuild'), #cache 
default location
 
# number of maximum allowed files to be parsed at once
'CMD_MAX_ARGS': 1000,



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/

2017-03-10 Thread Zac Medico
commit: 9ffefd66e618155ffb479cd1dbce9c3afe9a9ea4
Author: Zac Medico  gentoo  org>
AuthorDate: Fri Mar 10 09:38:04 2017 +
Commit: Zac Medico  gentoo  org>
CommitDate: Fri Mar 10 17:30:53 2017 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=9ffefd66

revdep_rebuild/assign.py: handle directory symlinks (bug 611808)

Use a _file_matcher class to make file comparisons work regardless
of directory symlinks.

X-Gentoo-bug: 611808
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=611808
Acked-by: Brian Dolbec  gentoo.org>

 pym/gentoolkit/revdep_rebuild/assign.py | 67 +
 1 file changed, 60 insertions(+), 7 deletions(-)

diff --git a/pym/gentoolkit/revdep_rebuild/assign.py 
b/pym/gentoolkit/revdep_rebuild/assign.py
index 00dda6e..84bd59f 100644
--- a/pym/gentoolkit/revdep_rebuild/assign.py
+++ b/pym/gentoolkit/revdep_rebuild/assign.py
@@ -6,6 +6,7 @@ Functions used for determining the package the broken lib 
belongs to.
 
 from __future__ import print_function
 
+import errno
 import os
 import io
 import re
@@ -22,11 +23,61 @@ try:
 except NameError:
pass
 
+
+class _file_matcher(object):
+   """
+   Compares files by basename and parent directory (device, inode),
+   so comparisons work regardless of directory symlinks. If a
+   parent directory does not exist, the realpath of the parent
+   directory is used instead of the (device, inode). When multiple
+   files share the same parent directory, stat is only called
+   once per directory, and the result is cached internally.
+   """
+   def __init__(self):
+   self._file_ids = {}
+   self._added = {}
+
+   def _file_id(self, filename):
+   try:
+   return self._file_ids[filename]
+   except KeyError:
+   try:
+   st = os.stat(filename)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   raise
+   file_id = (os.path.realpath(filename),)
+   else:
+   file_id = (st.st_dev, st.st_ino)
+
+   self._file_ids[filename] = file_id
+   return file_id
+
+   def _file_key(self, filename):
+   head, tail = os.path.split(filename)
+   key = self._file_id(head) + (tail,)
+   return key
+
+   def add(self, filename):
+   self._added[self._file_key(filename)] = filename
+
+   def intersection(self, other):
+   for file_key in self._added:
+   match = other._added.get(file_key)
+   if match is not None:
+   yield match
+
+
 def assign_packages(broken, logger, settings):
''' Finds and returns packages that owns files placed in broken.
Broken is list of files
'''
stime = current_milli_time()
+
+   broken_matcher = _file_matcher()
+   for filename in broken:
+   broken_matcher.add(filename)
+
assigned_pkgs = set()
assigned_filenames = set()
for group in os.listdir(settings['PKG_DIR']):
@@ -39,21 +90,23 @@ def assign_packages(broken, logger, settings):
continue
f = pkgpath + '/CONTENTS'
if os.path.exists(f):
+   contents_matcher = _file_matcher()
try:
with io.open(f, 'r', encoding='utf_8') 
as cnt:
for line in cnt.readlines():
m = re.match('^obj (/[^ 
]+)', line)
if m is not None:
-   m = m.group(1)
-   if m in broken:
-   found = 
group+'/'+pkg
-   
assigned_pkgs.add(found)
-   
assigned_filenames.add(m)
-   
logger.info('\t' + green('* ') + m +
-   
' -> ' + bold(found))
+   
contents_matcher.add(m.group(1))
except Exception as e:
logger.warning(red(' !! Failed to read 
' + f))
logger.warning(red(' !! Error was:' + 
str(e)))
+

[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/

2016-12-29 Thread Jason Donenfeld
commit: d84910d914c5efb5aeb6e0f25286e3e3c34172f6
Author: Jason A. Donenfeld  gentoo  org>
AuthorDate: Thu Dec 29 21:36:18 2016 +
Commit: Jason Donenfeld  gentoo  org>
CommitDate: Thu Dec 29 21:36:18 2016 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=d84910d9

revdep-rebuild: fix grammar

 pym/gentoolkit/revdep_rebuild/analyse.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/gentoolkit/revdep_rebuild/analyse.py 
b/pym/gentoolkit/revdep_rebuild/analyse.py
index 698a43f..44243f6 100644
--- a/pym/gentoolkit/revdep_rebuild/analyse.py
+++ b/pym/gentoolkit/revdep_rebuild/analyse.py
@@ -145,7 +145,7 @@ class LibCheck(object):
self.check = self._checkforlib
else:
self.smsg = '\tLibCheck.search(), Checking for broken 
%s bit libs'
-   self.pmsg = green(' * ') + bold('Broken files that 
requires:') + ' %s (%s bits)'
+   self.pmsg = green(' * ') + bold('Broken files that 
require:') + ' %s (%s bits)'
self.setlibs = self._setlibs
self.check = self._checkbroken
self.sfmsg = "\tLibCheck.search(); Total found: %(count)d libs, 
%(deps)d files in %(time)d milliseconds"



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/

2016-09-15 Thread Brian Dolbec
commit: d1becbe15b5b13322b3b88a359e851d0d318aaa2
Author: Brian Dolbec  gentoo  org>
AuthorDate: Wed Sep 14 17:41:49 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Sep 14 19:48:45 2016 +
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())
 

[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/

2016-09-15 Thread Brian Dolbec
commit: 06af2be2d987c0a2f34c872ed3d86ab74fe9800d
Author: Brian Dolbec  gentoo  org>
AuthorDate: Wed Sep 14 19:48:03 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Sep 14 19:49:32 2016 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=06af2be2

revdep-rebuild:  Use realpath on the mask directories too (Bug 593672)

 pym/gentoolkit/revdep_rebuild/analyse.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/gentoolkit/revdep_rebuild/analyse.py 
b/pym/gentoolkit/revdep_rebuild/analyse.py
index b8fca4b..698a43f 100644
--- a/pym/gentoolkit/revdep_rebuild/analyse.py
+++ b/pym/gentoolkit/revdep_rebuild/analyse.py
@@ -247,7 +247,7 @@ class LibCheck(object):
 
def is_masked(self, filename):
for m in self.masked_dirs:
-   t = m.split(os.sep)
+   t = os.path.realpath(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))]:



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/

2016-08-15 Thread Paul Varner
commit: c8783ccb225cddb43052463c092e8edc091c371a
Author: Paul Varner  gentoo  org>
AuthorDate: Mon Aug 15 21:02:03 2016 +
Commit: Paul Varner  gentoo  org>
CommitDate: Mon Aug 15 21:02:03 2016 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=c8783ccb

revdep-ebuild: Fix unicode argument expected error

Use the os module from portage to fix inconsistent returning of unicode
and str objects from listdir and explictly write the timestamp as
unicode.

X-Gentoo-bug: 589130
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=589130

 pym/gentoolkit/revdep_rebuild/cache.py   | 8 +---
 pym/gentoolkit/revdep_rebuild/collect.py | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/pym/gentoolkit/revdep_rebuild/cache.py 
b/pym/gentoolkit/revdep_rebuild/cache.py
index 7359d05..e92e7cd 100644
--- a/pym/gentoolkit/revdep_rebuild/cache.py
+++ b/pym/gentoolkit/revdep_rebuild/cache.py
@@ -5,17 +5,19 @@ Functions for reading, saving and verifying the data caches
 
 from __future__ import print_function
 
-import os
+from portage import os
 import time
 import sys
 if sys.hexversion < 0x300:
from io import open
+   _unicode = unicode
+else:
+   _unicode = str
 
 from portage import _encodings, _unicode_decode, _unicode_encode
 from portage.output import red
 from .settings import DEFAULTS
 
-
 def read_cache(temp_path=DEFAULTS['DEFAULT_TMP_DIR']):
''' Reads cache information needed by analyse function.
This function does not checks if files exists nor timestamps,
@@ -59,7 +61,7 @@ def save_cache(logger, to_save={}, 
temp_path=DEFAULTS['DEFAULT_TMP_DIR']):
try:
_file = open(_unicode_encode(os.path.join(temp_path, 
'timestamp'),
encoding=_encodings['fs']), mode='w', 
encoding=_encodings['content'])
-   _file.write(str(int(time.time(
+   _file.write(_unicode(int(time.time(
_file.close()
 
for key,val in to_save.items():

diff --git a/pym/gentoolkit/revdep_rebuild/collect.py 
b/pym/gentoolkit/revdep_rebuild/collect.py
index ab3ef97..82cec7b 100644
--- a/pym/gentoolkit/revdep_rebuild/collect.py
+++ b/pym/gentoolkit/revdep_rebuild/collect.py
@@ -5,7 +5,7 @@
 from __future__ import print_function
 
 import re
-import os
+from portage import os
 import glob
 import stat
 import sys



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/

2016-06-09 Thread Slawek Lis
commit: e1744420c7377dd28f9fbc1c6736e47c6c21bb85
Author: Slawek Lis  gentoo  org>
AuthorDate: Thu Jun  9 19:38:02 2016 +
Commit: Slawek Lis  gentoo  org>
CommitDate: Thu Jun  9 19:38:02 2016 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=e1744420

Excluding masked files from rebuilding. This should fix a bug #568902

 pym/gentoolkit/revdep_rebuild/analyse.py | 55 +++-
 1 file changed, 33 insertions(+), 22 deletions(-)

diff --git a/pym/gentoolkit/revdep_rebuild/analyse.py 
b/pym/gentoolkit/revdep_rebuild/analyse.py
index c9c5f71..59240b4 100644
--- a/pym/gentoolkit/revdep_rebuild/analyse.py
+++ b/pym/gentoolkit/revdep_rebuild/analyse.py
@@ -116,7 +116,7 @@ def extract_dependencies_from_la(la, libraries, to_check, 
logger):
 
 
 class LibCheck(object):
-   def __init__(self, scanned_files, logger, searchlibs=None, 
searchbits=None):
+   def __init__(self, scanned_files, logger, searchlibs=None, 
searchbits=None, all_masks=None):
'''LibCheck init function.
 
@param scanned_files: optional dictionary if the type created by
@@ -130,6 +130,7 @@ class LibCheck(object):
self.logger = logger
self.searchlibs = searchlibs
self.searchbits = sorted(searchbits) or ['32', '64']
+   self.all_masks = all_masks
self.logger.debug("\tLibCheck.__init__(), new searchlibs: %s" 
%(self.searchbits))
if searchlibs:
self.smsg = '\tLibCheck.search(), Checking for %s bit 
dependants'
@@ -213,6 +214,12 @@ class LibCheck(object):
for filename, needed in filepaths.items():
for l in needed:
if self.check(l):
+   if l in self.all_masks:
+   
self.logger.debug('\tLibrary %s ignored as it is masked' % l)
+   continue
+   if filename in 
self.all_masks:
+   
self.logger.debug('\tFile %s ignored as it is masked' % filename)
+   continue
if not bits in 
found_libs:

found_libs[bits] = {}
try:
@@ -275,6 +282,26 @@ def analyse(settings, logger, libraries=None, 
la_libraries=None,
_libs_to_check = set()'''
searchbits.update(['64', '32'])
 
+   masked_dirs, masked_files, ld = 
parse_revdep_config(settings['REVDEP_CONFDIR'])
+   masked_dirs.update([
+   '/lib/modules',
+   '/lib32/modules',
+   '/lib64/modules',
+   ]
+   )
+
+   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'))
@@ -287,20 +314,8 @@ def analyse(settings, logger, libraries=None, 
la_libraries=None,
bold('Collecting system binaries and libraries'))
bin_dirs, lib_dirs = prepare_search_dirs(logger, settings)
 
-   masked_dirs, masked_files, ld = \
-   parse_revdep_config(settings['REVDEP_CONFDIR'])
lib_dirs.update(ld)
bin_dirs.update(ld)
-   masked_dirs.update([
-   '/lib/modules',
-   '/lib32/modules',
-   '/lib64/modules',
-   ]
-   )
-   if '64' not in searchbits:
-   masked_dirs.update(['/lib64', '/usr/lib64'])
-   elif '32' not in searchbits:
-   masked_dirs.update(['/lib32', '/usr/lib32'])
 
logger.debug('\tanalyse(), bin directories:')
for x in sorted(bin_dirs):
@@ -320,11 +335,6 @@ def analyse(settings, logger, libraries=None, 
la_libraries=None,
stime = current_milli_time()
logger.info(green(' * ') +
bold('Collecting dynamic linking informations'))
-   all_masks = masked_dirs.copy()
-   all_masks.update(masked_files)
-   

[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/

2016-05-18 Thread Brian Dolbec
commit: 44d972ef07970c5cb812aa0b061fb2235fc6b0d6
Author: Brian Dolbec  gentoo  org>
AuthorDate: Wed May 18 15:40:42 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed May 18 15:40:42 2016 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=44d972ef

revdep-rebuild: Replace the deprecated logger.war calls with logger.warning

 pym/gentoolkit/revdep_rebuild/analyse.py |  6 +++---
 pym/gentoolkit/revdep_rebuild/assign.py  | 14 +++---
 pym/gentoolkit/revdep_rebuild/cache.py   |  2 +-
 pym/gentoolkit/revdep_rebuild/rebuild.py | 24 
 pym/gentoolkit/revdep_rebuild/stuff.py   |  2 +-
 5 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/pym/gentoolkit/revdep_rebuild/analyse.py 
b/pym/gentoolkit/revdep_rebuild/analyse.py
index b9c18c0..c9c5f71 100644
--- a/pym/gentoolkit/revdep_rebuild/analyse.py
+++ b/pym/gentoolkit/revdep_rebuild/analyse.py
@@ -283,7 +283,7 @@ def analyse(settings, logger, libraries=None, 
la_libraries=None,
# when found for some reason
 
stime = current_milli_time()
-   logger.warn(green(' * ') +
+   logger.warning(green(' * ') +
bold('Collecting system binaries and libraries'))
bin_dirs, lib_dirs = prepare_search_dirs(logger, settings)
 
@@ -351,7 +351,7 @@ def analyse(settings, logger, libraries=None, 
la_libraries=None,
scanned_files = scan_files(libs_and_bins, settings['CMD_MAX_ARGS'],
logger, searchbits)
 
-   logger.warn(green(' * ') + bold('Checking dynamic linking consistency'))
+   logger.warning(green(' * ') + bold('Checking dynamic linking 
consistency'))
logger.debug(
'\tanalyse(), Searching for %i libs, bins within %i libraries 
and links'
% (len(libs_and_bins), len(libraries)+len(libraries_links))
@@ -365,7 +365,7 @@ def analyse(settings, logger, libraries=None, 
la_libraries=None,
libraries.union(libraries_links), _libs_to_check, logger)
broken_pathes += broken_la
 
-   logger.warn(green(' * ') + bold('Assign files to packages'))
+   logger.warning(green(' * ') + bold('Assign files to packages'))
 
return assign_packages(broken_pathes, logger, settings)
 

diff --git a/pym/gentoolkit/revdep_rebuild/assign.py 
b/pym/gentoolkit/revdep_rebuild/assign.py
index 8d819d6..00dda6e 100644
--- a/pym/gentoolkit/revdep_rebuild/assign.py
+++ b/pym/gentoolkit/revdep_rebuild/assign.py
@@ -52,8 +52,8 @@ def assign_packages(broken, logger, settings):

logger.info('\t' + green('* ') + m +

' -> ' + bold(found))
except Exception as e:
-   logger.warn(red(' !! Failed to read ' + 
f))
-   logger.warn(red(' !! Error was:' + 
str(e)))
+   logger.warning(red(' !! Failed to read 
' + f))
+   logger.warning(red(' !! Error was:' + 
str(e)))
 
broken_filenames = set(broken)
orphaned = broken_filenames.difference(assigned_filenames)
@@ -76,7 +76,7 @@ def get_best_match(cpv, cp, logger):
"""
 
slot = portage.db[portage.root]["vartree"].dbapi.aux_get(cpv, 
["SLOT"])[0]
-   logger.warn('\t%s "%s" %s.' % (yellow('* Warning:'), cpv,bold('ebuild 
not found.')))
+   logger.warning('\t%s "%s" %s.' % (yellow('* Warning:'), 
cpv,bold('ebuild not found.')))
logger.debug('\tget_best_match(); Looking for %s:%s' %(cp, slot))
try:
match = portdb.match('%s:%s' %(cp, slot))
@@ -84,12 +84,12 @@ def get_best_match(cpv, cp, logger):
match = None
 
if not match:
-   logger.warn('\t' + red('!!') + ' ' + yellow(
+   logger.warning('\t' + red('!!') + ' ' + yellow(
'Could not find ebuild for %s:%s' %(cp, slot)))
slot = ['']
match = portdb.match(cp)
if not match:
-   logger.warn('\t' + red('!!') + ' ' +
+   logger.warning('\t' + red('!!') + ' ' +
yellow('Could not find ebuild for ' + cp))
return match, slot
 
@@ -104,7 +104,7 @@ def get_slotted_cps(cpvs, logger):
for cpv in cpvs:
parts = catpkgsplit(cpv)
if not parts:
-   logger.warn(('\t' + red("Failed to split the following 
pkg: "
+   logger.warning(('\t' + red("Failed to split the 
following pkg: "
"%s, not a valid cat/pkg-ver" %cpv)))
continue
 
@@ -114,7 +114,7 @@ def get_slotted_cps(cpvs, logger):
except KeyError:
  

[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/

2016-05-18 Thread Brian Dolbec
commit: ecd20fa451e72e03aacd41c297b47de896043a5f
Author: Brian Dolbec  gentoo  org>
AuthorDate: Wed May 18 15:35:55 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed May 18 15:35:55 2016 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=ecd20fa4

revdep-rebuild, assign.py: Trap an invalid cpv split bug 571782

Added a check for parts not being valid None or empty list from the 
catpkgsplit(cpv) call.
It will now log the warning with the invalid cpv.

 pym/gentoolkit/revdep_rebuild/assign.py | 5 +
 1 file changed, 5 insertions(+)

diff --git a/pym/gentoolkit/revdep_rebuild/assign.py 
b/pym/gentoolkit/revdep_rebuild/assign.py
index 412ed49..8d819d6 100644
--- a/pym/gentoolkit/revdep_rebuild/assign.py
+++ b/pym/gentoolkit/revdep_rebuild/assign.py
@@ -103,6 +103,11 @@ def get_slotted_cps(cpvs, logger):
cps = []
for cpv in cpvs:
parts = catpkgsplit(cpv)
+   if not parts:
+   logger.warn(('\t' + red("Failed to split the following 
pkg: "
+   "%s, not a valid cat/pkg-ver" %cpv)))
+   continue
+
cp = parts[0] + '/' + parts[1]
try:
slot = portdb.aux_get(cpv, ["SLOT"])



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/

2016-05-18 Thread Brian Dolbec
commit: 10c245fe9b72e5102d6ff553d2f87312c6be91ca
Author: Brian Dolbec  gentoo  org>
AuthorDate: Wed May 18 15:03:20 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed May 18 15:03:20 2016 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=10c245fe

revdep-rebuild, settings.py: whitespace cleanup

 pym/gentoolkit/revdep_rebuild/settings.py | 56 +++
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/pym/gentoolkit/revdep_rebuild/settings.py 
b/pym/gentoolkit/revdep_rebuild/settings.py
index e9a021a..14f5bc8 100644
--- a/pym/gentoolkit/revdep_rebuild/settings.py
+++ b/pym/gentoolkit/revdep_rebuild/settings.py
@@ -51,59 +51,59 @@ def parse_options():
#are not appliable
from .rebuild import VERSION, APP_NAME
settings = DEFAULTS.copy()
-   
+
parser = argparse.ArgumentParser(
description='Broken reverse dependency rebuilder, python 
implementation.',
epilog='Calls emerge, options after -- are ignored by %s '
'and passed directly to emerge.' % APP_NAME,
add_help=False
)
-   
-   parser.add_argument('-h', '--help', 
-action='help', 
+
+   parser.add_argument('-h', '--help',
+action='help',
 help='Print this usage and exit')
-   parser.add_argument('-V', '--version', 
-action='version', 
+   parser.add_argument('-V', '--version',
+action='version',
 help='Show version informations',
 version='%(prog)s ' + VERSION)
-   
-   parser.add_argument('-i', '--ignore', 
-action='store_true', 
-help='Ignore temporary files from 
previous runs ' 
+
+   parser.add_argument('-i', '--ignore',
+action='store_true',
+help='Ignore temporary files from 
previous runs '
'(also won\'t create any)')
 
-   parser.add_argument('-L', '--library', 
-action='append', 
+   parser.add_argument('-L', '--library',
+action='append',
 help='Unconditionally emerge existing 
packages that use '
'the library with NAME. NAME 
can be a full path, full '
'or partial name')
-   parser.add_argument('-l', '--no-ld-path', 
-action='store_true', 
+   parser.add_argument('-l', '--no-ld-path',
+action='store_true',
 help='Do not set LD_LIBRARY_PATH')
-   parser.add_argument('-o', '--no-order', 
-action='store_true', 
+   parser.add_argument('-o', '--no-order',
+action='store_true',
 help='Do not check the build order '
'(Saves time, but may cause 
breakage.)')
-   parser.add_argument('-p', '--pretend', 
+   parser.add_argument('-p', '--pretend',
 action='store_true',
 help='Do a trial run without actually 
emerging anything '
-'(also passed to emerge command)')
+   '(also passed to emerge 
command)')
 
-   parser.add_argument('-C', '--nocolor', 
-action='store_true', 
+   parser.add_argument('-C', '--nocolor',
+action='store_true',
 help='Turn off colored output')
-   parser.add_argument('-q', '--quiet', 
-action='store_true', 
+   parser.add_argument('-q', '--quiet',
+action='store_true',
 help='Be less verbose (also passed to 
emerge command)')
-   parser.add_argument('-v', '--verbose', 
-action='store_true', 
+   parser.add_argument('-v', '--verbose',
+action='store_true',
 help='Be more verbose (also passed to 
emerge command)')
-   parser.add_argument('-d', '--debug', 
-action='store_true', 
+   parser.add_argument('-d', '--debug',

[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/

2016-05-18 Thread Brian Dolbec
commit: 6f47784b6a706a51bddfdb0056b3d078a16ab80d
Author: Brian Dolbec  gentoo  org>
AuthorDate: Wed May 18 06:06:46 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed May 18 06:08:41 2016 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=6f47784b

revdep-rebuild/collect.py: Fix the masking issue where some masks were not 
honored

The masks at this point are combined into one list, both directories and files.
The code was only checking the full path, not the files for being in the masks.

 pym/gentoolkit/revdep_rebuild/collect.py | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/pym/gentoolkit/revdep_rebuild/collect.py 
b/pym/gentoolkit/revdep_rebuild/collect.py
index 1b406e8..1f34f1c 100644
--- a/pym/gentoolkit/revdep_rebuild/collect.py
+++ b/pym/gentoolkit/revdep_rebuild/collect.py
@@ -110,9 +110,9 @@ def collect_libraries_from_dir(dirs, mask, logger):
continue
 
try:
-   for listing in os.listdir(_dir):
-   listing = os.path.join(_dir, listing)
-   if listing in mask:
+   for _listing in os.listdir(_dir):
+   listing = os.path.join(_dir, _listing)
+   if listing in mask or _listing in mask:
continue
 
if os.path.isdir(listing):
@@ -179,9 +179,9 @@ def collect_binaries_from_dir(dirs, mask, logger):
continue
 
try:
-   for listing in os.listdir(_dir):
-   listing = os.path.join(_dir, listing)
-   if listing in mask:
+   for _listing in os.listdir(_dir):
+   listing = os.path.join(_dir, _listing)
+   if listing in mask or _listing in mask:
continue
 
if os.path.isdir(listing):



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/

2016-02-25 Thread Brian Dolbec
commit: 1727a4ad664daa5b98d7e2e15af8cfc59d13f4dc
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jan 18 19:47:26 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Thu Feb 25 21:24:55 2016 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=1727a4ad

revdep-rebuild/analyse.py: Add file masks to the collecting masks

file_masks appear to have been missed being added to the masks passed to the
collections functions.  Hopefully this will resolve most of the errors people 
are getting.
My testing, only bacula has any errors, but it does not work to add the 
offending symlink 
target lib to LD_LIBRARY_MASK. 

 pym/gentoolkit/revdep_rebuild/analyse.py | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/pym/gentoolkit/revdep_rebuild/analyse.py 
b/pym/gentoolkit/revdep_rebuild/analyse.py
index 92233ab..b9c18c0 100644
--- a/pym/gentoolkit/revdep_rebuild/analyse.py
+++ b/pym/gentoolkit/revdep_rebuild/analyse.py
@@ -320,9 +320,15 @@ def analyse(settings, logger, libraries=None, 
la_libraries=None,
stime = current_milli_time()
logger.info(green(' * ') +
bold('Collecting dynamic linking informations'))
+   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))
+
libraries, la_libraries, libraries_links = \
-   collect_libraries_from_dir(lib_dirs, masked_dirs, 
logger)
-   binaries = collect_binaries_from_dir(bin_dirs, masked_dirs, 
logger)
+   collect_libraries_from_dir(lib_dirs, all_masks, logger)
+   binaries = collect_binaries_from_dir(bin_dirs, all_masks, 
logger)
ftime = current_milli_time()
logger.debug('\ttime to complete task: %d milliseconds' % 
(ftime-stime))
 



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/

2016-01-17 Thread Jason Donenfeld
commit: e9445aa398126c24c729cfb1e0d488d9b0db45ab
Author: Jason A. Donenfeld  zx2c4  com>
AuthorDate: Mon Jan 18 00:01:01 2016 +
Commit: Jason Donenfeld  gentoo  org>
CommitDate: Mon Jan 18 00:01:01 2016 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=e9445aa3

revdep-rebuild: fix typo in bugs message

 pym/gentoolkit/revdep_rebuild/rebuild.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/gentoolkit/revdep_rebuild/rebuild.py 
b/pym/gentoolkit/revdep_rebuild/rebuild.py
index 417622e..fc57888 100644
--- a/pym/gentoolkit/revdep_rebuild/rebuild.py
+++ b/pym/gentoolkit/revdep_rebuild/rebuild.py
@@ -127,7 +127,7 @@ def main(settings=None, logger=None):
yellow('The original revdep-rebuild script is '
'installed as revdep-rebuild.sh'))
logger.warn(blue(' * ') +
-   yellow('Please files bugs at: '
+   yellow('Please file bugs at: '
'https://bugs.gentoo.org/'))
 
if os.getuid() != 0 and not settings['PRETEND']:



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/

2015-12-19 Thread Brian Dolbec
commit: 1fbd7ec8a46c359c5ef98168156a91ba05cf6a6f
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Dec 20 02:03:43 2015 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Dec 20 02:03:43 2015 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=1fbd7ec8

revdep-rebuild/analyse.py: Account for more than 5 parts to report the error 
bug 586752

As suggested by Zac Medico, the %F output does have the possibility of 
containing spaces, breaking a space separated output.
Change the format string to delimit on a semicolon to split it on. 

Traceback:
File "/usr/lib64/python3.4/site-packages/gentoolkit/revdep_rebuild/analyse.py", 
line 47, in scan_files
filename, sfilename, soname, needed, bits = parts
ValueError: too many values to unpack (expected 5)

 pym/gentoolkit/revdep_rebuild/analyse.py | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pym/gentoolkit/revdep_rebuild/analyse.py 
b/pym/gentoolkit/revdep_rebuild/analyse.py
index 056e421..92233ab 100644
--- a/pym/gentoolkit/revdep_rebuild/analyse.py
+++ b/pym/gentoolkit/revdep_rebuild/analyse.py
@@ -31,7 +31,7 @@ def scan_files(libs_and_bins, cmd_max_args, logger, 
searchbits):
'''
stime = current_milli_time()
scanned_files = {} # {bits: {soname: (filename, needed), ...}, ...}
-   lines = scan(['-BF', '%F %f %S %n %M'],
+   lines = scan(['-BF', '%F;%f;%S;%n;%M'],
 libs_and_bins, cmd_max_args, logger)
ftime = current_milli_time()
logger.debug("\tscan_files(); total time to get scanelf data is "
@@ -39,8 +39,8 @@ def scan_files(libs_and_bins, cmd_max_args, logger, 
searchbits):
stime = current_milli_time()
count = 0
for line in lines:
-   parts = line.split(' ')
-   if len(parts) < 5:
+   parts = line.split(';')
+   if len(parts) != 5:
logger.error("\tscan_files(); error processing lib: %s" 
% line)
logger.error("\tscan_files(); parts = %s" % str(parts))
continue
@@ -205,7 +205,7 @@ class LibCheck(object):
try:
scanned = scanned_files[bits]
except KeyError:
-   self.logger.debug('There are no %s-bit 
libraries'%bits) 
+   self.logger.debug('There are no %s-bit 
libraries'%bits)
continue
self.logger.debug(self.smsg % bits)
self.setlibs(sorted(scanned), bits)



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/

2015-12-16 Thread Brian Dolbec
commit: 2c238669fa5c7c59f503f869a7508584a2e00231
Author: Brian Dolbec  gentoo  org>
AuthorDate: Wed Dec 16 17:46:23 2015 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Dec 16 17:46:23 2015 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=2c238669

revdep-rebuild: Adjust the intro message for a normal release

 pym/gentoolkit/revdep_rebuild/rebuild.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pym/gentoolkit/revdep_rebuild/rebuild.py 
b/pym/gentoolkit/revdep_rebuild/rebuild.py
index 23fa694..417622e 100644
--- a/pym/gentoolkit/revdep_rebuild/rebuild.py
+++ b/pym/gentoolkit/revdep_rebuild/rebuild.py
@@ -119,10 +119,10 @@ def main(settings=None, logger=None):
if not settings['stdout'].isatty() or settings['nocolor']:
nocolor()
 
-   #TODO: Development warning
logger.warn(blue(' * ') +
-   yellow('This is a prerelease version, '
-   'so it may not work correctly'))
+   yellow('This is the new python coded version'))
+   logger.warn(blue(' * ') +
+   yellow('Please report any bugs found using it.'))
logger.warn(blue(' * ') +
yellow('The original revdep-rebuild script is '
'installed as revdep-rebuild.sh'))