Ejemplo n.º 1
0
def deps_clean(d):
    depstr = data.getVar('__depends', d)
    if depstr:
        deps = depstr.split(" ")
        for dep in deps:
            (f,old_mtime_s) = dep.split("@")
            old_mtime = int(old_mtime_s)
            new_mtime = parse.cached_mtime(f)
            if (new_mtime > old_mtime):
                return False
    return True
Ejemplo n.º 2
0
def load_bbfile( bbfile ):
    """Load and parse one .bb build file"""

    if not cache in [None, '']:
        # get the times
        cache_mtime = data.init_db_mtime(cache, bbfile)
        file_mtime = parse.cached_mtime(bbfile)

        if file_mtime > cache_mtime:
            #print " : '%s' dirty. reparsing..." % bbfile
            pass
        else:
            #print " : '%s' clean. loading from cache..." % bbfile
            cache_data = data.init_db( cache, bbfile, False )
            if deps_clean(cache_data):
                return cache_data, True

    topdir = data.getVar('TOPDIR', cfg)
    if not topdir:
        topdir = os.path.abspath(os.getcwd())
        # set topdir to here
        data.setVar('TOPDIR', topdir, cfg)
    bbfile = os.path.abspath(bbfile)
    bbfile_loc = os.path.abspath(os.path.dirname(bbfile))
    # expand tmpdir to include this topdir
    data.setVar('TMPDIR', data.getVar('TMPDIR', cfg, 1) or "", cfg)
    # set topdir to location of .bb file
    topdir = bbfile_loc
    #data.setVar('TOPDIR', topdir, cfg)
    # go there
    oldpath = os.path.abspath(os.getcwd())
    os.chdir(topdir)
    bb = data.init_db(cache,bbfile, True, cfg)
    try:
        parse.handle(bbfile, bb) # read .bb data
        if not cache in [None, '']:
            bb.commit(parse.cached_mtime(bbfile)) # write cache
        os.chdir(oldpath)
        return bb, False
    finally:
        os.chdir(oldpath)
Ejemplo n.º 3
0
def load_bbfile( bbfile ):
    """Load and parse one .bb build file"""

    if not cache in [None, '']:
        cache_bbfile = bbfile.replace( '/', '_' )

        try:
            cache_mtime = os.stat( "%s/%s" % ( cache, cache_bbfile ) )[8]
        except OSError:
            cache_mtime = 0
        file_mtime = parse.cached_mtime(bbfile)

        if file_mtime > cache_mtime:
            #print " : '%s' dirty. reparsing..." % bbfile
            pass
        else:
            #print " : '%s' clean. loading from cache..." % bbfile
            cache_data = unpickle_bb( cache_bbfile )
            if deps_clean(cache_data):
                return cache_data, True

    topdir = data.getVar('TOPDIR', cfg)
    if not topdir:
        topdir = os.path.abspath(os.getcwd())
        # set topdir to here
        data.setVar('TOPDIR', topdir, cfg)
    bbfile = os.path.abspath(bbfile)
    bbfile_loc = os.path.abspath(os.path.dirname(bbfile))
    # expand tmpdir to include this topdir
    data.setVar('TMPDIR', data.getVar('TMPDIR', cfg, 1) or "", cfg)
    # set topdir to location of .bb file
    topdir = bbfile_loc
    #data.setVar('TOPDIR', topdir, cfg)
    # go there
    oldpath = os.path.abspath(os.getcwd())
    os.chdir(topdir)
    bb = data.createCopy(cfg)
    try:
        parse.handle(bbfile, bb) # read .bb data
        if not cache in [None, '']: pickle_bb( cache_bbfile, bb) # write cache
        os.chdir(oldpath)
        return bb, False
    finally:
        os.chdir(oldpath)