Gentoo Archives: gentoo-commits

From: Slawek Lis <slis@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/gentoolkit:gentoolkit commit in: pym/gentoolkit/revdep_rebuild/
Date: Mon, 24 Mar 2014 07:17:45
Message-Id: 1395645297.4f2ad629e4802598878f5bc674462de23fcea51b.slis@gentoo
1 commit: 4f2ad629e4802598878f5bc674462de23fcea51b
2 Author: Slawek Lis <slis <AT> gentoo <DOT> org>
3 AuthorDate: Mon Mar 24 07:14:57 2014 +0000
4 Commit: Slawek Lis <slis <AT> gentoo <DOT> org>
5 CommitDate: Mon Mar 24 07:14:57 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=4f2ad629
7
8 parsing revdep config refactor, added environment config read (as sugggested here: https://bugs.gentoo.org/show_bug.cgi?id=504654#c28)
9
10 ---
11 pym/gentoolkit/revdep_rebuild/settings.py | 33 ++++++++++++++++++++-----------
12 1 file changed, 21 insertions(+), 12 deletions(-)
13
14 diff --git a/pym/gentoolkit/revdep_rebuild/settings.py b/pym/gentoolkit/revdep_rebuild/settings.py
15 index 057147c..7909aa6 100644
16 --- a/pym/gentoolkit/revdep_rebuild/settings.py
17 +++ b/pym/gentoolkit/revdep_rebuild/settings.py
18 @@ -130,13 +130,24 @@ def parse_options():
19 return settings
20
21
22 +def _parse_dirs_to_set(dir_str):
23 + '''Changes space-delimited directory list into set with them
24 + '''
25 + _ret = set()
26 + for search in dir_str.split():
27 + if search == '-*':
28 + break
29 + _ret.update(glob.glob(search))
30 + return _ret
31 +
32 +
33 def parse_revdep_config(revdep_confdir):
34 ''' Parses all files under and returns
35 tuple of: (masked_dirs, masked_files, search_dirs)'''
36
37 - search_dirs = set()
38 - masked_dirs = set()
39 - masked_files = set()
40 + search_dirs = os.environ.get('SEARCH_DIRS', '')
41 + masked_dirs = os.environ.get('SEARCH_DIRS_MASK', '')
42 + masked_files = os.environ.get('LD_LIBRARY_MASK', '')
43
44 for _file in os.listdir(revdep_confdir):
45 for line in open(os.path.join(revdep_confdir, _file)):
46 @@ -145,22 +156,20 @@ def parse_revdep_config(revdep_confdir):
47 if not line.startswith('#'):
48 match = re.match('LD_LIBRARY_MASK=\\"([^"]+)\\"', line)
49 if match is not None:
50 - masks = match.group(1).split(' ')
51 - masked_files.update(masks)
52 + masked_files += ' ' + match.group(1)
53 continue
54 match = re.match('SEARCH_DIRS_MASK=\\"([^"]+)\\"', line)
55 if match is not None:
56 - searches = match.group(1).split(' ')
57 - for search in searches:
58 - masked_dirs.update(glob.glob(search))
59 + masked_dirs += ' ' + match.group(1)
60 continue
61 match = re.match('SEARCH_DIRS=\\"([^"]+)\\"', line)
62 if match is not None:
63 - searches = match.group(1).split()
64 - for search in searches:
65 - search_dirs.update(glob.glob(search))
66 + search_dirs += ' ' + match.group(1)
67 continue
68
69 - print (masked_dirs, masked_files, search_dirs)
70 + masked_files = set(masked_files.split(' '))
71 + masked_dirs = _parse_dirs_to_set(masked_dirs)
72 + search_dirs = _parse_dirs_to_set(search_dirs)
73 +
74 return (masked_dirs, masked_files, search_dirs)