Gaudi Framework, version v21r8

Home   Generated: 17 Mar 2010

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.

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

def tag_release::checkout_structure (   url,
  proj 
)

Definition at line 53 of file tag_release.py.

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

def tag_release::dirname (   url  ) 

Definition at line 45 of file tag_release.py.

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

def tag_release::extract_version (   f  ) 

Find the version number in a requirements file.

Definition at line 14 of file tag_release.py.

00014                       :
00015     """
00016     Find the version number in a requirements file.
00017     """ 
00018     global _req_version_pattern
00019     for l in open(f):
00020         m = _req_version_pattern.match(l)
00021         if m:
00022             return m.group(1)
00023     return None
00024 
_use_pattern = re.compile(r"^\s*use\s*(\w+)\s*(v[0-9]+r[0-9]+(?:p[0-9]+)?)\s*(\w+)?\s*$")

def tag_release::gather_new_versions (   f  ) 

Definition at line 26 of file tag_release.py.

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

def tag_release::main (  ) 

Definition at line 70 of file tag_release.py.

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

def tag_release::svn (   args,
  kwargs 
)

Definition at line 35 of file tag_release.py.

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

def tag_release::svn_exists (   url  ) 

Definition at line 48 of file tag_release.py.

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

def tag_release::svn_ls (   url  ) 

Definition at line 39 of file tag_release.py.

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


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.


Generated at Wed Mar 17 18:22:41 2010 for Gaudi Framework, version v21r8 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004