summaryrefslogtreecommitdiff
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2007-04-01 15:04:49 +0000
committerRichard Purdie <richard@openedhand.com>2007-04-01 15:04:49 +0000
commit7371e6323c3fb6b0545712e3cf84606644073e77 (patch)
treee08f25669ec0f0e9d11334909f3b68c0ab6aca19 /bitbake
parent8b36dc217443aeeec8493d39561d2bb010336774 (diff)
downloadopenembedded-core-7371e6323c3fb6b0545712e3cf84606644073e77.tar.gz
openembedded-core-7371e6323c3fb6b0545712e3cf84606644073e77.tar.bz2
openembedded-core-7371e6323c3fb6b0545712e3cf84606644073e77.zip
bitbake: Update to 1.8.1 (inc. various bug fixes, epoch support)
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@1419 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/ChangeLog54
-rw-r--r--bitbake/MANIFEST26
-rwxr-xr-xbitbake/bin/bitbake14
-rw-r--r--bitbake/classes/base.bbclass79
-rw-r--r--bitbake/conf/bitbake.conf58
-rw-r--r--bitbake/lib/bb/__init__.py2
-rw-r--r--bitbake/lib/bb/build.py3
-rw-r--r--bitbake/lib/bb/cache.py10
-rw-r--r--bitbake/lib/bb/cooker.py318
-rw-r--r--bitbake/lib/bb/event.py5
-rw-r--r--bitbake/lib/bb/fetch/svn.py6
-rw-r--r--bitbake/lib/bb/msg.py31
-rw-r--r--bitbake/lib/bb/parse/parse_py/ConfHandler.py16
-rw-r--r--bitbake/lib/bb/providers.py47
-rw-r--r--bitbake/lib/bb/runqueue.py355
-rw-r--r--bitbake/lib/bb/shell.py25
-rw-r--r--bitbake/lib/bb/taskdata.py13
-rw-r--r--bitbake/lib/bb/utils.py8
18 files changed, 532 insertions, 538 deletions
diff --git a/bitbake/ChangeLog b/bitbake/ChangeLog
index 135aba9fee..0cb85db870 100644
--- a/bitbake/ChangeLog
+++ b/bitbake/ChangeLog
@@ -1,10 +1,52 @@
-Changes in BitBake 1.7.3:
+Changes in Bitbake 1.8.2:
+ - Catch truncated cache file errors
+ - Add PE (Package Epoch) support from Philipp Zabel (pH5)
+ - Add code to handle inter-task dependencies
+ - Allow operations other than assignment on flag variables
-Changes in BitBake 1.7.1:
- - Major updates of the dependency handling and execution
- of tasks
- - Change of the SVN Fetcher to keep the checkout around
- courtsey to Paul Sokolovsky (#1367)
+Changes in Bitbake 1.8.0:
+ - Release 1.7.x as a stable series
+
+Changes in BitBake 1.7.x:
+ - Major updates of the dependency handling and execution
+ of tasks. Code from bin/bitbake replaced with runqueue.py
+ and taskdata.py
+ - New task execution code supports multithreading with a simplistic
+ threading algorithm controlled by BB_NUMBER_THREADS
+ - Change of the SVN Fetcher to keep the checkout around
+ courtsey of Paul Sokolovsky (#1367)
+ - PATH fix to bbimage (#1108)
+ - Allow debug domains to be specified on the commandline (-l)
+ - Allow 'interactive' tasks
+ - Logging message improvements
+ - Drop now uneeded BUILD_ALL_DEPS variable
+ - Add support for wildcards to -b option
+ - Major overhaul of the fetchers making a large amount of code common
+ including mirroring code
+ - Fetchers now touch md5 stamps upon access (to show activity)
+ - Fix -f force option when used without -b (long standing bug)
+ - Add expand_cache to data_cache.py, caching expanded data (speedup)
+ - Allow version field in DEPENDS (ignored for now)
+ - Add abort flag support to the shell
+ - Make inherit fail if the class doesn't exist (#1478)
+ - Fix data.emit_env() to expand keynames as well as values
+ - Add ssh fetcher
+ - Add perforce fetcher
+ - Make PREFERRED_PROVIDER_foobar defaults to foobar if available
+ - Share the parser's mtime_cache, reducing the number of stat syscalls
+ - Compile all anonfuncs at once!
+ *** Anonfuncs must now use common spacing format ***
+ - Memorise the list of handlers in __BBHANDLERS and tasks in __BBTASKS
+ This removes 2 million function calls resulting in a 5-10% speedup
+ - Add manpage
+ - Update generateDotGraph to use taskData/runQueue improving accuracy
+ and also adding a task dependency graph
+ - Fix/standardise on GPLv2 licence
+ - Move most functionality from bin/bitbake to cooker.py and split into
+ separate funcitons
+ - CVS fetcher: Added support for non-default port
+ - Add BBINCLUDELOGS_LINES, the number of lines to read from any logfile
+ - Drop shebangs from lib/bb scripts
Changes in Bitbake 1.6.0:
- Better msg handling
diff --git a/bitbake/MANIFEST b/bitbake/MANIFEST
index 0440a4e2ea..a0e39c7715 100644
--- a/bitbake/MANIFEST
+++ b/bitbake/MANIFEST
@@ -1,45 +1,49 @@
AUTHORS
+COPYING
ChangeLog
MANIFEST
setup.py
bin/bitdoc
bin/bbimage
bin/bitbake
-lib/bb/COW.py
lib/bb/__init__.py
lib/bb/build.py
lib/bb/cache.py
lib/bb/cooker.py
+lib/bb/COW.py
lib/bb/data.py
lib/bb/data_smart.py
lib/bb/event.py
-lib/bb/manifest.py
-lib/bb/methodpool.py
-lib/bb/msg.py
-lib/bb/providers.py
-lib/bb/runqueue.py
-lib/bb/shell.py
-lib/bb/taskdata.py
-lib/bb/utils.py
+lib/bb/fetch/__init__.py
lib/bb/fetch/cvs.py
lib/bb/fetch/git.py
-lib/bb/fetch/__init__.py
lib/bb/fetch/local.py
lib/bb/fetch/perforce.py
lib/bb/fetch/ssh.py
lib/bb/fetch/svk.py
lib/bb/fetch/svn.py
lib/bb/fetch/wget.py
+lib/bb/manifest.py
+lib/bb/methodpool.py
+lib/bb/msg.py
lib/bb/parse/__init__.py
+lib/bb/parse/parse_py/__init__.py
lib/bb/parse/parse_py/BBHandler.py
lib/bb/parse/parse_py/ConfHandler.py
-lib/bb/parse/parse_py/__init__.py
+lib/bb/providers.py
+lib/bb/runqueue.py
+lib/bb/shell.py
+lib/bb/taskdata.py
+lib/bb/utils.py
+setup.py
doc/COPYING.GPL
doc/COPYING.MIT
+doc/bitbake.1
doc/manual/html.css
doc/manual/Makefile
doc/manual/usermanual.xml
contrib/bbdev.sh
contrib/vim/syntax/bitbake.vim
+contrib/vim/ftdetect/bitbake.vim
conf/bitbake.conf
classes/base.bbclass
diff --git a/bitbake/bin/bitbake b/bitbake/bin/bitbake
index 001f229331..70a862a815 100755
--- a/bitbake/bin/bitbake
+++ b/bitbake/bin/bitbake
@@ -27,7 +27,7 @@ sys.path.insert(0,os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'l
import bb
from bb import cooker
-__version__ = "1.7.4"
+__version__ = "1.8.1"
#============================================================================#
# BBOptions
@@ -109,15 +109,9 @@ Default BBFILES are the .bb files in the current directory.""" )
configuration.pkgs_to_build = []
configuration.pkgs_to_build.extend(args[1:])
- bb.cooker.BBCooker().cook(configuration)
+ cooker = bb.cooker.BBCooker(configuration)
+ cooker.cook()
+
if __name__ == "__main__":
main()
- sys.exit(0)
- import profile
- profile.run('main()', "profile.log")
- import pstats
- p = pstats.Stats('profile.log')
- p.sort_stats('time')
- p.print_stats()
- p.print_callers()
diff --git a/bitbake/classes/base.bbclass b/bitbake/classes/base.bbclass
deleted file mode 100644
index cfb82a41cb..0000000000
--- a/bitbake/classes/base.bbclass
+++ /dev/null
@@ -1,79 +0,0 @@
-# Copyright (C) 2003 Chris Larson
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-# OTHER DEALINGS IN THE SOFTWARE.
-
-die() {
- bbfatal "$*"
-}
-
-bbnote() {
- echo "NOTE:" "$*"
-}
-
-bbwarn() {
- echo "WARNING:" "$*"
-}
-
-bbfatal() {
- echo "FATAL:" "$*"
- exit 1
-}
-
-bbdebug() {
- test $# -ge 2 || {
- echo "Usage: bbdebug level \"message\""
- exit 1
- }
-
- test ${@bb.msg.debug_level} -ge $1 && {
- shift
- echo "DEBUG:" $*
- }
-}
-
-addtask showdata
-do_showdata[nostamp] = "1"
-python do_showdata() {
- import sys
- # emit variables and shell functions
- bb.data.emit_env(sys.__stdout__, d, True)
- # emit the metadata which isnt valid shell
- for e in bb.data.keys(d):
- if bb.data.getVarFlag(e, 'python', d):
- sys.__stdout__.write("\npython %s () {\n%s}\n" % (e, bb.data.getVar(e, d, 1)))
-}
-
-addtask listtasks
-do_listtasks[nostamp] = "1"
-python do_listtasks() {
- import sys
- for e in bb.data.keys(d):
- if bb.data.getVarFlag(e, 'task', d):
- sys.__stdout__.write("%s\n" % e)
-}
-
-addtask build
-do_build[dirs] = "${TOPDIR}"
-do_build[nostamp] = "1"
-python base_do_build () {
- bb.note("The included, default BB base.bbclass does not define a useful default task.")
- bb.note("Try running the 'listtasks' task against a .bb to see what tasks are defined.")
-}
-
-EXPORT_FUNCTIONS do_clean do_mrproper do_build
diff --git a/bitbake/conf/bitbake.conf b/bitbake/conf/bitbake.conf
deleted file mode 100644
index 19a3fe8ef8..0000000000
--- a/bitbake/conf/bitbake.conf
+++ /dev/null
@@ -1,58 +0,0 @@
-# Copyright (C) 2003 Chris Larson
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-# OTHER DEALINGS IN THE SOFTWARE.
-
-B = "${S}"
-CVSDIR = "${DL_DIR}/cvs"
-DEPENDS = ""
-DEPLOY_DIR = "${TMPDIR}/deploy"
-DEPLOY_DIR_IMAGE = "${DEPLOY_DIR}/images"
-DL_DIR = "${TMPDIR}/downloads"
-FETCHCOMMAND = ""
-FETCHCOMMAND_cvs = "/usr/bin/env cvs -d${CVSROOT} co ${CVSCOOPTS} ${CVSMODULE}"
-FETCHCOMMAND_svn = "/usr/bin/env svn co ${SVNCOOPTS} ${SVNROOT} ${SVNMODULE}"
-FETCHCOMMAND_wget = "/usr/bin/env wget -t 5 --passive-ftp -P ${DL_DIR} ${URI}"
-FILESDIR = "${@bb.which(bb.data.getVar('FILESPATH', d, 1), '.')}"
-FILESPATH = "${FILE_DIRNAME}/${PF}:${FILE_DIRNAME}/${P}:${FILE_DIRNAME}/${PN}:${FILE_DIRNAME}/files:${FILE_DIRNAME}"
-FILE_DIRNAME = "${@os.path.dirname(bb.data.getVar('FILE', d))}"
-GITDIR = "${DL_DIR}/git"
-IMAGE_CMD = "_NO_DEFINED_IMAGE_TYPES_"
-IMAGE_ROOTFS = "${TMPDIR}/rootfs"
-MKTEMPCMD = "mktemp -q ${TMPBASE}"
-MKTEMPDIRCMD = "mktemp -d -q ${TMPBASE}"
-OVERRIDES = "local:${MACHINE}:${TARGET_OS}:${TARGET_ARCH}"
-P = "${PN}-${PV}"
-PF = "${PN}-${PV}-${PR}"
-PN = "${@bb.parse.BBHandler.vars_from_file(bb.data.getVar('FILE',d),d)[0] or 'defaultpkgname'}"
-PR = "${@bb.parse.BBHandler.vars_from_file(bb.data.getVar('FILE',d),d)[2] or 'r0'}"
-PROVIDES = ""
-PV = "${@bb.parse.BBHandler.vars_from_file(bb.data.getVar('FILE',d),d)[1] or '1.0'}"
-RESUMECOMMAND = ""
-RESUMECOMMAND_wget = "/usr/bin/env wget -c -t 5 --passive-ftp -P ${DL_DIR} ${URI}"
-S = "${WORKDIR}/${P}"
-SRC_URI = "file://${FILE}"
-STAMP = "${TMPDIR}/stamps/${PF}"
-SVNDIR = "${DL_DIR}/svn"
-T = "${WORKDIR}/temp"
-TARGET_ARCH = "${BUILD_ARCH}"
-TMPDIR = "${TOPDIR}/tmp"
-UPDATECOMMAND = ""
-UPDATECOMMAND_cvs = "/usr/bin/env cvs -d${CVSROOT} update ${CVSCOOPTS}"
-UPDATECOMMAND_svn = "/usr/bin/env svn update ${SVNCOOPTS}"
-WORKDIR = "${TMPDIR}/work/${PF}"
diff --git a/bitbake/lib/bb/__init__.py b/bitbake/lib/bb/__init__.py
index a11af84b12..e34122a61e 100644
--- a/bitbake/lib/bb/__init__.py
+++ b/bitbake/lib/bb/__init__.py
@@ -21,7 +21,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-__version__ = "1.7.4"
+__version__ = "1.8.1"
__all__ = [
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
index bf6b612f32..3494c0a28e 100644
--- a/bitbake/lib/bb/build.py
+++ b/bitbake/lib/bb/build.py
@@ -188,7 +188,8 @@ def exec_func_shell(func, d):
maybe_fakeroot = "PATH=\"%s\" fakeroot " % bb.data.getVar("PATH", d, 1)
else:
maybe_fakeroot = ''
- ret = os.system('%ssh -e %s' % (maybe_fakeroot, runfile))
+ lang_environment = "LC_ALL=C "
+ ret = os.system('%s%ssh -e %s' % (lang_environment, maybe_fakeroot, runfile))
try:
os.chdir(prevdir)
except:
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py
index 934d230e6a..335b221979 100644
--- a/bitbake/lib/bb/cache.py
+++ b/bitbake/lib/bb/cache.py
@@ -39,7 +39,7 @@ except ImportError:
import pickle
bb.msg.note(1, bb.msg.domain.Cache, "Importing cPickle failed. Falling back to a very slow implementation.")
-__cache_version__ = "125"
+__cache_version__ = "126"
class Cache:
"""
@@ -75,6 +75,9 @@ class Cache:
raise ValueError, 'Cache Version Mismatch'
if version_data['BITBAKE_VER'] != bb.__version__:
raise ValueError, 'Bitbake Version Mismatch'
+ except EOFError:
+ bb.msg.note(1, bb.msg.domain.Cache, "Truncated cache found, rebuilding...")
+ self.depends_cache = {}
except (ValueError, KeyError):
bb.msg.note(1, bb.msg.domain.Cache, "Invalid cache found, rebuilding...")
self.depends_cache = {}
@@ -251,6 +254,7 @@ class Cache:
"""
pn = self.getVar('PN', file_name, True)
+ pe = self.getVar('PE', file_name, True) or "0"
pv = self.getVar('PV', file_name, True)
pr = self.getVar('PR', file_name, True)
dp = int(self.getVar('DEFAULT_PREFERENCE', file_name, True) or "0")
@@ -272,7 +276,7 @@ class Cache:
# build FileName to PackageName lookup table
cacheData.pkg_fn[file_name] = pn
- cacheData.pkg_pvpr[file_name] = (pv,pr)
+ cacheData.pkg_pepvpr[file_name] = (pe,pv,pr)
cacheData.pkg_dp[file_name] = dp
# Build forward and reverse provider hashes
@@ -407,7 +411,7 @@ class CacheData:
self.possible_world = []
self.pkg_pn = {}
self.pkg_fn = {}
- self.pkg_pvpr = {}
+ self.pkg_pepvpr = {}
self.pkg_dp = {}
self.pn_provides = {}
self.all_depends = Set()
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 8a9c588633..4b2a906133 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -31,29 +31,6 @@ import itertools
parsespin = itertools.cycle( r'|/-\\' )
#============================================================================#
-# BBStatistics
-#============================================================================#
-class BBStatistics:
- """
- Manage build statistics for one run
- """
- def __init__(self ):
- self.attempt = 0
- self.success = 0
- self.fail = 0
- self.deps = 0
-
- def show( self ):
- print "Build statistics:"
- print " Attempted builds: %d" % self.attempt
- if self.fail:
- print " Failed builds: %d" % self.fail
- if self.deps:
- print " Dependencies not satisfied: %d" % self.deps
- if self.fail or self.deps: return 1
- else: return 0
-
-#============================================================================#
# BBCooker
#============================================================================#
class BBCooker:
@@ -61,43 +38,61 @@ class BBCooker:
Manages one bitbake build run
"""
- Statistics = BBStatistics # make it visible from the shell
-
- def __init__( self ):
- self.build_cache_fail = []
- self.build_cache = []
- self.stats = BBStatistics()
+ def __init__(self, configuration):
self.status = None
self.cache = None
self.bb_cache = None
+ self.configuration = configuration
+
+ if self.configuration.verbose:
+ bb.msg.set_verbose(True)
+
+ if self.configuration.debug:
+ bb.msg.set_debug_level(self.configuration.debug)
+ else:
+ bb.msg.set_debug_level(0)
+
+ if self.configuration.debug_domains:
+ bb.msg.set_debug_domains(self.configuration.debug_domains)
+
+ self.configuration.data = bb.data.init()
+
+ for f in self.configuration.file:
+ self.parseConfigurationFile( f )
+
+ self.parseConfigurationFile( os.path.join( "conf", "bitbake.conf" ) )
+
+ if not self.configuration.cmd:
+ self.configuration.cmd = bb.data.getVar("BB_DEFAULT_TASK", self.configuration.data) or "build"
+
+ #
+ # Special updated configuration we use for firing events
+ #
+ self.configuration.event_data = bb.data.createCopy(self.configuration.data)
+ bb.data.update_data(self.configuration.event_data)
+
def tryBuildPackage(self, fn, item, task, the_data, build_depends):
"""
Build one task of a package, optionally build following task depends
"""
bb.event.fire(bb.event.PkgStarted(item, the_data))
try:
- self.stats.attempt += 1
if not build_depends:
bb.data.setVarFlag('do_%s' % task, 'dontrundeps', 1, the_data)
if not self.configuration.dry_run:
bb.build.exec_task('do_%s' % task, the_data)
bb.event.fire(bb.event.PkgSucceeded(item, the_data))
- self.build_cache.append(fn)
return True
except bb.build.FuncFailed:
- self.stats.fail += 1
bb.msg.error(bb.msg.domain.Build, "task stack execution failed")
bb.event.fire(bb.event.PkgFailed(item, the_data))
- self.build_cache_fail.append(fn)
raise
except bb.build.EventException, e:
- self.stats.fail += 1
event = e.args[1]
bb.msg.error(bb.msg.domain.Build, "%s event exception, aborting" % bb.event.getName(event))
bb.event.fire(bb.event.PkgFailed(item, the_data))
- self.build_cache_fail.append(fn)
raise
def tryBuild( self, fn, build_depends):
@@ -112,12 +107,11 @@ class BBCooker:
item = self.status.pkg_fn[fn]
if bb.build.stamp_is_current('do_%s' % self.configuration.cmd, the_data):
- self.build_cache.append(fn)
return True
return self.tryBuildPackage(fn, item, self.configuration.cmd, the_data, build_depends)
- def showVersions( self ):
+ def showVersions(self):
pkg_pn = self.status.pkg_pn
preferred_versions = {}
latest_versions = {}
@@ -136,11 +130,11 @@ class BBCooker:
latest = latest_versions[p]
if pref != latest:
- prefstr = pref[0][0] + "-" + pref[0][1]
+ prefstr = pref[0][0] + ":" + pref[0][1] + '-' + pref[0][2]
else:
prefstr = ""
- print "%-30s %20s %20s" % (p, latest[0][0] + "-" + latest[0][1],
+ print "%-30s %20s %20s" % (p, latest[0][0] + ":" + latest[0][1] + "-" + latest[0][2],
prefstr)
@@ -192,8 +186,8 @@ class BBCooker:
taskdata.add_unresolved(localdata, self.status)
except bb.providers.NoProvider:
sys.exit(1)
- rq = bb.runqueue.RunQueue()
- rq.prepare_runqueue(self, self.configuration.data, self.status, taskdata, runlist)
+ rq = bb.runqueue.RunQueue(self, self.configuration.data, self.status, taskdata, runlist)
+ rq.prepare_runqueue()
seen_fnids = []
depends_file = file('depends.dot', 'w' )
@@ -371,98 +365,138 @@ class BBCooker:
except ValueError:
bb.msg.error(bb.msg.domain.Parsing, "invalid value for BBFILE_PRIORITY_%s: \"%s\"" % (c, priority))
+ def buildSetVars(self):
+ """
+ Setup any variables needed before starting a build
+ """
+ if not bb.data.getVar("BUILDNAME", self.configuration.data):
+ bb.data.setVar("BUILDNAME", os.popen('date +%Y%m%d%H%M').readline().strip(), self.configuration.data)
+ bb.data.setVar("BUILDSTART", time.strftime('%m/%d/%Y %H:%M:%S',time.gmtime()),self.configuration.data)
- def cook(self, configuration):
+ def buildFile(self, buildfile):
"""
- We are building stuff here. We do the building
- from here. By default we try to execute task
- build.
+ Build the file matching regexp buildfile
"""
- self.configuration = configuration
+ bf = os.path.abspath(buildfile)
+ try:
+ os.stat(bf)
+ except OSError:
+ (filelist, masked) = self.collect_bbfiles()
+ regexp = re.compile(buildfile)
+ matches = []
+ for f in filelist:
+ if regexp.search(f) and os.path.isfile(f):
+ bf = f
+ matches.append(f)
+ if len(matches) != 1:
+ bb.msg.error(bb.msg.domain.Parsing, "Unable to match %s (%s matches found):" % (buildfile, len(matches)))
+ for f in matches:
+ bb.msg.error(bb.msg.domain.Parsing, " %s" % f)
+ sys.exit(1)
+ bf = matches[0]
- if self.configuration.verbose:
- bb.msg.set_verbose(True)
+ bbfile_data = bb.parse.handle(bf, self.configuration.data)
- if self.configuration.debug:
- bb.msg.set_debug_level(self.configuration.debug)
+ # Remove stamp for target if force mode active
+ if self.configuration.force:
+ bb.msg.note(2, bb.msg.domain.RunQueue, "Remove stamp %s, %s" % (self.configuration.cmd, bf))
+ bb.build.del_stamp('do_%s' % self.configuration.cmd, bbfile_data)
+
+ item = bb.data.getVar('PN', bbfile_data, 1)
+ try:
+ self.tryBuildPackage(bf, item, self.configuration.cmd, bbfile_data, True)
+ except bb.build.EventException:
+ bb.msg.error(bb.msg.domain.Build, "Build of '%s' failed" % item )
+
+ sys.exit(0)
+
+ def buildTargets(self, targets):
+ """
+ Attempt to build the targets specified
+ """
+
+ buildname = bb.data.getVar("BUILDNAME", self.configuration.data)
+ bb.event.fire(bb.event.BuildStarted(buildname, targets, self.configuration.event_data))
+
+ localdata = data.createCopy(self.configuration.data)
+ bb.data.update_data(localdata)
+ bb.data.expandKeys(localdata)
+
+ taskdata = bb.taskdata.TaskData(self.configuration.abort)
+
+ runlist = []
+ try:
+ for k in targets:
+ taskdata.add_provider(localdata, self.status, k)
+ runlist.append([k, "do_%s" % self.configuration.cmd])
+ taskdata.add_unresolved(localdata, self.status)
+ except bb.providers.NoProvider:
+ sys.exit(1)
+
+ rq = bb.runqueue.RunQueue(self, self.configuration.data, self.status, taskdata, runlist)
+ rq.prepare_runqueue()
+ try:
+ failures = rq.execute_runqueue()
+ except runqueue.TaskFailure, fnids:
+ for fnid in fnids:
+ bb.msg.error(bb.msg.domain.Build, "'%s' failed" % taskdata.fn_index[fnid])
+ sys.exit(1)
+ bb.event.fire(bb.event.BuildCompleted(buildname, targets, self.configuration.event_data, failures))
+
+ sys.exit(0)
+
+ def updateCache(self):
+ # Import Psyco if available and not disabled
+ if not self.configuration.disable_psyco:
+ try:
+ import psyco
+ except ImportError:
+ bb.msg.note(1, bb.msg.domain.Collection, "Psyco JIT Compiler (http://psyco.sf.net) not available. Install it to increase performance.")
+ else:
+ psyco.bind( self.parse_bbfiles )
else:
- bb.msg.set_debug_level(0)
+ bb.msg.note(1, bb.msg.domain.Collection, "You have disabled Psyco. This decreases performance.")
- if self.configuration.debug_domains:
- bb.msg.set_debug_domains(self.configuration.debug_domains)
+ self.status = bb.cache.CacheData()
- self.configuration.data = bb.data.init()
+ ignore = bb.data.getVar("ASSUME_PROVIDED", self.configuration.data, 1) or ""
+ self.status.ignored_dependencies = Set( ignore.split() )
- for f in self.configuration.file:
- self.parseConfigurationFile( f )
+ self.handleCollections( bb.data.getVar("BBFILE_COLLECTIONS", self.configuration.data, 1) )
- self.parseConfigurationFile( os.path.join( "conf", "bitbake.conf" ) )
+ bb.msg.debug(1, bb.msg.domain.Collection, "collecting .bb files")
+ (filelist, masked) = self.collect_bbfiles()
+ self.parse_bbfiles(filelist, masked, self.myProgressCallback)
+ bb.msg.debug(1, bb.msg.domain.Collection, "parsing complete")
- if not self.configuration.cmd:
- self.configuration.cmd = bb.data.getVar("BB_DEFAULT_TASK", self.configuration.data) or "build"
+ self.buildDepgraph()
- #
- # Special updated configuration we use for firing events
- #
- self.configuration.event_data = bb.data.createCopy(self.configuration.data)
- bb.data.update_data(self.configuration.event_data)
+ def cook(self):
+ """
+ We are building stuff here. We do the building
+ from here. By default we try to execute task
+ build.
+ """
if self.configuration.show_environment:
self.showEnvironment()
sys.exit( 0 )
- # inject custom variables
- if not bb.data.getVar("BUILDNAME", self.configuration.data):
- bb.data.setVar("BUILDNAME", os.popen('date +%Y%m%d%H%M').readline().strip(), self.configuration.data)
- bb.data.setVar("BUILDSTART", time.strftime('%m/%d/%Y %H:%M:%S',time.gmtime()),self.configuration.data)
-
- buildname = bb.data.getVar("BUILDNAME", self.configuration.data)
+ self.buildSetVars()
if self.configuration.interactive:
self.interactiveMode()
if self.configuration.buildfile is not None:
- bf = os.path.abspath( self.configuration.buildfile )
- try:
- os.stat(bf)
- except OSError:
- (filelist, masked) = self.collect_bbfiles()
- regexp = re.compile(self.configuration.buildfile)
- matches = []
- for f in filelist:
- if regexp.search(f) and os.path.isfile(f):
- bf = f
- matches.append(f)
- if len(matches) != 1:
- bb.msg.error(bb.msg.domain.Parsing, "Unable to match %s (%s matches found):" % (self.configuration.buildfile, len(matches)))
- for f in matches:
- bb.msg.error(bb.msg.domain.Parsing, " %s" % f)
- sys.exit(1)
- bf = matches[0]
-
- bbfile_data = bb.parse.handle(bf, self.configuration.data)
-
- # Remove stamp for target if force mode active
- if self.configuration.force:
- bb.msg.note(2, bb.msg.domain.RunQueue, "Remove stamp %s, %s" % (self.configuration.cmd, bf))
- bb.build.del_stamp('do_%s' % self.configuration.cmd, bbfile_data)
-
- item = bb.data.getVar('PN', bbfile_data, 1)
- try:
- self.tryBuildPackage(bf, item, self.configuration.cmd, bbfile_data, True)
- except bb.build.EventException:
- bb.msg.error(bb.msg.domain.Build, "Build of '%s' failed" % item )
-
- sys.exit( self.stats.show() )
+ return self.buildFile(self.configuration.buildfile)
# initialise the parsing status now we know we will need deps
- self.status = bb.cache.CacheData()
+ self.updateCache()
- ignore = bb.data.getVar("ASSUME_PROVIDED", self.configuration.data, 1) or ""
- self.status.ignored_dependencies = Set( ignore.split() )
-
- self.handleCollections( bb.data.getVar("BBFILE_COLLECTIONS", self.configuration.data, 1) )
+ if self.configuration.parse_only:
+ bb.msg.note(1, bb.msg.domain.Collection, "Requested parsing .bb files only. Exiting.")
+ return 0
pkgs_to_build = self.configuration.pkgs_to_build
@@ -475,30 +509,7 @@ class BBCooker:
print "for usage information."
sys.exit(0)
- # Import Psyco if available and not disabled
- if not self.configuration.disable_psyco:
- try:
- import psyco
- except ImportError:
- bb.msg.note(1, bb.msg.domain.Collection, "Psyco JIT Compiler (http://psyco.sf.net) not available. Install it to increase performance.")
- else:
- psyco.bind( self.parse_bbfiles )
- else:
- bb.msg.note(1, bb.msg.domain.Collection, "You have disabled Psyco. This decreases performance.")
-
try:
- bb.msg.debug(1, bb.msg.domain.Collection, "collecting .bb files")
- (filelist, masked) = self.collect_bbfiles()
- self.parse_bbfiles(filelist, masked, self.myProgressCallback)
- bb.msg.debug(1, bb.msg.domain.Collection, "parsing complete")
- print
- if self.configuration.parse_only:
- bb.msg.note(1, bb.msg.domain.Collection, "Requested parsing .bb files only. Exiting.")
- return
-
-
- self.buildDepgraph()
-
if self.configuration.show_versions:
self.showVersions()
sys.exit( 0 )
@@ -512,34 +523,7 @@ class BBCooker:
self.generateDotGraph( pkgs_to_build, self.configuration.ignored_dot_deps )
sys.exit( 0 )
- bb.event.fire(bb.event.BuildStarted(buildname, pkgs_to_build, self.configuration.event_data))
-
- localdata = data.createCopy(self.configuration.data)
- bb.data.update_data(localdata)
- bb.data.expandKeys(localdata)
-
- taskdata = bb.taskdata.TaskData(self.configuration.abort)
-
- runlist = []
- try:
- for k in pkgs_to_build:
- taskdata.add_provider(localdata, self.status, k)
- runlist.append([k, "do_%s" % self.configuration.cmd])
- taskdata.add_unresolved(localdata, self.status)
- except bb.providers.NoProvider:
- sys.exit(1)
-
- rq = bb.runqueue.RunQueue()
- rq.prepare_runqueue(self, self.configuration.data, self.status, taskdata, runlist)
- try:
- failures = rq.execute_runqueue(self, self.configuration.data, self.status, taskdata, runlist)
- except runqueue.TaskFailure, fnids:
- for fnid in fnids:
- bb.msg.error(bb.msg.domain.Build, "'%s' failed" % taskdata.fn_index[fnid])
- sys.exit(1)
- bb.event.fire(bb.event.BuildCompleted(buildname, pkgs_to_build, self.configuration.event_data, failures))
-
- sys.exit( self.stats.show() )
+ return self.buildTargets(pkgs_to_build)
except KeyboardInterrupt:
bb.msg.note(1, bb.msg.domain.Collection, "KeyboardInterrupt - Build not completed.")
@@ -556,13 +540,17 @@ class BBCooker:
return bbfiles
def find_bbfiles( self, path ):
- """Find all the .bb files in a directory (uses find)"""
- findcmd = 'find ' + path + ' -name *.bb | grep -v SCCS/'
- try:
- finddata = os.popen(findcmd)
- except OSError:
- return []
- return finddata.readlines()
+ """Find all the .bb files in a directory"""
+ from os.path import join
+
+