aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Parborg <darkdefende@gmail.com>2011-07-21 21:53:40 +0200
committerSebastian Parborg <darkdefende@gmail.com>2011-07-21 21:53:40 +0200
commit662df0bb4a4629c1b0d99b8dd114520b1e231d7a (patch)
tree114f763ea701e922d33b4242c64f7f702b14b293 /linkdeps.py
parentMore work on autotools (diff)
downloadebuildgen-662df0bb4a4629c1b0d99b8dd114520b1e231d7a.tar.gz
ebuildgen-662df0bb4a4629c1b0d99b8dd114520b1e231d7a.tar.bz2
ebuildgen-662df0bb4a4629c1b0d99b8dd114520b1e231d7a.zip
Added pfl support! And basic automake support.
Diffstat (limited to 'linkdeps.py')
-rw-r--r--linkdeps.py43
1 files changed, 42 insertions, 1 deletions
diff --git a/linkdeps.py b/linkdeps.py
index ec8766a..c89869e 100644
--- a/linkdeps.py
+++ b/linkdeps.py
@@ -1,5 +1,6 @@
import os
from subprocess import getstatusoutput
+from urllib.request import urlopen
def deptopackage(dep,addpaths):
"""Converts supplied deps with additional include paths to portage packages
@@ -31,7 +32,47 @@ def deptopackage(dep,addpaths):
print(package)
if not package:
- print("not matching package found withing the include paths!")
+ print("not matching package found within the include paths!")
package = ["dummy"]
return package
+def pfltopackage(dep,addpaths):
+ """This uses the online ply database to guess packages
+
+ """
+
+ incpaths = ["/usr/include", "/usr/local/include"]
+ incpaths += addpaths
+
+ url_lines = []
+ depname = os.path.split(dep)[1]
+ matching_packages = set()
+
+ url = urlopen("http://www.portagefilelist.de/index.php/Special:PFLQuery2?file="
+ + depname + "&searchfile=lookup&lookup=file&txt")
+
+ for line in url:
+ url_lines += [line.decode("utf-8").split()]
+
+ #First line does not contain any useful information, skip it
+ url_lines = url_lines[1:]
+ #structure of lines: [portage_category, package, path, file, misc, version]
+
+ for line in url_lines:
+ #check if path is correct
+ for path in incpaths:
+ if line[2] + line[3] == path + dep:
+ matching_packages.add(line[0] + "/" + line[1])
+
+ if len(matching_packages) > 1:
+ print("More than one matching package for dep found!\nPicking the last one...")
+
+ if not matching_packages:
+ print("not matching package found within the include paths!")
+ print("file not found was:" + dep)
+ print("a dummy dep will be placed in the ebuild, fix it!")
+ package = ["dummy"]
+
+ print([matching_packages.pop()])
+
+#pfltopackage("ncurses.h",[])