| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Namespace List
- Namespace Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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.

42
43 def basename(url):
44 return url.rsplit("/", 1)[-1]

def tag_release.checkout_structure | ( |  | url,
|  |  | proj,
|  |  | branch
| ) |  |

Definition at line 53 of file tag_release.py.

53
54 def checkout_structure(url, proj, branch):
55 def checkout_level(base):
56 dirs = ["%s/%s" % (base, d) for d in svn_ls(base) if d.endswith("/")]
57 apply(svn, ["up", "-N"] + dirs).wait()
58 return dirs
59
60 root = basename(url)
61 svn("co","-N", url, root).wait()
62 old_dir = os.getcwd()
63 os.chdir(root)
64 svn("up", "-N", proj).wait()
65 br = [proj] + branch.split("/")
66 for base in [ "/".join(br[:n+1]) for n in range(len(br))]:
67 checkout_level(base)
68 checkout_level(proj + "/tags")
69 os.chdir(old_dir)
70 return root

def tag_release.dirname | ( |  | url | ) |

Definition at line 45 of file tag_release.py.

45
46 def dirname(url):
47 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.

14
15 def extract_version(f):
16 """
17 Find the version number in a requirements file.
18 """
19 global _req_version_pattern
20 for l in open(f):
21 m = _req_version_pattern.match(l)
22 if m:
23 return m.group(1)
24 return None

def tag_release.gather_new_versions | ( |  | f | ) |

Definition at line 26 of file tag_release.py.

26
27 def gather_new_versions(f):
28 global _use_pattern
29 versions = {}
30 for l in open(f):
31 m = _use_pattern.match(l)
32 if m:
33 versions[m.group(1)] = m.group(2)
34 return versions

def tag_release.main | ( |  | ) |

Definition at line 71 of file tag_release.py.

71
72 def main():
73 from optparse import OptionParser
74 parser = OptionParser()
75 parser.add_option("--pre", action = "store_true",
76 help = "Create -pre tags instead of final tags.")
77 parser.add_option("-b", "--branch",
78 help = "Use the given (global) branch as source for the tags instead of the trunk")
79 opts, args = parser.parse_args()
80 if opts.branch:
81 opts.branch = "/".join(["branches", "GAUDI", opts.branch])
82 else:
83 opts.branch = "trunk"
84
85 url = "svn+ssh://svn.cern.ch/reps/gaudi"
86 proj = "Gaudi"
87 container = "GaudiRelease"
88 packages = gather_new_versions("requirements")
89 packages[container] = extract_version("requirements")
90 tempdir = tempfile.mkdtemp()
91 try:
92 os.chdir(tempdir)
93 # prepare repository structure (and move to its top level)
94 os.chdir(checkout_structure(url, proj, opts.branch))
95
96 # note that the project does not have "-pre"
97 pvers = "%s_%s" % (proj.upper(), packages[container])
98
99 # prepare project tag
100 ptagdir = "%s/tags/%s/%s" % (proj, proj.upper(), pvers)
101 if not svn_exists(ptagdir):
102 svn("mkdir", ptagdir).wait()
103 for f in ["cmt", "Makefile.cmt",
104 "Makefile-cmake.mk", "cmake", "CMakeLists.txt",
105 "configure", "toolchain.cmake"]:
106 svn("cp", "/".join([proj, opts.branch, f]), "/".join([ptagdir, f])).wait()
107
108 # prepare package tags
109 tag_re = re.compile(r"^v(\d+)r(\d+)(?:p(\d+))?$")
110 for p in packages:
111 tag = packages[p]
112 pktagdir = "%s/tags/%s/%s" % (proj, p, tag)
113 # I have to make the tag if it doesn't exist and (if we use -pre tags)
114 # neither the -pre tag exists.
115 no_tag = not svn_exists(pktagdir)
116 make_tag = no_tag or (opts.pre and no_tag and not svn_exists(pktagdir + "-pre"))
117 if make_tag:
118 if opts.pre:
119 pktagdir += "-pre"
120 svn("cp", "/".join([proj, opts.branch, p]), pktagdir).wait()
121 # Atlas type of tag
122 tagElements = tag_re.match(tag)
123 if tagElements:
124 tagElements = "-".join([ "%02d" % int(el or "0") for el in tagElements.groups() ])
125 pktagdir = "%s/tags/%s/%s-%s" % (proj, p, p, tagElements)
126 svn("cp", "/".join([proj, opts.branch, p]), pktagdir).wait()
127 else:
128 if not no_tag:
129 svn("up", "-N", pktagdir).wait() # needed for the copy in the global tag
130
131 if not opts.pre:
132 # prepare the full global tag too
133 for p in packages:
134 tag = packages[p]
135 pktagdir = "%s/tags/%s/%s" % (proj, p, tag)
136 svn("cp", pktagdir, "%s/%s" % (ptagdir, p)).wait()
137
138 svn("ci").wait()
139
140 finally:
141 shutil.rmtree(tempdir, ignore_errors = True)
142
143 return 0

def tag_release.svn | ( |  | args,
|  |  | kwargs
| ) |  |

Definition at line 35 of file tag_release.py.

35
36 def svn(*args, **kwargs):
37 print "> svn", " ".join(args)
38 return apply(Popen, (["svn"] + list(args),), kwargs)

def tag_release.svn_exists | ( |  | url | ) |

Definition at line 48 of file tag_release.py.

48
49 def svn_exists(url):
50 d,b = url.rsplit("/", 1)
51 l = [x.rstrip("/") for x in svn_ls(d)]
52 return b in l

def tag_release.svn_ls | ( |  | url | ) |

Definition at line 39 of file tag_release.py.

39
40 def svn_ls(url):
41 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.