summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Wilcox <AWilcox@Wilcox-Tech.com>2016-04-24 18:18:56 -0500
committerAndrew Wilcox <AWilcox@Wilcox-Tech.com>2016-04-24 18:18:56 -0500
commit7ee11c38a924599a0c8281bb78abfc8638e3b25a (patch)
tree21831b8fc12f8057a357473efb7232cd56c54566
parent2a693a78501c889cf825571989458ae9bf56e4af (diff)
downloadapkkit-7ee11c38a924599a0c8281bb78abfc8638e3b25a.tar.gz
apkkit-7ee11c38a924599a0c8281bb78abfc8638e3b25a.tar.bz2
apkkit-7ee11c38a924599a0c8281bb78abfc8638e3b25a.tar.xz
apkkit-7ee11c38a924599a0c8281bb78abfc8638e3b25a.zip
Portage integration: Handle PROVIDES and give it to apk
-rw-r--r--apkkit/portage.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/apkkit/portage.py b/apkkit/portage.py
index a6dab76..721e7d4 100644
--- a/apkkit/portage.py
+++ b/apkkit/portage.py
@@ -183,6 +183,26 @@ def _translate_dep(dep):
return '{name}{op}{ver}'.format(name=package, op=dep_op, ver=ver)
+def _maybe_package_provides(settings):
+ """Determine if this package provides SONAMEs."""
+
+ build_info = os.path.join(settings['PORTAGE_BUILDDIR'], 'build-info')
+ provides = os.path.join(build_info, 'PROVIDES')
+ if os.path.exists(provides):
+ with open(provides, 'r') as provide_file:
+ provide_lines = provide_file.readlines()
+ else:
+ provide_lines = []
+
+ for line in provide_lines:
+ if line.startswith(settings['ARCH'] + ': '):
+ # We have some SONAMEs! Chop the arch name off.
+ sonames = line.split()[1:]
+ return ['so:' + soname for soname in sonames]
+
+ return []
+
+
def native(settings, mydbapi=None):
"""Take a Portage settings object and turn it into an APK.
@@ -221,6 +241,8 @@ def native(settings, mydbapi=None):
params['depends'] = map(_translate_dep, run_deps)
+ params['provides'] = _maybe_package_provides(settings)
+
package = Package(**params)
apk = APKFile.create(package, settings['D'])
filename = "{name}-{ver}.apk".format(name=package.name, ver=package.version)