def sUpdateNBVer(ins): currVer = clearcase.getNextLabel(ins.getNBView(),ins.getWuceProduct()) nextBlVer = clearcase.getNextBaselineLabel(ins.getNBView(),ins.getWuceProduct()) l = clearcase.parseLabel(nextBlVer) if len(l) < 8: raise Exception("Invalid baseline label {label}".format(label=nextBlVer)) clearcase.ctInView(ins.getNBView(), "cd {vt}/bld/wuce/ver; {ct} co -nc sys prod sysrel bld iter prodver bldrev extra".format(vt=ins.getVobTag(),ct=bmc.config.get('cleartool'))) clearcase.ctInView(ins.getNBView(), "cd {vt}/bld/wuce/ver; echo {sys}>sys; echo {prod}>prod; echo {sysrel}>sysrel; echo {bld}>bld; echo {iter}>iter; echo {prodver}>prodver; echo {bldrev}>bldrev; echo {extra}>extra;".format(vt=ins.getVobTag(), sys=l[0],prod=l[1],sysrel=l[2],bld=l[3],iter=l[4],prodver=l[5],bldrev=l[6],extra=l[7])) clearcase.ctInView(ins.getNBView(), "cd {vt}/bld/wuce/ver; {ct} ci -nc -iden sys prod sysrel bld iter prodver bldrev extra".format(vt=ins.getVobTag(),ct=bmc.config.get('cleartool')))
def sIncreNBVer(ins): """ Increase nightly build version, e.g. if current version is 02, then increase to 03 """ currVer = clearcase.getNextLabel(ins.getNBView(),ins.getWuceProduct()) l = clearcase.parseLabel(currVer) (incfile,ver) = ('bldrev',int(l[6])) if float(l[2]) >= 5.0: #mainline release greater than 5.0 (incfile,ver) = ('prodver',int(l[5])) clearcase.ctInView(ins.getNBView(), "cd {vt}/bld/wuce/ver; {ct} co -nc {incfile}".format(vt=ins.getVobTag(),ct=bmc.config.get('cleartool'),incfile=incfile)) clearcase.ctInView(ins.getNBView(), "cd {vt}/bld/wuce/ver; echo {ver}>{incfile}".format(vt=ins.getVobTag(),ct=bmc.config.get('cleartool'),ver=ver,incfile=incfile)) clearcase.ctInView(ins.getNBView(), "cd {vt}/bld/wuce/ver; {ct} ci -nc -iden {incfile}".format(vt=ins.getVobTag(),ct=bmc.config.get('cleartool'),incfile=incfile))
def sCheckNBVer(ins): nextLabel = clearcase.getNextLabel(ins.getNBView(),ins.getWuceProduct()) logger.info("next label is {label}".format(label=nextLabel)) if clearcase.isLabelExist(nextLabel): raise Exception("label {nextLabel} exists, maybe previous build is not complished".format(nextLabel=nextLabel))