diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2014-12-19 11:41:44 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-12-21 12:37:56 +0000 |
commit | de8730ce2dd4d8186f0388ad8205f2cd04726fdd (patch) | |
tree | 827458262279663a03fc6914ef1b1e735f5d65a5 /meta | |
parent | 3e6e4e0198eec87f5d7960b815cab6a268bb9015 (diff) | |
download | poky-de8730ce2dd4d8186f0388ad8205f2cd04726fdd.tar.gz |
classes/package: move read_shlib_providers() to a common unit
This allows us to use this function elsewhere in the code.
(From OE-Core rev: 657cff8a0f0e5db171b2ed9388a790ee0b135842)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/package.bbclass | 24 | ||||
-rw-r--r-- | meta/lib/oe/package.py | 26 |
2 files changed, 27 insertions, 23 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index dc4025d327..fc501fcdea 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass | |||
@@ -1391,32 +1391,11 @@ python package_do_shlibs() { | |||
1391 | 1391 | ||
1392 | pkgdest = d.getVar('PKGDEST', True) | 1392 | pkgdest = d.getVar('PKGDEST', True) |
1393 | 1393 | ||
1394 | shlibs_dirs = d.getVar('SHLIBSDIRS', True).split() | ||
1395 | shlibswork_dir = d.getVar('SHLIBSWORKDIR', True) | 1394 | shlibswork_dir = d.getVar('SHLIBSWORKDIR', True) |
1396 | 1395 | ||
1397 | # Take shared lock since we're only reading, not writing | 1396 | # Take shared lock since we're only reading, not writing |
1398 | lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}")) | 1397 | lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}")) |
1399 | 1398 | ||
1400 | def read_shlib_providers(): | ||
1401 | list_re = re.compile('^(.*)\.list$') | ||
1402 | # Go from least to most specific since the last one found wins | ||
1403 | for dir in reversed(shlibs_dirs): | ||
1404 | bb.debug(2, "Reading shlib providers in %s" % (dir)) | ||
1405 | if not os.path.exists(dir): | ||
1406 | continue | ||
1407 | for file in os.listdir(dir): | ||
1408 | m = list_re.match(file) | ||
1409 | if m: | ||
1410 | dep_pkg = m.group(1) | ||
1411 | fd = open(os.path.join(dir, file)) | ||
1412 | lines = fd.readlines() | ||
1413 | fd.close() | ||
1414 | for l in lines: | ||
1415 | s = l.strip().split(":") | ||
1416 | if s[0] not in shlib_provider: | ||
1417 | shlib_provider[s[0]] = {} | ||
1418 | shlib_provider[s[0]][s[1]] = (dep_pkg, s[2]) | ||
1419 | |||
1420 | def linux_so(file, needed, sonames, renames, pkgver): | 1399 | def linux_so(file, needed, sonames, renames, pkgver): |
1421 | needs_ldconfig = False | 1400 | needs_ldconfig = False |
1422 | ldir = os.path.dirname(file).replace(pkgdest + "/" + pkg, '') | 1401 | ldir = os.path.dirname(file).replace(pkgdest + "/" + pkg, '') |
@@ -1513,8 +1492,7 @@ python package_do_shlibs() { | |||
1513 | use_ldconfig = False | 1492 | use_ldconfig = False |
1514 | 1493 | ||
1515 | needed = {} | 1494 | needed = {} |
1516 | shlib_provider = {} | 1495 | shlib_provider = oe.package.read_shlib_providers(d) |
1517 | read_shlib_providers() | ||
1518 | 1496 | ||
1519 | for pkg in packages.split(): | 1497 | for pkg in packages.split(): |
1520 | private_libs = d.getVar('PRIVATE_LIBS_' + pkg, True) or d.getVar('PRIVATE_LIBS', True) or "" | 1498 | private_libs = d.getVar('PRIVATE_LIBS_' + pkg, True) or d.getVar('PRIVATE_LIBS', True) or "" |
diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py index f8b532220a..ea6feaaea4 100644 --- a/meta/lib/oe/package.py +++ b/meta/lib/oe/package.py | |||
@@ -97,3 +97,29 @@ def filedeprunner(arg): | |||
97 | raise e | 97 | raise e |
98 | 98 | ||
99 | return (pkg, provides, requires) | 99 | return (pkg, provides, requires) |
100 | |||
101 | |||
102 | def read_shlib_providers(d): | ||
103 | import re | ||
104 | |||
105 | shlib_provider = {} | ||
106 | shlibs_dirs = d.getVar('SHLIBSDIRS', True).split() | ||
107 | list_re = re.compile('^(.*)\.list$') | ||
108 | # Go from least to most specific since the last one found wins | ||
109 | for dir in reversed(shlibs_dirs): | ||
110 | bb.debug(2, "Reading shlib providers in %s" % (dir)) | ||
111 | if not os.path.exists(dir): | ||
112 | continue | ||
113 | for file in os.listdir(dir): | ||
114 | m = list_re.match(file) | ||
115 | if m: | ||
116 | dep_pkg = m.group(1) | ||
117 | fd = open(os.path.join(dir, file)) | ||
118 | lines = fd.readlines() | ||
119 | fd.close() | ||
120 | for l in lines: | ||
121 | s = l.strip().split(":") | ||
122 | if s[0] not in shlib_provider: | ||
123 | shlib_provider[s[0]] = {} | ||
124 | shlib_provider[s[0]][s[1]] = (dep_pkg, s[2]) | ||
125 | return shlib_provider | ||