CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
cmstc.TagCollector Class Reference
Inheritance diagram for cmstc.TagCollector:

Public Member Functions

def __init__
 
def approvePackage
 
def approveTagsets
 
def bypassTagsets
 
def commentTagsets
 
def createRelease
 
def getIBs
 
def getPackageManagersRequested
 
def getPackagesPendingApproval
 
def getPackageTagDescriptionFirstLine
 
def getPackageTagReleases
 
def getPackageTags
 
def getPendingApprovalTags
 
def getReleaseArchitectures
 
def getReleasesTags
 
def getReleaseTags
 
def getTagsetInformation
 
def getTagsetsTagsPendingSignatures
 
def getTagsetTags
 
def rejectTagsetsPendingApproval
 
def rejectTagsetsPendingSignatures
 
def removeTagsets
 
def requestCustomIB
 
def search
 
def signIn
 
def signInInteractive
 
def signOut
 
def signTagsets
 
def signTagsetsAll
 

Public Attributes

 login
 
 useCert
 

Private Member Functions

def _open
 
def _openjson
 

Private Attributes

 _cj
 
 _opener
 
 _url
 

Detailed Description

CMS TagCollector Python API

Definition at line 24 of file cmstc.py.

Constructor & Destructor Documentation

def cmstc.TagCollector.__init__ (   self,
  useCert = False 
)

Definition at line 27 of file cmstc.py.

27 
28  def __init__(self,useCert=False):
29  self._url = _tagcollector_url
30  self.useCert = useCert
31  self.login = False
32  if self.useCert:
33  self.login = True
34  self._cj = cookielib.CookieJar()
35  self._opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self._cj))
36 
37  def __del__(self):
38  if self.login: self.signOut()

Member Function Documentation

def cmstc.TagCollector._open (   self,
  page,
  params = None,
  data = None 
)
private

Definition at line 39 of file cmstc.py.

References cmstc.TagCollector._url, ws_sso_content_reader.getContent(), SiPixelLorentzAngle_cfi.read, and cmstc.TagCollector.useCert.

Referenced by cmstc.TagCollector._openjson(), cmstc.TagCollector.approvePackage(), cmstc.TagCollector.approveTagsets(), cmstc.TagCollector.bypassTagsets(), cmstc.TagCollector.commentTagsets(), cmstc.TagCollector.createRelease(), cmstc.TagCollector.getIBs(), cmstc.TagCollector.rejectTagsetsPendingApproval(), cmstc.TagCollector.rejectTagsetsPendingSignatures(), cmstc.TagCollector.removeTagsets(), cmstc.TagCollector.requestCustomIB(), cmstc.TagCollector.signIn(), cmstc.TagCollector.signOut(), cmstc.TagCollector.signTagsets(), and cmstc.TagCollector.signTagsetsAll().

39 
40  def _open(self, page, params = None, data = None):
41  url = self._url + page + '?'
42  if params:
43  url += urllib.urlencode(params)
44  if data:
45  data = urllib.urlencode(data)
46  if self.useCert:
47  return ws_sso_content_reader.getContent(url, '~/.globus/usercert.pem', '~/.globus/userkey.pem', data)
48  try:
49  return self._opener.open(url, data).read()
50  except urllib2.HTTPError, e:
51  raise Exception(e.read().strip())
def cmstc.TagCollector._openjson (   self,
  page,
  params = None,
  data = None 
)
private

Definition at line 52 of file cmstc.py.

References cmstc.TagCollector._open().

Referenced by cmstc.TagCollector.getIBs(), cmstc.TagCollector.getPackageManagersRequested(), cmstc.TagCollector.getPackagesPendingApproval(), cmstc.TagCollector.getPackageTagDescriptionFirstLine(), cmstc.TagCollector.getPackageTagReleases(), cmstc.TagCollector.getPackageTags(), cmstc.TagCollector.getPendingApprovalTags(), cmstc.TagCollector.getReleaseArchitectures(), cmstc.TagCollector.getReleasesTags(), cmstc.TagCollector.getTagsetInformation(), cmstc.TagCollector.getTagsetsTagsPendingSignatures(), cmstc.TagCollector.getTagsetTags(), and cmstc.TagCollector.search().

52 
53  def _openjson(self, page, params = None, data = None):
54  return json.loads(self._open(page, params, data))
def cmstc.TagCollector.approvePackage (   self,
  package 
)
Approve a New Package Request.
Requirement: Signed in as a Creator (i.e. people in the top-level .admin/developers file).
Warning: This does *not* create the package in CVS.

Definition at line 192 of file cmstc.py.

References cmstc.TagCollector._open().

193  def approvePackage(self, package):
194  """Approve a New Package Request.
195  Requirement: Signed in as a Creator (i.e. people in the top-level .admin/developers file).
196  Warning: This does *not* create the package in CVS."""
197  self._open('approveNewPackageRequest', {'package_name': package})
def approvePackage
Definition: cmstc.py:192
def cmstc.TagCollector.approveTagsets (   self,
  tagset_ids,
  comment = '' 
)
Approve one or more tagsets.
Requirement: Signed in as a Release Manager for each tagset's release.

Definition at line 155 of file cmstc.py.

References cmstc.TagCollector._open().

156  def approveTagsets(self, tagset_ids, comment = ''):
157  """Approve one or more tagsets.
158  Requirement: Signed in as a Release Manager for each tagset's release."""
159  tagset_ids = json.dumps(tagset_ids)
160  self._open('approveTagsets', {'tagset_ids': tagset_ids, 'comment': comment})
def approveTagsets
Definition: cmstc.py:155
def cmstc.TagCollector.bypassTagsets (   self,
  tagset_ids,
  comment = '' 
)
Bypass one or more tagsets.
Requirement: Signed in as a Release Manager for each tagset's release.

Definition at line 161 of file cmstc.py.

References cmstc.TagCollector._open().

162  def bypassTagsets(self, tagset_ids, comment = ''):
163  """Bypass one or more tagsets.
164  Requirement: Signed in as a Release Manager for each tagset's release."""
165  tagset_ids = json.dumps(tagset_ids)
166  self._open('bypassTagsets', {'tagset_ids': tagset_ids, 'comment': comment})
def cmstc.TagCollector.commentTagsets (   self,
  tagset_ids,
  comment 
)
Comment one or more tagsets.
Requirement: Signed in.

Definition at line 128 of file cmstc.py.

References cmstc.TagCollector._open().

129  def commentTagsets(self, tagset_ids, comment):
130  """Comment one or more tagsets.
131  Requirement: Signed in."""
132  tagset_ids = json.dumps(tagset_ids)
133  if len(comment) < 1:
134  raise Exception("Error: Expected a comment.")
135  self._open('commentTagsets', {'tagset_ids': tagset_ids, 'comment': comment})
def commentTagsets
Definition: cmstc.py:128
def cmstc.TagCollector.createRelease (   self,
  base_release_name,
  new_release_name,
  new_state,
  new_private,
  new_type,
  new_description,
  release_managers,
  copy_queues,
  tags 
)
Create a new release.
Requirement: Signed in as a release manager.

Definition at line 210 of file cmstc.py.

References cmstc.TagCollector._open(), and cmstc.TagCollector.login.

211  def createRelease(self, base_release_name, new_release_name, new_state, new_private, new_type, new_description, release_managers, copy_queues, tags):
212  """Create a new release.
213  Requirement: Signed in as a release manager."""
214  if self.login:
215  self._open('copyRelease', {'release_name': base_release_name, 'new_release_name': new_release_name, 'new_state': new_state, 'new_private': new_private, 'new_type': new_type, 'new_description': new_description, 'release_managers': release_managers, 'copy_queues': copy_queues, 'tags': tags})
216  else:
217  raise Exception("Error: Not logged in?!")
def cmstc.TagCollector.getIBs (   self,
  filt = '',
  limit = 10 
)
Get the name and creation date of Integration Builds.
By default, it only returns the latest 10 IBs.
Optionally, filter by name.

Definition at line 198 of file cmstc.py.

References cmstc.TagCollector._open(), cmstc.TagCollector._openjson(), join(), and cmstc.TagCollector.login.

199  def getIBs(self, filt = '', limit = 10):
200  """Get the name and creation date of Integration Builds.
201  By default, it only returns the latest 10 IBs.
202  Optionally, filter by name."""
203  return self._openjson('public/py_getIBs', {'filt': filt, 'limit': limit})
204 
205  def deprecateReleases(self, *releases):
206  """ Deprecate releases"""
207  if not self.login:
208  raise Exception("Error: Not logged in?!")
209  self._open('deprecateReleases', {"releases": ",".join(releases)})
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def cmstc.TagCollector.getPackageManagersRequested (   self,
  package 
)
Get the Package Managers (administrators and developers) requested in a New Package Request.

Definition at line 183 of file cmstc.py.

References cmstc.TagCollector._openjson().

184  def getPackageManagersRequested(self, package):
185  """Get the Package Managers (administrators and developers) requested in a New Package Request."""
186  return self._openjson('public/py_getPackageManagersRequested', {'package': package})
def getPackageManagersRequested
Definition: cmstc.py:183
def cmstc.TagCollector.getPackagesPendingApproval (   self)
Get New Package Requests which are Pending Approval.

Definition at line 179 of file cmstc.py.

References cmstc.TagCollector._openjson().

180  def getPackagesPendingApproval(self):
181  """Get New Package Requests which are Pending Approval."""
182  return self._openjson('public/py_getPackagesPendingApproval')
def getPackagesPendingApproval
Definition: cmstc.py:179
def cmstc.TagCollector.getPackageTagDescriptionFirstLine (   self,
  package,
  tag 
)
Get the first line of the descriptions of a tag.

Definition at line 80 of file cmstc.py.

References cmstc.TagCollector._openjson().

80 
81  def getPackageTagDescriptionFirstLine(self, package, tag):
82  """Get the first line of the descriptions of a tag."""
83  return self._openjson('public/py_getPackageTagDescriptionFirstLine', {'package': package, 'tag': tag})
def getPackageTagDescriptionFirstLine
Definition: cmstc.py:80
def cmstc.TagCollector.getPackageTagReleases (   self,
  package,
  tag 
)
Get the releases where a tag is.

Definition at line 84 of file cmstc.py.

References cmstc.TagCollector._openjson().

84 
85  def getPackageTagReleases(self, package, tag):
86  """Get the releases where a tag is."""
87  return self._openjson('public/py_getPackageTagReleases', {'package': package, 'tag': tag})
def getPackageTagReleases
Definition: cmstc.py:84
def cmstc.TagCollector.getPackageTags (   self,
  package 
)
Get the tags published in TagCollector for a package.
Note: TagCollector's published tags are a subset of CVS' tags.

Definition at line 75 of file cmstc.py.

References cmstc.TagCollector._openjson().

75 
76  def getPackageTags(self, package):
77  """Get the tags published in TagCollector for a package.
78  Note: TagCollector's published tags are a subset of CVS' tags."""
79  return self._openjson('public/py_getPackageTags', {'package': package})
def getPackageTags
Definition: cmstc.py:75
def cmstc.TagCollector.getPendingApprovalTags (   self,
  args,
  allow_multiple_tags = False 
)
Prints Pending Approval tags of one or more releases,
one or more tagsets, or both (i.e. it joins all the tags).
Prints an error if several tags appear for a single package.
Suitable for piping to addpkg (note: at the moment,
addpkg does not read from stdin, use "-f" instead).

Definition at line 107 of file cmstc.py.

References cmstc.TagCollector._openjson().

108  def getPendingApprovalTags(self, args, allow_multiple_tags = False):
109  """Prints Pending Approval tags of one or more releases,
110  one or more tagsets, or both (i.e. it joins all the tags).
111  Prints an error if several tags appear for a single package.
112  Suitable for piping to addpkg (note: at the moment,
113  addpkg does not read from stdin, use "-f" instead)."""
114  args = json.dumps(args)
115  allow_multiple_tags = json.dumps(allow_multiple_tags)
116  return self._openjson('public/py_getPendingApprovalTags', {'args': args, 'allow_multiple_tags': allow_multiple_tags})
def getPendingApprovalTags
Definition: cmstc.py:107
def cmstc.TagCollector.getReleaseArchitectures (   self,
  release,
  default = '0' 
)
Returns release architectures.

Definition at line 226 of file cmstc.py.

References cmstc.TagCollector._openjson().

227  def getReleaseArchitectures(self, release, default='0'):
228  """Returns release architectures."""
229  return self._openjson('public/py_getReleaseArchitectures', {'release': release, 'default': default})
def getReleaseArchitectures
Definition: cmstc.py:226
def cmstc.TagCollector.getReleasesTags (   self,
  releases,
  diff = False 
)
Get the tags of one or more release.
Optionally, return only the tags that differ between releases.

Definition at line 88 of file cmstc.py.

References cmstc.TagCollector._openjson().

Referenced by cmstc.TagCollector.getReleaseTags().

88 
89  def getReleasesTags(self, releases, diff = False):
90  """Get the tags of one or more release.
91  Optionally, return only the tags that differ between releases."""
92  releases = json.dumps(releases)
93  diff = json.dumps(diff)
94  return self._openjson('public/py_getReleasesTags', {'releases': releases, 'diff': diff})
def getReleasesTags
Definition: cmstc.py:88
def cmstc.TagCollector.getReleaseTags (   self,
  release 
)
Get the tags of one release.

Definition at line 95 of file cmstc.py.

References cmstc.TagCollector.getReleasesTags().

95 
96  def getReleaseTags(self, release):
97  """Get the tags of one release."""
98  return self.getReleasesTags((release, ))
def getReleasesTags
Definition: cmstc.py:88
def getReleaseTags
Definition: cmstc.py:95
def cmstc.TagCollector.getTagsetInformation (   self,
  tagset 
)
Get the information of one tagset.

Definition at line 103 of file cmstc.py.

References cmstc.TagCollector._openjson().

104  def getTagsetInformation(self, tagset):
105  """Get the information of one tagset."""
106  return self._openjson('public/py_getTagsetInformation', {'tagset': tagset})
def getTagsetInformation
Definition: cmstc.py:103
def cmstc.TagCollector.getTagsetsTagsPendingSignatures (   self,
  user_name,
  show_all,
  author_tagsets,
  release_names = None 
)
Prints Pending Signature tags of one or more releases,
one or more tagsets, or both (i.e. it joins all the tags).
Prints an error if several tags appear for a single package.
Suitable for piping to addpkg (note: at the moment,
addpkg does not read from stdin, use "-f" instead).

Definition at line 117 of file cmstc.py.

References cmstc.TagCollector._openjson().

118  def getTagsetsTagsPendingSignatures(self, user_name, show_all, author_tagsets, release_names = None):
119  """Prints Pending Signature tags of one or more releases,
120  one or more tagsets, or both (i.e. it joins all the tags).
121  Prints an error if several tags appear for a single package.
122  Suitable for piping to addpkg (note: at the moment,
123  addpkg does not read from stdin, use "-f" instead)."""
124  if not release_names == None:
125  return self._openjson('public/py_getTagsetsTagsPendingSignatures', {'user_name': user_name, 'show_all': show_all, 'author_tagsets': author_tagsets, 'release_names': json.dumps(release_names)})
126  else:
127  return self._openjson('public/py_getTagsetsTagsPendingSignatures', {'user_name': user_name, 'show_all': show_all, 'author_tagsets': author_tagsets})
def getTagsetsTagsPendingSignatures
Definition: cmstc.py:117
def cmstc.TagCollector.getTagsetTags (   self,
  tagset 
)
Get the tags of one tagset.

Definition at line 99 of file cmstc.py.

References cmstc.TagCollector._openjson().

99 
100  def getTagsetTags(self, tagset):
101  """Get the tags of one tagset."""
102  return self._openjson('public/py_getTagsetTags', {'tagset': tagset})
def getTagsetTags
Definition: cmstc.py:99
def cmstc.TagCollector.rejectTagsetsPendingApproval (   self,
  tagset_ids,
  comment = '' 
)
Reject one or more tagsets Pending Approval.
Requirement: Signed in as a Release Manager.

Definition at line 167 of file cmstc.py.

References cmstc.TagCollector._open().

168  def rejectTagsetsPendingApproval(self, tagset_ids, comment = ''):
169  """Reject one or more tagsets Pending Approval.
170  Requirement: Signed in as a Release Manager."""
171  tagset_ids = json.dumps(tagset_ids)
172  self._open('rejectTagsetsPendingApproval', {'tagset_ids': tagset_ids, 'comment': comment})
def rejectTagsetsPendingApproval
Definition: cmstc.py:167
def cmstc.TagCollector.rejectTagsetsPendingSignatures (   self,
  tagset_ids,
  comment = '' 
)
Reject one or more tagsets Pending Signatures.
Requirement: Signed in as a L2s or as a Release Manager
for the tagset's release or as the author of the tagset.

Definition at line 148 of file cmstc.py.

References cmstc.TagCollector._open().

149  def rejectTagsetsPendingSignatures(self, tagset_ids, comment = ''):
150  """Reject one or more tagsets Pending Signatures.
151  Requirement: Signed in as a L2s or as a Release Manager
152  for the tagset's release or as the author of the tagset."""
153  tagset_ids = json.dumps(tagset_ids)
154  self._open('rejectTagsetsPendingSignatures', {'tagset_ids': tagset_ids, 'comment': comment})
def rejectTagsetsPendingSignatures
Definition: cmstc.py:148
def cmstc.TagCollector.removeTagsets (   self,
  tagset_ids,
  comment = '' 
)
Remove one or more tagsets from the History (i.e. stack of the release).
Requirement: Signed in as a Release Manager.

Definition at line 173 of file cmstc.py.

References cmstc.TagCollector._open().

174  def removeTagsets(self, tagset_ids, comment = ''):
175  """Remove one or more tagsets from the History (i.e. stack of the release).
176  Requirement: Signed in as a Release Manager."""
177  tagset_ids = json.dumps(tagset_ids)
178  self._open('removeTagsets', {'tagset_ids': tagset_ids, 'comment': comment})
def cmstc.TagCollector.requestCustomIB (   self,
  release_name,
  architectures,
  tags 
)
Request a CustomIB.
Requirement: Signed in.

Definition at line 218 of file cmstc.py.

References cmstc.TagCollector._open(), and cmstc.TagCollector.login.

219  def requestCustomIB(self, release_name, architectures, tags):
220  """Request a CustomIB.
221  Requirement: Signed in."""
222  if self.login:
223  self._open('requestCustomIB', {'release_name': release_name, 'architecture_names': architectures, 'tags': tags})
224  else:
225  raise Exception("Error: Not logged in?!")
def requestCustomIB
Definition: cmstc.py:218
def cmstc.TagCollector.search (   self,
  term 
)
Searches for releases, packages, tagsets, users and categories.
Requirement: Signed in.

Definition at line 187 of file cmstc.py.

References cmstc.TagCollector._openjson().

188  def search(self, term):
189  """Searches for releases, packages, tagsets, users and categories.
190  Requirement: Signed in."""
191  return self._openjson('search', {'term': term})
def cmstc.TagCollector.signIn (   self,
  username,
  password 
)

Definition at line 55 of file cmstc.py.

References cmstc.TagCollector._open(), cmstc.TagCollector.login, and cmstc.TagCollector.useCert.

Referenced by cmstc.TagCollector.signInInteractive().

55 
56  def signIn(self, username, password):
57  if self.useCert: return
58  """Sign in to TagCollector."""
59  self._open('signIn', data = {'password': password, 'user_name': username})
60  self.login = True
def cmstc.TagCollector.signInInteractive (   self)

Definition at line 61 of file cmstc.py.

References cmstc.TagCollector.signIn(), upload_popcon.DropBox.signIn(), and cmstc.TagCollector.useCert.

61 
62  def signInInteractive(self):
63  if self.useCert: return
64  """Sign in to TagCollector, asking for the username and password."""
65  username = raw_input('Username: ')
66  password = getpass.getpass()
67  self.signIn(username, password)
68  return username
def signInInteractive
Definition: cmstc.py:61
def cmstc.TagCollector.signOut (   self)

Definition at line 69 of file cmstc.py.

References cmstc.TagCollector._open(), cmstc.TagCollector.login, and cmstc.TagCollector.useCert.

69 
70  def signOut(self):
71  if self.useCert: return
72  """Sign out of TagCollector."""
73  self._open('signOut')
74  self.login = False
def cmstc.TagCollector.signTagsets (   self,
  tagset_ids,
  comment = '' 
)
Sign one or more tagsets.
Requirement: Signed in as a L2.

Definition at line 136 of file cmstc.py.

References cmstc.TagCollector._open().

137  def signTagsets(self, tagset_ids, comment = ''):
138  """Sign one or more tagsets.
139  Requirement: Signed in as a L2."""
140  tagset_ids = json.dumps(tagset_ids)
141  self._open('signTagsets', {'tagset_ids': tagset_ids, 'comment': comment})
def cmstc.TagCollector.signTagsetsAll (   self,
  tagset_ids,
  comment = '' 
)
Sign all one or more tagsets.
Requirement: Signed in as a top-level admin.

Definition at line 142 of file cmstc.py.

References cmstc.TagCollector._open().

143  def signTagsetsAll(self, tagset_ids, comment = ''):
144  """Sign all one or more tagsets.
145  Requirement: Signed in as a top-level admin."""
146  tagset_ids = json.dumps(tagset_ids)
147  self._open('signTagsetsAll', {'tagset_ids': tagset_ids, 'comment': comment})
def signTagsetsAll
Definition: cmstc.py:142

Member Data Documentation

cmstc.TagCollector._cj
private

Definition at line 33 of file cmstc.py.

cmstc.TagCollector._opener
private

Definition at line 34 of file cmstc.py.

cmstc.TagCollector._url
private

Definition at line 28 of file cmstc.py.

Referenced by cmstc.TagCollector._open().

cmstc.TagCollector.login

Definition at line 30 of file cmstc.py.

Referenced by cmstc.TagCollector.createRelease(), cmstc.TagCollector.getIBs(), cmstc.TagCollector.requestCustomIB(), cmstc.TagCollector.signIn(), and cmstc.TagCollector.signOut().

cmstc.TagCollector.useCert

Definition at line 29 of file cmstc.py.

Referenced by cmstc.TagCollector._open(), cmstc.TagCollector.signIn(), cmstc.TagCollector.signInInteractive(), and cmstc.TagCollector.signOut().