| The Gaudi Framework v32r1 (f65d50dc)

Functions | Variables
svn_tag_release Namespace Reference

## Functions
def | svn (*args, **kwargs)
def | svn_ls (url)
def | basename (url)
def | dirname (url)
def | svn_exists (url)
def | checkout_structure (url, proj, branch)
def | main ()

## Variables
string | __author__ = "Marco Clemencic <Marco.Clemencic@cern.ch>"

## Detailed Description

    Small script to prepare the tags and the distribution special directory for a
    release of Gaudi.
    See https://twiki.cern.ch/twiki/bin/view/Gaudi/GaudiSVNRepository for a
    description of the repository structure.

## Function Documentation

## ◆ basename()

def svn_tag_release.basename | ( |  | url | ) |

Definition at line 28 of file svn_tag_release.py.

28 def basename(url):
29 return url.rsplit("/", 1)[-1]
30
31
svn_tag_release.basename
def basename(url)
Definition: svn_tag_release.py:28

## ◆ checkout_structure()

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

Definition at line 42 of file svn_tag_release.py.

42 def checkout_structure(url, proj, branch):
43 def checkout_level(base):
44 dirs = ["%s/%s" % (base, d) for d in svn_ls(base) if d.endswith("/")]
45 svn("up", "-N", *args).wait()
46 return dirs
47
48 root = basename(url)
49 svn("co", "-N", url, root).wait()
50 old_dir = os.getcwd()
51 os.chdir(root)
52 svn("up", "-N", proj).wait()
53 br = [proj] + branch.split("/")
54 for base in ["/".join(br[:n + 1]) for n in range(len(br))]:
55 checkout_level(base)
56 checkout_level(proj + "/tags")
57 os.chdir(old_dir)
58 return root
59
60
Gaudi::Functional::details::zip::range
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.
Definition: FunctionalDetails.h:71
svn_tag_release.svn
def svn(*args, **kwargs)
Definition: svn_tag_release.py:19
svn_tag_release.svn_ls
def svn_ls(url)
Definition: svn_tag_release.py:24
svn_tag_release.basename
def basename(url)
Definition: svn_tag_release.py:28
svn_tag_release.checkout_structure
def checkout_structure(url, proj, branch)
Definition: svn_tag_release.py:42

## ◆ dirname()

def svn_tag_release.dirname | ( |  | url | ) |

Definition at line 32 of file svn_tag_release.py.

32 def dirname(url):
33 return url.rsplit("/", 1)[1]
34
35
svn_tag_release.dirname
def dirname(url)
Definition: svn_tag_release.py:32

## ◆ main()

def svn_tag_release.main | ( |  | ) |

Definition at line 61 of file svn_tag_release.py.

61 def main():
62 from optparse import OptionParser
63 parser = OptionParser()
64 parser.add_option(
65 "--pre",
66 action="store_true",
67 help="Create -pre tags instead of final tags.")
68 parser.add_option(
69 "-b",
70 "--branch",
71 help=
72 "Use the given (global) branch as source for the tags instead of the trunk"
73 )
74 opts, args = parser.parse_args()
75 if opts.branch:
76 opts.branch = "/".join(["branches", "GAUDI", opts.branch])
77 else:
78 opts.branch = "trunk"
79
80 url = "svn+ssh://svn.cern.ch/reps/gaudi"
81 proj = "Gaudi"
82 container = "GaudiRelease"
83 project_info = ConfigParser()
84 project_info.optionxform = str # make options case sensitive
85 project_info.read('project.info')
86 packages = dict(project_info.items('Packages'))
87 tempdir = tempfile.mkdtemp()
88 try:
89 os.chdir(tempdir)
90 # prepare repository structure (and move to its top level)
91 os.chdir(checkout_structure(url, proj, opts.branch))
92
93 # note that the project does not have "-pre"
94 pvers = "%s_%s" % (proj.upper(), packages[container])
95
96 # prepare project tag
97 ptagdir = "%s/tags/%s/%s" % (proj, proj.upper(), pvers)
98 if not svn_exists(ptagdir):
99 svn('cp', '/'.join([proj, opts.branch]), ptagdir).wait()
100
101 # prepare package tags
102 tag_re = re.compile(r"^v(\d+)r(\d+)(?:p(\d+))?$")
103 for p in packages:
104 tag = packages[p]
105 pktagdir = "%s/tags/%s/%s" % (proj, p, tag)
106 # I have to make the tag if it doesn't exist and (if we use -pre tags)
107 # neither the -pre tag exists.
108 no_tag = not svn_exists(pktagdir)
109 make_tag = no_tag or (opts.pre and no_tag
110 and not svn_exists(pktagdir + "-pre"))
111 if make_tag:
112 if opts.pre:
113 pktagdir += "-pre"
114 svn("cp", "/".join([proj, opts.branch, p]), pktagdir).wait()
115 # Atlas type of tag
116 tagElements = tag_re.match(tag)
117 if tagElements:
118 tagElements = "-".join([
119 "%02d" % int(el or "0") for el in tagElements.groups()
120 ])
121 pktagdir = "%s/tags/%s/%s-%s" % (proj, p, p, tagElements)
122 svn("cp", "/".join([proj, opts.branch, p]),
123 pktagdir).wait()
124 else:
125 if not no_tag:
126 # needed for the copy in the global tag
127 svn("up", "--depth=empty", pktagdir).wait()
128
129 svn("ci").wait()
130
131 finally:
132 shutil.rmtree(tempdir, ignore_errors=True)
133
134 return 0
135
136
svn_tag_release.svn
def svn(*args, **kwargs)
Definition: svn_tag_release.py:19
svn_tag_release.main
def main()
Definition: svn_tag_release.py:61
svn_tag_release.svn_exists
def svn_exists(url)
Definition: svn_tag_release.py:36
svn_tag_release.checkout_structure
def checkout_structure(url, proj, branch)
Definition: svn_tag_release.py:42

## ◆ svn()

def svn_tag_release.svn | ( | * | args,
|  | ** | kwargs
| ) |  |

Definition at line 19 of file svn_tag_release.py.

19 def svn(*args, **kwargs):
20 print "> svn", " ".join(args)
21 return Popen(["svn"] + list(args), **kwargs)
22
23
svn_tag_release.svn
def svn(*args, **kwargs)
Definition: svn_tag_release.py:19

## ◆ svn_exists()

def svn_tag_release.svn_exists | ( |  | url | ) |

Definition at line 36 of file svn_tag_release.py.

36 def svn_exists(url):
37 d, b = url.rsplit("/", 1)
38 l = [x.rstrip("/") for x in svn_ls(d)]
39 return b in l
40
41
svn_tag_release.svn_exists
def svn_exists(url)
Definition: svn_tag_release.py:36
svn_tag_release.svn_ls
def svn_ls(url)
Definition: svn_tag_release.py:24

## ◆ svn_ls()

def svn_tag_release.svn_ls | ( |  | url | ) |

Definition at line 24 of file svn_tag_release.py.

24 def svn_ls(url):
25 return svn("ls", url, stdout=PIPE).communicate()[0].splitlines()
26
27
svn_tag_release.svn
def svn(*args, **kwargs)
Definition: svn_tag_release.py:19
svn_tag_release.svn_ls
def svn_ls(url)
Definition: svn_tag_release.py:24

## Variable Documentation

## ◆ __author__

string svn_tag_release.__author__ = "Marco Clemencic <Marco.Clemencic@cern.ch>"
| private

Definition at line 8 of file svn_tag_release.py.