CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
checkforupdate.checkforupdate Class Reference

Public Member Functions

def __init__ (self, statusfilename='tagstatus.txt')
 
def checkforupdate (self, workingtag, isverbose=True)
 
def fetchTagsHTTP (self)
 
def runningVersion (self, cmsswWorkingBase, scriptname, isverbose=True)
 

Public Attributes

 lumiurl
 

Detailed Description

Definition at line 3 of file checkforupdate.py.

Constructor & Destructor Documentation

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

Definition at line 4 of file checkforupdate.py.

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

Definition at line 35 of file checkforupdate.py.

References checkforupdate.checkforupdate.fetchTagsHTTP(), createfilelist.int, edm.print(), and split.

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
72 
def checkforupdate(self, workingtag, isverbose=True)
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
double split
Definition: MVATrainer.cc:139

Member Function Documentation

def checkforupdate.checkforupdate.fetchTagsHTTP (   self)

Definition at line 6 of file checkforupdate.py.

References checkforupdate.checkforupdate.lumiurl, split, and digitizers_cfi.strip.

Referenced by checkforupdate.checkforupdate.checkforupdate().

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]])
14  return taglist
double split
Definition: MVATrainer.cc:139
def checkforupdate.checkforupdate.runningVersion (   self,
  cmsswWorkingBase,
  scriptname,
  isverbose = True 
)

Definition at line 15 of file checkforupdate.py.

References edm.print(), and digitizers_cfi.strip.

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 [line for line in result.split('\n') if "Sticky Tag" in line]:
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)
34  return workingversion
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def runningVersion(self, cmsswWorkingBase, scriptname, isverbose=True)

Member Data Documentation

checkforupdate.checkforupdate.lumiurl

Definition at line 5 of file checkforupdate.py.

Referenced by checkforupdate.checkforupdate.fetchTagsHTTP().