def load_bbfile( self, bbfile , config): """ Load and parse one .bb build file Return the data and whether parsing resulted in the file being skipped """ import bb from bb import utils, data, parse, debug, event, fatal # expand tmpdir to include this topdir data.setVar('TMPDIR', data.getVar('TMPDIR', config, 1) or "", config) bbfile_loc = os.path.abspath(os.path.dirname(bbfile)) oldpath = os.path.abspath(os.getcwd()) if self.mtime(bbfile_loc): os.chdir(bbfile_loc) bb_data = data.init_db(config) try: bb_data = parse.handle(bbfile, bb_data) # read .bb data os.chdir(oldpath) return bb_data, False except bb.parse.SkipPackage: os.chdir(oldpath) return bb_data, True except: os.chdir(oldpath) raise
def load_bbfile(bbfile, appends, config): """ Load and parse one .bb build file Return the data and whether parsing resulted in the file being skipped """ chdir_back = False from bb import data, parse # expand tmpdir to include this topdir data.setVar('TMPDIR', data.getVar('TMPDIR', config, 1) or "", config) bbfile_loc = os.path.abspath(os.path.dirname(bbfile)) oldpath = os.path.abspath(os.getcwd()) parse.cached_mtime_noerror(bbfile_loc) bb_data = data.init_db(config) # The ConfHandler first looks if there is a TOPDIR and if not # then it would call getcwd(). # Previously, we chdir()ed to bbfile_loc, called the handler # and finally chdir()ed back, a couple of thousand times. We now # just fill in TOPDIR to point to bbfile_loc if there is no TOPDIR yet. if not data.getVar('TOPDIR', bb_data): chdir_back = True data.setVar('TOPDIR', bbfile_loc, bb_data) try: if appends: data.setVar('__BBAPPEND', " ".join(appends), bb_data) bb_data = parse.handle(bbfile, bb_data) if chdir_back: os.chdir(oldpath) return bb_data except: if chdir_back: os.chdir(oldpath) raise
def load_bbfile( self, bbfile , config): """ Load and parse one .bb build file Return the data and whether parsing resulted in the file being skipped """ import bb from bb import utils, data, parse, debug, event, fatal # expand tmpdir to include this topdir data.setVar('TMPDIR', data.getVar('TMPDIR', config, 1) or "", config) bbfile_loc = os.path.abspath(os.path.dirname(bbfile)) oldpath = os.path.abspath(os.getcwd()) if bb.parse.cached_mtime_noerror(bbfile_loc): os.chdir(bbfile_loc) bb_data = data.init_db(config) try: bb_data = parse.handle(bbfile, bb_data) # read .bb data os.chdir(oldpath) return bb_data, False except bb.parse.SkipPackage: os.chdir(oldpath) return bb_data, True except: os.chdir(oldpath) raise
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)
def load_bbfile( self, bbfile , cooker): """ Load and parse one .bb build file Return the data and whether parsing resulted in the file being skipped """ import bb from bb import utils, data, parse, debug, event, fatal topdir = data.getVar('TOPDIR', cooker.configuration.data) if not topdir: topdir = os.path.abspath(os.getcwd()) # set topdir to here data.setVar('TOPDIR', topdir, cooker.configuration) 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', cooker.configuration.data, 1) or "", cooker.configuration.data) # set topdir to location of .bb file topdir = bbfile_loc #data.setVar('TOPDIR', topdir, cfg) # go there oldpath = os.path.abspath(os.getcwd()) if self.mtime(topdir): os.chdir(topdir) bb_data = data.init_db(cooker.configuration.data) try: parse.handle(bbfile, bb_data) # read .bb data os.chdir(oldpath) return bb_data, False except bb.parse.SkipPackage: os.chdir(oldpath) return bb_data, True except: os.chdir(oldpath) raise