db7fac3f24
git-svn-id: https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Core/OpenFOAM-1.5-dev@1731 e4e07f05-0c2f-0410-a05a-b8ba57e0c909
46 lines
942 B
Python
Executable file
46 lines
942 B
Python
Executable file
#! /usr/bin/python
|
|
|
|
import sys,re
|
|
from os import path
|
|
from subprocess import Popen,PIPE,call
|
|
import tarfile
|
|
|
|
if len(sys.argv)!=2:
|
|
print "Error: SVN-Url is needed"
|
|
sys.exit(-1)
|
|
|
|
url=sys.argv[1]
|
|
|
|
name=path.basename(url[:-1])
|
|
|
|
p=Popen(["svn","info",url],stdin=PIPE, stdout=PIPE, close_fds=True)
|
|
|
|
(child_stdout, child_stdin) = (p.stdout, p.stdin)
|
|
|
|
revision=-1
|
|
|
|
for l in child_stdout.readlines():
|
|
m=re.compile("Last Changed Rev: (.+)").match(l)
|
|
if m!=None:
|
|
revision=int(m.group(1))
|
|
|
|
if revision<0:
|
|
print "Invalid URL or stuff"
|
|
sys.exit(-1)
|
|
|
|
fullname="%s.r%d" % (name,revision)
|
|
l
|
|
print "Generating",fullname
|
|
|
|
retcode=call(["svn","export",url,fullname])
|
|
if retcode!=0:
|
|
print "Problem. Returncode",retcode
|
|
sys.exit(-1)
|
|
|
|
print "Tarring ...."
|
|
tar=tarfile.open(fullname+".tgz","w:gz")
|
|
tar.add(fullname,arcname=name)
|
|
tar.close()
|
|
print "Removing directory"
|
|
retcode=call(["rm","-rf",fullname])
|
|
print "Finished"
|