diff options
author | 2011-08-11 00:58:47 +0200 | |
---|---|---|
committer | 2011-08-11 00:58:47 +0200 | |
commit | 6daa3830d27cc4346ff30b25fffc665a559819e1 (patch) | |
tree | aad0b151daf1e1d88009cda6a925a398333dc02c | |
parent | fixed bogus deps in the moc project (diff) | |
download | ebuildgen-6daa3830d27cc4346ff30b25fffc665a559819e1.tar.gz ebuildgen-6daa3830d27cc4346ff30b25fffc665a559819e1.tar.bz2 ebuildgen-6daa3830d27cc4346ff30b25fffc665a559819e1.zip |
todays work
-rwxr-xr-x | cli.py | 14 | ||||
-rw-r--r-- | filetypes/autoconf.py | 11 | ||||
-rw-r--r-- | filetypes/ctypefiles.py | 13 | ||||
-rw-r--r-- | linkdeps.py | 20 | ||||
-rw-r--r-- | scanfiles.py | 9 |
5 files changed, 49 insertions, 18 deletions
@@ -57,23 +57,25 @@ targets = [["install"]] binaries = [] gpackages = set() for dep in inclst[0]: - gpackages.add(linkdeps.deptopackage(dep,[])[0]) + gpackages.add(linkdeps.deptopackage(dep,[])) #print(gpackages) if "__cplusplus" in inclst[2]: for dep in inclst[2]["__cplusplus"][0]: - gpackages.add(linkdeps.deptopackage(dep,[])[0]) + newpack = linkdeps.deptopackage(dep,[]) + if newpack: + gpackages.add(newpack) usedeps = {} for use in useargs: packages = set() for dep in useargs[use][0]: - newpack = linkdeps.deptopackage(dep,[])[0] - if not newpack in gpackages: + newpack = linkdeps.deptopackage(dep,[]) + if newpack and not newpack in gpackages: packages.add(newpack) if "__cplusplus" in useargs[use][2]: for dep in useargs[use][2]["__cplusplus"][0]: - newpack = linkdeps.deptopackage(dep,[])[0] - if not newpack in gpackages: + newpack = linkdeps.deptopackage(dep,[]) + if newpack and not newpack in gpackages: packages.add(newpack) usedeps[use] = packages diff --git a/filetypes/autoconf.py b/filetypes/autoconf.py index 71ec0b2..6e4b0dc 100644 --- a/filetypes/autoconf.py +++ b/filetypes/autoconf.py @@ -412,7 +412,7 @@ def ifs(inputlst,variables): for item in inputlst: ac_check = 0 #is this an ac_check? - if item[0] == "AC_CHECK_HEADERS": + if item[0] == "AC_CHECK_HEADERS" or item[0] == "AC_CHECK_HEADER": ac_check = 1 elif item[0] == "AC_CHECK_LIB": ac_check = 2 @@ -433,11 +433,16 @@ def ifs(inputlst,variables): if ac_check == 2: variables["ac_cv_lib_" + header] = "yes" - if len(item[1]) > 2: + if len(item[1]) > 2 and ac_check > 1: if isinstance(item[1][2],list): variables.update(ifs(item[1][2], variables)) else: variables.update(ifs(scanacfile(item[1][2].strip("[]")), variables)) + elif ac_check == 1 and len(item[1]) > 1: + if isinstance(item[1][1],list): + variables.update(ifs(item[1][1], variables)) + else: + variables.update(ifs(scanacfile(item[1][1].strip("[]")), variables)) elif isinstance(item[0],list): #if statement variables.update(ifs(item[1],variables)) @@ -476,4 +481,4 @@ def scanac(acfile,topdir): def openfile(ofile): with open(ofile, encoding="utf-8", errors="replace") as inputfile: - return inputfile.read() + return inputfile.read() diff --git a/filetypes/ctypefiles.py b/filetypes/ctypefiles.py index dac3e0d..50b20ed 100644 --- a/filetypes/ctypefiles.py +++ b/filetypes/ctypefiles.py @@ -66,17 +66,17 @@ def scanincludes(string,inclst,curdir,incpaths): return t def t_GINCLUDE(t): - r"\#[Ii][Nn][Cc][Ll][Uu][Dd][Ee][ \t]+<.*\.h>" - t.value = t.value[8:].strip().strip("<>") + r"\#[ \t]*[Ii][Nn][Cc][Ll][Uu][Dd][Ee][ \t]+<.*\.h>" + t.value = t.value[t.value.find("<"):].strip().strip("<>") return t def t_LINCLUDE(t): - r"\#[Ii][Nn][Cc][Ll][Uu][Dd][Ee][ \t]+\".*\.h\"" - t.value = t.value[8:].strip().strip('""') + r"\#[ \t]*[Ii][Nn][Cc][Ll][Uu][Dd][Ee][ \t]+\".*\.h\"" + t.value = t.value[t.value.find('"'):].strip().strip('""') return t def t_BUNDLEINC(t): - r"\#[Ii][Nn][Cc][Ll][Uu][Dd][Ee][ \t]+<.*>" + r"\#[ \t]*[Ii][Nn][Cc][Ll][Uu][Dd][Ee][ \t]+<.*>" pass def t_ANY_error(t): @@ -223,4 +223,7 @@ def addnewifdefs(dict1,dict2): dict1[name][0] = dict1[name][0] | dict2[name][0] dict1[name][1] = dict1[name][1] | dict2[name][1] dict1[name][2] = addnewifdefs(dict1[name][2],dict2[name][2]) + dict2.pop(name) + for name in dict2: + dict1[name] = dict2[name] return(dict1) diff --git a/linkdeps.py b/linkdeps.py index bf44391..01b1fb9 100644 --- a/linkdeps.py +++ b/linkdeps.py @@ -44,7 +44,10 @@ def qfiletopackage(dep,addpaths): package = pfltopackage(dep,incpaths) print(package) - return package + if package: + return package[0] + else: + return package def pfltopackage(dep,addpaths): """This uses the online ply database to guess packages @@ -57,6 +60,7 @@ def pfltopackage(dep,addpaths): url_lines = [] depname = os.path.split(dep)[1] matching_packages = set() + all_packages = set() url = urlopen("http://www.portagefilelist.de/index.php/Special:PFLQuery2?file=" + depname + "&searchfile=lookup&lookup=file&txt") @@ -69,6 +73,7 @@ def pfltopackage(dep,addpaths): #structure of lines: [portage_category, package, path, file, misc, version] for line in url_lines: + all_packages.add(line[0] + "/" + line[1]) #check if path is correct for path in incpaths: if line[2] + "/" + line[3] == path + "/" + dep: @@ -79,9 +84,16 @@ def pfltopackage(dep,addpaths): if not matching_packages: print("no 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!") - matching_packages = ["dummy_for_" + dep] + if len(all_packages) == 1: + print("but only one package matches the headerfile, picking that one") + matching_packages = all_packages + elif all_packages: + print("file not found was: " + dep) + print("a dummy dep will be placed in the ebuild, fix it!") + matching_packages = ["dummy_for_" + dep] + else: + print("No package supplies the headerfile, ignoring...") + return [] return [matching_packages.pop()] diff --git a/scanfiles.py b/scanfiles.py index 6ebe92b..fc701f6 100644 --- a/scanfiles.py +++ b/scanfiles.py @@ -86,6 +86,7 @@ def scanautotoolsdeps(acfile,amfile): #print(iflst) #print(srcfiles) + #print(src_useflag) #standard includes includes = scanfilelist(srcfiles,src_incflag) @@ -111,6 +112,14 @@ def scanautotoolsdeps(acfile,amfile): for usearg in useargs: useargs[usearg] = scanfilelist(useargs[usearg],src_incflag) + for ifdef in includes[2]: + for switch in iflst: + if ifdef in switch[1]: + usearg = inter_useflag(switch[0]) + if usearg in useargs: + useargs[usearg][0].update(includes[2][ifdef][0]) + else: + useargs[usearg] = includes[2][ifdef] #print(useargs) #print(includes) return useflags,includes,useargs |