From: "Sebastian Parborg" <darkdefende@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/ebuildgen:master commit in: filetypes/, /
Date: Sun, 14 Aug 2011 22:17:48 +0000 (UTC) [thread overview]
Message-ID: <6daa3830d27cc4346ff30b25fffc665a559819e1.darkdefender@gentoo> (raw)
commit: 6daa3830d27cc4346ff30b25fffc665a559819e1
Author: Sebastian Parborg <darkdefende <AT> gmail <DOT> com>
AuthorDate: Wed Aug 10 22:58:47 2011 +0000
Commit: Sebastian Parborg <darkdefende <AT> gmail <DOT> com>
CommitDate: Wed Aug 10 22:58:47 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/ebuildgen.git;a=commit;h=6daa3830
todays work
---
cli.py | 14 ++++++++------
filetypes/autoconf.py | 11 ++++++++---
filetypes/ctypefiles.py | 13 ++++++++-----
linkdeps.py | 20 ++++++++++++++++----
scanfiles.py | 9 +++++++++
5 files changed, 49 insertions(+), 18 deletions(-)
diff --git a/cli.py b/cli.py
index 500c8ae..e88df84 100755
--- a/cli.py
+++ b/cli.py
@@ -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
reply other threads:[~2011-08-14 22:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6daa3830d27cc4346ff30b25fffc665a559819e1.darkdefender@gentoo \
--to=darkdefende@gmail.com \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox