Gaudi Framework, version v22r2

Home   Generated: Tue May 10 2011
Functions | Variables

tag_release Namespace Reference

Functions

def extract_version
def gather_new_versions
def svn
def svn_ls
def basename
def dirname
def svn_exists
def checkout_structure
def main

Variables

string __author__ = "Marco Clemencic <Marco.Clemencic@cern.ch>"
tuple _req_version_pattern = re.compile(r"^\s*version\s*(v[0-9]+r[0-9]+(?:p[0-9]+)?)\s*$")
tuple _use_pattern = re.compile(r"^\s*use\s*(\w+)\s*(v[0-9]+r[0-9]+(?:p[0-9]+)?)\s*(\w+)?\s*$")

Function Documentation

def tag_release::basename (   url )

Definition at line 42 of file tag_release.py.

00043                  :
00044     return url.rsplit("/", 1)[-1]

def tag_release::checkout_structure (   url,
  proj 
)

Definition at line 53 of file tag_release.py.

00054                                  :
00055     def checkout_level(base):
00056         dirs = ["%s/%s" % (base, d) for d in svn_ls(base) if d.endswith("/")]
00057         apply(svn, ["up", "-N"] + dirs).wait()
00058         return dirs
00059 
00060     root = basename(url)
00061     svn("co","-N", url, root).wait()
00062     old_dir = os.getcwd()
00063     os.chdir(root)
00064     svn("up", "-N", proj).wait()
00065     for base in [proj, proj + "/trunk"]:
00066         checkout_level(base)
00067     checkout_level(proj + "/tags")
00068     os.chdir(old_dir)
00069     return root

def tag_release::dirname (   url )

Definition at line 45 of file tag_release.py.

00046                 :
00047     return url.rsplit("/", 1)[1]

def tag_release::extract_version (   f )
Find the version number in a requirements file.

Definition at line 14 of file tag_release.py.

00015                       :
00016     """
00017     Find the version number in a requirements file.
00018     """
00019     global _req_version_pattern
00020     for l in open(f):
00021         m = _req_version_pattern.match(l)
00022         if m:
00023             return m.group(1)
00024     return None

def tag_release::gather_new_versions (   f )

Definition at line 26 of file tag_release.py.

00027                           :
00028     global _use_pattern
00029     versions = {}
00030     for l in open(f):
00031         m = _use_pattern.match(l)
00032         if m:
00033             versions[m.group(1)] = m.group(2)
00034     return versions

def tag_release::main (  )

Definition at line 70 of file tag_release.py.

00071           :
00072     use_pre = len(sys.argv) > 1 and 'pre' in  sys.argv
00073     url = "svn+ssh://svn.cern.ch/reps/gaudi"
00074     proj = "Gaudi"
00075     container = "GaudiRelease"
00076     packages = gather_new_versions("requirements")
00077     packages[container] = extract_version("requirements")
00078     tempdir = tempfile.mkdtemp()
00079     try:
00080         os.chdir(tempdir)
00081         # prepare repository structure (and move to its top level)
00082         os.chdir(checkout_structure(url, proj))
00083 
00084         # note that the project does not have "-pre"
00085         pvers = "%s_%s" % (proj.upper(), packages[container])
00086 
00087         # prepare project tag
00088         ptagdir = "%s/tags/%s/%s" % (proj, proj.upper(), pvers)
00089         if not svn_exists(ptagdir):
00090             svn("mkdir", ptagdir).wait()
00091             svn("cp", "%s/trunk/cmt" % proj, ptagdir + "/cmt").wait()
00092             svn("cp", "%s/trunk/Makefile.cmt" % proj, ptagdir + "/Makefile.cmt").wait()
00093 
00094         # prepare package tags
00095         tag_re = re.compile(r"^v(\d+)r(\d+)(?:p(\d+))?$")
00096         for p in packages:
00097             tag = packages[p]
00098             pktagdir = "%s/tags/%s/%s" % (proj, p, tag)
00099             # I have to make the tag if it doesn't exist and (if we use -pre tags)
00100             # neither the -pre tag exists.
00101             no_tag = not svn_exists(pktagdir)
00102             make_tag = no_tag or (use_pre and no_tag and not svn_exists(pktagdir + "-pre"))
00103             if make_tag:
00104                 if use_pre:
00105                     pktagdir += "-pre"
00106                 svn("cp", "%s/trunk/%s" % (proj, p), pktagdir).wait()
00107                 # Atlas type of tag
00108                 tagElements = tag_re.match(tag)
00109                 if tagElements:
00110                     tagElements = "-".join([ "%02d" % int(el or "0") for el in tagElements.groups() ])
00111                     pktagdir = "%s/tags/%s/%s-%s" % (proj, p, p, tagElements)
00112                     svn("cp", "%s/trunk/%s" % (proj, p), pktagdir).wait()
00113             else:
00114                 if not no_tag:
00115                     svn("up", "-N", pktagdir).wait() # needed for the copy in the global tag
00116 
00117         if not use_pre:
00118             # prepare the full global tag too
00119             for p in packages:
00120                 tag = packages[p]
00121                 pktagdir = "%s/tags/%s/%s" % (proj, p, tag)
00122                 svn("cp", pktagdir, "%s/%s" % (ptagdir, p)).wait()
00123 
00124         svn("ci").wait()
00125 
00126     finally:
00127         shutil.rmtree(tempdir, ignore_errors = True)
00128 
00129     return 0

def tag_release::svn (   args,
  kwargs 
)

Definition at line 35 of file tag_release.py.

00036                         :
00037     print "> svn", " ".join(args)
00038     return apply(Popen, (["svn"] + list(args),), kwargs)

def tag_release::svn_exists (   url )

Definition at line 48 of file tag_release.py.

00049                    :
00050     d,b = url.rsplit("/", 1)
00051     l = [x.rstrip("/") for x in svn_ls(d)]
00052     return b in l

def tag_release::svn_ls (   url )

Definition at line 39 of file tag_release.py.

00040                :
00041     return svn("ls", url, stdout = PIPE).communicate()[0].splitlines()


Variable Documentation

string tag_release::__author__ = "Marco Clemencic <Marco.Clemencic@cern.ch>"

Definition at line 8 of file tag_release.py.

tuple tag_release::_req_version_pattern = re.compile(r"^\s*version\s*(v[0-9]+r[0-9]+(?:p[0-9]+)?)\s*$")

Definition at line 13 of file tag_release.py.

tuple tag_release::_use_pattern = re.compile(r"^\s*use\s*(\w+)\s*(v[0-9]+r[0-9]+(?:p[0-9]+)?)\s*(\w+)?\s*$")

Definition at line 25 of file tag_release.py.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Tue May 10 2011 18:55:46 for Gaudi Framework, version v22r2 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004