From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Qsj0H-0000MD-Qx for garchives@archives.gentoo.org; Sun, 14 Aug 2011 22:17:58 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EA2AC21C0D9; Sun, 14 Aug 2011 22:17:49 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id AB4F821C0D9 for ; Sun, 14 Aug 2011 22:17:49 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 05AA61B405E for ; Sun, 14 Aug 2011 22:17:49 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 5C55580044 for ; Sun, 14 Aug 2011 22:17:48 +0000 (UTC) From: "Sebastian Parborg" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sebastian Parborg" Message-ID: <6daa3830d27cc4346ff30b25fffc665a559819e1.darkdefender@gentoo> Subject: [gentoo-commits] proj/ebuildgen:master commit in: filetypes/, / X-VCS-Repository: proj/ebuildgen X-VCS-Files: cli.py filetypes/autoconf.py filetypes/ctypefiles.py linkdeps.py scanfiles.py X-VCS-Directories: filetypes/ / X-VCS-Committer: darkdefender X-VCS-Committer-Name: Sebastian Parborg X-VCS-Revision: 6daa3830d27cc4346ff30b25fffc665a559819e1 Date: Sun, 14 Aug 2011 22:17:48 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: b208de51277dbf50ed9f08b421cdc51d commit: 6daa3830d27cc4346ff30b25fffc665a559819e1 Author: Sebastian Parborg gmail com> AuthorDate: Wed Aug 10 22:58:47 2011 +0000 Commit: Sebastian Parborg gmail com> CommitDate: Wed Aug 10 22:58:47 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/ebuildgen.git= ;a=3Dcommit;h=3D6daa3830 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 =3D [["install"]] binaries =3D [] gpackages =3D 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 =3D linkdeps.deptopackage(dep,[]) + if newpack: + gpackages.add(newpack) =20 usedeps =3D {} for use in useargs: packages =3D set() for dep in useargs[use][0]: - newpack =3D linkdeps.deptopackage(dep,[])[0] - if not newpack in gpackages: + newpack =3D 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 =3D linkdeps.deptopackage(dep,[])[0] - if not newpack in gpackages: + newpack =3D linkdeps.deptopackage(dep,[]) + if newpack and not newpack in gpackages: packages.add(newpack) usedeps[use] =3D packages =20 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): =20 for item in inputlst: ac_check =3D 0 #is this an ac_check? - if item[0] =3D=3D "AC_CHECK_HEADERS": + if item[0] =3D=3D "AC_CHECK_HEADERS" or item[0] =3D=3D "AC_CHECK= _HEADER": ac_check =3D 1 elif item[0] =3D=3D "AC_CHECK_LIB": ac_check =3D 2 @@ -433,11 +433,16 @@ def ifs(inputlst,variables): if ac_check =3D=3D 2: variables["ac_cv_lib_" + header] =3D "yes" =20 - 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 =3D=3D 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)) =20 elif isinstance(item[0],list): #if statement variables.update(ifs(item[1],variables)) @@ -476,4 +481,4 @@ def scanac(acfile,topdir): =20 def openfile(ofile): with open(ofile, encoding=3D"utf-8", errors=3D"replace") as inputfil= e: - return inputfile.read() =20 + 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 =20 def t_GINCLUDE(t): - r"\#[Ii][Nn][Cc][Ll][Uu][Dd][Ee][ \t]+<.*\.h>" - t.value =3D t.value[8:].strip().strip("<>") + r"\#[ \t]*[Ii][Nn][Cc][Ll][Uu][Dd][Ee][ \t]+<.*\.h>" + t.value =3D t.value[t.value.find("<"):].strip().strip("<>") return t =20 def t_LINCLUDE(t): - r"\#[Ii][Nn][Cc][Ll][Uu][Dd][Ee][ \t]+\".*\.h\"" - t.value =3D t.value[8:].strip().strip('""') + r"\#[ \t]*[Ii][Nn][Cc][Ll][Uu][Dd][Ee][ \t]+\".*\.h\"" + t.value =3D t.value[t.value.find('"'):].strip().strip('""') return t =20 def t_BUNDLEINC(t): - r"\#[Ii][Nn][Cc][Ll][Uu][Dd][Ee][ \t]+<.*>" + r"\#[ \t]*[Ii][Nn][Cc][Ll][Uu][Dd][Ee][ \t]+<.*>" pass =20 def t_ANY_error(t): @@ -223,4 +223,7 @@ def addnewifdefs(dict1,dict2): dict1[name][0] =3D dict1[name][0] | dict2[name][0] dict1[name][1] =3D dict1[name][1] | dict2[name][1] dict1[name][2] =3D addnewifdefs(dict1[name][2],dict2[name][2]) + dict2.pop(name) + for name in dict2: + dict1[name] =3D 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 =3D pfltopackage(dep,incpaths) =20 print(package) - return package + if package: + return package[0] + else: + return package =20 def pfltopackage(dep,addpaths): """This uses the online ply database to guess packages @@ -57,6 +60,7 @@ def pfltopackage(dep,addpaths): url_lines =3D [] depname =3D os.path.split(dep)[1] matching_packages =3D set() + all_packages =3D set() =20 url =3D urlopen("http://www.portagefilelist.de/index.php/Special:PFL= Query2?file=3D" + depname + "&searchfile=3Dlookup&lookup=3Dfile&txt") @@ -69,6 +73,7 @@ def pfltopackage(dep,addpaths): #structure of lines: [portage_category, package, path, file, misc, v= ersion] =20 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] =3D=3D path + "/" + dep: @@ -79,9 +84,16 @@ def pfltopackage(dep,addpaths): =20 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 =3D ["dummy_for_" + dep] + if len(all_packages) =3D=3D 1: + print("but only one package matches the headerfile, picking = that one") + matching_packages =3D 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 =3D ["dummy_for_" + dep] + else: + print("No package supplies the headerfile, ignoring...") + return [] =20 return [matching_packages.pop()] =20 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): =20 #print(iflst) #print(srcfiles) + #print(src_useflag) #standard includes includes =3D scanfilelist(srcfiles,src_incflag) =20 @@ -111,6 +112,14 @@ def scanautotoolsdeps(acfile,amfile): for usearg in useargs: useargs[usearg] =3D scanfilelist(useargs[usearg],src_incflag) =20 + for ifdef in includes[2]: + for switch in iflst: + if ifdef in switch[1]: + usearg =3D inter_useflag(switch[0]) + if usearg in useargs: + useargs[usearg][0].update(includes[2][ifdef][0]) + else: + useargs[usearg] =3D includes[2][ifdef] #print(useargs) #print(includes) return useflags,includes,useargs