summaryrefslogtreecommitdiff
path: root/bitbake/lib
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/COW.py323
-rw-r--r--bitbake/lib/bb/__init__.py100
-rw-r--r--bitbake/lib/bb/build.py446
-rw-r--r--bitbake/lib/bb/cache.py559
-rw-r--r--bitbake/lib/bb/codeparser.py329
-rw-r--r--bitbake/lib/bb/command.py280
-rw-r--r--bitbake/lib/bb/cooker.py1034
-rw-r--r--bitbake/lib/bb/daemonize.py190
-rw-r--r--bitbake/lib/bb/data.py330
-rw-r--r--bitbake/lib/bb/data_smart.py371
-rw-r--r--bitbake/lib/bb/event.py300
-rw-r--r--bitbake/lib/bb/fetch/__init__.py789
-rw-r--r--bitbake/lib/bb/fetch/bzr.py147
-rw-r--r--bitbake/lib/bb/fetch/cvs.py177
-rw-r--r--bitbake/lib/bb/fetch/git.py254
-rw-r--r--bitbake/lib/bb/fetch/hg.py172
-rw-r--r--bitbake/lib/bb/fetch/local.py73
-rw-r--r--bitbake/lib/bb/fetch/osc.py150
-rw-r--r--bitbake/lib/bb/fetch/perforce.py208
-rw-r--r--bitbake/lib/bb/fetch/repo.py105
-rw-r--r--bitbake/lib/bb/fetch/ssh.py118
-rw-r--r--bitbake/lib/bb/fetch/svk.py106
-rw-r--r--bitbake/lib/bb/fetch/svn.py201
-rw-r--r--bitbake/lib/bb/fetch/wget.py95
-rw-r--r--bitbake/lib/bb/methodpool.py84
-rw-r--r--bitbake/lib/bb/msg.py144
-rw-r--r--bitbake/lib/bb/parse/__init__.py118
-rw-r--r--bitbake/lib/bb/parse/ast.py445
-rw-r--r--bitbake/lib/bb/parse/parse_py/BBHandler.py242
-rw-r--r--bitbake/lib/bb/parse/parse_py/ConfHandler.py138
-rw-r--r--bitbake/lib/bb/parse/parse_py/__init__.py33
-rw-r--r--bitbake/lib/bb/persist_data.py133
-rw-r--r--bitbake/lib/bb/providers.py323
-rw-r--r--bitbake/lib/bb/runqueue.py1591
-rw-r--r--bitbake/lib/bb/server/__init__.py0
-rw-r--r--bitbake/lib/bb/server/none.py191
-rw-r--r--bitbake/lib/bb/server/xmlrpc.py199
-rw-r--r--bitbake/lib/bb/shell.py824
-rw-r--r--bitbake/lib/bb/siggen.py265
-rw-r--r--bitbake/lib/bb/taskdata.py587
-rw-r--r--bitbake/lib/bb/ui/__init__.py17
-rw-r--r--bitbake/lib/bb/ui/crumbs/__init__.py17
-rw-r--r--bitbake/lib/bb/ui/crumbs/buildmanager.py455
-rw-r--r--bitbake/lib/bb/ui/crumbs/puccho.glade606
-rw-r--r--bitbake/lib/bb/ui/crumbs/runningbuild.py178
-rw-r--r--bitbake/lib/bb/ui/depexp.py271
-rw-r--r--bitbake/lib/bb/ui/goggle.py76
-rw-r--r--bitbake/lib/bb/ui/knotty.py192
-rw-r--r--bitbake/lib/bb/ui/ncurses.py336
-rw-r--r--bitbake/lib/bb/ui/puccho.py425
-rw-r--r--bitbake/lib/bb/ui/uievent.py124
-rw-r--r--bitbake/lib/bb/ui/uihelper.py50
-rw-r--r--bitbake/lib/bb/utils.py762
-rw-r--r--bitbake/lib/codegen.py570
-rw-r--r--bitbake/lib/ply/__init__.py4
-rw-r--r--bitbake/lib/ply/lex.py1058
-rw-r--r--bitbake/lib/ply/yacc.py3276
-rw-r--r--bitbake/lib/pysh/__init__.py0
-rw-r--r--bitbake/lib/pysh/builtin.py710
-rw-r--r--bitbake/lib/pysh/interp.py1367
-rw-r--r--bitbake/lib/pysh/lsprof.py116
-rw-r--r--bitbake/lib/pysh/pysh.py167
-rw-r--r--bitbake/lib/pysh/pyshlex.py888
-rw-r--r--bitbake/lib/pysh/pyshyacc.py772
-rw-r--r--bitbake/lib/pysh/sherrors.py41
-rw-r--r--bitbake/lib/pysh/subprocess_fix.py77
66 files changed, 0 insertions, 24729 deletions
diff --git a/bitbake/lib/bb/COW.py b/bitbake/lib/bb/COW.py
deleted file mode 100644
index 6917ec378a..0000000000
--- a/bitbake/lib/bb/COW.py
+++ /dev/null
@@ -1,323 +0,0 @@
-# ex:ts=4:sw=4:sts=4:et
-# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
-#
-# This is a copy on write dictionary and set which abuses classes to try and be nice and fast.
-#
-# Copyright (C) 2006 Tim Amsell
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-#Please Note:
-# Be careful when using mutable types (ie Dict and Lists) - operations involving these are SLOW.
-# Assign a file to __warn__ to get warnings about slow operations.
-#
-
-from __future__ import print_function
-import copy
-import types
-ImmutableTypes = (
- types.NoneType,
- bool,
- complex,
- float,
- int,
- long,
- tuple,
- frozenset,
- basestring
-)
-
-MUTABLE = "__mutable__"
-
-class COWMeta(type):
- pass
-
-class COWDictMeta(COWMeta):
- __warn__ = False
- __hasmutable__ = False
- __marker__ = tuple()
-
- def __str__(cls):
- # FIXME: I have magic numbers!
- return "<COWDict Level: %i Current Keys: %i>" % (cls.__count__, len(cls.__dict__) - 3)
- __repr__ = __str__
-
- def cow(cls):
- class C(cls):
- __count__ = cls.__count__ + 1
- return C
- copy = cow
- __call__ = cow
-
- def __setitem__(cls, key, value):
- if not isinstance(value, ImmutableTypes):
- if not isinstance(value, COWMeta):
- cls.__hasmutable__ = True
- key += MUTABLE
- setattr(cls, key, value)
-
- def __getmutable__(cls, key, readonly=False):
- nkey = key + MUTABLE
- try:
- return cls.__dict__[nkey]
- except KeyError:
- pass
-
- value = getattr(cls, nkey)
- if readonly:
- return value
-
- if not cls.__warn__ is False and not isinstance(value, COWMeta):
- print("Warning: Doing a copy because %s is a mutable type." % key, file=cls.__warn__)
- try:
- value = value.copy()
- except AttributeError as e:
- value = copy.copy(value)
- setattr(cls, nkey, value)
- return value
-
- __getmarker__ = []
- def __getreadonly__(cls, key, default=__getmarker__):
- """\
- Get a value (even if mutable) which you promise not to change.
- """
- return cls.__getitem__(key, default, True)
-
- def __getitem__(cls, key, default=__getmarker__, readonly=False):
- try:
- try:
- value = getattr(cls, key)
- except AttributeError:
- value = cls.__getmutable__(key, readonly)
-
- # This is for values which have been deleted
- if value is cls.__marker__:
- raise AttributeError("key %s does not exist." % key)
-
- return value
- except AttributeError as e:
- if not default is cls.__getmarker__:
- return default
-
- raise KeyError(str(e))
-
- def __delitem__(cls, key):
- cls.__setitem__(key, cls.__marker__)
-
- def __revertitem__(cls, key):
- if not cls.__dict__.has_key(key):
- key += MUTABLE
- delattr(cls, key)
-
- def __contains__(cls, key):
- return cls.has_key(key)
-
- def has_key(cls, key):
- value = cls.__getreadonly__(key, cls.__marker__)
- if value is cls.__marker__:
- return False
- return True
-
- def iter(cls, type, readonly=False):
- for key in dir(cls):
- if key.startswith("__"):
- continue
-
- if key.endswith(MUTABLE):
- key = key[:-len(MUTABLE)]
-
- if type == "keys":
- yield key
-
- try:
- if readonly:
- value = cls.__getreadonly__(key)
- else:
- value = cls[key]
- except KeyError:
- continue
-
- if type == "values":
- yield value
- if type == "items":
- yield (key, value)
- raise StopIteration()
-
- def iterkeys(cls):
- return cls.iter("keys")
- def itervalues(cls, readonly=False):
- if not cls.__warn__ is False and cls.__hasmutable__ and readonly is False:
- print("Warning: If you arn't going to change any of the values call with True.", file=cls.__warn__)
- return cls.iter("values", readonly)
- def iteritems(cls, readonly=False):
- if not cls.__warn__ is False and cls.__hasmutable__ and readonly is False:
- print("Warning: If you arn't going to change any of the values call with True.", file=cls.__warn__)
- return cls.iter("items", readonly)
-
-class COWSetMeta(COWDictMeta):
- def __str__(cls):
- # FIXME: I have magic numbers!
- return "<COWSet Level: %i Current Keys: %i>" % (cls.__count__, len(cls.__dict__) -3)
- __repr__ = __str__
-
- def cow(cls):
- class C(cls):
- __count__ = cls.__count__ + 1
- return C
-
- def add(cls, value):
- COWDictMeta.__setitem__(cls, repr(hash(value)), value)
-
- def remove(cls, value):
- COWDictMeta.__delitem__(cls, repr(hash(value)))
-
- def __in__(cls, value):
- return COWDictMeta.has_key(repr(hash(value)))
-
- def iterkeys(cls):
- raise TypeError("sets don't have keys")
-
- def iteritems(cls):
- raise TypeError("sets don't have 'items'")
-
-# These are the actual classes you use!
-class COWDictBase(object):
- __metaclass__ = COWDictMeta
- __count__ = 0
-
-class COWSetBase(object):
- __metaclass__ = COWSetMeta
- __count__ = 0
-
-if __name__ == "__main__":
- import sys
- COWDictBase.__warn__ = sys.stderr
- a = COWDictBase()
- print("a", a)
-
- a['a'] = 'a'
- a['b'] = 'b'
- a['dict'] = {}
-
- b = a.copy()
- print("b", b)
- b['c'] = 'b'
-
- print()
-
- print("a", a)
- for x in a.iteritems():
- print(x)
- print("--")
- print("b", b)
- for x in b.iteritems():
- print(x)
- print()
-
- b['dict']['a'] = 'b'
- b['a'] = 'c'
-
- print("a", a)
- for x in a.iteritems():
- print(x)
- print("--")
- print("b", b)
- for x in b.iteritems():
- print(x)
- print()
-
- try:
- b['dict2']
- except KeyError as e:
- print("Okay!")
-
- a['set'] = COWSetBase()
- a['set'].add("o1")
- a['set'].add("o1")
- a['set'].add("o2")
-
- print("a", a)
- for x in a['set'].itervalues():
- print(x)
- print("--")
- print("b", b)
- for x in b['set'].itervalues():
- print(x)
- print()
-
- b['set'].add('o3')
-
- print("a", a)
- for x in a['set'].itervalues():
- print(x)
- print("--")
- print("b", b)
- for x in b['set'].itervalues():
- print(x)
- print()
-
- a['set2'] = set()
- a['set2'].add("o1")
- a['set2'].add("o1")
- a['set2'].add("o2")
-
- print("a", a)
- for x in a.iteritems():
- print(x)
- print("--")
- print("b", b)
- for x in b.iteritems(readonly=True):
- print(x)
- print()
-
- del b['b']
- try:
- print(b['b'])
- except KeyError:
- print("Yay! deleted key raises error")
-
- if b.has_key('b'):
- print("Boo!")
- else:
- print("Yay - has_key with delete works!")
-
- print("a", a)
- for x in a.iteritems():
- print(x)
- print("--")
- print("b", b)
- for x in b.iteritems(readonly=True):
- print(x)
- print()
-
- b.__revertitem__('b')
-
- print("a", a)
- for x in a.iteritems():
- print(x)
- print("--")
- print("b", b)
- for x in b.iteritems(readonly=True):
- print(x)
- print()
-
- b.__revertitem__('dict')
- print("a", a)
- for x in a.iteritems():
- print(x)
- print("--")
- print("b", b)
- for x in b.iteritems(readonly=True):
- print(x)
- print()
diff --git a/bitbake/lib/bb/__init__.py b/bitbake/lib/bb/__init__.py
deleted file mode 100644
index 88adfc1dfa..0000000000
--- a/bitbake/lib/bb/__init__.py
+++ /dev/null
@@ -1,100 +0,0 @@
-# ex:ts=4:sw=4:sts=4:et
-# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
-#
-# BitBake Build System Python Library
-#
-# Copyright (C) 2003 Holger Schurig
-# Copyright (C) 2003, 2004 Chris Larson
-#
-# Based on Gentoo's portage.py.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-__version__ = "1.11.0"
-
-import sys
-if sys.version_info < (2, 6, 0):
- raise RuntimeError("Sorry, python 2.6.0 or later is required for this version of bitbake")
-
-import os
-import bb.msg
-
-if "BBDEBUG" in os.environ:
- level = int(os.environ["BBDEBUG"])
- if level:
- bb.msg.set_debug_level(level)
-
-
-# Messaging convenience functions
-def plain(*args):
- bb.msg.plain(''.join(args))
-
-def debug(lvl, *args):
- bb.msg.debug(lvl, None, ''.join(args))
-
-def note(*args):
- bb.msg.note(1, None, ''.join(args))
-
-def warn(*args):
- bb.msg.warn(None, ''.join(args))
-
-def error(*args):
- bb.msg.error(None, ''.join(args))
-
-def fatal(*args):
- bb.msg.fatal(None, ''.join(args))
-
-
-def deprecated(func, name = None, advice = ""):
- """This is a decorator which can be used to mark functions
- as deprecated. It will result in a warning being emmitted
- when the function is used."""
- import warnings
-
- if advice:
- advice = ": %s" % advice
- if name is None:
- name = func.__name__
-
- def newFunc(*args, **kwargs):
- warnings.warn("Call to deprecated function %s%s." % (name,
- advice),
- category = PendingDeprecationWarning,
- stacklevel = 2)
- return func(*args, **kwargs)
- newFunc.__name__ = func.__name__
- newFunc.__doc__ = func.__doc__
- newFunc.__dict__.update(func.__dict__)
- return newFunc
-
-# For compatibility
-def deprecate_import(current, modulename, fromlist, renames = None):
- """Import objects from one module into another, wrapping them with a DeprecationWarning"""
- import sys
-
- module = __import__(modulename, fromlist = fromlist)
- for position, objname in enumerate(fromlist):
- obj = getattr(module, objname)
- newobj = deprecated(obj, "{0}.{1}".format(current, objname),
- "Please use {0}.{1} instead".format(modulename, objname))
- if renames:
- newname = renames[position]
- else:
- newname = objname
-
- setattr(sys.modules[current], newname, newobj)
-
-deprecate_import(__name__, "bb.fetch", ("MalformedUrl", "encodeurl", "decodeurl"))
-deprecate_import(__name__, "bb.utils", ("mkdirhier", "movefile", "copyfile", "which"))
-deprecate_import(__name__, "bb.utils", ["vercmp_string"], ["vercmp"])
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
deleted file mode 100644
index 18a75edca3..0000000000
--- a/bitbake/lib/bb/build.py
+++ /dev/null
@@ -1,446 +0,0 @@
-# ex:ts=4:sw=4:sts=4:et
-# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
-#
-# BitBake 'Build' implementation
-#
-# Core code for function execution and task handling in the
-# BitBake build tools.
-#
-# Copyright (C) 2003, 2004 Chris Larson
-#
-# Based on Gentoo's portage.py.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-#Based on functions from the base bb module, Copyright 2003 Holger Schurig
-
-from bb import data, event, mkdirhier, utils
-import bb, os, sys
-import bb.utils
-
-# When we execute a python function we'd like certain things
-# in all namespaces, hence we add them to __builtins__
-# If we do not do this and use the exec globals, they will
-# not be available to subfunctions.
-__builtins__['bb'] = bb
-__builtins__['os'] = os
-
-# events
-class FuncFailed(Exception):
- """
- Executed function failed
- First parameter a message
- Second paramter is a logfile (optional)
- """
-
-class TaskBase(event.Event):
- """Base class for task events"""
-
- def __init__(self, t, d ):
- self._task = t
- self._package = bb.data.getVar("PF", d, 1)
- event.Event.__init__(self)
- self._message = "package %s: task %s: %s" % (bb.data.getVar("PF", d, 1), t, bb.event.getName(self)[4:])
-
- def getTask(self):
- return self._task
-
- def setTask(self, task):
- self._task = task
-
- task = property(getTask, setTask, None, "task property")
-
-class TaskStarted(TaskBase):
- """Task execution started"""
-
-class TaskSucceeded(TaskBase):
- """Task execution completed"""
-
-class TaskFailed(TaskBase):
- """Task execution failed"""
- def __init__(self, msg, logfile, t, d ):
- self.logfile = logfile
- self.msg = msg
- TaskBase.__init__(self, t, d)
-
-class TaskInvalid(TaskBase):
- """Invalid Task"""
-
-# functions
-
-def exec_func(func, d, dirs = None):
- """Execute an BB 'function'"""
-
- body = data.getVar(func, d)
- if not body:
- bb.warn("Function %s doesn't exist" % func)
- return
-
- flags = data.getVarFlags(func, d)
- for item in ['deps', 'check', 'interactive', 'python', 'cleandirs', 'dirs', 'lockfiles', 'fakeroot', 'task']:
- if not item in flags:
- flags[item] = None
-
- ispython = flags['python']
-
- cleandirs = flags['cleandirs']
- if cleandirs:
- for cdir in data.expand(cleandirs, d).split():
- os.system("rm -rf %s" % cdir)
-
- if dirs is None:
- dirs = flags['dirs']
- if dirs:
- dirs = data.expand(dirs, d).split()
-
- if dirs:
- for adir in dirs:
- bb.utils.mkdirhier(adir)
- adir = dirs[-1]
- else:
- adir = data.getVar('B', d, 1)
-
- # Save current directory
- try:
- prevdir = os.getcwd()
- except OSError:
- prevdir = data.getVar('TOPDIR', d, True)
-
- # Setup scriptfile
- t = data.getVar('T', d, 1)
- if not t:
- raise SystemExit("T variable not set, unable to build")
- bb.utils.mkdirhier(t)
- runfile = "%s/run.%s.%s" % (t, func, str(os.getpid()))
- logfile = d.getVar("BB_LOGFILE", True)
-
- # Change to correct directory (if specified)
- if adir and os.access(adir, os.F_OK):
- os.chdir(adir)
-
- locks = []
- lockfiles = flags['lockfiles']
- if lockfiles:
- for lock in data.expand(lockfiles, d).split():
- locks.append(bb.utils.lockfile(lock))
-
- try:
- # Run the function
- if ispython:
- exec_func_python(func, d, runfile, logfile)
- else:
- exec_func_shell(func, d, runfile, logfile, flags)
-
- # Restore original directory
- try:
- os.chdir(prevdir)
- except:
- pass
-
- finally:
-
- # Unlock any lockfiles
- for lock in locks:
- bb.utils.unlockfile(lock)
-
-def exec_func_python(func, d, runfile, logfile):
- """Execute a python BB 'function'"""
-
- bbfile = bb.data.getVar('FILE', d, 1)
- tmp = "def " + func + "(d):\n%s" % data.getVar(func, d)
- tmp += '\n' + func + '(d)'
-
- f = open(runfile, "w")
- f.write(tmp)
- comp = utils.better_compile(tmp, func, bbfile)
- try:
- utils.better_exec(comp, {"d": d}, tmp, bbfile)
- except:
- (t, value, tb) = sys.exc_info()
-
- if t in [bb.parse.SkipPackage, bb.build.FuncFailed]:
- raise
- raise FuncFailed("Function %s failed" % func, logfile)
-
-
-def exec_func_shell(func, d, runfile, logfile, flags):
- """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