test
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
checkforupdate.checkforupdate Class Reference

Public Member Functions

def __init__
 
def checkforupdate
 
def fetchTagsHTTP
 
def runningVersion
 

Public Attributes

 lumiurl
 

Detailed Description

Definition at line 2 of file checkforupdate.py.

Constructor & Destructor Documentation

def checkforupdate.checkforupdate.__init__ (   self,
  statusfilename = 'tagstatus.txt' 
)

Definition at line 3 of file checkforupdate.py.

3 
4  def __init__(self,statusfilename='tagstatus.txt'):
self.lumiurl='http://cms-service-lumi.web.cern.ch/cms-service-lumi/'+statusfilename
def checkforupdate.checkforupdate.checkforupdate (   self,
  workingtag,
  isverbose = True 
)

Definition at line 34 of file checkforupdate.py.

References checkforupdate.checkforupdate.fetchTagsHTTP(), and split.

34 
35  def checkforupdate(self,workingtag,isverbose=True):
36  newtags=self.fetchTagsHTTP()
37  if workingtag=='(none)':#means HEAD
38  if isverbose:
39  print 'checking update for HEAD'
40  print ' no update'
41  return []
42  w=workingtag.lstrip('V').split('-')
43  if len(w)!=3:
44  #print workingtag+' is not a release tag, can not compare'
45  return []
46  w=[int(r) for r in w]
47  updatetags=[]
48  for [tagstr,ismajor,desc] in newtags:
49  digits=[int(r) for r in tagstr.lstrip('V').split('-')]
50  if digits[0]==w[0] and digits[1]==w[1] and digits[2]==w[2]:
51  continue
52  if digits[0]<w[0]:
53  continue
54  elif digits[0]==w[0]:
55  if digits[1]<w[1]:
56  continue
57  elif digits[1]==w[1]:
58  if digits[2]<=w[2]:
59  continue
60  updatetags.append([tagstr,ismajor,desc])
61  if isverbose:
62  print 'checking update for '+workingtag
63  if not updatetags:
64  print ' no update'
65  return []
66  for [tag,ismajor,description] in updatetags:
67  if ismajor=='1':
68  print ' major update, tag ',tag+' , '+description
69  else:
70  print ' minor update, tag ',tag+' , '+description
71  return updatetags
double split
Definition: MVATrainer.cc:139

Member Function Documentation

def checkforupdate.checkforupdate.fetchTagsHTTP (   self)

Definition at line 5 of file checkforupdate.py.

References checkforupdate.checkforupdate.lumiurl, and split.

Referenced by checkforupdate.checkforupdate.checkforupdate().

5 
6  def fetchTagsHTTP(self):
7  taglist=[]
8  openurl=urllib2.build_opener()
9  tagfile=openurl.open(self.lumiurl)
10  tagfileStr=tagfile.read()
11  for tag in tagfileStr.lstrip('\n').strip('\n').split('\n'):
12  fields=tag.split(',')
13  taglist.append([fields[0],fields[1],fields[2]])
return taglist
double split
Definition: MVATrainer.cc:139
def checkforupdate.checkforupdate.runningVersion (   self,
  cmsswWorkingBase,
  scriptname,
  isverbose = True 
)

Definition at line 14 of file checkforupdate.py.

References alcazmumu_cfi.filter.

14 
15  def runningVersion(self,cmsswWorkingBase,scriptname,isverbose=True):
16  currentdir=os.getcwd()
17  os.chdir(os.path.join(cmsswWorkingBase,'src','RecoLuminosity','LumiDB','scripts'))
18  cvscmmd='cvs status '+scriptname
19  (cmmdstatus,result)=commands.getstatusoutput(cvscmmd+'| grep "Sticky Tag:"')
20  os.chdir(currentdir)
21  cleanresult=result.lstrip().strip()
22  cleanresult=re.sub(r'\s+|\t+',' ',cleanresult)
23  allfields=cleanresult.split(' ')
24  workingversion = "n/a"
25  for line in filter(lambda line: "Sticky Tag" in line, result.split('\n')):
26  workingversion = line.split()[2]
27  if workingversion=='(none)':
28  workingversion='HEAD'
29  if isverbose:
30  print 'checking current version......'
31  print ' project base : '+cmsswWorkingBase
32  print ' script : '+scriptname
33  print ' version : '+workingversion
return workingversion

Member Data Documentation

checkforupdate.checkforupdate.lumiurl

Definition at line 4 of file checkforupdate.py.

Referenced by checkforupdate.checkforupdate.fetchTagsHTTP().