Exemplo n.º 1
0
def prefix():
    global _prefix
    if _prefix:
        return _prefix
    import cmt

    _prefix = os.path.join(fs.external(), "git", ver(), cmt.macro("tag").strip())
    return _prefix
Exemplo n.º 2
0
def unpack():
    'Unpack the previously downloaded tarfile'
    log.info('unpacking cmt source')
    target = srcdir()
    if os.path.exists(target):
        log.info('CMT appears to already be unpacked in %s'%(target))
        return target
    fs.goto(fs.external(),True)
    untar(tgz())
    return target
Exemplo n.º 3
0
def download():
    'Download CMT source tar file into external area.'
    log.info('downloading cmt tar file')
    target = "%s/%s"%(fs.external(),tgz())
    from get import get
    from exception import InconsistentState
    target = get(url(),target)
    if not os.path.exists(target):
        raise InconsistentState,'Tar file does not exist: %s%s'%(os.getcwd(),tgz())
    return target
Exemplo n.º 4
0
def unpack():
    "Unpack the previously downloaded tarfile"
    log.info("unpacking git source")
    target = srcdir()
    if os.path.exists(target):
        log.info("git appears to already be unpacked in %s" % (target))
        return target
    fs.goto(fs.external(), True)
    untar(tgz())
    return target
Exemplo n.º 5
0
def download():
    "Download GIT source tar file into external area."
    log.info("downloading git tar file")
    target = os.path.join(fs.external(), tgz())
    from get import get
    from exception import InconsistentState

    target = get(url(), target)
    if not os.path.exists(target):
        raise InconsistentState, "Tar file does not exist: %s%s" % (os.getcwd(), tgz())
    return target
Exemplo n.º 6
0
    def build_package(self,pkg,cmds = None):
        '''
    for cmd in get config make install
    do
        echo "$pkg: running \"cmt pkg_$cmd\""
        cmt pkg_$cmd
        check_cmd
    done
        '''
        import fs
        fs.assure(os.path.join(fs.external(),'tarFiles'))
        fs.assure(os.path.join(fs.external(),'build/LCG'))
        
        bdir = self.builder_directory(pkg)
        from exception import InconsistentState
        if bdir is None: 
            raise InconsistentState('No builder directory for "%s"'%pkg)
        
        if not cmds:
            print 'Building %s in %s'%(pkg,bdir)

        pkg = os.path.basename(bdir)
        cmtdir = os.path.join(bdir,'cmt')

        envdir = os.path.join('LCG_Builders',pkg)
        environ = self.env(envdir)

        import fs
        fs.goto(cmtdir)
        
        import cmt
        if not cmds: cmds = ['get','config','make','install']
        for what in cmds:
            print '\t%s'%what
            cmt.cmt('pkg_%s'%what, environ=environ, dir=cmtdir)

        
        fs.goback()
        return
Exemplo n.º 7
0
def check_external():
    'If non-standard external location, make sure it is symlinked'
    from config import cli
    import fs
    path = fs.external()
    extdir = os.path.basename(path)
    base = os.path.dirname(path)
    target = os.path.join(cli.cwd,'external')

    # standard name, standard location
    if extdir == 'external' and os.path.samefile(cli.cwd,base):
        return True
    
    if os.path.exists(target):
        if os.path.islink(target):
            os.remove(target)
        else:
            log.error('External directory is "%s" but need to symlink it from "%s" which is in the way'%(path,target))
            return False
        
    log.info('Making symlink from "%s" to "%s"'%(path,target))
    os.symlink(path,target)
    return True
Exemplo n.º 8
0
def srcdir():
    return fs.external() + '/CMT/'+ver()
Exemplo n.º 9
0
def srcdir():
    return os.path.join(fs.external(), "git-%s" % ver())