aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcli.py27
-rw-r--r--scmprojects.py21
2 files changed, 46 insertions, 2 deletions
diff --git a/cli.py b/cli.py
index 732680d..6188020 100755
--- a/cli.py
+++ b/cli.py
@@ -4,6 +4,7 @@ import argparse
import scanfiles
import linkdeps
import ebuildgen
+from scmprojects import getsourcecode
parser = argparse.ArgumentParser(
description="Scan a dir for files and output includes",
@@ -22,20 +23,42 @@ parser.add_argument("-d", "--ifdef", action="store_true",
parser.add_argument("-q", "--quiet", action="store_true",
help="don't print anything") #this needs work...
+parser.add_argument("--svn", action="store_true",
+ help="this is a SVN project")
+parser.add_argument("--git", action="store_true",
+ help="this is a GIT project")
+parser.add_argument("--hg", action="store_true",
+ help="this is a HG project")
+
args = parser.parse_args()
#print(args.dir)
#print(args.types)
#inclst is a list of includes. First in it is global then local.
+if args.svn:
+ getsourcecode(args.dir,"svn")
+ srcdir = "/tmp/ebuildgen/curproj"
+ dltype = "svn"
+elif args.git:
+ getsourcecode(args.dir,"git")
+ srcdir = "/tmp/ebuildgen/curproj"
+ dltype = "git"
+elif args.hg:
+ getsourcecode(args.dir,"hg")
+ srcdir = "/tmp/ebuildgen/curproj"
+ dltype = "hg"
+else:
+ srcdir = args.dir
+ dltype = "www"
-(inclst,binaries,targets) = scanfiles.scanproject(args.dir,"makefile")
+(inclst,binaries,targets) = scanfiles.scanproject(srcdir,"makefile")
packages = set()
print(binaries)
for dep in inclst[0]:
packages.add(linkdeps.deptopackage(dep)[0])
-ebuildgen.genebuild([],packages,"svn","http://doneyet.googlecode.com/svn/trunk",targets,binaries)
+ebuildgen.genebuild([],packages,dltype,args.dir,targets,binaries)
if args.ginc == args.linc == args.ifdef == args.quiet == False:
print(inclst)
diff --git a/scmprojects.py b/scmprojects.py
new file mode 100644
index 0000000..4ecedd0
--- /dev/null
+++ b/scmprojects.py
@@ -0,0 +1,21 @@
+from subprocess import call
+import sys
+
+cmdlineget = {
+ "svn" : "svn checkout ",
+ "git" : "git clone ",
+ "hg" : "hg clone ",
+ "www" : "wget ",
+ }
+
+def getsourcecode(adress,repotype):
+ callstr = cmdlineget[repotype]
+
+ try:
+ retcode = call(callstr + adress + " /tmp/ebuildgen/curproj",shell=True)
+ if retcode < 0:
+ print("Child was terminated by signal", -retcode, file=sys.stderr)
+ else:
+ print("Child returned", retcode, file=sys.stderr)
+ except OSError as e:
+ print("Execution failed:", e, file=sys.stderr)