|
Gaudi Framework, version v21r8 |
| Home | Generated: 17 Mar 2010 |
Functions | |
| def | _spawn |
| def | _exec_cmd |
| def | _exec_cmd_output |
| def | svn |
| def | svn_output |
| def | svn_ci_fake |
| def | basename |
| def | dirname |
| def | svn_exists |
| def | checkout_structure |
| def | svn_listdir |
| def | main |
Variables | |
| string | __author__ = "Marco Clemencic <Marco.Clemencic@cern.ch>" |
| svn_ci_real = svn_ci | |
| def finalize_tags::_exec_cmd | ( | args, | ||
| kwargs | ||||
| ) | [private] |
Definition at line 19 of file finalize_tags.py.
00019 : 00020 return apply(_spawn, args, kwargs).wait() def _exec_cmd_output(*args, **kwargs):
| def finalize_tags::_exec_cmd_output | ( | args, | ||
| kwargs | ||||
| ) | [private] |
Definition at line 21 of file finalize_tags.py.
00021 : 00022 kwargs["stdout"] = PIPE 00023 p = apply(_spawn, args, kwargs) 00024 out = p.communicate()[0] 00025 return out, p.returncode 00026 def svn(*args, **kwargs):
| def finalize_tags::_spawn | ( | args, | ||
| kwargs | ||||
| ) | [private] |
Definition at line 14 of file finalize_tags.py.
00014 : 00015 cmd = args 00016 cwd = kwargs.get("cwd", os.getcwd()) 00017 print ">>>> %s: %s" % (cwd, cmd) 00018 return apply(Popen, (cmd,), kwargs) def _exec_cmd(*args, **kwargs):
| def finalize_tags::basename | ( | url | ) |
| def finalize_tags::checkout_structure | ( | url, | ||
| proj | ||||
| ) |
Definition at line 58 of file finalize_tags.py.
00058 : 00059 def checkout_level(base): 00060 dirs = ["%s/%s" % (base, d) for d in svn_ls_output(base)[0].splitlines() if d.endswith("/")] 00061 apply(svn, ["up", "-N"] + dirs) 00062 return dirs 00063 root = basename(url) 00064 svn("co","-N", url, root) 00065 old_dir = os.getcwd() 00066 os.chdir(root) 00067 packages = [ pkg 00068 for pkg, prj in 00069 [ x.split() 00070 for x in [ x.strip() 00071 for x in svn_pg_output("packages", ".")[0].splitlines()] 00072 if x and not x.startswith("#") ] 00073 if prj == proj ] 00074 pkg_tag_dirs = [ proj + "/tags/" + pkg for pkg in packages ] 00075 apply(svn, ["up", "-N", proj, proj + "/tags"] + pkg_tag_dirs) 00076 os.chdir(old_dir) 00077 return root, packages 00078 def svn_listdir(path):
| def finalize_tags::dirname | ( | url | ) |
Definition at line 50 of file finalize_tags.py.
00050 : 00051 return url.rsplit("/", 1)[1] 00052 def svn_exists(url):
| def finalize_tags::main | ( | ) |
Definition at line 82 of file finalize_tags.py.
00082 : 00083 url = "svn+ssh://svn.cern.ch/reps/gaudi" 00084 proj = "Gaudi" 00085 tempdir = tempfile.mkdtemp() 00086 try: 00087 os.chdir(tempdir) 00088 00089 # prepare repository structure (and move to its top level) 00090 root, packages = checkout_structure(url, proj) 00091 os.chdir(root) 00092 00093 pre_rx = re.compile("(v[0-9]+r[0-9]+(p[0-9]+)?)-pre([0-9]*)") 00094 for p in packages: 00095 entries = svn_listdir("%s/tags/%s" %(proj, p)) 00096 # get the list of -pre tags in the package 00097 pre_tags = [ (t.group(0), t.group(1), t.group(3)) 00098 for t in map(pre_rx.match, entries) 00099 if t ] 00100 # extract the latest -pre tag for each tag 00101 tags = {} 00102 for pt, t, ptv in pre_tags: 00103 if ptv: 00104 ptv = int(ptv) 00105 else: 00106 ptv = -1 00107 if (t not in tags) or (tags[t][0] < ptv): 00108 tags[t] = (ptv, pt) 00109 # throw away unneeded information from the map 00110 tags = dict(zip(tags.keys(), map(lambda a: a[1], tags.values()))) 00111 for tag in tags: 00112 pretagdir = "%s/tags/%s/%s" %(proj, p, tags[tag]) 00113 tagdir = "%s/tags/%s/%s" %(proj, p, tag) 00114 if tag not in entries: 00115 svn_up("-N", pretagdir) 00116 svn_cp(pretagdir, tagdir) 00117 00118 return svn_ci() 00119 00120 finally: 00121 shutil.rmtree(tempdir, ignore_errors = True) 00122 pass 00123 if __name__ == '__main__':
| def finalize_tags::svn | ( | args, | ||
| kwargs | ||||
| ) |
Definition at line 27 of file finalize_tags.py.
00027 : 00028 return apply(_exec_cmd, ["svn"] + list(args), kwargs) 00029 def svn_output(*args, **kwargs):
| def finalize_tags::svn_ci_fake | ( | args, | ||
cwd = "." | ||||
| ) |
Definition at line 42 of file finalize_tags.py.
00042 : 00043 cmd = ["svn", "ci"] + args 00044 print "(n)> %s: %s" % (cwd, cmd) 00045 #svn_ci = svn_ci_fake 00046 def basename(url):
| def finalize_tags::svn_exists | ( | url | ) |
Definition at line 53 of file finalize_tags.py.
00053 : 00054 d,b = url.rsplit("/", 1) 00055 l = [x.rstrip("/") for x in svn_ls(d)] 00056 return b in l 00057 def checkout_structure(url, proj):
| def finalize_tags::svn_listdir | ( | path | ) |
| def finalize_tags::svn_output | ( | args, | ||
| kwargs | ||||
| ) |
Definition at line 30 of file finalize_tags.py.
00030 : 00031 return apply(_exec_cmd_output, ["svn"] + list(args), kwargs) 00032 for c in ["co", "up", "ci", "ls", "add", "rm", "cp", "mkdir", "mv", "pg"]:
| string finalize_tags::__author__ = "Marco Clemencic <Marco.Clemencic@cern.ch>" |
Definition at line 8 of file finalize_tags.py.
| finalize_tags::svn_ci_real = svn_ci |
Definition at line 41 of file finalize_tags.py.