rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
self._categories = "<br>".join(clist)
self._categories = "<br />".join(clist)
def genCategories(self): config = self._request.getConfiguration() root = config["datadir"]
return cache[self._filename]
if cache.has_key(id): return cache[id] else: return None
def getFromCache(self, id): """ Retrieves information from the cache that pertains to this specific id.
if path_info.startswith("/"):
while path_info and path_info.startswith("/"):
def blosxom_process_path_info(args): """ Process HTTP PATH_INFO for URI according to path specifications, fill in data dict accordingly The paths specification looks like this: - C{/foo.html} and C{/cat/foo.html} - file foo.* in / and /cat - C{/cat} - category - C{/2002} - year - C{/2002/Feb} (or 02) - Year and Month ...
timedict = dict([(x, time.strftime('%' + x, timetuple)) for x in list('bmYy')])
timedict = {} for x in ["b", "m", "Y", "y"]: timedict[x] = time.strftime("%" + x, timetuple)
def genLinearArchive(self): config = self._request.getConfiguration() data = self._request.getData() root = config["datadir"] archives = {} archiveList = tools.Walk(self._request, root) fulldict = {} fulldict.update(config) fulldict.update(data) template = config.get('archive_template', '<a href="%(base_url)s/%(Y)s/%(...
if (timedict['Y'] + timedict['m']) not in archives:
if not archives.has_key(timedict['Y'] + timedict['m']):
def genLinearArchive(self): config = self._request.getConfiguration() data = self._request.getData() root = config["datadir"] archives = {} archiveList = tools.Walk(self._request, root) fulldict = {} fulldict.update(config) fulldict.update(data) template = config.get('archive_template', '<a href="%(base_url)s/%(Y)s/%(...
def __init__(self, request, xmlRpcCall=0):
def __init__(self, request):
def __init__(self, request, xmlRpcCall=0): global myrequest myrequest = request
self.xmlRpcCall = xmlRpcCall
def __init__(self, request, xmlRpcCall=0): global myrequest myrequest = request
filelist = [data['root_datadir']]
filelist = []
def defaultFileListHandler(self, args): """ This is the default handler for getting entries. It takes the request object in and figures out which entries based on the default behavior that we want to show and generates a list of EntryBase subclass objects which it returns.
else: data['pi_bl'] = '' data['bl_type'] = 'dir'
def what_ext(path): for ext in data['extensions'].keys(): if os.path.isfile(path + '.' + ext): return ext return None
def register_xmlrpc_methods(): return {'math.add': add,
def cb_xmlrpc_register(args): args["methods"].update( {'math.add': add,
def register_xmlrpc_methods(): return {'math.add': add, 'math.sub': sub, 'system.test': test, 'system.fault': sureFireFault}
'system.fault': sureFireFault}
'system.fault': sureFireFault}) return args
def register_xmlrpc_methods(): return {'math.add': add, 'math.sub': sub, 'system.test': test, 'system.fault': sureFireFault}
self.py['pi_bl'] += '/%s' % path_info.pop(0)
data['pi_bl'] += '/%s' % path_info.pop(0)
def startup(self): data = self._request.getData() pyhttp = self._request.getHttp() config = self._request.getConfiguration()
meta = meta.split(" ", 2)
meta = meta.split(" ", 1)
def blosxom_entry_parser(filename, request): """ Open up a *.txt file and read its contents. The first line becomes the title of the entry. The other lines are the body of the entry. @param filename: A filename to extract data and metadata from @type filename: string @param request: A standard request object @type ...
self['mtime'] = time.mktime(timeTuple) gmTimeTuple = time.gmtime(self['mtime'])
mtime = time.mktime(timeTuple) gmTimeTuple = time.gmtime(mtime) self['mtime'] = mtime
def setTime(self, timeTuple): """ This takes in a given time tuple and sets all the magic metadata variables we have according to the items in the time tuple.
if config["datadir"].endswith(os.sep): config['datadir'] = config['datadir'][:-1]
datadir = config["datadir"] if datadir.endswith("/") or datadir.endswith("\\"): datadir = datadir[:-1] config['datadir'] = datadir
def initialize(self): """ The initialize step further initializes the Request by setting additional information in the _data dict, registering plugins, and entryparsers. """ global VERSION_DATE
if data['pi_bl'] != '':
if os.path.dirname(data['pi_bl']) != '':
def blosxom_process_path_info(args): """ Process HTTP PATH_INFO for URI according to path specifications, fill in data dict accordingly The paths specification looks like this: - C{/cat} - category - C{/2002} - year - C{/2002/Feb} (or 02) - Year and Month - C{/cat/2002/Feb/31} - year and month day in category. - C{/fo...
if path_info[0]:
if path_info and path_info[0]:
def run(self): """ Main loop for pyblosxom. """ config = self._request.getConfiguration() data = self._request.getData() pyhttp = self._request.getHttp()
def __init__(self, request): self._request = request
def __init__(self, config): self._config = config
def __init__(self, request): self._request = request self._referrers ={} self._referrersText = "" self._requestors = {} self._destinations = {}
config = self._request.getConfiguration()
def genReferrers(self): """ Generate the list of referring files """ config = self._request.getConfiguration()
bad_list = string.split(config.get('refer_blacklist',''),',')
bad_list = string.split(self._config.get('refer_blacklist',''),',')
def genReferrers(self): """ Generate the list of referring files """ config = self._request.getConfiguration()
stats = PyblStats(data)
stats = PyblStats(config)
def prepare(args): request = args[0] config = request.getConfiguration() data = request.getData() try: filename = config['logfile']+'.dat' f = file(filename) stats = cPickle.load(f) stats._request = request f.close() except IOError: stats = PyblStats(data) data["referrers"] = stats.genReferrers()
names = os.listdir(root)
try: names = os.listdir(root) except: return []
def _walk_internal( root, recurse, pattern, return_folders ): # initialize result = [] names = os.listdir(root) # check each file for name in names: fullname = os.path.normpath(os.path.join(root, name)) # grab if it matches our pattern and entry type if pattern.match(name): if (os.path.isfile(fullname) and not retur...
pydf.append( ("/usr/share/doc/" + PVER, doc_files) ) pydf.append( ("/usr/share/" + PVER + "/web", ["web/pyblosxom.cgi", "web/xmlrpc.cgi", "web/config.py"]) )
web_files = [os.path.normpath("web/pyblosxom.cgi"), os.path.normpath("web/xmlrpc.cgi"), os.path.normpath("web/config.py")]
def Walk(root='.'): """ A really really scaled down version of what we have in tools.py. """ # initialize result = [] # must have at least root folder try: names = os.listdir(root) except os.error: return result # check each file for name in names: if name == "CVS": continue fullname = os.path.normpath(os.path.join(r...
try: eparser = data['extensions'][fileExt] entrydict = eparser(self._filename, self._request) self.addToCache(self._filename, entrydict) except IOError: return None
eparser = data['extensions'][fileExt] entrydict = eparser(self._filename, self._request) self.addToCache(self._filename, entrydict)
def __populateData(self): """ Fills the metadata dict with metadata about the given file. This metadata consists of things we pick up from an os.stat call as well as knowledge of the filename and the root directory. We then parse the file and fill in the rest of the information that we know. """ file_basename = os.pat...
fileurlpattern = r'(?:http|https|file|ftp)\:' + '[\/\-\_\.\w]+[\/\w][\?\&\+\=\%\w\/\-\_\.]*'
fileurlpattern = r'(?:http|https|file|ftp)\:[\/\-\_\.\w]+[\/\w][\?\&\+\=\%\w\/\-\_\.]*'
def parse(self): # url of your wiki up to page name wikibaseurl = "http://ourpla.net/cgi/pikie?" # WikiName pattern used in your wiki wikinamepattern = r'\b(([A-Z]+[a-z]+){2,})\b' # original mailurlpattern = r'mailto\:[\"\-\_\.\w]+\@[\-\_\.\w]+\w' newsurlpattern = r'news\:(?:\w+\.){1,}\w+' fileurlpattern = r'(?:http|ht...
self._filename = filename.replace('\\', '/') self._root = root.replace('\\', '/')
self._filename = filename.replace(os.sep, '/') self._root = root.replace(os.sep, '/')
def __init__(self, request, filename, root, datadir=""): """ @param request: the Request object @type request: Request
if type(entry_list) == type([]):
if isinstance(entry_list, list):
def blosxom_handler(request): """ This is the default blosxom handler. """ config = request.getConfiguration() data = request.getData() # go through the renderer callback to see if anyone else # wants to render. this renderer gets stored in the data dict # for downstream processing. r = tools.run_callback('renderer'...
try: story = open(filename).readlines() except IOError: raise IOError
story = open(filename).readlines()
def blosxom_entry_parser(filename, request): """ Open up a *.txt file and read its contents. The first line becomes the title of the entry. The other lines are the body of the entry. @param filename: A filename to extract data and metadata from @type filename: string @param request: A standard request object @type ...
file_path = os.path.join(absolute_path, fn)
file_path = '/'.join((absolute_path.rstrip('/'), fn))
def __populateData(self): """ Fills the metadata dict with metadata about the given file. This metadata consists of things we pick up from an os.stat call as well as knowledge of the filename and the root directory. We then parse the file and fill in the rest of the information that we know. """ file_basename = os.pat...
results = os.popen(JAVA_HOME+' -cp '+classpath+' LuceneSearch '+index+' '+term,'r').readlines()
cmd =JAVA_HOME+' -cp '+classpath+' LuceneSearch '+index+' '+term pipe = os.popen(cmd,'r') results = pipe.readlines() status = pipe.close()
def search(config, term): """ Search for the specified search term @param config: a pyblosxom config dict @type config: a dict @param term: the search term @type term: a string """ urllib.quote(term) JAVA_HOME=config['JAVA_HOME'] classpath = ':'.join(glob.glob(config['lucene_home']+'/*.jar')+[config['lucene_bin']]) ...
if re.search(r'\Wxml', data['content-type']): quotes = {"'":"&apos;", '"':"&quot;"}
if data["content-type"] == "text/xml": quotes = {"'": "&apos;", '"': "&quot;"}
def _processEntry(self, entry, current_date): """ Main workhorse of pyblosxom stories, comments and other miscelany goes here
datadir = config["datadir"]
def _getFlavour(self, taste='html'): """ Flavours, or views, or templates, as some may call it, defaults are given, but can be overidden with files on the datadir. Don't like the default html templates, add your own, head.html, story.html etc. """ data = self._request.getData() config = self._request.getConfiguration()
template_files = tools.Walk(self._request, dirname, 1, pattern)
template_files = None while dirname != datadir: template_files = tools.Walk(self._request, dirname, 1, pattern) if template_files: break dirname = os.path.split(dirname)[0]
def _getFlavour(self, taste='html'): """ Flavours, or views, or templates, as some may call it, defaults are given, but can be overidden with files on the datadir. Don't like the default html templates, add your own, head.html, story.html etc. """ data = self._request.getData() config = self._request.getConfiguration()
html = {'content_type' : 'text/html', 'head' : """<html><head><link rel="alternate" type="application/rss+xml" title="RSS" href="$url/?flav=rss" /><title>$blog_title $pi_da $pi_mo $pi_yr</title></head><body><center><font size="+3">$blog_title</font><br />$pi_da $pi_mo $pi_yr</center><p />""", 'date_head' : '<div class=...
def _getFlavour(self, taste = 'html'): """ Flavours, or views, or templates, as some may call it, defaults are given, but can be overidden with files on the datadir. Don't like the default html templates, add your own, head.html, story.html etc. """ # Ugly default templates, have to though :( html = {'content_type' : '...
custom_flavours = config.get('blosxom_custom_flavours', []) if custom_flavours: custom_flavours = "|" + "|".join(custom_flavours) else: custom_flavours = "" pattern = re.compile(r'(content_type|head|date_head|date_foot|foot|story'+custom_flavours+')\.' + taste) flavourlist = tools.Walk(self._request, data['root_datadi...
pattern = re.compile(r'.+?\.' + taste + '$') dirname = data["root_datadir"] if os.path.isfile(dirname): dirname = os.path.dirname(dirname) template_files = tools.Walk(self._request, dirname, 1, pattern) if not template_files: template_files = tools.Walk(self._request, config['datadir'], 1, pattern) flavour = {} fl...
def _getFlavour(self, taste = 'html'): """ Flavours, or views, or templates, as some may call it, defaults are given, but can be overidden with files on the datadir. Don't like the default html templates, add your own, head.html, story.html etc. """ # Ugly default templates, have to though :( html = {'content_type' : '...
if flavours.has_key(flavouring[1]): flavours[flavouring[1]][flavouring[0]] = flav_template else: flavours[flavouring[1]] = {flavouring[0]: flav_template} if not flavours.has_key(taste): taste = 'error' return flavours[taste]
flavour[flavouring[0]] = flav_template if not flavour: return DEFAULT_FLAVOURS["error"] return flavour
def _getFlavour(self, taste = 'html'): """ Flavours, or views, or templates, as some may call it, defaults are given, but can be overidden with files on the datadir. Don't like the default html templates, add your own, head.html, story.html etc. """ # Ugly default templates, have to though :( html = {'content_type' : '...
bb.msg.debug(3, bb.msg.domain.TaskData, self.build_names_index)
bb.msg.debug(3, bb.msg.domain.TaskData, ", ".join(self.build_names_index))
def dump_data(self): """ Dump some debug information on the internal data structures """ bb.msg.debug(3, bb.msg.domain.TaskData, "build_names:") bb.msg.debug(3, bb.msg.domain.TaskData, self.build_names_index) bb.msg.debug(3, bb.msg.domain.TaskData, "run_names:") bb.msg.debug(3, bb.msg.domain.TaskData, self.run_names_in...
bb.msg.debug(3, bb.msg.domain.TaskData, self.run_names_index)
bb.msg.debug(3, bb.msg.domain.TaskData, ", ".join(self.run_names_index))
def dump_data(self): """ Dump some debug information on the internal data structures """ bb.msg.debug(3, bb.msg.domain.TaskData, "build_names:") bb.msg.debug(3, bb.msg.domain.TaskData, self.build_names_index) bb.msg.debug(3, bb.msg.domain.TaskData, "run_names:") bb.msg.debug(3, bb.msg.domain.TaskData, self.run_names_in...
os.chdir(prevdir)
if os.path.exists(prevdir): os.chdir(prevdir)
def exec_func(func, d, dirs = None): """Execute an BB 'function'""" body = data.getVar(func, d) if not body: return if not dirs: dirs = (data.getVarFlag(func, 'dirs', d) or "").split() for adir in dirs: adir = data.expand(adir, d) mkdirhier(adir) if len(dirs) > 0: adir = dirs[-1] else: adir = data.getVar('B', d, 1) ...
self.tryBuildPackage( os.path.abspath( bf ), item, bbfile_data )
data.setVar( "_task_cache", [], bbfile_data ) cooker.tryBuildPackage( os.path.abspath( bf ), item, bbfile_data ) make.options.cmd = oldcmd
def fileBuildCommand( params, cmd = "build" ): """Parse and build a .bb file""" name = params[0] bf = completeFilePath( name ) try: bbfile_data = parse.handle( bf, make.cfg ) except IOError: print "ERROR: Unable to open %s" % bf else: item = data.getVar('PN', bbfile_data, 1) self.tryBuildPackage( os.path.abspath( bf )...
print "NYI"
fileBuildCommand( params, "clean" ) def fileRebuildCommand( params ): """Rebuild (clean & build) a .bb file""" fileCleanCommand( params ) fileBuildCommand( params )
def fileCleanCommand( params ): print "NYI"
for cmd, (function,numparams,usage,helptext) in cmds.items():
allcmds = cmds.keys() allcmds.sort() for cmd in allcmds: function,numparams,usage,helptext = cmds[cmd]
def showHelp( *args ): """Show a comprehensive list of commands and their purpose""" print "="*35, "Available Commands", "="*35 for cmd, (function,numparams,usage,helptext) in cmds.items(): print "| %s | %s" % (usage.ljust(35), helptext) print "="*88
bb.error("The lines resulting into thiis error were:")
bb.error("The lines resulting into this error were:")
def better_compile(text, file, realfile): """ A better compile method. This method will print the offending lines. """ try: return compile(text, file, "exec") except Exception, e: import bb,sys # split the text into lines again body = text.split('\n') bb.error("Error in compiling: ", realfile) bb.error("The lines res...
"GPL QPL" : True
"GPL QPL" : True,
def maintainer2(): return lambda fn, value : [None,TestItem(fn,False,"You forgot to put an e-mail address into MAINTAINER"),None] [value.find("@") == -1]
bb.msg.debug_level[ddomain] = 2 else: std_warn("Logging domain %s is not valid, ignoring" % domain)
bb.msg.debug_level[ddomain] = bb.msg.debug_level[ddomain] + 1 found = True if not found: std_warn("Logging domain %s is not valid, ignoring" % domain)
def set_debug_domains(domains): for domain in domains: for ddomain in bb.msg.domain: if domain == str(ddomain): bb.msg.debug_level[ddomain] = 2 else: std_warn("Logging domain %s is not valid, ignoring" % domain)
self.bbfile = name
self.bbfile = os.path.abspath( name )
def __init__(self,cache,name,clean,parent): """ Construct a persistent data instance """ #Initialize the dictionary DataSmart.__init__(self)
if bb.msg.debug_level > 0: f.write("set -x\n")
if bb.msg.debug_level['general'] > 0: f.write("set -x\n")
def exec_func_shell(func, d): """Execute a shell BB 'function' Returns true if execution was successful. For this, it creates a bash shell script in the tmp dectory, writes the local data into it and finally executes. The output of the shell will end in a log file and stdout. Note on directory behavior. The 'dirs' v...
if bb.msg.debug_level > 0:
if bb.msg.debug_level['general'] > 0:
def exec_func_shell(func, d): """Execute a shell BB 'function' Returns true if execution was successful. For this, it creates a bash shell script in the tmp dectory, writes the local data into it and finally executes. The output of the shell will end in a log file and stdout. Note on directory behavior. The 'dirs' v...
a = COWBase
a = COWBase.copy()
def testGetSet(self): """ Test and set """ from bb.COW import COWBase a = COWBase
b = COWBase c = COWBase
b = COWBase.copy() c = COWBase.copy()
def testCopyCopy(self): """ Test the copy of copies """
self.assertEquals(10, a['a'])
self.assertEquals(10, b['a'])
def testCopyCopy(self): """ Test the copy of copies """
self.assertEquals(40, b_2.haskey('d'))
self.assertEquals(40, b_2['d'])
def testCopyCopy(self): """ Test the copy of copies """
self.assertEquals(False, b_3.haskey('e'))
self.assertEquals(True, b_3.haskey('e'))
def testCopyCopy(self): """ Test the copy of copies """
c = COWBase
c = COWBase.copy()
def testCow(self): from bb.COW import COWBase c = COWBase c['123'] = 1027 c['other'] = 4711 c['d'] = { 'abc' : 10, 'bcd' : 20 }
self.dump_data(taskData)
def mark_active(listid, depth): """ Mark an item as active along with its depends (calls itself recursively) """
task = self.prio_map[task1] bb.msg.debug(3, bb.msg.domain.RunQueue, " (%s)%s - %s: %s Deps %s RevDeps %s" % (task,
if task1 in self.prio_map: task = self.prio_map[task1] bb.msg.debug(3, bb.msg.domain.RunQueue, " (%s)%s - %s: %s Deps %s RevDeps %s" % (task,
def dump_data(self, taskQueue): """ Dump some debug information on the internal data structures """ bb.msg.debug(3, bb.msg.domain.RunQueue, "run_tasks:") for task in range(len(self.runq_fnid)): bb.msg.debug(3, bb.msg.domain.RunQueue, " (%s)%s - %s: %s Deps %s RevDeps %s" % (task, taskQueue.fn_index[self.runq_fnid[tas...
if 'rev' in parm:
if 'rev' in ud.parm:
def localpath(self, url, ud, d): if not "module" in ud.parm: raise MissingParameterError("svn method needs a 'module' parameter") else: ud.module = ud.parm["module"]
bbfile_data = parse.handle( bf, cooker.configuration.data )
bbfile_data = parse.handle( bf, thisdata )
def fileBuild( self, params, cmd = "build" ): """Parse and build a .bb file""" name = params[0] bf = completeFilePath( name ) print "SHELL: Calling '%s' on '%s'" % ( cmd, bf )
if bb.msg.debug_level['general'] > 0: f.write("set -x\n")
if bb.msg.debug_level['default'] > 0: f.write("set -x\n")
def exec_func_shell(func, d): """Execute a shell BB 'function' Returns true if execution was successful. For this, it creates a bash shell script in the tmp dectory, writes the local data into it and finally executes. The output of the shell will end in a log file and stdout. Note on directory behavior. The 'dirs' v...
if bb.msg.debug_level['general'] > 0:
if bb.msg.debug_level['default'] > 0:
def exec_func_shell(func, d): """Execute a shell BB 'function' Returns true if execution was successful. For this, it creates a bash shell script in the tmp dectory, writes the local data into it and finally executes. The output of the shell will end in a log file and stdout. Note on directory behavior. The 'dirs' v...
print "exited"
pass
def __init__(self): self.__dict__ = { 'abort' : False, 'interactive' : False, 'force' : False, 'cmd' : 'build', 'file' : [], 'verbose' : False, 'debug' : 0, 'dry_run' : False, 'parse_only' : False, 'disable_psyco' : False, 'show_versions' : False, 'show_environment' : False, 'buildfile' : None }
print "exited"
pass
def __init__(self): self.__dict__ = { 'abort' : False, 'interactive' : False, 'force' : False, 'cmd' : 'build', 'file' : [], 'verbose' : False, 'debug' : 0, 'dry_run' : False, 'parse_only' : False, 'disable_psyco' : False, 'show_versions' : True, 'show_environment' : False, 'buildfile' : None }
bb.error("BUG init called with None as data object!!!") import traceback traceback.print_stack()
bb.debug(2,"BUG init called with None as data object!!!")
def init(urls = [], d = None): if d == None: bb.error("BUG init called with None as data object!!!") import traceback traceback.print_stack() return for m in methods: m.urls = [] for u in urls: for m in methods: m.data = d if m.supports(u, d): m.urls.append(u)
ververify(myrev, 0)
ververify(myrev, silent)
def pkgsplit(mypkg, silent=1): """This function can be used as a package verification function. If it is a valid name, pkgsplit will return a list containing: [pkgname, pkgversion(norev), pkgrev ]. >>> pkgsplit('') >>> pkgsplit('x') >>> pkgsplit('x-') >>> pkgsplit('-1') >>> pkgsplit('glibc-1.2-8.9-r7') >>> pkgsplit('...
os.chdir(prevdir)
try: os.chdir(prevdir) except: pass
def exec_func_shell(func, d): """Execute a shell BB 'function' Returns true if execution was successful. For this, it creates a bash shell script in the tmp dectory, writes the local data into it and finally executes. The output of the shell will end in a log file and stdout. Note on directory behavior. The 'dirs' v...
bb.msg.debug(2, bb.msg.domain.RunQueue, "Stamp current task %s (%s)" % (task, self.get_user_idstring(task, taskData))) runq_running[task] = 1 task_complete(self, task) continue
targetid = taskData.gettask_id(fn, taskname) if not (targetid in taskData.external_targets and cooker.configuration.force): bb.msg.debug(2, bb.msg.domain.RunQueue, "Stamp current task %s (%s)" % (task, self.get_user_idstring(task, taskData))) runq_running[task] = 1 task_complete(self, task) continue
def task_complete(data, task): """ Mark a task as completed Look at the reverse dependencies and mark any task with completed dependencies as buildable """ runq_complete[task] = 1 for revdep in data.runq_revdeps[task]: if runq_running[revdep] == 1: continue if runq_buildable[revdep] == 1: continue alldeps = 1 for dep i...
if os.path.join('classes', '%s.bbclass' % klass) in val:
if os.path.join('classes', '%s.bbclass' % klass) in val.split():
def inherits_class(klass, d): val = getVar('__inherit_cache', d) or [] if os.path.join('classes', '%s.bbclass' % klass) in val: return True return False
print "ERROR: %s %s" % ( response.status, response.reason )
print "ERROR: %s %s" % ( status, error )
def pasteBin( self, params ): """Send a command + output buffer to http://pastebin.com""" index = params[0] contents = self._shell.myout.buffer( int( index ) ) status, error, location = sendToPastebin( contents ) if status == 302: print "SHELL: Pasted to %s" % location else: print "ERROR: %s %s" % ( response.status, re...
print "ERROR: %s %s" % ( response.status, response.reason )
print "ERROR: %s %s" % ( status, error )
def pasteLog( self, params ): """Send the last event exception error log (if there is one) to http://pastebin.com""" if last_exception is None: print "SHELL: No Errors yet (Phew)..." else: reason, event = last_exception.args print "SHELL: Reason for the last error: '%s'" % reason if ':' in reason: msg, filename = reaso...
if target in self.failed_deps:
if self.build_names_index.index(target) in self.failed_deps:
def get_unresolved_build_targets(self, dataCache): """ Return a list of build targets who's providers are unknown. """ unresolved = [] for target in self.build_names_index: if target in dataCache.ignored_dependencies: continue if target in self.failed_deps: continue if not self.have_build_target(target): unresolved.app...
if target in self.failed_rdeps:
if self.run_names_index.index(target) in self.failed_rdeps:
def get_unresolved_run_targets(self, dataCache): """ Return a list of runtime targets who's providers are unknown. """ unresolved = [] for target in self.run_names_index: if target in dataCache.ignored_dependencies: continue if target in self.failed_rdeps: continue if not self.have_runtime_target(target): unresolved.ap...
_task_cache = []
def exec_func_shell(func, d): """Execute a shell BB 'function' Returns true if execution was successful. For this, it creates a bash shell script in the tmp dectory, writes the local data into it and finally executes. The output of the shell will end in a log file and stdout. Note on directory behavior. The 'dirs' v...
cooker.buildProvider( name )
cooker.buildProvider( name, data.getVar("BUILD_ALL_DEPS", cooker.configuration.data, True) )
def build( self, params, cmd = "build" ): """Build a providee""" globexpr = params[0] self._checkParsed() names = globfilter( cooker.status.pkg_pn.keys(), globexpr ) if len( names ) == 0: names = [ globexpr ] print "SHELL: Building %s" % ' '.join( names )
Check to see if a given url can be fetched with cvs.
Check to see if a given url can be fetched with git.
def supports(self, url, ud, d): """ Check to see if a given url can be fetched with cvs. """ return ud.type in ['git']
svncmd = "svn co -r %s %s://%s/%s" % (proto, revision, svnroot, module)
svncmd = "svn co -r %s %s://%s/%s" % (revision, proto, svnroot, module)
def go(self, d = bb.data.init(), urls = []): """Fetch urls""" if not urls: urls = self.urls
bb.msg.debug_level = level
bb.msg.debug_level = {} for domain in bb.msg.domain: bb.msg.debug_level[domain] = level bb.msg.debug_level['default'] = level
def set_debug_level(level): bb.msg.debug_level = level
std_debug(level, msg)
if debug_level[domain] >= level: print 'DEBUG: ' + msg
def debug(level, domain, msg, fn = None): std_debug(level, msg)
if level == 1 or verbose:
if level == 1 or verbose or debug_level[domain] >= 1:
def note(level, domain, msg, fn = None): if level == 1 or verbose: std_note(msg)
if debug_level >= lvl:
if debug_level['default'] >= lvl:
def std_debug(lvl, msg): if debug_level >= lvl: print 'DEBUG: ' + msg
if not attr.startswith( "__" ):
if not attr.startswith( "_" ):
def __init__( self, shell ): """Register all the commands""" self._shell = shell for attr in BitBakeShellCommands.__dict__: if not attr.startswith( "__" ): if attr.endswith( "_" ): command = attr[:-1].lower() else: command = attr[:].lower() method = getattr( BitBakeShellCommands, attr ) if debug: print "registering com...
if debug: print "registering command '%s'" % command
debugOut( "registering command '%s'" % command )
def __init__( self, shell ): """Register all the commands""" self._shell = shell for attr in BitBakeShellCommands.__dict__: if not attr.startswith( "__" ): if attr.endswith( "_" ): command = attr[:-1].lower() else: command = attr[:].lower() method = getattr( BitBakeShellCommands, attr ) if debug: print "registering com...
if not parsed: print "SHELL: D'oh! The .bb files haven't been parsed yet. Next time call 'parse' before building stuff. This time I'll do it for 'ya." self.parse( None )
self._checkParsed()
def build( self, params, cmd = "build" ): """Build a providee""" name = params[0]
if debug: print "(setting leave_mainloop to true)"
debugOut( "setting leave_mainloop to true" )
def exit_( self, params ): """Leave the BitBake Shell""" if debug: print "(setting leave_mainloop to true)" global leave_mainloop leave_mainloop = True
def print_( self, params ): """Print the contents of an outer BitBake environment variable"""
def getvar( self, params ): """Dump the contents of an outer BitBake environment variable"""
def print_( self, params ): """Print the contents of an outer BitBake environment variable""" var = params[0] value = data.getVar( var, make.cfg, 1 ) print value
print_.usage = "<variable>"
getvar.usage = "<variable>" def print_( self, params ): """Dump all files or providers""" what = params[0] if what == "files": self._checkParsed() for i in make.pkgdata.keys(): print i elif what == "providers": self._checkParsed() for i in cooker.status.providers.keys(): print i else: print "Usage: print %s" % self.pr...
def print_( self, params ): """Print the contents of an outer BitBake environment variable""" var = params[0] value = data.getVar( var, make.cfg, 1 ) print value
if not parsed: print "SHELL: D'oh! The .bb files haven't been parsed yet. Next time call 'parse' before building stuff. This time I'll do it for 'ya." self.parse( None )
self._checkParsed()
def which( self, params ): """Computes the providers for a given providee""" item = params[0]
if debug: print "(completer called with text='%s', state='%d'" % ( text, state )
debugOut( "completer called with text='%s', state='%d'" % ( text, state ) )
def completer( text, state ): """Return a possible readline completion""" if debug: print "(completer called with text='%s', state='%d'" % ( text, state ) if state == 0: line = readline.get_line_buffer() if " " in line: line = line.split() # we are in second (or more) argument if line[0] in cmds and hasattr( cmds[line...
self.delegate.write( text )
if self.delegate is not None: self.delegate.write( text )
def write( self, text ): if self._command is not None and text != "BB>> ": self.text.append( text ) self.delegate.write( text )
if debug: print "(writing command history)"
debugOut( "writing command history" )
def cleanup( self ): """Write readline history and clean up resources""" if debug: print "(writing command history)" try: global history_file readline.write_history_file( history_file ) except: print "SHELL: Unable to save command history"
if debug: print "(processing command '%s'...)" % command
debugOut( "processing command '%s'..." % command )
def processCommand( self, command, params ): """Process a command. Check number of params and print a usage string, if appropriate""" if debug: print "(processing command '%s'...)" % command try: function, numparams, usage, helptext = cmds[command] except KeyError: print "SHELL: ERROR: '%s' command is not a valid comma...
if debug: print "(result was '%s')" % result
debugOut( "result was '%s'" % result )
def processCommand( self, command, params ): """Process a command. Check number of params and print a usage string, if appropriate""" if debug: print "(processing command '%s'...)" % command try: function, numparams, usage, helptext = cmds[command] except KeyError: print "SHELL: ERROR: '%s' command is not a valid comma...
commands = cmdline.split( ';' ) for command in commands:
allCommands = cmdline.split( ';' ) for command in allCommands: pipecmd = None
def main( self ): """The main command loop""" while not leave_mainloop: try: sys.stdout = self.myout.delegate cmdline = raw_input( "BB>> " ) sys.stdout = self.myout if cmdline: commands = cmdline.split( ';' ) for command in commands: self.myout.startCommand( command ) if ' ' in command: self.processCommand( command.spl...
def linkDataSet(self,parent): if not parent == None:
def linkDataSet(self): if not self.parent == None:
def linkDataSet(self,parent): if not parent == None: # assume parent is a DataSmartInstance self.dict = copy.deepcopy(parent.dict)
self.dict = copy.deepcopy(parent.dict)
self.dict["_data"] = self.parent.dict
def linkDataSet(self,parent): if not parent == None: # assume parent is a DataSmartInstance self.dict = copy.deepcopy(parent.dict)
self.linkDataSet(parent)
self.linkDataSet()
def __init__(self,cache,name,clean,parent): """ Construct a persistent data instance """ #Initialize the dictionary DataSmart.__init__(self)
self.runq_depends.append(depends) self.runq_revdeps.append([])
self.runq_depends.append(Set(depends)) self.runq_revdeps.append(Set())
def add_recursive_run(rdepid): """ Add runtime depends of rdepid to depends, if we've not see it before (calls itself recursively) """ if str(rdepid) in rdep_seen: return rdep_seen.append(rdepid) if rdepid in taskData.run_targets: depdata = taskData.run_targets[rdepid][0] if depdata: dep = taskData.fn_index[depdata] ta...
self.runq_depends[listid] = newdeps
self.runq_depends[listid] = Set(newdeps)
def mark_active(listid, depth): """ Mark an item as active along with its depends (calls itself recursively) """
if dep not in self.runq_revdeps[dep]: self.runq_revdeps[dep].append(listid)
self.runq_revdeps[dep].add(listid)
def mark_active(listid, depth): """ Mark an item as active along with its depends (calls itself recursively) """
bb.msg.fatal(bb.msg.domain.RunQueue, "Task %s (%s) not processed!" % (task, self.get_user_idstring(task, taskData)))
seen = [] def print_chain(taskid): seen.append(taskid) for revdep in self.runq_revdeps[taskid]: if runq_done[revdep] == 0: bb.msg.error(bb.msg.domain.RunQueue, "Task %s (%s) (depends: %s)" % (revdep, self.get_user_idstring(revdep, taskData), self.runq_depends[revdep])) if revdep not in seen: print_chain(revdep) print_c...
def mark_active(listid, depth): """ Mark an item as active along with its depends (calls itself recursively) """
make.options.cmd = oldcmd def fileCleanCommand( params ): """Clean a .bb file""" fileBuildCommand( params, "clean" ) def fileRebuildCommand( params ): """Rebuild (clean & build) a .bb file""" fileCleanCommand( params ) fileBuildCommand( params ) def lastErrorCommand( params ): """Show the reason or log that was prod...
make.options.cmd = oldcmd build.usage = "<providee>" def clean( self, params ): """Clean a providee""" self.build( params, "clean" ) clean.usage = "<providee>" def edit( self, params ): """Call $EDITOR on a .bb file""" name = params[0] os.system( "%s %s" % ( os.environ.get( "EDITOR", "vi" ), completeFilePath( name ) ...
def fileBuildCommand( params, cmd = "build" ): """Parse and build a .bb file""" name = params[0] bf = completeFilePath( name ) print "SHELL: Calling '%s' on '%s'" % ( cmd, bf ) oldcmd = make.options.cmd make.options.cmd = cmd cooker.build_cache = [] cooker.build_cache_fail = [] try: bbfile_data = parse.handle( bf, ma...