| # Gaudi Framework, version v22r2 |

Home |  | Generated: Tue May 10 2011

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.

    00020                               :
        return apply(_spawn, args, kwargs).wait()

def finalize_tags::_exec_cmd_output | ( |  | args,
|  |  | kwargs
| ) |  | `[private]`

Definition at line 21 of file finalize_tags.py.

    00022                                      :
    00023     kwargs["stdout"] = PIPE
    00024     p = apply(_spawn, args, kwargs)
    00025     out = p.communicate()[0]
    00026     return out, p.returncode

def finalize_tags::_spawn | ( |  | args,
|  |  | kwargs
| ) |  | `[private]`

Definition at line 14 of file finalize_tags.py.

    00015                            :
    00016     cmd = args
    00017     cwd = kwargs.get("cwd", os.getcwd())
    00018     print ">>>> %s: %s" % (cwd, cmd)
        return apply(Popen, (cmd,), kwargs)

def finalize_tags::basename | ( |  | url ) |

Definition at line 47 of file finalize_tags.py.

    00048                  :
    00049     return url.rsplit("/", 1)[-1]

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

Definition at line 58 of file finalize_tags.py.

    00059                                  :
    00060     def checkout_level(base):
    00061         dirs = ["%s/%s" % (base, d) for d in svn_ls_output(base)[0].splitlines() if d.endswith("/")]
    00062         apply(svn, ["up", "-N"] + dirs)
    00063         return dirs
    00064     root = basename(url)
    00065     svn("co","-N", url, root)
    00066     old_dir = os.getcwd()
    00067     os.chdir(root)
    00068     packages = [ pkg
    00069                  for pkg, prj in
    00070                    [ x.split()
    00071                      for x in [ x.strip()
    00072                                 for x in svn_pg_output("packages", ".")[0].splitlines()]
    00073                      if x and not x.startswith("#") ]
    00074                  if prj == proj ]
    00075     pkg_tag_dirs = [ proj + "/tags/" + pkg for pkg in packages ]
    00076     apply(svn, ["up", "-N", proj, proj + "/tags"] + pkg_tag_dirs)
    00077     os.chdir(old_dir)
    00078     return root, packages

def finalize_tags::dirname | ( |  | url ) |

Definition at line 50 of file finalize_tags.py.

    00051                 :
    00052     return url.rsplit("/", 1)[1]

def finalize_tags::main | ( | ) |

Definition at line 82 of file finalize_tags.py.

    00083           :
    00084     url = "svn+ssh://svn.cern.ch/reps/gaudi"
    00085     proj = "Gaudi"
    00086     tempdir = tempfile.mkdtemp()
    00087     try:
    00088         os.chdir(tempdir)
    00089
    00090         # prepare repository structure (and move to its top level)
    00091         root, packages = checkout_structure(url, proj)
    00092         os.chdir(root)
    00093
    00094         pre_rx = re.compile("(v[0-9]+r[0-9]+(p[0-9]+)?)-pre([0-9]*)")
    00095         for p in packages:
    00096             entries = svn_listdir("%s/tags/%s" %(proj, p))
    00097             # get the list of -pre tags in the package
    00098             pre_tags = [ (t.group(0), t.group(1), t.group(3))
    00099                          for t in map(pre_rx.match, entries)
    00100                          if t ]
    00101             # extract the latest -pre tag for each tag
    00102             tags = {}
    00103             for pt, t, ptv in pre_tags:
    00104                 if ptv:
    00105                     ptv = int(ptv)
    00106                 else:
    00107                     ptv = -1
    00108                 if (t not in tags) or (tags[t][0] < ptv):
    00109                     tags[t] = (ptv, pt)
    00110             # throw away unneeded information from the map
    00111             tags = dict(zip(tags.keys(), map(lambda a: a[1], tags.values())))
    00112             for tag in tags:
    00113                 pretagdir = "%s/tags/%s/%s" %(proj, p, tags[tag])
    00114                 tagdir = "%s/tags/%s/%s" %(proj, p, tag)
    00115                 if tag not in entries:
    00116                     svn_up("-N", pretagdir)
    00117                     svn_cp(pretagdir, tagdir)
    00118
    00119         return svn_ci()
    00120
    00121     finally:
    00122         shutil.rmtree(tempdir, ignore_errors = True)
    00123         pass

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

Definition at line 27 of file finalize_tags.py.

    00028                         :
    00029     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.

    00043                                 :
    00044     cmd = ["svn", "ci"] + args
    00045     print "(n)> %s: %s" % (cwd, cmd)
    00046 #svn_ci = svn_ci_fake

def finalize_tags::svn_exists | ( |  | url ) |

Definition at line 53 of file finalize_tags.py.

    00054                    :
    00055     d,b = url.rsplit("/", 1)
    00056     l = [x.rstrip("/") for x in svn_ls(d)]
    00057     return b in l

def finalize_tags::svn_listdir | ( |  | path ) |

Definition at line 79 of file finalize_tags.py.

    00080                      :
    00081     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.

    00031                                :
    00032     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.

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines