| # 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
finalize_tags Namespace Reference

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

## Function Documentation

def finalize_tags._exec_cmd | ( |  | args,
|  |  | kwargs
| ) |  |
| private

Definition at line 19 of file finalize_tags.py.

19
20 def _exec_cmd(*args, **kwargs):
return apply(_spawn, args, kwargs).wait()

def finalize_tags._exec_cmd_output | ( |  | args,
|  |  | kwargs
| ) |  |
| private

Definition at line 21 of file finalize_tags.py.

21
22 def _exec_cmd_output(*args, **kwargs):
23 kwargs["stdout"] = PIPE
24 p = apply(_spawn, args, kwargs)
25 out = p.communicate()[0]
26 return out, p.returncode

def finalize_tags._spawn | ( |  | args,
|  |  | kwargs
| ) |  |
| private

Definition at line 14 of file finalize_tags.py.

14
15 def _spawn(*args, **kwargs):
16 cmd = args
17 cwd = kwargs.get("cwd", os.getcwd())
18 print ">>>> %s: %s" % (cwd, cmd)
return apply(Popen, (cmd,), kwargs)

def finalize_tags.basename | ( |  | url | ) |

Definition at line 47 of file finalize_tags.py.

47
48 def basename(url):
49 return url.rsplit("/", 1)[-1]

def finalize_tags.checkout_structure | ( |  | url,
|  |  | proj
| ) |  |

Definition at line 58 of file finalize_tags.py.

58
59 def checkout_structure(url, proj):
60 def checkout_level(base):
61 dirs = ["%s/%s" % (base, d) for d in svn_ls_output(base)[0].splitlines() if d.endswith("/")]
62 apply(svn, ["up", "-N"] + dirs)
63 return dirs
64 root = basename(url)
65 svn("co","-N", url, root)
66 old_dir = os.getcwd()
67 os.chdir(root)
68 packages = [ pkg
69 for pkg, prj in
70 [ x.split()
71 for x in [ x.strip()
72 for x in svn_pg_output("packages", ".")[0].splitlines()]
73 if x and not x.startswith("#") ]
74 if prj == proj ]
75 pkg_tag_dirs = [ proj + "/tags/" + pkg for pkg in packages ]
76 apply(svn, ["up", "-N", proj, proj + "/tags"] + pkg_tag_dirs)
77 os.chdir(old_dir)
78 return root, packages

def finalize_tags.dirname | ( |  | url | ) |

Definition at line 50 of file finalize_tags.py.

50
51 def dirname(url):
52 return url.rsplit("/", 1)[1]

def finalize_tags.main | ( |  | ) |

Definition at line 82 of file finalize_tags.py.

82
83 def main():
84 url = "svn+ssh://svn.cern.ch/reps/gaudi"
85 proj = "Gaudi"
86 tempdir = tempfile.mkdtemp()
87 try:
88 os.chdir(tempdir)
89
90 # prepare repository structure (and move to its top level)
91 root, packages = checkout_structure(url, proj)
92 os.chdir(root)
93
94 pre_rx = re.compile("(v[0-9]+r[0-9]+(p[0-9]+)?)-pre([0-9]*)")
95 for p in packages:
96 entries = svn_listdir("%s/tags/%s" %(proj, p))
97 # get the list of -pre tags in the package
98 pre_tags = [ (t.group(0), t.group(1), t.group(3))
99 for t in map(pre_rx.match, entries)
100 if t ]
101 # extract the latest -pre tag for each tag
102 tags = {}
103 for pt, t, ptv in pre_tags:
104 if ptv:
105 ptv = int(ptv)
106 else:
107 ptv = -1
108 if (t not in tags) or (tags[t][0] < ptv):
109 tags[t] = (ptv, pt)
110 # throw away unneeded information from the map
111 tags = dict(zip(tags.keys(), map(lambda a: a[1], tags.values())))
112 for tag in tags:
113 pretagdir = "%s/tags/%s/%s" %(proj, p, tags[tag])
114 tagdir = "%s/tags/%s/%s" %(proj, p, tag)
115 if tag not in entries:
116 svn_up("-N", pretagdir)
117 svn_cp(pretagdir, tagdir)
118
119 return svn_ci()
120
121 finally:
122 shutil.rmtree(tempdir, ignore_errors = True)
123 pass

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

Definition at line 27 of file finalize_tags.py.

27
28 def svn(*args, **kwargs):
29 return apply(_exec_cmd, ["svn"] + list(args), kwargs)

def finalize_tags.svn_ci_fake | ( |  | args,
|  |  | cwd = `"."`
| ) |  |

Definition at line 42 of file finalize_tags.py.

42
43 def svn_ci_fake(args, cwd = "."):
44 cmd = ["svn", "ci"] + args
45 print "(n)> %s: %s" % (cwd, cmd)
46 #svn_ci = svn_ci_fake

def finalize_tags.svn_exists | ( |  | url | ) |

Definition at line 53 of file finalize_tags.py.

53
54 def svn_exists(url):
55 d,b = url.rsplit("/", 1)
56 l = [x.rstrip("/") for x in svn_ls(d)]
57 return b in l

def finalize_tags.svn_listdir | ( |  | path | ) |

Definition at line 79 of file finalize_tags.py.

79
80 def svn_listdir(path):
81 return [f.rstrip("/") for f in svn_ls_output(path)[0].splitlines()]

def finalize_tags.svn_output | ( |  | args,
|  |  | kwargs
| ) |  |

Definition at line 30 of file finalize_tags.py.

30
31 def svn_output(*args, **kwargs):
32 return apply(_exec_cmd_output, ["svn"] + list(args), kwargs)

## Variable Documentation

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.