CMS 3D CMS Logo

Public Member Functions | Public Attributes

checkforupdate::checkforupdate Class Reference

List of all members.

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.

00004                                                      :
        self.lumiurl='https://cms-service-lumi.web.cern.ch/cms-service-lumi/publicplots/'+statusfilename
def checkforupdate::checkforupdate::checkforupdate (   self,
  workingtag,
  isverbose = True 
)

Definition at line 32 of file checkforupdate.py.

00033                                                       :
00034         newtags=self.fetchTagsHTTP()
00035         if workingtag=='(none)':#means HEAD
00036             if isverbose:
00037                 print 'checking update for HEAD'
00038                 print '  no update'
00039             return []
00040         w=workingtag.lstrip('V').split('-')
00041         if len(w)!=3:
00042             print workingtag+' is not a release tag, can not compare'
00043             return []
00044         w=[int(r) for r in w]
00045         updatetags=[]
00046         for [tagstr,ismajor,desc] in newtags:
00047             digits=[int(r) for r in tagstr.lstrip('V').split('-')]
00048             if digits[0]==w[0] and  digits[1]==w[1] and digits[2]==w[2]:
00049                 continue
00050             if digits[0]<w[0]: 
00051                 continue            
00052             elif digits[0]==w[0]:
00053                 if digits[1]<w[1]:
00054                     continue
00055                 elif digits[1]==w[1]:
00056                     if digits[2]<=w[2]:
00057                         continue
00058             updatetags.append([tagstr,ismajor,desc])
00059         if isverbose:
00060             print 'checking update for '+workingtag
00061             if not updatetags:
00062                 print '  no update'
00063                 return []
00064             for [tag,ismajor,description] in updatetags:
00065                 if ismajor=='1':
00066                     print '  major update, tag ',tag+' , '+description
00067                 else:
00068                     print '  minor update, tag ',tag+' , '+description
00069         return updatetags
        

Member Function Documentation

def checkforupdate::checkforupdate::fetchTagsHTTP (   self)

Definition at line 5 of file checkforupdate.py.

00006                            :
00007         taglist=[]
00008         openurl=urllib2.build_opener()
00009         tagfile=openurl.open(self.lumiurl)
00010         tagfileStr=tagfile.read()
00011         for tag in tagfileStr.lstrip('\n').strip('\n').split('\n'):
00012             fields=tag.split(',')
00013             taglist.append([fields[0],fields[1],fields[2]])
        return taglist
def checkforupdate::checkforupdate::runningVersion (   self,
  cmsswWorkingBase,
  scriptname,
  isverbose = True 
)

Definition at line 14 of file checkforupdate.py.

00015                                                                        :
00016         currentdir=os.getcwd()
00017         os.chdir(os.path.join(cmsswWorkingBase,'src','RecoLuminosity','LumiDB','scripts'))
00018         cvscmmd='cvs status '+scriptname
00019         (cmmdstatus,result)=commands.getstatusoutput(cvscmmd+'| grep "Sticky Tag:"')
00020         os.chdir(currentdir)
00021         cleanresult=result.lstrip().strip()
00022         cleanresult=re.sub(r'\s+|\t+',' ',cleanresult)
00023         allfields=cleanresult.split(' ')
00024         workingversion=allfields[2]
00025         if workingversion=='(none)':
00026             workingversion='HEAD'
00027         if isverbose:
00028             print 'checking current version......'
00029             print '  project base : '+cmsswWorkingBase
00030             print '  script : '+scriptname
00031             print '  version : '+workingversion
        return allfields[2]

Member Data Documentation

Definition at line 3 of file checkforupdate.py.