def init_pkg(url,pkg): log.info('Initializing %s'%pkg) if not os.path.exists(pkg): os.mkdir(pkg) fs.goto(pkg) if not os.path.exists('.git'): url = 'https://svnweb.cern.ch/guest/gaudi/packages/%s'%pkg cmd('git-svn init -s --prefix=upstream-svn/ %s'%url) cmd('git-svn fetch') fs.goback() if not os.path.exists('.git'): cmd('git init') def need_add(): if os.path.exists('.gitmodules'): fp = open(".gitmodules") lines = map(lambda x: x.strip(), fp.readlines()) if '[submodule "%s"]'%pkg in lines: return False return True if need_add(): cmd('git submodule add %s/%s %s'%(url,pkg,pkg)) fp = open('.git/config') lines = map(lambda x: x.strip(), fp.readlines()) if not '[submodule "%s"]'%pkg in lines: cmd('git submodule init %s'%pkg) cmd('git add %s'%pkg) return
def download(self, cargo): log.info("cmt download") target = "%s/%s" % (self.garpi.go.external(), self.tgz()) from get import get get(self.url(), target) self.check_tgz() return ("CMT_UNPACK", cargo)
def unpack(self, cargo): log.info("cmt unpack") target = self.srcdir() if os.path.exists(target): log.info("CMT appears to already be unpacked in %s" % (target)) return ("CMT_BUILD", cargo) self.garpi.go.external() self.check_tgz() untar(self.tgz()) return ("CMT_BUILD", cargo)
def build(self, cargo): log.info("cmt build") target = self.srcdir() + "/mgr/setup.sh" self.garpi.go.to(self.srcdir() + "/mgr/") if os.path.exists(target): log.info("CMT appears to already have be initialized, found: %s" % target) else: cmd("./INSTALL") env = source2env("setup.sh") cmt = "%s/%s/cmt" % (self.srcdir(), env["CMTCONFIG"]) if os.path.exists(cmt): log.info("CMT appears to already have been built: %s" % cmt) else: cmd("make", env=env) return ("CMT_SETUP", cargo)
def test_info(): print 'calling info' log.info('test') print 'done'