| # Gaudi Framework, version v20r4
Generated: 8 Jan 2009

# tag_release Namespace Reference

## Functions
def | extract_version
def | gather_new_versions
def | svn
def | svn_ls
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::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 42 of file tag_release.py.

    00042           :
    00043     url = "svn+ssh://svn.cern.ch/reps/gaudi"
    00044     puburl = "https://svnweb.cern.ch/guest/gaudi"
    00045     packages = gather_new_versions("requirements")
    00046     packages["GaudiRelease"] = extract_version("requirements")
    00047     tempdir = tempfile.mkdtemp()
    00048     try:
    00049         os.chdir(tempdir)
    00050         # prepare root dir
    00051         svn("co","-N", url, "gaudi").wait()
    00052         os.chdir("gaudi")
    00053
    00054         pvers = packages["GaudiRelease"]
    00055
    00056         to_commit = []
    00057
    00058         # prepare project tag
    00059         if (pvers + "/") not in svn_ls("%s/projects/GAUDI/tags" % url):
    00060             svn("co", "-N", "%s/projects/GAUDI/tags" % url, "ProjTags").wait()
    00061             svn("cp", "%s/projects/GAUDI/trunk" % url, os.path.join("ProjTags",pvers)).wait()
    00062             to_commit.append("ProjTags")
    00063
    00064         # prepare package tags
    00065         for p in packages:
    00066             tagsdir = "%s/packages/%s/tags" % (url, p)
    00067             tags = svn_ls(tagsdir)
    00068             if (packages[p]+"/") not in tags:
    00069                 svn("co", "-N", tagsdir, "%s_Tags" % p).wait()
    00070                 svn("cp", "%s/packages/%s/trunk" % (url, p), "%s_Tags/%s" % (p, packages[p])).wait()
    00071                 to_commit.append("%s_Tags" % p)
    00072
    00073         # prepare "distribution" dir
    00074         distvers = pvers
    00075         if len(sys.argv) > 1 and 'pre' in  sys.argv:
    00076             distvers += '-pre'
    00077         if ("GAUDI_%s/" % distvers) not in svn_ls("%s/distribution/tags/GAUDI" % url):
    00078             svn("co","-N", "%s/distribution/tags/GAUDI" % url, "DistTags").wait()
    00079             svn("mkdir", os.path.join("DistTags", "GAUDI_%s" % distvers)).wait()
    00080             externals = open(os.path.join(tempdir, "svn_externals"), "w")
    00081             pks = packages.keys()
    00082             pks.sort()
    00083             for p in pks:
    00084                 externals.write("%(pack)-20s %(url)s/packages/%(pack)s/tags/%(vers)s\n" % { "pack": p,
    00085                                                                                             "vers": packages[p],
    00086                                                                                             "url" : puburl })
    00087             externals.write("%(dir)-20s %(url)s/projects/%(proj)s/tags/%(vers)s\n" % { "dir" : "cmt",
    00088                                                                                        "proj": "GAUDI",
    00089                                                                                        "vers": pvers,
    00090                                                                                        "url" : puburl })
    00091             externals.close()
    00092             svn("ps", "-F", externals.name, "svn:externals", os.path.join("DistTags", "GAUDI_%s" % distvers)).wait()
    00093             to_commit.append("DistTags")
    00094
    00095         if to_commit:
    00096             apply(svn, ["ci"] + to_commit).wait()
    00097         else:
    00098             print "Nothing to commit"
    00099
    00100     finally:
    00101         shutil.rmtree(tempdir, ignore_errors = True)
    00102
    00103     return 0
    00104
    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_ls | ( |  | url | ) |

Definition at line 39 of file tag_release.py.

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

## 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.