summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Larson <clarson@kergoth.com>2005-05-18 18:55:38 +0000
committerChris Larson <clarson@kergoth.com>2005-05-18 18:55:38 +0000
commitaeb38884d232a93daf58d26662cbce76e7ede439 (patch)
tree3d124da006a841975deba4d094e091c844090a20
parentbc35fa4992cbe4bd802b9c67a51a6f0fc649c639 (diff)
downloadbitbake-1.2.1.tar.gz
Undo that last extranious svn cp, and pull over the change to trunk which sets bb.__version__ to 1.2.1 and makes setup.py import bb to get to that.1.2.1
-rw-r--r--bitbake/AUTHORS5
-rw-r--r--bitbake/ChangeLog10
-rw-r--r--bitbake/MANIFEST26
-rwxr-xr-xbitbake/bin/bbimage155
-rwxr-xr-xbitbake/bin/bbread49
-rwxr-xr-xbitbake/bin/bitbake739
-rw-r--r--bitbake/classes/base.bbclass79
-rw-r--r--bitbake/conf/bitbake.conf55
-rw-r--r--bitbake/contrib/README1
-rw-r--r--bitbake/contrib/bbdev.sh31
-rw-r--r--bitbake/contrib/vim/syntax/bitbake.vim120
-rw-r--r--bitbake/doc/COPYING.GPL340
-rw-r--r--bitbake/doc/COPYING.MIT17
-rw-r--r--bitbake/doc/manual/Makefile56
-rw-r--r--bitbake/doc/manual/html.css281
-rw-r--r--bitbake/doc/manual/usermanual.xml329
-rw-r--r--bitbake/lib/bb/__init__.py1285
-rw-r--r--bitbake/lib/bb/build.py403
-rw-r--r--bitbake/lib/bb/data.py526
-rw-r--r--bitbake/lib/bb/data_dict.py244
-rw-r--r--bitbake/lib/bb/data_smart.py329
-rw-r--r--bitbake/lib/bb/event.py210
-rw-r--r--bitbake/lib/bb/fetch.py635
-rw-r--r--bitbake/lib/bb/make.py237
-rw-r--r--bitbake/lib/bb/manifest.py144
-rw-r--r--bitbake/lib/bb/parse/BBHandler.py378
-rw-r--r--bitbake/lib/bb/parse/ConfHandler.py194
-rw-r--r--bitbake/lib/bb/parse/__init__.py76
-rwxr-xr-xbitbake/setup.py70
-rw-r--r--lib/bb/__init__.py2
-rwxr-xr-xsetup.py9
31 files changed, 6 insertions, 7029 deletions
diff --git a/bitbake/AUTHORS b/bitbake/AUTHORS
deleted file mode 100644
index 4129e4c52..000000000
--- a/bitbake/AUTHORS
+++ /dev/null
@@ -1,5 +0,0 @@
-Holger Freyther <zecke@handhelds.org>
-Chris Larson <kergoth@handhelds.org>
-Mickey Lauer <mickey@Vanille.de>
-Holger Schurig <holgerschurig@gmx.de>
-Phil Blundell <pb@handhelds.org>
diff --git a/bitbake/ChangeLog b/bitbake/ChangeLog
deleted file mode 100644
index f1715732b..000000000
--- a/bitbake/ChangeLog
+++ /dev/null
@@ -1,10 +0,0 @@
-Changes in bitbake 1.2.1:
- The 1.2.1 release is meant as a intermediate release to lay the
-ground for more radical changes. The most notable changes are:
-
- -Do not hardcode {}, use bb.data.init() instead if you want to
-get a instance of a data class
- -bb.data.init() is a factory and the old bb.data methods are delegates
- -Do not use deepcopy use bb.data.createCopy() instead.
- -Removed default arguments in bb.fetch
-
diff --git a/bitbake/MANIFEST b/bitbake/MANIFEST
deleted file mode 100644
index e1807e11a..000000000
--- a/bitbake/MANIFEST
+++ /dev/null
@@ -1,26 +0,0 @@
-AUTHORS
-ChangeLog
-MANIFEST
-setup.py
-bin/bbimage
-bin/bitbake
-bin/bbread
-lib/bb/__init__.py
-lib/bb/build.py
-lib/bb/data.py
-lib/bb/data_dict.py
-lib/bb/event.py
-lib/bb/fetch.py
-lib/bb/make.py
-lib/bb/manifest.py
-lib/bb/parse/BBHandler.py
-lib/bb/parse/ConfHandler.py
-lib/bb/parse/__init__.py
-doc/COPYING.GPL
-doc/COPYING.MIT
-doc/manual/html.css
-doc/manual/Makefile
-doc/manual/usermanual.xml
-contrib/bbdev.sh
-conf/bitbake.conf
-classes/base.bbclass
diff --git a/bitbake/bin/bbimage b/bitbake/bin/bbimage
deleted file mode 100755
index 33851f396..000000000
--- a/bitbake/bin/bbimage
+++ /dev/null
@@ -1,155 +0,0 @@
-#!/usr/bin/env python
-# ex:ts=4:sw=4:sts=4:et
-# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
-#
-# Copyright (C) 2003 Chris Larson
-#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# 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., 59 Temple
-# Place, Suite 330, Boston, MA 02111-1307 USA.
-
-import sys, os
-sys.path.append(os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib'))
-import bb
-from bb import *
-
-__version__ = 1.0
-type = "jffs2"
-cfg_bb = data.init()
-cfg_oespawn = data.init()
-
-
-def usage():
- print "Usage: bbimage [options ...]"
- print "Creates an image for a target device from a root filesystem,"
- print "obeying configuration parameters from the BitBake"
- print "configuration files, thereby easing handling of deviceisms."
- print ""
- print " %s\t\t%s" % ("-r [arg], --root [arg]", "root directory (default=${IMAGE_ROOTFS})")
- print " %s\t\t%s" % ("-t [arg], --type [arg]", "image type (jffs2[default], cramfs)")
- print " %s\t\t%s" % ("-n [arg], --name [arg]", "image name (override IMAGE_NAME variable)")
- print " %s\t\t%s" % ("-v, --version", "output version information and exit")
- sys.exit(0)
-
-def version():
- print "BitBake Build Tool Core version %s" % bb.__version__
- print "BBImage version %s" % __version__
-
-def emit_bb(d, base_d = {}):
- for v in d.keys():
- if d[v] != base_d[v]:
- data.emit_var(v, d)
-
-def getopthash(l):
- h = {}
- for (opt, val) in l:
- h[opt] = val
- return h
-
-import getopt
-try:
- (opts, args) = getopt.getopt(sys.argv[1:], 'vr:t:e:n:', [ 'version', 'root=', 'type=', 'bbfile=', 'name=' ])
-except getopt.GetoptError:
- usage()
-
-# handle opts
-opthash = getopthash(opts)
-
-if '--version' in opthash or '-v' in opthash:
- version()
- sys.exit(0)
-
-try:
- cfg_bb = parse.handle(os.path.join('conf', 'bitbake.conf'), cfg_bb)
-except IOError:
- fatal("Unable to open bitbake.conf")
-
-# sanity check
-if cfg_bb is None:
- fatal("Unable to open/parse %s" % os.path.join('conf', 'bitbake.conf'))
- usage(1)
-
-rootfs = None
-extra_files = []
-
-if '--root' in opthash:
- rootfs = opthash['--root']
-if '-r' in opthash:
- rootfs = opthash['-r']
-
-if '--type' in opthash:
- type = opthash['--type']
-if '-t' in opthash:
- type = opthash['-t']
-
-if '--bbfile' in opthash:
- extra_files.append(opthash['--bbfile'])
-if '-e' in opthash:
- extra_files.append(opthash['-e'])
-
-for f in extra_files:
- try:
- cfg_bb = parse.handle(f, cfg_bb)
- except IOError:
- print "unable to open %s" % f
-
-if not rootfs:
- rootfs = data.getVar('IMAGE_ROOTFS', cfg_bb, 1)
-
-if not rootfs:
- bb.fatal("IMAGE_ROOTFS not defined")
-
-data.setVar('IMAGE_ROOTFS', rootfs, cfg_bb)
-
-from copy import copy, deepcopy
-localdata = data.createCopy(cfg_bb)
-
-overrides = data.getVar('OVERRIDES', localdata)
-if not overrides:
- bb.fatal("OVERRIDES not defined.")
-data.setVar('OVERRIDES', '%s:%s' % (overrides, type), localdata)
-data.update_data(localdata)
-data.setVar('OVERRIDES', overrides, localdata)
-
-if '-n' in opthash:
- data.setVar('IMAGE_NAME', opthash['-n'], localdata)
-if '--name' in opthash:
- data.setVar('IMAGE_NAME', opthash['--name'], localdata)
-
-topdir = data.getVar('TOPDIR', localdata, 1) or os.getcwd()
-
-cmd = data.getVar('IMAGE_CMD', localdata, 1)
-if not cmd:
- bb.fatal("IMAGE_CMD not defined")
-
-outdir = data.getVar('DEPLOY_DIR_IMAGE', localdata, 1)
-if not outdir:
- bb.fatal('DEPLOY_DIR_IMAGE not defined')
-mkdirhier(outdir)
-
-#depends = data.getVar('IMAGE_DEPENDS', localdata, 1) or ""
-#if depends:
-# bb.note("Spawning bbmake to satisfy dependencies: %s" % depends)
-# ret = os.system('bbmake %s' % depends)
-# if ret != 0:
-# bb.error("executing bbmake to satisfy dependencies")
-
-bb.note("Executing %s" % cmd)
-data.setVar('T', '${TMPDIR}', localdata)
-data.setVar('image_cmd', cmd, localdata)
-data.setVarFlag('image_cmd', 'func', 1, localdata)
-try:
- bb.build.exec_func('image_cmd', localdata)
-except bb.build.FuncFailed:
- sys.exit(1)
-#ret = os.system(cmd)
-#sys.exit(ret)
diff --git a/bitbake/bin/bbread b/bitbake/bin/bbread
deleted file mode 100755
index cafdeab22..000000000
--- a/bitbake/bin/bbread
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/env python
-# ex:ts=4:sw=4:sts=4:et
-# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
-#
-# Copyright (C) 2003, 2004 Chris Larson
-#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# 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., 59 Temple
-# Place, Suite 330, Boston, MA 02111-1307 USA.
-
-import sys, copy, os
-sys.path.append(os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib'))
-import bb, bb.parse, bb.build, bb.make
-
-d = bb.data.init()
-try:
- bb.make.cfg = bb.parse.handle(os.path.join('conf', 'bitbake.conf'), d)
-except IOError, e:
- bb.fatal("Unable to read conf/bitbake.conf: %s" % e)
-
-if len(sys.argv) == 2:
- bbfile = sys.argv[1]
- try:
- d, fromCache = bb.make.load_bbfile(bbfile)
- except IOError, e:
- bb.fatal("Unable to read %s: %s" % (bbfile, e))
- except Exception, e:
- bb.fatal("%s" % e)
-
-# emit variables and shell functions
-try:
- bb.data.emit_env(sys.__stdout__, d, True)
-except bb.build.FuncFailed:
- pass
-except Exception, e:
- bb.fatal("%s" % e)
-# emit the metadata which isnt valid shell
-for e in d.keys():
- if bb.data.getVarFlag(e, 'python', d):
- sys.__stdout__.write("\npython %s () {\n%s}\n" % (e, bb.data.getVar(e, d, 1)))
diff --git a/bitbake/bin/bitbake b/bitbake/bin/bitbake
deleted file mode 100755
index f9142c42f..000000000
--- a/bitbake/bin/bitbake
+++ /dev/null
@@ -1,739 +0,0 @@
-#!/usr/bin/env python
-# ex:ts=4:sw=4:sts=4:et
-# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
-#
-# Copyright (C) 2003, 2004 Chris Larson
-# Copyright (C) 2003, 2004 Phil Blundell
-# Copyright (C) 2003 - 2005 Michael 'Mickey' Lauer
-# Copyright (C) 2005 Holger Hans Peter Freyther
-# Copyright (C) 2005 ROAD GmbH
-#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# 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., 59 Temple
-# Place, Suite 330, Boston, MA 02111-1307 USA.
-
-import sys, os, getopt, glob, copy, os.path, re
-sys.path.append(os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib'))
-import bb
-from bb import make
-from sets import Set
-import itertools, optparse
-
-parsespin = itertools.cycle( r'|/-\\' )
-
-__version__ = "1.2.1"
-__build_cache_fail = []
-__build_cache = []
-__building_list = []
-__build_path = []
-
-__preferred = {}
-__world_target = Set()
-
-__stats = {}
-
-bbfile_config_priorities = []
-bbfile_priority = {}
-bbdebug = 0
-providers = {}
-
-def handle_options( args ):
- parser = optparse.OptionParser( version = "BitBake Build Tool Core version %s, %%prog version %s" % ( bb.__version__, __version__ ),
- usage = """%prog [options] [package ...]
-
-Executes the specified task (default is 'build') for a given set of BitBake files.
-It expects that BBFILES is defined, which is a space seperated list of files to
-be executed. BBFILES does support wildcards.
-Default BBFILES are the .bb files in the current directory.""" )
-
- parser.add_option( "-b", "--buildfile", help = "execute the task against this .bb file, rather than a package from BBFILES.",
- action = "store", dest = "buildfile", default = None )
-
- parser.add_option( "-k", "--continue", help = "continue as much as possible after an error. While the target that failed, and those that depend on it, cannot be remade, the other dependencies of these targets can be processed all the same.",
- action = "store_false", dest = "abort", default = True )
-
- parser.add_option( "-f", "--force", help = "force run of specified cmd, regardless of stamp status",
- action = "store_true", dest = "force", default = False )
-
-
- parser.add_option( "-c", "--cmd", help = "Specify task to execute",
- action = "store", dest = "cmd", default = "build" )
-
- parser.add_option( "-r", "--read", help = "read the specified file before bitbake.conf",
- action = "append", dest = "file", default = [] )
-
- parser.add_option( "-v", "--verbose", help = "output more chit-chat to the terminal",
- action = "store_true", dest = "verbose", default = False )
- parser.add_option( "-D", "--debug", help = "Increase the debug level",
- action = "count", dest="debug", default = 0)
-
- parser.add_option( "-n", "--dry-run", help = "don't execute, just go through the motions",
- action = "store_true", dest = "dry_run", default = False )
-
- parser.add_option( "-p", "--parse-only", help = "quit after parsing the BB files (developers only)",
- action = "store_true", dest = "parse_only", default = False )
-
- parser.add_option( "-d", "--disable-psyco", help = "disable using the psyco just-in-time compiler (not recommended)",
- action = "store_true", dest = "disable_psyco", default = False )
-
- parser.add_option( "-s", "--show-versions", help = "show current and preferred versions of all packages",
- action = "store_true", dest = "show_versions", default = False )
-
- options, args = parser.parse_args( args )
- return options, args[1:]
-
-def try_build(fn, virtual):
- if fn in __building_list:
- bb.error("%s depends on itself (eventually)" % fn)
- bb.error("upwards chain is: %s" % (" -> ".join(__build_path)))
- return False
-
- the_data = make.pkgdata[fn]
- item = bb.data.getVar('PN', the_data, 1)
-
- __building_list.append(fn)
-
- pathstr = "%s (%s)" % (item, virtual)
- __build_path.append(pathstr)
-
- depends_list = (bb.data.getVar('DEPENDS', the_data, 1) or "").split()
- if make.options.verbose:
- bb.note("current path: %s" % (" -> ".join(__build_path)))
- bb.note("dependencies for %s are: %s" % (item, " ".join(depends_list)))
-
- try:
- failed = False
-
- depcmd = make.options.cmd
- bbdepcmd = bb.data.getVarFlag('do_%s' % make.options.cmd, 'bbdepcmd', the_data)
- if bbdepcmd is not None:
- if bbdepcmd == "":
- depcmd = None
- else:
- depcmd = bbdepcmd
-
- if depcmd:
- oldcmd = make.options.cmd
- make.options.cmd = depcmd
-
- for d in depends_list:
- if d in __ignored_dependencies:
- continue
- if not depcmd:
- continue
- if buildPackage(d) == 0:
- bb.error("dependency %s (for %s) not satisfied" % (d,item))
- failed = True
- if make.options.abort:
- break
-
- if depcmd:
- make.options.cmd = oldcmd
-
- if failed:
- __stats["deps"] += 1
- return False
-
- if bb.build.stamp_is_current('do_%s' % make.options.cmd, the_data):
- __build_cache.append(fn)
- return True
-
- bb.event.fire(bb.event.PkgStarted(item, the_data))
- try:
- __stats["attempt"] += 1
- if not make.options.dry_run:
- bb.build.exec_task('do_%s' % make.options.cmd, the_data)
- bb.event.fire(bb.event.PkgSucceeded(item, the_data))
- __build_cache.append(fn)
- return True
- except bb.build.FuncFailed:
- __stats["fail"] += 1
- bb.error("task stack execution failed")
- bb.event.fire(bb.event.PkgFailed(item, the_data))
- __build_cache_fail.append(fn)
- raise
- except bb.build.EventException:
- __stats["fail"] += 1
- (type, value, traceback) = sys.exc_info()
- e = value.event
- bb.error("%s event exception, aborting" % bb.event.getName(e))
- bb.event.fire(bb.event.PkgFailed(item, the_data))
- __build_cache_fail.append(fn)
- raise
- finally:
- __building_list.remove(fn)
- __build_path.remove(pathstr)
-
-def showVersions():
- pkg_pn = {}
- preferred_versions = {}
- latest_versions = {}
-
- for p in make.pkgdata.keys():
- pn = bb.data.getVar('PN', make.pkgdata[p], 1)
- if not pkg_pn.has_key(pn):
- pkg_pn[pn] = []
- pkg_pn[pn].append(p)
-
- # Sort by priority
- for pn in pkg_pn.keys():
- files = pkg_pn[pn]
- priorities = {}
- for f in files:
- priority = bbfile_priority[f]
- if not priorities.has_key(priority):
- priorities[priority] = []
- priorities[priority].append(f)
- p_list = priorities.keys()
- p_list.sort(lambda a, b: a - b)
- pkg_pn[pn] = []
- for p in p_list:
- pkg_pn[pn] = [ priorities[p] ] + pkg_pn[pn]
-
- # If there is a PREFERRED_VERSION, find the highest-priority bbfile providing that
- # version. If not, find the latest version provided by an bbfile in the
- # highest-priority set.
- for pn in pkg_pn.keys():
- preferred_file = None
-
- preferred_v = bb.data.getVar('PREFERRED_VERSION_%s' % pn, make.cfg, 1)
- if preferred_v:
- preferred_r = None
- m = re.match('(.*)_(.*)', preferred_v)
- if m:
- preferred_v = m.group(1)
- preferred_r = m.group(2)
-
- for file_set in pkg_pn[pn]:
- for f in file_set:
- the_data = make.pkgdata[f]
- pv = bb.data.getVar('PV', the_data, 1)
- pr = bb.data.getVar('PR', the_data, 1)
- if preferred_v == pv and (preferred_r == pr or preferred_r == None):
- preferred_file = f
- preferred_ver = (pv, pr)
- break
- if preferred_file:
- break
- if preferred_r:
- pv_str = '%s-%s' % (preferred_v, preferred_r)
- else:
- pv_str = preferred_v
- if preferred_file is None:
- bb.note("preferred version %s of %s not available" % (pv_str, pn))
- else:
- bb.debug(1, "selecting %s as PREFERRED_VERSION %s of package %s" % (preferred_file, pv_str, pn))
-
- # get highest priority file set
- files = pkg_pn[pn][0]
- latest = None
- latest_p = 0
- latest_f = None
- for f in files:
- the_data = make.pkgdata[f]
- pv = bb.data.getVar('PV', the_data, 1)
- pr = bb.data.getVar('PR', the_data, 1)
- dp = int(bb.data.getVar('DEFAULT_PREFERENCE', the_data, 1) or "0")
-
- if (latest is None) or ((latest_p == dp) and (make.vercmp(latest, (pv, pr)) < 0)) or (dp > latest_p):
- latest = (pv, pr)
- latest_f = f
- latest_p = dp
- if preferred_file is None:
- preferred_file = latest_f
- preferred_ver = latest
-
- preferred_versions[pn] = (preferred_ver, preferred_file)
- latest_versions[pn] = (latest, latest_f)
-
- pkg_list = pkg_pn.keys()
- pkg_list.sort()
-
- for p in pkg_list:
- pref = preferred_versions[p]
- latest = latest_versions[p]
-
- if pref != latest:
- prefstr = pref[0][0] + "-" + pref[0][1]
- else:
- prefstr = ""
-
- print "%-30s %20s %20s" % (p, latest[0][0] + "-" + latest[0][1],
- prefstr)
-
-__consider_msgs_cache = []
-def buildPackage(item):
- fn = None
-
- discriminated = False
-
- if not providers.has_key(item):
- bb.error("Nothing provides %s" % item)
- return 0
-
- all_p = providers[item]
-
- for p in all_p:
- if p in __build_cache:
- bb.debug(1, "already built %s in this run\n" % p)
- return 1
-
- eligible = []
- preferred_versions = {}
-
- # Collate providers by PN
- pkg_pn = {}
- for p in all_p:
- the_data = make.pkgdata[p]
- pn = bb.data.getVar('PN', the_data, 1)
- if not pkg_pn.has_key(pn):
- pkg_pn[pn] = []
- pkg_pn[pn].append(p)
-
- bb.debug(1, "providers for %s are: %s" % (item, pkg_pn.keys()))
-
- # Sort by priority
- for pn in pkg_pn.keys():
- files = pkg_pn[pn]
- priorities = {}
- for f in files:
- priority = bbfile_priority[f]
- if not priorities.has_key(priority):
- priorities[priority] = []
- priorities[priority].append(f)
- p_list = priorities.keys()
- p_list.sort(lambda a, b: a - b)
- pkg_pn[pn] = []
- for p in p_list:
- pkg_pn[pn] = [ priorities[p] ] + pkg_pn[pn]
-
- # If there is a PREFERRED_VERSION, find the highest-priority bbfile providing that
- # version. If not, find the latest version provided by an bbfile in the
- # highest-priority set.
- for pn in pkg_pn.keys():
- preferred_file = None
-
- preferred_v = bb.data.getVar('PREFERRED_VERSION_%s' % pn, make.cfg, 1)
- if preferred_v:
- preferred_r = None
- m = re.match('(.*)_(.*)', preferred_v)
- if m:
- preferred_v = m.group(1)
- preferred_r = m.group(2)
-
- for file_set in pkg_pn[pn]:
- for f in file_set:
- the_data = make.pkgdata[f]
- pv = bb.data.getVar('PV', the_data, 1)
- pr = bb.data.getVar('PR', the_data, 1)
- if preferred_v == pv and (preferred_r == pr or preferred_r == None):
- preferred_file = f
- preferred_ver = (pv, pr)
- break
- if preferred_file:
- break
- if preferred_r:
- pv_str = '%s-%s' % (preferred_v, preferred_r)
- else:
- pv_str = preferred_v
- if preferred_file is None:
- bb.note("preferred version %s of %s not available" % (pv_str, pn))
- else:
- bb.debug(1, "selecting %s as PREFERRED_VERSION %s of package %s" % (preferred_file, pv_str, pn))
-
- if preferred_file is None:
- # get highest priority file set
- files = pkg_pn[pn][0]
- latest = None
- latest_p = 0
- latest_f = None
- for f in files:
- the_data = make.pkgdata[f]
- pv = bb.data.getVar('PV', the_data, 1)
- pr = bb.data.getVar('PR', the_data, 1)
- dp = int(bb.data.getVar('DEFAULT_PREFERENCE', the_data, 1) or "0")
-
- if (latest is None) or ((latest_p == dp) and (make.vercmp(latest, (pv, pr)) < 0)) or (dp > latest_p):
- latest = (pv, pr)
- latest_f = f
- latest_p = dp
- preferred_file = latest_f
- preferred_ver = latest
-
- bb.debug(1, "selecting %s as latest version of provider %s" % (preferred_file, pn))
-
- preferred_versions[pn] = (preferred_ver, preferred_file)
- eligible.append(preferred_file)
-
- for p in eligible:
- if p in __build_cache_fail:
- bb.debug(1, "rejecting already-failed %s" % p)
- eligible.remove(p)
-
- if len(eligible) == 0:
- bb.error("no eligible providers for %s" % item)
- return 0
-
- # look to see if one of them is already staged, or marked as preferred.
- # if so, bump it to the head of the queue
- for p in all_p:
- the_data = make.pkgdata[p]
- pn = bb.data.getVar('PN', the_data, 1)
- pv = bb.data.getVar('PV', the_data, 1)
- pr = bb.data.getVar('PR', the_data, 1)
- tmpdir = bb.data.getVar('TMPDIR', the_data, 1)
- stamp = '%s/stamps/%s-%s-%s.do_populate_staging' % (tmpdir, pn, pv, pr)
- if os.path.exists(stamp):
- (newvers, fn) = preferred_versions[pn]
- if not fn in eligible:
- # package was made ineligible by already-failed check
- continue
- oldver = "%s-%s" % (pv, pr)
- newver = '-'.join(newvers)
- if (newver != oldver):
- extra_chat = "; upgrading from %s to %s" % (oldver, newver)
- else:
- extra_chat = ""
- if make.options.verbose:
- bb.note("selecting already-staged %s to satisfy %s%s" % (pn, item, extra_chat))
- eligible.remove(fn)
- eligible = [fn] + eligible
- discriminated = True
- break
-
- prefervar = bb.data.getVar('PREFERRED_PROVIDER_%s' % item, make.cfg, 1)
- if prefervar:
- __preferred[item] = prefervar
-
- if __preferred.has_key(item):
- for p in eligible:
- the_data = make.pkgdata[p]
- pn = bb.data.getVar('PN', the_data, 1)
- if __preferred[item] == pn:
- if make.options.verbose:
- bb.note("selecting %s to satisfy %s due to PREFERRED_PROVIDERS" % (pn, item))
- eligible.remove(p)
- eligible = [p] + eligible
- discriminated = True
- break
-
- if len(eligible) > 1 and discriminated == False:
- if item not in __consider_msgs_cache:
- providers_list = []
- for fn in eligible:
- providers_list.append(bb.data.getVar('PN', make.pkgdata[fn], 1))
- bb.note("multiple providers are available (%s);" % ", ".join(providers_list))
- bb.note("consider defining PREFERRED_PROVIDER_%s" % item)
- __consider_msgs_cache.append(item)
-
-
- # run through the list until we find one that we can build
- for fn in eligible:
- bb.debug(2, "selecting %s to satisfy %s" % (fn, item))
- if try_build(fn, item):
- return 1
-
- bb.note("no buildable providers for %s" % item)
- return 0
-
-def build_depgraph():
- all_depends = Set()
- pn_provides = {}
-
- def progress(p):
- if bbdebug or progress.p == p: return
- progress.p = p
- if os.isatty(sys.stdout.fileno()):
- sys.stdout.write("\rNOTE: Building provider hash: [%s%s] (%02d%%)" % ( "#" * (p/5), " " * ( 20 - p/5 ), p ) )
- sys.stdout.flush()
- else:
- if p == 0:
- sys.stdout.write("NOTE: Building provider hash, please wait...\n")
- if p == 100:
- sys.stdout.write("done.\n")
- progress.p = 0
-
- def calc_bbfile_priority(filename):
- for (regex, pri) in bbfile_config_priorities:
- if regex.match(filename):
- return pri
- return 0
-
- # Handle PREFERRED_PROVIDERS
- for p in (bb.data.getVar('PREFERRED_PROVIDERS', make.cfg, 1) or "").split():
- (providee, provider) = p.split(':')
- if __preferred.has_key(providee) and __preferred[providee] != provider:
- bb.error("conflicting preferences for %s: both %s and %s specified" % (providee, provider, __preferred[providee]))
- __preferred[providee] = provider
-
- # Calculate priorities for each file
- for p in make.pkgdata.keys():
- bbfile_priority[p] = calc_bbfile_priority(p)
-
- n = len(make.pkgdata.keys())
- i = 0
-
- op = -1
-
- bb.debug(1, "building providers hashes")
-
- # Build forward and reverse provider hashes
- # Forward: virtual -> [filenames]
- # Reverse: PN -> [virtuals]
- for f in make.pkgdata.keys():
- d = make.pkgdata[f]
-
- pn = bb.data.getVar('PN', d, 1)
- provides = Set([pn] + (bb.data.getVar("PROVIDES", d, 1) or "").split())
-
- if not pn_provides.has_key(pn):
- pn_provides[pn] = Set()
- pn_provides[pn] |= provides
-
- for provide in provides:
- if not providers.has_key(provide):
- providers[provide] = []
- providers[provide].append(f)
-
- deps = (bb.data.getVar("DEPENDS", d, 1) or "").split()
- for dep in deps:
- all_depends.add(dep)
-
- i += 1
- p = (100 * i) / n
- if p != op:
- op = p
- progress(p)
-
- if bbdebug == 0:
- sys.stdout.write("\n")
-
- # Build package list for "bitbake world"
- bb.debug(1, "collating packages for \"world\"")
- for f in make.pkgdata.keys():
- d = make.pkgdata[f]
- if bb.data.getVar('BROKEN', d, 1) or bb.data.getVar('EXCLUDE_FROM_WORLD', d, 1):
- bb.debug(2, "skipping %s due to BROKEN/EXCLUDE_FROM_WORLD" % f)
- continue
- terminal = True
- pn = bb.data.getVar('PN', d, 1)
- for p in pn_provides[pn]:
- if p.startswith('virtual/'):
- bb.debug(2, "skipping %s due to %s provider starting with virtual/" % (f, p))
- terminal = False
- break
- for pf in providers[p]:
- if bb.data.getVar('PN', make.pkgdata[pf], 1) != pn:
- bb.debug(2, "skipping %s due to both us and %s providing %s" % (f, pf, p))
- terminal = False
- break
- if terminal:
- __world_target.add(pn)
-
-def myProgressCallback( x, y, f ):
- if bbdebug > 0:
- return
- if os.isatty(sys.stdout.fileno()):
- sys.stdout.write("\rNOTE: Handling BitBake files: %s (%04d/%04d) [%2d %%]" % ( parsespin.next(), x, y, x*100/y ) )
- sys.stdout.flush()
- else:
- if x == 1:
- sys.stdout.write("Parsing .bb files, please wait...")
- sys.stdout.flush()
- if x == y:
- sys.stdout.write("done.")
- sys.stdout.flush()
-
-def executeOneBB( fn ):
- try:
- d = bb.parse.handle(fn, make.cfg)
- except IOError:
- bb.fatal("Unable to open %s" % fn)
-
- if make.options.parse_only:
- print "Requested parsing .bb files only. Exiting."
- sys.exit(0)
-
- name = bb.data.getVar('PN', d, 1)
- bb.event.fire(bb.event.PkgStarted(name, d))
- try:
- __stats["attempt"] += 1
- if make.options.force:
- bb.data.setVarFlag('do_%s' % make.options.cmd, 'force', 1, d)
- if not make.options.dry_run:
- bb.build.exec_task('do_%s' % make.options.cmd, d)
- bb.event.fire(bb.event.PkgSucceeded(name, d))
- __build_cache.append(fn)
- except bb.build.FuncFailed:
- __stats["fail"] += 1
- bb.error("task stack execution failed")
- bb.event.fire(bb.event.PkgFailed(name, d))
- __build_cache_fail.append(fn)
- except bb.build.EventException:
- __stats["fail"] += 1
- (type, value, traceback) = sys.exc_info()
- e = value.event
- bb.error("%s event exception, aborting" % bb.event.getName(e))
- bb.event.fire(bb.event.PkgFailed(name, d))
- __build_cache_fail.append(fn)
-
-#
-# main
-#
-
-__stats["attempt"] = 0
-__stats["success"] = 0
-__stats["fail"] = 0
-__stats["deps"] = 0
-
-def printStats( ):
- print "Build statistics:"
- print " Attempted builds: %d" % __stats["attempt"]
- if __stats["fail"] != 0:
- print " Failed builds: %d" % __stats["fail"]
- if __stats["deps"] != 0:
- print " Dependencies not satisfied: %d" % __stats["deps"]
- if __stats["fail"] != 0 or __stats["deps"] != 0:
- sys.exit(1)
- sys.exit(0)
-
-if __name__ == "__main__":
-
- make.options, args = handle_options( sys.argv )
-
- if not make.options.cmd:
- make.options.cmd = "build"
-
- if make.options.debug:
- bb.debug_level = make.options.debug
-
- make.cfg = bb.data.init()
-
- for f in make.options.file:
- try:
- make.cfg = bb.parse.handle(f, make.cfg)
- except IOError:
- bb.fatal("Unable to open %s" % f)
-
- try:
- make.cfg = bb.parse.handle(os.path.join('conf', 'bitbake.conf'), make.cfg)
- except IOError:
- bb.fatal("Unable to open %s" % os.path.join('conf', 'bitbake.conf'))
-
- if not bb.data.getVar("BUILDNAME", make.cfg):
- bb.data.setVar("BUILDNAME", os.popen('date +%Y%m%d%H%M').readline().strip(), make.cfg)
-
- buildname = bb.data.getVar("BUILDNAME", make.cfg)
-
- bf = make.options.buildfile
- if bf:
- executeOneBB( os.path.abspath(bf) )
- printStats()
-
- ignore = bb.data.getVar("ASSUME_PROVIDED", make.cfg, 1) or ""
- global __ignored_dependencies
- __ignored_dependencies = Set( ignore.split() )
-
- collections = bb.data.getVar("BBFILE_COLLECTIONS", make.cfg, 1)
- if collections:
- collection_list = collections.split()
- for c in collection_list:
- regex = bb.data.getVar("BBFILE_PATTERN_%s" % c, make.cfg, 1)
- if regex == None:
- bb.error("BBFILE_PATTERN_%s not defined" % c)
- continue
- priority = bb.data.getVar("BBFILE_PRIORITY_%s" % c, make.cfg, 1)
- if priority == None:
- bb.error("BBFILE_PRIORITY_%s not defined" % c)
- continue
- try:
- cre = re.compile(regex)
- except re.error:
- bb.error("BBFILE_PATTERN_%s \"%s\" is not a valid regular expression" % (c, regex))
- continue
- try:
- pri = int(priority)
- bbfile_config_priorities.append((cre, pri))
- except ValueError:
- bb.error("invalid value for BBFILE_PRIORITY_%s: \"%s\"" % (c, priority))
-
- pkgs_to_build = None
- if args:
- if not pkgs_to_build:
- pkgs_to_build = []
- pkgs_to_build.extend(args)
- if not pkgs_to_build:
- bbpkgs = bb.data.getVar('BBPKGS', make.cfg, 1)
- if bbpkgs:
- pkgs_to_build = bbpkgs.split()
- if not pkgs_to_build and not make.options.show_versions:
- print "Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help'"
- print "for usage information."
- sys.exit(0)
-
-
- # Import Psyco if available and not disabled
- if not make.options.disable_psyco:
- try:
- import psyco
- except ImportError:
- if bbdebug == 0:
- bb.note("Psyco JIT Compiler (http://psyco.sf.net) not available. Install it to increase performance.")
- else:
- psyco.bind( make.collect_bbfiles )
- else:
- bb.note("You have disabled Psyco. This decreases performance.")
-
- try:
- bb.debug(1, "collecting .bb files")
- make.collect_bbfiles( myProgressCallback )
- bb.debug(1, "parsing complete")
- if bbdebug == 0:
- print
- if make.options.parse_only:
- print "Requested parsing .bb files only. Exiting."
- sys.exit(0)
-
- build_depgraph()
-
- if make.options.show_versions:
- showVersions()
- sys.exit(0)
-
- if 'world' in pkgs_to_build:
- pkgs_to_build.remove('world')
- for t in __world_target:
- pkgs_to_build.append(t)
-
- bb.event.fire(bb.event.BuildStarted(buildname, pkgs_to_build, make.cfg))
-
- for k in pkgs_to_build:
- failed = False
- try:
- if buildPackage(k) == 0:
- # already diagnosed
- failed = True
- except bb.build.EventException:
- bb.error("Build of " + k + " failed")
- failed = True
-
- if failed:
- if make.options.abort:
- sys.exit(1)
-
- bb.event.fire(bb.event.BuildCompleted(buildname, pkgs_to_build, make.cfg))
-
- printStats()
-
- except KeyboardInterrupt:
- print "\nNOTE: KeyboardInterrupt - Build not completed."
- sys.exit(1)
diff --git a/bitbake/classes/base.bbclass b/bitbake/classes/base.bbclass
deleted file mode 100644
index 1d75964f5..000000000
--- 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.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 fd216a326..000000000
--- a/bitbake/conf/bitbake.conf
+++ /dev/null
@@ -1,55 +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 http://${SVNROOT} ${SVNCOOPTS} ${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))}"
-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}"
-T = "${WORKDIR}/temp"
-TARGET_ARCH = "${BUILD_ARCH}"
-TMPDIR = "${TOPDIR}/tmp"
-UPDATECOMMAND = ""
-UPDATECOMMAND_cvs = "/usr/bin/env cvs update ${CVSCOOPTS}"
-WORKDIR = "${TMPDIR}/work/${PF}"
diff --git a/bitbake/contrib/README b/bitbake/contrib/README
deleted file mode 100644
index 25e515661..000000000
--- a/bitbake/contrib/README
+++ /dev/null
@@ -1 +0,0 @@
-This directory is for additional contributed files which may be useful.
diff --git a/bitbake/contrib/bbdev.sh b/bitbake/contrib/bbdev.sh
deleted file mode 100644
index 33a78531e..000000000
--- a/bitbake/contrib/bbdev.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-# This is a shell function to be sourced into your shell or placed in your .profile,
-# which makes setting things up for BitBake a bit easier.
-#
-# The author disclaims copyright to the contents of this file and places it in the
-# public domain.
-
-bbdev () {
- local BBDIR PKGDIR BUILDDIR
- if test x"$1" = "x--help"; then echo >&2 "syntax: bbdev [bbdir [pkgdir [builddir]]]"; return 1; fi
- if test x"$1" = x; then BBDIR=`pwd`; else BBDIR=$1; fi
- if test x"$2" = x; then PKGDIR=`pwd`; else PKGDIR=$2; fi
- if test x"$3" = x; then BUILDDIR=`pwd`; else BUILDDIR=$3; fi
-
- BBDIR=`readlink -f $BBDIR`
- PKGDIR=`readlink -f $PKGDIR`
- BUILDDIR=`readlink -f $BUILDDIR`
- if ! (test -d $BBDIR && test -d $PKGDIR && test -d $BUILDDIR); then
- echo >&2 "syntax: bbdev [bbdir [pkgdir [builddir]]]"
- return 1
- fi
-
- PATH=$BBDIR/bin:$PATH
- BBPATH=$BBDIR
- if test x"$BBDIR" != x"$PKGDIR"; then
- BBPATH=$PKGDIR:$BBPATH
- fi
- if test x"$PKGDIR" != x"$BUILDDIR"; then
- BBPATH=$BUILDDIR:$BBPATH
- fi
- export BBPATH
-}
diff --git a/bitbake/contrib/vim/syntax/bitbake.vim b/bitbake/contrib/vim/syntax/bitbake.vim
deleted file mode 100644
index 5d2bc633e..000000000
--- a/bitbake/contrib/vim/syntax/bitbake.vim
+++ /dev/null
@@ -1,120 +0,0 @@
-" Vim syntax file
-"
-" Copyright (C) 2004 Chris Larson <kergoth@handhelds.org>
-" This file is licensed under the MIT license, see COPYING.MIT in
-" this source distribution for the terms.
-"
-" Language: BitBake
-" Maintainer: Chris Larson <kergoth@handhelds.org>
-" Filenames: *.bb, *.bbclass
-
-if version < 600
- syntax clear
-elseif exists("b:current_syntax")
- finish
-endif
-
-syn case match
-
-
-" Catch incorrect syntax (only matches if nothing else does)
-"
-syn match bbUnmatched "."
-
-
-" Other
-
-syn match bbComment "^#.*$" display contains=bbTodo
-syn keyword bbTodo TODO FIXME XXX contained
-syn match bbDelimiter "[(){}=]" contained
-syn match bbQuote /['"]/ contained
-syn match bbArrayBrackets "[\[\]]" contained
-
-
-" BitBake strings
-
-syn match bbContinue "\\$"
-syn region bbString matchgroup=bbQuote start=/"/ skip=/\\$/ excludenl end=/"/ contained keepend contains=bbTodo,bbContinue,bbVarDeref
-syn region bbString matchgroup=bbQuote start=/'/ skip=/\\$/ excludenl end=/'/ contained keepend contains=bbTodo,bbContinue,bbVarDeref
-
-
-" BitBake variable metadata
-
-syn keyword bbExportFlag export contained nextgroup=bbIdentifier skipwhite
-syn match bbVarDeref "${[a-zA-Z0-9\-_\.]\+}" contained
-syn match bbVarDef "^\(export\s*\)\?\([a-zA-Z0-9\-_\.]\+\(_[${}a-zA-Z0-9\-_\.]\+\)\?\)\s*\(\(:=\)\|\(+=\)\|\(=+\)\|\(?=\)\|=\)\@=" contains=bbExportFlag,bbIdentifier,bbVarDeref nextgroup=bbVarEq
-
-syn match bbIdentifier "[a-zA-Z0-9\-_\.]\+" display contained
-"syn keyword bbVarEq = display contained nextgroup=bbVarValue
-syn match bbVarEq "\(:=\)\|\(+=\)\|\(=+\)\|\(?=\)\|=" contained nextgroup=bbVarValue
-syn match bbVarValue ".*$" contained contains=bbString,bbVarDeref
-
-
-" BitBake variable metadata flags
-syn match bbVarFlagDef "^\([a-zA-Z0-9\-_\.]\+\)\(\[[a-zA-Z0-9\-_\.]\+\]\)\@=" contains=bbIdentifier nextgroup=bbVarFlagFlag
-syn region bbVarFlagFlag matchgroup=bbArrayBrackets start="\[" end="\]\s*\(=\)\@=" keepend excludenl contained contains=bbIdentifier nextgroup=bbVarEq
-"syn match bbVarFlagFlag "\[\([a-zA-Z0-9\-_\.]\+\)\]\s*\(=\)\@=" contains=bbIdentifier nextgroup=bbVarEq
-
-
-" Functions!
-syn match bbFunction "\h\w*" display contained
-
-
-" BitBake python metadata
-syn include @python syntax/python.vim
-if exists("b:current_syntax")
- unlet b:current_syntax
-endif
-
-syn keyword bbPythonFlag python contained nextgroup=bbFunction
-syn match bbPythonFuncDef "^\(python\s\+\)\(\w\+\)\?\(\s*()\s*\)\({\)\@=" contains=bbPythonFlag,bbFunction,bbDelimiter nextgroup=bbPythonFuncRegion skipwhite
-syn region bbPythonFuncRegion matchgroup=bbDelimiter start="{\s*$" end="^}\s*$" keepend contained contains=@python
-"hi def link bbPythonFuncRegion Comment
-
-
-" BitBake shell metadata
-syn include @shell syntax/sh.vim
-if exists("b:current_syntax")
- unlet b:current_syntax
-endif
-
-syn keyword bbFakerootFlag fakeroot contained nextgroup=bbFunction
-syn match bbShellFuncDef "^\(fakeroot\s*\)\?\(\w\+\)\(python\)\@<!\(\s*()\s*\)\({\)\@=" contains=bbFakerootFlag,bbFunction,bbDelimiter nextgroup=bbShellFuncRegion skipwhite
-syn region bbShellFuncRegion matchgroup=bbDelimiter start="{\s*$" end="^}\s*$" keepend contained contains=@shell
-"hi def link bbShellFuncRegion Comment
-
-
-" BitBake 'def'd python functions
-syn keyword bbDef def contained
-syn region bbDefRegion start='^def\s\+\w\+\s*([^)]*)\s*:\s*$' end='^\(\s\|$\)\@!' contains=@python
-
-
-" BitBake statements
-syn keyword bbStatement include inherit addtask addhandler EXPORT_FUNCTIONS display contained
-syn match bbStatementLine "^\(include\|inherit\|addtask\|addhandler\|EXPORT_FUNCTIONS\)\s\+" contains=bbStatement nextgroup=bbStatementRest
-syn match bbStatementRest ".*$" contained contains=bbString,bbVarDeref
-
-" Highlight
-"
-hi def link bbArrayBrackets Statement
-hi def link bbUnmatched Error
-hi def link bbVarDeref String
-hi def link bbContinue Special
-hi def link bbDef Statement
-hi def link bbPythonFlag Type
-hi def link bbExportFlag Type
-hi def link bbFakerootFlag Type
-hi def link bbStatement Statement
-hi def link bbString String
-hi def link bbTodo Todo
-hi def link bbComment Comment
-hi def link bbOperator Operator
-hi def link bbError Error
-hi def link bbFunction Function
-hi def link bbDelimiter Delimiter
-hi def link bbIdentifier Identifier
-hi def link bbVarEq Operator
-hi def link bbQuote String
-hi def link bbVarValue String
-
-let b:current_syntax = "bb"
diff --git a/bitbake/doc/COPYING.GPL b/bitbake/doc/COPYING.GPL
deleted file mode 100644
index d60c31a97..000000000
--- a/bitbake/doc/COPYING.GPL
+++ /dev/null
@@ -1,340 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
diff --git a/bitbake/doc/COPYING.MIT b/bitbake/doc/COPYING.MIT
deleted file mode 100644
index 7e7d57413..000000000
--- a/bitbake/doc/COPYING.MIT
+++ /dev/null
@@ -1,17 +0,0 @@
-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.
diff --git a/bitbake/doc/manual/Makefile b/bitbake/doc/manual/Makefile
deleted file mode 100644
index a43c02545..000000000
--- a/bitbake/doc/manual/Makefile
+++ /dev/null
@@ -1,56 +0,0 @@
-topdir = .
-manual = $(topdir)/usermanual.xml
-# types = pdf txt rtf ps xhtml html man tex texi dvi
-# types = pdf txt
-types = $(xmltotypes) $(htmltypes)
-xmltotypes = pdf txt
-htmltypes = html xhtml
-htmlxsl = $(if $(filter $@,$(foreach type,$(htmltypes),$(type)-nochunks)),http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl,http://docbook.sourceforge.net/release/xsl/current/$@/chunk.xsl)
-htmlcssfile = docbook.css
-htmlcss = $(topdir)/html.css
-# htmlcssfile =
-# htmlcss =
-cleanfiles = $(foreach i,$(types),$(topdir)/$(i))
-
-ifdef DEBUG
-define command
- $(1)
-endef
-else
-define command
- @echo $(2) $(3) $(4)
- @$(1) >/dev/null
-endef
-endif
-
-all: $(types)
-
-lint: $(manual) FORCE
- $(call command,xmllint --xinclude --postvalid --noout $(manual),XMLLINT $(manual))
-
-$(types) $(foreach type,$(htmltypes),$(type)-nochunks): lint FORCE
-
-$(foreach type,$(htmltypes),$(type)-nochunks): $(if $(htmlcss),$(htmlcss)) $(manual)
- @mkdir -p $@
-ifdef htmlcss
- $(call command,install -m 0644 $(htmlcss) $@/$(htmlcssfile),CP $(htmlcss) $@/$(htmlcssfile))
-endif
- $(call command,xsltproc --stringparam base.dir $@/ $(if $(htmlcssfile),--stringparam html.stylesheet $(htmlcssfile)) $(htmlxsl) $(manual) > $@/index.$(patsubst %-nochunks,%,$@),XSLTPROC $@ $(manual))
-
-$(htmltypes): $(if $(htmlcss),$(htmlcss)) $(manual)
- @mkdir -p $@
-ifdef htmlcss
- $(call command,install -m 0644 $(htmlcss) $@/$(htmlcssfile),CP $(htmlcss) $@/$(htmlcssfile))
-endif
- $(call command,xsltproc --stringparam base.dir $@/ $(if $(htmlcssfile),--stringparam html.stylesheet $(htmlcssfile)) $(htmlxsl) $(manual),XSLTPROC $@ $(manual))
-
-$(xmltotypes): $(manual)
- $(call command,xmlto --extensions -o $(topdir)/$@ $@ $(manual),XMLTO $@ $(manual))
-
-clean:
- rm -rf $(cleanfiles)
-
-$(foreach i,$(types) $(foreach type,$(htmltypes),$(type)-nochunks),clean-$(i)):
- rm -rf $(patsubst clean-%,%,$@)
-
-FORCE:
diff --git a/bitbake/doc/manual/html.css b/bitbake/doc/manual/html.css
deleted file mode 100644
index 6eedfd318..000000000
--- a/bitbake/doc/manual/html.css
+++ /dev/null
@@ -1,281 +0,0 @@
-/* Feuille de style DocBook du projet Traduc.org */
-/* DocBook CSS stylesheet of the Traduc.org project */
-
-/* (c) Jean-Philippe Guérard - 14 août 2004 */
-/* (c) Jean-Philippe Guérard - 14 August 2004 */
-
-/* Cette feuille de style est libre, vous pouvez la */
-/* redistribuer et la modifier selon les termes de la Licence */
-/* Art Libre. Vous trouverez un exemplaire de cette Licence sur */
-/* http://tigreraye.org/Petit-guide-du-traducteur.html#licence-art-libre */
-
-/* This work of art is free, you can redistribute it and/or */
-/* modify it according to terms of the Free Art license. You */
-/* will find a specimen of this license on the Copyleft */
-/* Attitude web site: http://artlibre.org as well as on other */
-/* sites. */
-/* Please note that the French version of this licence as shown */
-/* on http://tigreraye.org/Petit-guide-du-traducteur.html#licence-art-libre */
-/* is only official licence of this document. The English */
-/* is only provided to help you understand this licence. */
-
-/* La dernière version de cette feuille de style est toujours */
-/* disponible sur : http://tigreraye.org/style.css */
-/* Elle est également disponible sur : */
-/* http://www.traduc.org/docs/HOWTO/lecture/style.css */
-
-/* The latest version of this stylesheet is available from: */
-/* http://tigreraye.org/style.css */
-/* It is also available on: */
-/* http://www.traduc.org/docs/HOWTO/lecture/style.css */
-
-/* N'hésitez pas à envoyer vos commentaires et corrections à */
-/* Jean-Philippe Guérard <jean-philippe.guerard@tigreraye.org> */
-
-/* Please send feedback and bug reports to */
-/* Jean-Philippe Guérard <jean-philippe.guerard@tigreraye.org> */
-
-/* $Id: style.css,v 1.14 2004/09/10 20:12:09 fevrier Exp fevrier $ */
-
-/* Présentation générale du document */
-/* Overall document presentation */
-
-body {
- /*
- font-family: Apolline, "URW Palladio L", Garamond, jGaramond,
- "Bitstream Cyberbit", "Palatino Linotype", serif;
- */
- margin: 7%;
- background-color: white;
-}
-
-/* Taille du texte */
-/* Text size */
-
-* { font-size: 100%; }
-
-/* Gestion des textes mis en relief imbriqués */
-/* Embedded emphasis */
-
-em { font-style: italic; }
-em em { font-style: normal; }
-em em em { font-style: italic; }
-
-/* Titres */
-/* Titles */
-
-h1 { font-size: 200%; font-weight: 900; }
-h2 { font-size: 160%; font-weight: 900; }
-h3 { font-size: 130%; font-weight: bold; }
-h4 { font-size: 115%; font-weight: bold; }
-h5 { font-size: 108%; font-weight: bold; }
-h6 { font-weight: bold; }
-
-/* Nom de famille en petites majuscules (uniquement en français) */
-/* Last names in small caps (for French only) */
-
-*[class~="surname"]:lang(fr) { font-variant: small-caps; }
-
-/* Blocs de citation */
-/* Quotation blocs */
-
-div[class~="blockquote"] {
- border: solid 2px #AAA;
- padding: 5px;
- margin: 5px;
-}
-
-div[class~="blockquote"] > table {
- border: none;
-}
-
-/* Blocs litéraux : fond gris clair */
-/* Literal blocs: light gray background */
-
-*[class~="literallayout"] {
- background: #f0f0f0;
- padding: 5px;
- margin: 5px;
-}
-
-/* Programmes et captures texte : fond bleu clair */
-/* Listing and text screen snapshots: light blue background */
-
-*[class~="programlisting"], *[class~="screen"] {
- background: #f0f0ff;
- padding: 5px;
- margin: 5px;
-}
-
-/* Les textes à remplacer sont surlignés en vert pâle */
-/* Replaceable text in highlighted in pale green */
-
-*[class~="replaceable"] {
- background-color: #98fb98;
- font-style: normal; }
-
-/* Tables : fonds gris clair & bords simples */
-/* Tables: light gray background and solid borders */
-
-*[class~="table"] *[class~="title"] { width:100%; border: 0px; }
-
-table {
- border: 1px solid #aaa;
- border-collapse: collapse;
- padding: 2px;
- margin: 5px;
-}
-
-/* Listes simples en style table */
-/* Simples lists in table presentation */
-
-table[class~="simplelist"] {
- background-color: #F0F0F0;
- margin: 5px;
- border: solid 1px #AAA;
-}
-
-table[class~="simplelist"] td {
- border: solid 1px #AAA;
-}
-
-/* Les tables */
-/* Tables */
-
-*[class~="table"] table {
- background-color: #F0F0F0;
- border: solid 1px #AAA;
-}
-*[class~="informaltable"] table { background-color: #F0F0F0; }
-
-th,td {
- vertical-align: baseline;
- text-align: left;
- padding: 0.1em 0.3em;
- empty-cells: show;
-}
-
-/* Alignement des colonnes */
-/* Colunms alignment */
-
-td[align=center] , th[align=center] { text-align: center; }
-td[align=right] , th[align=right] { text-align: right; }
-td[align=left] , th[align=left] { text-align: left; }
-td[align=justify] , th[align=justify] { text-align: justify; }
-
-/* Pas de marge autour des images */
-/* No inside margins for images */
-
-img { border: 0; }
-
-/* Les liens ne sont pas soulignés */
-/* No underlines for links */
-
-:link , :visited , :active { text-decoration: none; }
-
-/* Prudence : cadre jaune et fond jaune clair */
-/* Caution: yellow border and light yellow background */
-
-*[class~="caution"] {
- border: solid 2px yellow;
- background-color: #ffffe0;
- padding: 1em 6px 1em ;
- margin: 5px;
-}
-
-*[class~="caution"] th {
- vertical-align: middle
-}
-
-*[class~="caution"] table {
- background-color: #ffffe0;
- border: none;
-}
-
-/* Note importante : cadre jaune et fond jaune clair */
-/* Important: yellow border and light yellow background */
-
-*[class~="important"] {
- border: solid 2px yellow;
- background-color: #ffffe0;
- padding: 1em 6px 1em;
- margin: 5px;
-}
-
-*[class~="important"] th {
- vertical-align: middle
-}
-
-*[class~="important"] table {
- background-color: #ffffe0;
- border: none;
-}
-
-/* Mise en évidence : texte légèrement plus grand */
-/* Highlights: slightly larger texts */
-
-*[class~="highlights"] {
- font-size: 110%;
-}
-
-/* Note : cadre bleu et fond bleu clair */
-/* Notes: blue border and light blue background */
-
-*[class~="note"] {
- border: solid 2px #7099C5;
- background-color: #f0f0ff;
- padding: 1em 6px 1em ;
- margin: 5px;
-}
-
-*[class~="note"] th {
- vertical-align: middle
-}
-
-*[class~="note"] table {
- background-color: #f0f0ff;
- border: none;
-}
-
-/* Astuce : cadre vert et fond vert clair */
-/* Tip: green border and light green background */
-
-*[class~="tip"] {
- border: solid 2px #00ff00;
- background-color: #f0ffff;
- padding: 1em 6px 1em ;
- margin: 5px;
-}
-
-*[class~="tip"] th {
- vertical-align: middle;
-}
-
-*[class~="tip"] table {
- background-color: #f0ffff;
- border: none;
-}
-
-/* Avertissement : cadre rouge et fond rouge clair */
-/* Warning: red border and light red background */
-
-*[class~="warning"] {
- border: solid 2px #ff0000;
- background-color: #fff0f0;
- padding: 1em 6px 1em ;
- margin: 5px;
-}
-
-*[class~="warning"] th {
- vertical-align: middle;
-}
-
-
-*[class~="warning"] table {
- background-color: #fff0f0;
- border: none;
-}
-
-/* Fin */
-/* The End */
-
diff --git a/bitbake/doc/manual/usermanual.xml b/bitbake/doc/manual/usermanual.xml
deleted file mode 100644
index 3c3009d0e..000000000
--- a/bitbake/doc/manual/usermanual.xml
+++ /dev/null
@@ -1,329 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ex:ts=4:sw=4:sts=4:et
- -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
--->
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
- "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
-<book>
- <bookinfo>
- <title>BitBake User Manual</title>
- <authorgroup>
- <corpauthor>BitBake Team</corpauthor>
- </authorgroup>
- <copyright>
- <year>2004</year>
- <holder>Chris Larson</holder>
- <holder>Phil Blundell</holder>
- </copyright>
- <legalnotice>
- <para>This work is licensed under the Creative Commons Attribution License. To view a copy of this license, visit <ulink url="http://creativecommons.org/licenses/by/2.0/">http://creativecommons.org/licenses/by/2.0/</ulink> or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.</para>
- </legalnotice>
- </bookinfo>
- <chapter>
- <title>Introduction</title>
- <section>
- <title>Overview</title>
- <para>BitBake is, at its simplest, a tool for executing
-tasks and managing metadata. As such, its similarities to GNU make and other
-build tools are readily apparent. It was inspired by Portage, the package management system used by the Gentoo Linux distribution. BitBake is the basis of the <ulink url="http://www.openembedded.org/">OpenEmbedded</ulink> project, which is being used to build and maintain a number of embedded Linux distributions, including OpenZaurus and Familiar.</para>
- </section>
- <section>
- <title>Background and Goals</title>
- <para>Prior to BitBake, no other build tool adequately met
-the needs of an aspiring embedded Linux distribution. All of the
-buildsystems used by traditional desktop Linux distributions lacked
-important functionality, and none of the ad-hoc
-<emphasis>buildroot</emphasis> systems, prevalent in the
-embedded space, were scalable or maintainable.</para>
-
- <para>Some important goals for BitBake were:
- <itemizedlist>
- <listitem><para>Handle crosscompilation.</para></listitem>
- <listitem><para>Handle interpackage dependencies (build time on target architecture, build time on native architecture, and runtime).</para></listitem>
- <listitem><para>Support running any number of tasks within a given package, including, but not limited to, fetching upstream sources, unpacking them, patching them, configuring them, et cetera.</para></listitem>
- <listitem><para>Must be linux distribution agnostic (both build and target).</para></listitem>
- <listitem><para>Must be architecture agnostic</para></listitem>
- <listitem><para>Must support multiple build and target operating systems (including cygwin, the BSDs, etc).</para></listitem>
- <listitem><para>Must be able to be self contained, rather than tightly integrated into the build machine's root filesystem.</para></listitem>
- <listitem><para>There must be a way to handle conditional metadata (on target architecture, operating system, distribution, machine).</para></listitem>
- <listitem><para>It must be easy for the person using the tools to supply their own local metadata and packages to operate against.</para></listitem>
- <listitem><para>Must make it easy to collaborate
-between multiple projects using BitBake for their
-builds.</para></listitem>
- <listitem><para>Should provide an inheritance mechanism to
-share common metadata between many packages.</para></listitem>
- <listitem><para>Et cetera...</para></listitem>
- </itemizedlist>
- </para>
- <para>BitBake satisfies all these and many more. Flexibility and power have always been the priorities. It is highly extensible, supporting embedded Python code and execution of any arbitrary tasks.</para>
- </section>
- </chapter>
- <chapter>
- <title>Metadata</title>
- <section>
- <title>Description</title>
- <itemizedlist>
- <para>BitBake metadata can be classified into 3 major areas:</para>
- <listitem>
- <para>Configuration Files</para>
- </listitem>
- <listitem>
- <para>.bb Files</para>
- </listitem>
- <listitem>
- <para>Classes</para>
- </listitem>
- </itemizedlist>
- <para>What follows are a large number of examples of BitBake metadata. Any syntax which isn't supported in any of the aforementioned areas will be documented as such.</para>
- <section>
- <title>Basic variable setting</title>
- <para><screen><varname>VARIABLE</varname> = "value"</screen></para>
- <para>In this example, <varname>VARIABLE</varname> is <literal>value</literal>.</para>
- </section>
- <section>
- <title>Variable expansion</title>
- <para>BitBake supports variables referencing one another's contents using a syntax which is similar to shell scripting</para>
- <para><screen><varname>A</varname> = "aval"
-<varname>B</varname> = "pre${A}post"</screen></para>
- <para>This results in <varname>A</varname> containing <literal>aval</literal> and <varname>B</varname> containing <literal>preavalpost</literal>.</para>
- </section>
- <section>
- <title>Immediate variable expansion (:=)</title>
- <para>:= results in a variable's contents being expanded immediately, rather than when the variable is actually used.</para>
- <para><screen><varname>T</varname> = "123"
-<varname>A</varname> := "${B} ${A} test ${T}"
-<varname>T</varname> = "456"
-<varname>B</varname> = "${T} bval"
-
-<varname>C</varname> = "cval"
-<varname>C</varname> := "${C}append"</screen></para>
- <para>In that example, <varname>A</varname> would contain <literal> test 123</literal>, <varname>B</varname> would contain <literal>456 bval</literal>, and <varname>C</varname> would be <literal>cvalappend</literal>.</para>
- </section>
- <section>
- <title>Appending (+=) and prepending (=+)</title>
- <para><screen><varname>B</varname> = "bval"
-<varname>B</varname> += "additionaldata"
-<varname>C</varname> = "cval"
-<varname>C</varname> =+ "test"</screen></para>
- <para>In this example, <varname>B</varname> is now <literal>bval additionaldata</literal> and <varname>C</varname> is <literal>test cval</literal>.</para>
- </section>
- <section>
- <title>Conditional metadata set</title>
- <para>OVERRIDES is a <quote>:</quote> seperated variable containing each item you want to satisfy conditions. So, if you have a variable which is conditional on <quote>arm</quote>, and <quote>arm</quote> is in OVERRIDES, then the <quote>arm</quote> specific version of the variable is used rather than the non-conditional version. Example:</para>
- <para><screen><varname>OVERRIDES</varname> = "architecture:os:machine"
-<varname>TEST</varname> = "defaultvalue"
-<varname>TEST_os</varname> = "osspecificvalue"
-<varname>TEST_condnotinoverrides</varname> = "othercondvalue"</screen></para>
- <para>In this example, <varname>TEST</varname> would be <literal>osspecificvalue</literal>, due to the condition <quote>os</quote> being in <varname>OVERRIDES</varname>.</para>
- </section>
- <section>
- <title>Conditional appending</title>
- <para>BitBake also supports appending and prepending to variables based on whether something is in OVERRIDES. Example:</para>
- <para><screen><varname>DEPENDS</varname> = "glibc ncurses"
-<varname>OVERRIDES</varname> = "machine:local"
-<varname>DEPENDS_append_machine</varname> = " libmad"</screen></para>
- <para>In this example, <varname>DEPENDS</varname> is set to <literal>glibc ncurses libmad</literal>.</para>
- </section>
- <section>
- <title>Inclusion</title>
- <para>Next, there is the <literal>include</literal> directive, which causes BitBake to parse in whatever file you specify, and insert it at that location, which is not unlike <command>make</command>. However, if the path specified on the <literal>include</literal> line is a relative path, BitBake will locate the first one it can find within <envar>BBPATH</envar>.</para>
- </section>
- <section>
- <title>Python variable expansion</title>
- <para><screen><varname>DATE</varname> = "${@time.strftime('%Y%m%d',time.gmtime())}"</screen></para>
- <para>This would result in the <varname>DATE</varname> variable containing today's date.</para>
- </section>
- <section>
- <title>Defining executable metadata</title>
- <para><emphasis>NOTE:</emphasis> This is only supported in .bb and .bbclass files.</para>
- <para><screen>do_mytask () {
- echo "Hello, world!"
-}</screen></para>
- <para>This is essentially identical to setting a variable, except that this variable happens to be executable shell code.</para>
- <para><screen>python do_printdate () {
- import time
- print time.strftime('%Y%m%d', time.gmtime())
-}</screen></para>
- <para>This is the similar to the previous, but flags it as python so that BitBake knows it is python code.</para>
- </section>
- <section>
- <title>Defining python functions into the global python namespace</title>
- <para><emphasis>NOTE:</emphasis> This is only supported in .bb and .bbclass files.</para>
- <para><screen>def get_depends(bb, d):
- if bb.data.getVar('SOMECONDITION', d, 1):
- return "dependencywithcond"
- else:
- return "dependency"
-
-<varname>SOMECONDITION</varname> = "1"
-<varname>DEPENDS</varname> = "${@get_depends(bb, d)}"</screen></para>
- <para>This would result in <varname>DEPENDS</varname> containing <literal>dependencywithcond</literal>.</para>
- </section>
- <section>
- <title>Inheritance</title>
- <para><emphasis>NOTE:</emphasis> This is only supported in .bb and .bbclass files.</para>
- <para>The <literal>inherit</literal> directive is a means of specifying what classes of functionality your .bb requires. It is a rudamentary form of inheritence. For example, you can easily abstract out the tasks involved in building a package that uses autoconf and automake, and put that into a bbclass for your packages to make use of. A given bbclass is located by searching for classes/filename.oeclass in <envar>BBPATH</envar>, where filename is what you inherited.</para>
- </section>
- <section>
- <title>Tasks</title>
- <para><emphasis>NOTE:</emphasis> This is only supported in .bb and .bbclass files.</para>
- <para>In BitBake, each step that needs to be run for a given .bb is known as a task. There is a command <literal>addtask</literal> to add new tasks (must be a defined python executable metadata and must start with <quote>do_</quote>) and describe intertask dependencies.</para>
- <para><screen>python do_printdate () {
- import time
- print time.strftime('%Y%m%d', time.gmtime())
-}
-
-addtask printdate before do_build</screen></para>
- <para>This defines the necessary python function and adds it as a task which is now a dependency of do_build (the default task). If anyone executes the do_build task, that will result in do_printdate being run first.</para>
- </section>
- <section>
- <title>Events</title>
- <para><emphasis>NOTE:</emphasis> This is only supported in .bb and .bbclass files.</para>
- <para>BitBake also implements a means of registering event handlers. Events are triggered at certain points during operation, such as, the beginning of operation against a given .bb, the start of a given task, task failure, task success, et cetera. The intent was to make it easy to do things like email notifications on build failure.</para>
- <para><emphasis>[Insert instructions on how to add event handlers here]</emphasis></para>
- </section>
- </section>
- <section>
- <title>Parsing</title>
- <section>
- <title>Configuration Files</title>
- <para>The first of the classifications of metadata in BitBake is configuration metadata. This metadata is global, and therefore affects <emphasis>all</emphasis> packages and tasks which are executed. Currently, BitBake has hardcoded knowledge of a single configuration file. It expects to find 'conf/bitbake.conf' somewhere in the user specified <envar>BBPATH</envar>. That configuration file generally has include directives to pull in any other metadata (generally files specific to architecture, machine, <emphasis>local</emphasis> and so on.</para>
- <para>Only variable definitions and include directives are allowed in .conf files.</para>
- </section>
- <section>
- <title>Classes</title>
- <para>BitBake classes are our rudamentary inheritence mechanism. As briefly mentioned in the metadata introduction, they're parsed when an <literal>inherit</literal> directive is encountered, and they are located in classes/ relative to the dirs in <envar>BBPATH</envar>.</para>
- </section>
- <section>
- <title>.bb Files</title>
- <para>A BitBake (.bb) file is a logical unit of tasks to be executed. Normally this is a package to be built. Inter-.bb dependencies are obeyed. The files themselves are located via the <varname>BBFILES</varname> variable, which is set to a space seperated list of .bb files, and does handle wildcards.</para>
- </section>
- </section>
- </chapter>
- <chapter>
- <title>Commands</title>
- <section>
- <title>bbread</title>
- <para>bbread is a command for displaying BitBake metadata. When run with no arguments, it has the core parse 'conf/bitbake.conf', as located in BBPATH, and displays that. If you supply a file on the commandline, such as a .bb, then it parses that afterwards, using the aforementioned configuration metadata.</para>
- </section>
- <section>
- <title>bitbake</title>
- <section>
- <title>Introduction</title>
- <para>bitbake is the primary command in the system. It facilitates executing tasks in a single .bb file, or executing a given task on a set of multiple .bb files, accounting for interdependencies amongst them.</para>
- </section>
- <section>
- <title>Usage and Syntax</title>
- <para>
- <screen><prompt>$ </prompt>bitbake --help
-usage: bitbake [options] [package ...]
-
-Executes the specified task (default is 'build') for a given set of BitBake files.
-It expects that BBFILES is defined, which is a space seperated list of files to
-be executed. BBFILES does support wildcards.
-Default BBFILES are the .bb files in the current directory.
-
-options:
- --version show program's version number and exit
- -h, --help show this help message and exit
- -bBUILDFILE, --buildfile=BUILDFILE
- execute the task against this .bb file, rather than a
- package from BBFILES.
- -k, --continue continue as much as possible after an error. While the
- target that failed, and those that depend on it, cannot
- be remade, the other dependencies of these targets can
- be processed all the same.
- -f, --force force run of specified cmd, regardless of stamp status
- -cCMD, --cmd=CMD Specify task to execute
- -rFILE, --read=FILE read the specified file before bitbake.conf
- -v, --verbose output more chit-chat to the terminal
- -D, --debug Increase the debug level
- -n, --dry-run don't execute, just go through the motions
- -p, --parse-only quit after parsing the BB files (developers only)
- -d, --disable-psyco disable using the psyco just-in-time compiler (not
- recommended)
- -s, --show-versions show current and preferred versions of all packages</screen>
- </para>
- <para>
- <example>
- <title>Executing a task against a single .bb</title>
- <para>Executing tasks for a single file is relatively simple. You specify the file in question, and bitbake parses it and executes the specified task (or <quote>build</quote> by default). It obeys intertask dependencies when doing so.</para>
- <para><quote>clean</quote> task:</para>
- <para><screen><prompt>$ </prompt>bitbake -b blah_1.0.bb -c clean</screen></para>
- <para><quote>build</quote> task:</para>
- <para><screen><prompt>$ </prompt>bitbake -b blah_1.0.bb</screen></para>
- </example>
- </para>
- <para>
- <example>
- <title>Executing tasks against a set of .bb files</title>
- <para>There are a number of additional complexities introduced when one wants to manage multiple .bb files. Clearly there needs to be a way to tell bitbake what files are available, and of those, which we want to execute at this time. There also needs to be a way for each .bb to express its dependencies, both for build time and runtime. There must be a way for the user to express their preferences when multiple .bb's provide the same functionality, or when there are multiple versions of a .bb.</para>
- <para>The next section, Metadata, outlines how one goes about specifying such things.</para>
- <para>Note that the bitbake command, when not using --buildfile, accepts a <varname>PROVIDER</varname>, not a filename or anything else. By default, a .bb generally PROVIDES its packagename, packagename-version, and packagename-version-revision.</para>
- <screen><prompt>$ </prompt>bitbake blah</screen>
- <screen><prompt>$ </prompt>bitbake blah-1.0</screen>
- <screen><prompt>$ </prompt>bitbake blah-1.0-r0</screen>
- <screen><prompt>$ </prompt>bitbake -c clean blah</screen>
- <screen><prompt>$ </prompt>bitbake virtual/whatever</screen>
- <screen><prompt>$ </prompt>bitbake -c clean virtual/whatever</screen>
- </example>
- </para>
- </section>
- <section>
- <title>Metadata</title>
- <para>As you may have seen in the usage information, or in the information about .bb files, the BBFILES variable is how the bitbake tool locates its files. This variable is a space seperated list of files that are available, and supports wildcards.
- <example>
- <title>Setting BBFILES</title>
- <programlisting><varname>BBFILES</varname> = "/path/to/bbfiles/*.bb"</programlisting>
- </example></para>
- <para>With regard to dependencies, it expects the .bb to define a <varname>DEPENDS</varname> variable, which contains a space seperated list of <quote>package names</quote>, which themselves are the <varname>PN</varname> variable. The <varname>PN</varname> variable is, in general, by default, set to a component of the .bb filename.</para>
- <example>
- <title>Depending on another .bb</title>
- <para>a.bb:
- <screen>PN = "package-a"
- DEPENDS += "package-b"</screen>
- </para>
- <para>b.bb:
- <screen>PN = "package-b"</screen>
- </para>
- </example>
- <example>
- <title>Using PROVIDES</title>
- <para>This example shows the usage of the PROVIDES variable, which allows a given .bb to specify what functionality it provides.</para>
- <para>package1.bb:
- <screen>PROVIDES += "virtual/package"</screen>
- </para>
- <para>package2.bb:
- <screen>DEPENDS += "virtual/package"</screen>
- </para>
- <para>package3.bb:
- <screen>PROVIDES += "virtual/package"</screen>
- </para>
- <para>As you can see, here there are two different .bb's that provide the same functionality (virtual/package). Clearly, there needs to be a way for the person running bitbake to control which of those providers gets used. There is, indeed, such a way.</para>
- <para>The following would go into a .conf file, to select package1:
- <screen>PREFERRED_PROVIDER_virtual/package = "package1"</screen>
- </para>
- </example>
- <example>
- <title>Specifying version preference</title>
- <para>When there are multiple <quote>versions</quote> of a given package, bitbake defaults to selecting the most recent version, unless otherwise specified. If the .bb in question has a <varname>DEFAULT_PREFERENCE</varname> set lower than the other .bb's (default is 0), then it will not be selected. This allows the person or persons maintaining the repository of .bb files to specify their preferences for the default selected version. In addition, the user can specify their preferences with regard to version.</para>
- <para>If the first .bb is named <filename>a_1.1.bb</filename>, then the <varname>PN</varname> variable will be set to <quote>a</quote>, and the <varname>PV</varname> variable will be set to 1.1.</para>
- <para>If we then have an <filename>a_1.2.bb</filename>, bitbake will choose 1.2 by default. However, if we define the following variable in a .conf that bitbake parses, we can change that.
- <screen>PREFERRED_VERSION_a = "1.1"</screen>
- </para>
- </example>
- <example>
- <title>Using <quote>bbfile collections</quote></title>
- <para>bbfile collections exist to allow the user to have multiple repositories of bbfiles that contain the same exact package. For example, one could easily use them to make one's own local copy of an upstream repository, but with custom modifications that one does not want upstream. Usage:</para>
- <screen>BBFILES = "/stuff/openembedded/*/*.bb /stuff/openembedded.modified/*/*.bb"
-BBFILE_COLLECTIONS = "upstream local"
-BBFILE_PATTERN_upstream = "^/stuff/openembedded/"
-BBFILE_PATTERN_local = "^/stuff/openembedded.modified/"
-BBFILE_PRIORITY_upstream = "5"
-BBFILE_PRIORITY_local = "10"</screen>
- </example>
- </section>
- </section>
- </chapter>
-</book>
diff --git a/bitbake/lib/bb/__init__.py b/bitbake/lib/bb/__init__.py
deleted file mode 100644
index c5ac9a772..000000000
--- a/bitbake/lib/bb/__init__.py
+++ /dev/null
@@ -1,1285 +0,0 @@
-#!/usr/bin/python
-# 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 as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-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., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA.
-"""
-
-__version__ = "1.2.1"
-
-__all__ = [
-
- "debug",
- "note",
- "error",
- "fatal",
-
- "mkdirhier",
- "movefile",
-
- "tokenize",
- "evaluate",
- "flatten",
- "relparse",
- "ververify",
- "isjustname",
- "isspecific",
- "pkgsplit",
- "catpkgsplit",
- "vercmp",
- "pkgcmp",
- "dep_parenreduce",
- "dep_opconvert",
- "digraph",
-
-# fetch
- "decodeurl",
- "encodeurl",
-
-# modules
- "parse",
- "data",
- "event",
- "build",
- "fetch",
- "make",
- "manifest"
- ]
-
-whitespace = '\t\n\x0b\x0c\r '
-lowercase = 'abcdefghijklmnopqrstuvwxyz'
-
-import sys, os, types, re
-
-#
-# Check for the Python version. A lot of stuff needs Python 2.3 or later
-#
-if sys.version_info[:3] < (2, 3, 0):
- print "BitBake needs Python 2.3 or later. Please upgrade."
- sys.exit(-1)
-
-#projectdir = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
-projectdir = os.getcwd()
-
-debug_level = 0
-
-if "BBDEBUG" in os.environ:
- level = int(os.environ["BBDEBUG"])
- if level:
- debug_level = level
- else:
- debug_level = 0
-
-class VarExpandError(Exception):
- pass
-
-class MalformedUrl(Exception):
- """Exception raised when encountering an invalid url"""
-
-
-#######################################################################
-#######################################################################
-#
-# SECTION: Debug
-#
-# PURPOSE: little functions to make yourself known
-#
-#######################################################################
-#######################################################################
-
-debug_prepend = ''
-
-
-def debug(lvl, *args):
- if debug_level >= lvl:
- print debug_prepend + 'DEBUG:', ''.join(args)
-
-def note(*args):
- print debug_prepend + 'NOTE:', ''.join(args)
-
-def error(*args):
- print debug_prepend + 'ERROR:', ''.join(args)
-
-def fatal(*args):
- print debug_prepend + 'ERROR:', ''.join(args)
- sys.exit(1)
-
-
-#######################################################################
-#######################################################################
-#
-# SECTION: File
-#
-# PURPOSE: Basic file and directory tree related functions
-#
-#######################################################################
-#######################################################################
-
-def mkdirhier(dir):
- """Create a directory like 'mkdir -p', but does not complain if
- directory already exists like os.makedirs
- """
-
- debug(3, "mkdirhier(%s)" % dir)
- try:
- os.makedirs(dir)
- debug(2, "created " + dir)
- except OSError, e:
- if e.errno != 17: raise e
-
-
-#######################################################################
-
-import stat
-
-def movefile(src,dest,newmtime=None,sstat=None):
- """Moves a file from src to dest, preserving all permissions and
- attributes; mtime will be preserved even when moving across
- filesystems. Returns true on success and false on failure. Move is
- atomic.
- """
-
- #print "movefile("+src+","+dest+","+str(newmtime)+","+str(sstat)+")"
- try:
- if not sstat:
- sstat=os.lstat(src)
- except Exception, e:
- print "!!! Stating source file failed... movefile()"
- print "!!!",e
- return None
-
- destexists=1
- try:
- dstat=os.lstat(dest)
- except:
- dstat=os.lstat(os.path.dirname(dest))
- destexists=0
-
- if destexists:
- if stat.S_ISLNK(dstat[stat.ST_MODE]):
- try:
- os.unlink(dest)
- destexists=0
- except Exception, e:
- pass
-
- if stat.S_ISLNK(sstat[stat.ST_MODE]):
- try:
- target=os.readlink(src)
- if destexists and not stat.S_ISDIR(dstat[stat.ST_MODE]):
- os.unlink(dest)
- os.symlink(target,dest)
-# os.lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
- os.unlink(src)
- return os.lstat(dest)
- except Exception, e:
- print "!!! failed to properly create symlink:"
- print "!!!",dest,"->",target
- print "!!!",e
- return None
-
- renamefailed=1
- if sstat[stat.ST_DEV]==dstat[stat.ST_DEV]:
- try:
- ret=os.rename(src,dest)
- renamefailed=0
- except Exception, e:
- import errno
- if e[0]!=errno.EXDEV:
- # Some random error.
- print "!!! Failed to move",src,"to",dest
- print "!!!",e
- return None
- # Invalid cross-device-link 'bind' mounted or actually Cross-Device
-
- if renamefailed:
- didcopy=0
- if stat.S_ISREG(sstat[stat.ST_MODE]):
- try: # For safety copy then move it over.
- shutil.copyfile(src,dest+"#new")
- os.rename(dest+"#new",dest)
- didcopy=1
- except Exception, e:
- print '!!! copy',src,'->',dest,'failed.'
- print "!!!",e
- return None
- else:
- #we don't yet handle special, so we need to fall back to /bin/mv
- a=getstatusoutput("/bin/mv -f "+"'"+src+"' '"+dest+"'")
- if a[0]!=0:
- print "!!! Failed to move special file:"
- print "!!! '"+src+"' to '"+dest+"'"
- print "!!!",a
- return None # failure
- try:
- if didcopy:
- missingos.lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
- os.chmod(dest, stat.S_IMODE(sstat[stat.ST_MODE])) # Sticky is reset on chown
- os.unlink(src)
- except Exception, e:
- print "!!! Failed to chown/chmod/unlink in movefile()"
- print "!!!",dest
- print "!!!",e
- return None
-
- if newmtime:
- os.utime(dest,(newmtime,newmtime))
- else:
- os.utime(dest, (sstat[stat.ST_ATIME], sstat[stat.ST_MTIME]))
- newmtime=sstat[stat.ST_MTIME]
- return newmtime
-
-
-
-#######################################################################
-#######################################################################
-#
-# SECTION: Download
-#
-# PURPOSE: Download via HTTP, FTP, CVS, BITKEEPER, handling of MD5-signatures
-# and mirrors
-#
-#######################################################################
-#######################################################################
-
-def decodeurl(url):
- """Decodes an URL into the tokens (scheme, network location, path,
- user, password, parameters).
-
- >>> decodeurl("http://www.google.com/index.html")
- ('http', 'www.google.com', '/index.html', '', '', {})
-
- CVS url with username, host and cvsroot. The cvs module to check out is in the
- parameters:
-
- >>> decodeurl("cvs://anoncvs@cvs.handhelds.org/cvs;module=familiar/dist/ipkg")
- ('cvs', 'cvs.handhelds.org', '/cvs', 'anoncvs', '', {'module': 'familiar/dist/ipkg'})
-
- Dito, but this time the username has a password part. And we also request a special tag
- to check out.
-
- >>> decodeurl("cvs://anoncvs:anonymous@cvs.handhelds.org/cvs;module=familiar/dist/ipkg;tag=V0-99-81")
- ('cvs', 'cvs.handhelds.org', '/cvs', 'anoncvs', 'anonymous', {'tag': 'V0-99-81', 'module': 'familiar/dist/ipkg'})
- """
-
- m = re.compile('(?P<type>[^:]*)://((?P<user>.+)@)?(?P<location>[^;]+)(;(?P<parm>.*))?').match(url)
- if not m:
- raise MalformedUrl(url)
-
- type = m.group('type')
- location = m.group('location')
- if not location:
- raise MalformedUrl(url)
- user = m.group('user')
- parm = m.group('parm')
- m = re.compile('(?P<host>[^/;]+)(?P<path>/[^;]+)').match(location)
- if m:
- host = m.group('host')
- path = m.group('path')
- else:
- host = ""
- path = location
- if user:
- m = re.compile('(?P<user>[^:]+)(:?(?P<pswd>.*))').match(user)
- if m:
- user = m.group('user')
- pswd = m.group('pswd')
- else:
- user = ''
- pswd = ''
- #note("decodeurl: %s decoded to:" % url)
- #note("decodeurl: type = '%s'" % type)
- #note("decodeurl: host = '%s'" % host)
- #note("decodeurl: path = '%s'" % path)
- #note("decodeurl: parm = '%s'" % parm)
- #note("decodeurl: user = '%s'" % user)
- #note("decodeurl: pswd = '%s'" % pswd)
- p = {}
- if parm:
- for s in parm.split(';'):
- s1,s2 = s.split('=')
- p[s1] = s2
-
- return (type, host, path, user, pswd, p)
-
-#######################################################################
-
-def encodeurl(decoded):
- """Encodes a URL from tokens (scheme, network location, path,
- user, password, parameters).
-
- >>> encodeurl(['http', 'www.google.com', '/index.html', '', '', {}])
-
- "http://www.google.com/index.html"
-
- CVS with username, host and cvsroot. The cvs module to check out is in the
- parameters:
-
- >>> encodeurl(['cvs', 'cvs.handhelds.org', '/cvs', 'anoncvs', '', {'module': 'familiar/dist/ipkg'}])
-
- "cvs://anoncvs@cvs.handhelds.org/cvs;module=familiar/dist/ipkg"
-
- Dito, but this time the username has a password part. And we also request a special tag
- to check out.
-
- >>> encodeurl(['cvs', 'cvs.handhelds.org', '/cvs', 'anoncvs', 'anonymous', {'tag': 'V0-99-81', 'module': 'familiar/dist/ipkg'}])
-
- "cvs://anoncvs:anonymous@cvs.handhelds.org/cvs;module=familiar/dist/ipkg;tag=V0-99-81"
- """
-
- (type, host, path, user, pswd, p) = decoded
-
- if not type or not path:
- fatal("invalid or missing parameters for url encoding")
- url = '%s://' % type
- if user:
- url += "%s" % user
- if pswd:
- url += ":%s" % pswd
- url += "@"
- if host:
- url += "%s" % host
- url += "%s" % path
- if p:
- for parm in p.keys():
- url += ";%s=%s" % (parm, p[parm])
-
- return url
-
-#######################################################################
-
-def which(path, item, direction = 0):
- """Useful function for locating a file in a PATH"""
- found = ""
- for p in (path or "").split(':'):
- if os.path.exists(os.path.join(p, item)):
- found = os.path.join(p, item)
- if direction == 0:
- break
- return found
-
-#######################################################################
-
-
-
-
-#######################################################################
-#######################################################################
-#
-# SECTION: Dependency
-#
-# PURPOSE: Compare build & run dependencies
-#
-#######################################################################
-#######################################################################
-
-def tokenize(mystring):
- """Breaks a string like 'foo? (bar) oni? (blah (blah))' into (possibly embedded) lists:
-
- >>> tokenize("x")
- ['x']
- >>> tokenize("x y")
- ['x', 'y']
- >>> tokenize("(x y)")
- [['x', 'y']]
- >>> tokenize("(x y) b c")
- [['x', 'y'], 'b', 'c']
- >>> tokenize("foo? (bar) oni? (blah (blah))")
- ['foo?', ['bar'], 'oni?', ['blah', ['blah']]]
- >>> tokenize("sys-apps/linux-headers nls? (sys-devel/gettext)")
- ['sys-apps/linux-headers', 'nls?', ['sys-devel/gettext']]
- """
-
- newtokens = []
- curlist = newtokens
- prevlists = []
- level = 0
- accum = ""
- for x in mystring:
- if x=="(":
- if accum:
- curlist.append(accum)
- accum=""
- prevlists.append(curlist)
- curlist=[]
- level=level+1
- elif x==")":
- if accum:
- curlist.append(accum)
- accum=""
- if level==0:
- print "!!! tokenizer: Unmatched left parenthesis in:\n'"+mystring+"'"
- return None
- newlist=curlist
- curlist=prevlists.pop()
- curlist.append(newlist)
- level=level-1
- elif x in whitespace:
- if accum:
- curlist.append(accum)
- accum=""
- else:
- accum=accum+x
- if accum:
- curlist.append(accum)
- if (level!=0):
- print "!!! tokenizer: Exiting with unterminated parenthesis in:\n'"+mystring+"'"
- return None
- return newtokens
-
-
-#######################################################################
-
-def evaluate(tokens,mydefines,allon=0):
- """Removes tokens based on whether conditional definitions exist or not.
- Recognizes !
-
- >>> evaluate(['sys-apps/linux-headers', 'nls?', ['sys-devel/gettext']], {})
- ['sys-apps/linux-headers']
-
- Negate the flag:
-
- >>> evaluate(['sys-apps/linux-headers', '!nls?', ['sys-devel/gettext']], {})
- ['sys-apps/linux-headers', ['sys-devel/gettext']]
-
- Define 'nls':
-
- >>> evaluate(['sys-apps/linux-headers', 'nls?', ['sys-devel/gettext']], {"nls":1})
- ['sys-apps/linux-headers', ['sys-devel/gettext']]
-
- Turn allon on:
-
- >>> evaluate(['sys-apps/linux-headers', 'nls?', ['sys-devel/gettext']], {}, True)
- ['sys-apps/linux-headers', ['sys-devel/gettext']]
- """
-
- if tokens == None:
- return None
- mytokens = tokens + [] # this copies the list
- pos = 0
- while pos < len(mytokens):
- if type(mytokens[pos]) == types.ListType:
- evaluate(mytokens[pos], mydefines)
- if not len(mytokens[pos]):
- del mytokens[pos]
- continue
- elif mytokens[pos][-1] == "?":
- cur = mytokens[pos][:-1]
- del mytokens[pos]
- if allon:
- if cur[0] == "!":
- del mytokens[pos]
- else:
- if cur[0] == "!":
- if (cur[1:] in mydefines) and (pos < len(mytokens)):
- del mytokens[pos]
- continue
- elif (cur not in mydefines) and (pos < len(mytokens)):
- del mytokens[pos]
- continue
- pos = pos + 1
- return mytokens
-
-
-#######################################################################
-
-def flatten(mytokens):
- """Converts nested arrays into a flat arrays:
-
- >>> flatten([1,[2,3]])
- [1, 2, 3]
- >>> flatten(['sys-apps/linux-headers', ['sys-devel/gettext']])
- ['sys-apps/linux-headers', 'sys-devel/gettext']
- """
-
- newlist=[]
- for x in mytokens:
- if type(x)==types.ListType:
- newlist.extend(flatten(x))
- else:
- newlist.append(x)
- return newlist
-
-
-#######################################################################
-
-_package_weights_ = {"pre":-2,"p":0,"alpha":-4,"beta":-3,"rc":-1} # dicts are unordered
-_package_ends_ = ["pre", "p", "alpha", "beta", "rc", "cvs", "bk", "HEAD" ] # so we need ordered list
-
-def relparse(myver):
- """Parses the last elements of a version number into a triplet, that can
- later be compared:
-
- >>> relparse('1.2_pre3')
- [1.2, -2, 3.0]
- >>> relparse('1.2b')
- [1.2, 98, 0]
- >>> relparse('1.2')
- [1.2, 0, 0]
- """
-
- number = 0
- p1 = 0
- p2 = 0
- mynewver = myver.split('_')
- if len(mynewver)==2:
- # an _package_weights_
- number = float(mynewver[0])
- match = 0
- for x in _package_ends_:
- elen = len(x)
- if mynewver[1][:elen] == x:
- match = 1
- p1 = _package_weights_[x]
- try:
- p2 = float(mynewver[1][elen:])
- except:
- p2 = 0
- break
- if not match:
- # normal number or number with letter at end
- divider = len(myver)-1
- if myver[divider:] not in "1234567890":
- # letter at end
- p1 = ord(myver[divider:])
- number = float(myver[0:divider])
- else:
- number = float(myver)
- else:
- # normal number or number with letter at end
- divider = len(myver)-1
- if myver[divider:] not in "1234567890":
- #letter at end
- p1 = ord(myver[divider:])
- number = float(myver[0:divider])
- else:
- number = float(myver)
- return [number,p1,p2]
-
-
-#######################################################################
-
-__ververify_cache__ = {}
-
-def ververify(myorigval,silent=1):
- """Returns 1 if given a valid version string, els 0. Valid versions are in the format
-
- <v1>.<v2>...<vx>[a-z,_{_package_weights_}[vy]]
-
- >>> ververify('2.4.20')
- 1
- >>> ververify('2.4..20') # two dots
- 0
- >>> ververify('2.x.20') # 'x' is not numeric
- 0
- >>> ververify('2.4.20a')
- 1
- >>> ververify('2.4.20cvs') # only one trailing letter
- 0
- >>> ververify('1a')
- 1
- >>> ververify('test_a') # no version at all
- 0
- >>> ververify('2.4.20_beta1')
- 1
- >>> ververify('2.4.20_beta')
- 1
- >>> ververify('2.4.20_wrongext') # _wrongext is no valid trailer
- 0
- """
-
- # Lookup the cache first
- try:
- return __ververify_cache__[myorigval]
- except KeyError:
- pass
-
- if len(myorigval) == 0:
- if not silent:
- error("package version is empty")
- __ververify_cache__[myorigval] = 0
- return 0
- myval = myorigval.split('.')
- if len(myval)==0:
- if not silent:
- error("package name has empty version string")
- __ververify_cache__[myorigval] = 0
- return 0
- # all but the last version must be a numeric
- for x in myval[:-1]:
- if not len(x):
- if not silent:
- error("package version has two points in a row")
- __ververify_cache__[myorigval] = 0
- return 0
- try:
- foo = int(x)
- except:
- if not silent:
- error("package version contains non-numeric '"+x+"'")
- __ververify_cache__[myorigval] = 0
- return 0
- if not len(myval[-1]):
- if not silent:
- error("package version has trailing dot")
- __ververify_cache__[myorigval] = 0
- return 0
- try:
- foo = int(myval[-1])
- __ververify_cache__[myorigval] = 1
- return 1
- except:
- pass
-
- # ok, our last component is not a plain number or blank, let's continue
- if myval[-1][-1] in lowercase:
- try:
- foo = int(myval[-1][:-1])
- return 1
- __ververify_cache__[myorigval] = 1
- # 1a, 2.0b, etc.
- except:
- pass
- # ok, maybe we have a 1_alpha or 1_beta2; let's see
- ep=string.split(myval[-1],"_")
- if len(ep)!= 2:
- if not silent:
- error("package version has more than one letter at then end")
- __ververify_cache__[myorigval] = 0
- return 0
- try:
- foo = string.atoi(ep[0])
- except:
- # this needs to be numeric, i.e. the "1" in "1_alpha"
- if not silent:
- error("package version must have numeric part before the '_'")
- __ververify_cache__[myorigval] = 0
- return 0
-
- for mye in _package_ends_:
- if ep[1][0:len(mye)] == mye:
- if len(mye) == len(ep[1]):
- # no trailing numeric is ok
- __ververify_cache__[myorigval] = 1
- return 1
- else:
- try:
- foo = string.atoi(ep[1][len(mye):])
- __ververify_cache__[myorigval] = 1
- return 1
- except:
- # if no _package_weights_ work, *then* we return 0
- pass
- if not silent:
- error("package version extension after '_' is invalid")
- __ververify_cache__[myorigval] = 0
- return 0
-
-
-def isjustname(mypkg):
- myparts = string.split(mypkg,'-')
- for x in myparts:
- if ververify(x):
- return 0
- return 1
-
-
-_isspecific_cache_={}
-
-def isspecific(mypkg):
- "now supports packages with no category"
- try:
- return __isspecific_cache__[mypkg]
- except:
- pass
-
- mysplit = string.split(mypkg,"/")
- if not isjustname(mysplit[-1]):
- __isspecific_cache__[mypkg] = 1
- return 1
- __isspecific_cache__[mypkg] = 0
- return 0
-
-
-#######################################################################
-
-__pkgsplit_cache__={}
-
-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('glibc-2.2.5-r7')
- ['glibc', '2.2.5', 'r7']
- >>> pkgsplit('foo-1.2-1')
- >>> pkgsplit('Mesa-3.0')
- ['Mesa', '3.0', 'r0']
- """
-
- try:
- return __pkgsplit_cache__[mypkg]
- except KeyError:
- pass
-
- myparts = string.split(mypkg,'-')
- if len(myparts) < 2:
- if not silent:
- error("package name without name or version part")
- __pkgsplit_cache__[mypkg] = None
- return None
- for x in myparts:
- if len(x) == 0:
- if not silent:
- error("package name with empty name or version part")
- __pkgsplit_cache__[mypkg] = None
- return None
- # verify rev
- revok = 0
- myrev = myparts[-1]
- ververify(myrev, 0)
- if len(myrev) and myrev[0] == "r":
- try:
- string.atoi(myrev[1:])
- revok = 1
- except:
- pass
- if revok:
- if ververify(myparts[-2]):
- if len(myparts) == 2:
- __pkgsplit_cache__[mypkg] = None
- return None
- else:
- for x in myparts[:-2]:
- if ververify(x):
- __pkgsplit_cache__[mypkg]=None
- return None
- # names can't have versiony looking parts
- myval=[string.join(myparts[:-2],"-"),myparts[-2],myparts[-1]]
- __pkgsplit_cache__[mypkg]=myval
- return myval
- else:
- __pkgsplit_cache__[mypkg] = None
- return None
-
- elif ververify(myparts[-1],silent):
- if len(myparts)==1:
- if not silent:
- print "!!! Name error in",mypkg+": missing name part."
- __pkgsplit_cache__[mypkg]=None
- return None
- else:
- for x in myparts[:-1]:
- if ververify(x):
- if not silent: error("package name has multiple version parts")
- __pkgsplit_cache__[mypkg] = None
- return None
- myval = [string.join(myparts[:-1],"-"), myparts[-1],"r0"]
- __pkgsplit_cache__[mypkg] = myval
- return myval
- else:
- __pkgsplit_cache__[mypkg] = None
- return None
-
-
-#######################################################################
-
-__catpkgsplit_cache__ = {}
-
-def catpkgsplit(mydata,silent=1):
- """returns [cat, pkgname, version, rev ]
-
- >>> catpkgsplit('sys-libs/glibc-1.2-r7')
- ['sys-libs', 'glibc', '1.2', 'r7']
- >>> catpkgsplit('glibc-1.2-r7')
- ['null', 'glibc', '1.2', 'r7']
- """
-
- try:
- return __catpkgsplit_cache__[mydata]
- except KeyError:
- pass
-
- cat = os.path.basename(os.path.dirname(mydata))
- mydata = os.path.join(cat, os.path.basename(mydata))
-# if mydata[:len(projectdir)] == projectdir:
-# mydata = mydata[len(projectdir)+1:]
- if mydata[-3:] == '.bb':
- mydata = mydata[:-3]
-
- mysplit = mydata.split("/")
- p_split = None
- splitlen = len(mysplit)
- if splitlen == 1:
- retval = [None]
- p_split = pkgsplit(mydata,silent)
- else:
- retval = [mysplit[splitlen - 2]]
- p_split = pkgsplit(mysplit[splitlen - 1],silent)
- if not p_split:
- __catpkgsplit_cache__[mydata] = None
- return None
- retval.extend(p_split)
- __catpkgsplit_cache__[mydata] = retval
- return retval
-
-
-#######################################################################
-
-__vercmp_cache__ = {}
-
-def vercmp(val1,val2):
- """This takes two version strings and returns an integer to tell you whether
- the versions are the same, val1>val2 or val2>val1.
-
- >>> vercmp('1', '2')
- -1.0
- >>> vercmp('2', '1')
- 1.0
- >>> vercmp('1', '1.0')
- 0
- >>> vercmp('1', '1.1')
- -1.0
- >>> vercmp('1.1', '1_p2')
- 1.0
- """
-
- # quick short-circuit
- if val1 == val2:
- return 0
- valkey = val1+" "+val2
-
- # cache lookup
- try:
- return __vercmp_cache__[valkey]
- try:
- return - __vercmp_cache__[val2+" "+val1]
- except KeyError:
- pass
- except KeyError:
- pass
-
- # consider 1_p2 vc 1.1
- # after expansion will become (1_p2,0) vc (1,1)
- # then 1_p2 is compared with 1 before 0 is compared with 1
- # to solve the bug we need to convert it to (1,0_p2)
- # by splitting _prepart part and adding it back _after_expansion
-
- val1_prepart = val2_prepart = ''
- if val1.count('_'):
- val1, val1_prepart = val1.split('_', 1)
- if val2.count('_'):
- val2, val2_prepart = val2.split('_', 1)
-
- # replace '-' by '.'
- # FIXME: Is it needed? can val1/2 contain '-'?
-
- val1 = string.split(val1,'-')
- if len(val1) == 2:
- val1[0] = val1[0] +"."+ val1[1]
- val2 = string.split(val2,'-')
- if len(val2) == 2:
- val2[0] = val2[0] +"."+ val2[1]
-
- val1 = string.split(val1[0],'.')
- val2 = string.split(val2[0],'.')
-
- # add back decimal point so that .03 does not become "3" !
- for x in range(1,len(val1)):
- if val1[x][0] == '0' :
- val1[x] = '.' + val1[x]
- for x in range(1,len(val2)):
- if val2[x][0] == '0' :
- val2[x] = '.' + val2[x]
-
- # extend varion numbers
- if len(val2) < len(val1):
- val2.extend(["0"]*(len(val1)-len(val2)))
- elif len(val1) < len(val2):
- val1.extend(["0"]*(len(val2)-len(val1)))
-
- # add back _prepart tails
- if val1_prepart:
- val1[-1] += '_' + val1_prepart
- if val2_prepart:
- val2[-1] += '_' + val2_prepart
- # The above code will extend version numbers out so they
- # have the same number of digits.
- for x in range(0,len(val1)):
- cmp1 = relparse(val1[x])
- cmp2 = relparse(val2[x])
- for y in range(0,3):
- myret = cmp1[y] - cmp2[y]
- if myret != 0:
- __vercmp_cache__[valkey] = myret
- return myret
- __vercmp_cache__[valkey] = 0
- return 0
-
-
-#######################################################################
-
-def pkgcmp(pkg1,pkg2):
- """ Compares two packages, which should have been split via
- pkgsplit(). if the return value val is less than zero, then pkg2 is
- newer than pkg1, zero if equal and positive if older.
-
- >>> pkgcmp(['glibc', '2.2.5', 'r7'], ['glibc', '2.2.5', 'r7'])
- 0
- >>> pkgcmp(['glibc', '2.2.5', 'r4'], ['glibc', '2.2.5', 'r7'])
- -1
- >>> pkgcmp(['glibc', '2.2.5', 'r7'], ['glibc', '2.2.5', 'r2'])
- 1
- """
-
- mycmp = vercmp(pkg1[1],pkg2[1])
- if mycmp > 0:
- return 1
- if mycmp < 0:
- return -1
- r1=string.atoi(pkg1[2][1:])
- r2=string.atoi(pkg2[2][1:])
- if r1 > r2:
- return 1
- if r2 > r1:
- return -1
- return 0
-
-
-#######################################################################
-
-def dep_parenreduce(mysplit, mypos=0):
- """Accepts a list of strings, and converts '(' and ')' surrounded items to sub-lists:
-
- >>> dep_parenreduce([''])
- ['']
- >>> dep_parenreduce(['1', '2', '3'])
- ['1', '2', '3']
- >>> dep_parenreduce(['1', '(', '2', '3', ')', '4'])
- ['1', ['2', '3'], '4']
- """
-
- while mypos < len(mysplit):
- if mysplit[mypos] == "(":
- firstpos = mypos
- mypos = mypos + 1
- while mypos < len(mysplit):
- if mysplit[mypos] == ")":
- mysplit[firstpos:mypos+1] = [mysplit[firstpos+1:mypos]]
- mypos = firstpos
- break
- elif mysplit[mypos] == "(":
- # recurse
- mysplit = dep_parenreduce(mysplit,mypos)
- mypos = mypos + 1
- mypos = mypos + 1
- return mysplit
-
-
-def dep_opconvert(mysplit, myuse):
- "Does dependency operator conversion"
-
- mypos = 0
- newsplit = []
- while mypos < len(mysplit):
- if type(mysplit[mypos]) == types.ListType:
- newsplit.append(dep_opconvert(mysplit[mypos],myuse))
- mypos += 1
- elif mysplit[mypos] == ")":
- # mismatched paren, error
- return None
- elif mysplit[mypos]=="||":
- if ((mypos+1)>=len(mysplit)) or (type(mysplit[mypos+1])!=types.ListType):
- # || must be followed by paren'd list
- return None
- try:
- mynew = dep_opconvert(mysplit[mypos+1],myuse)
- except Exception, e:
- error("unable to satisfy OR dependancy: " + string.join(mysplit," || "))
- raise e
- mynew[0:0] = ["||"]
- newsplit.append(mynew)
- mypos += 2
- elif mysplit[mypos][-1] == "?":
- # use clause, i.e "gnome? ( foo bar )"
- # this is a quick and dirty hack so that repoman can enable all USE vars:
- if (len(myuse) == 1) and (myuse[0] == "*"):
- # enable it even if it's ! (for repoman) but kill it if it's
- # an arch variable that isn't for this arch. XXX Sparc64?
- if (mysplit[mypos][:-1] not in settings.usemask) or \
- (mysplit[mypos][:-1]==settings["ARCH"]):
- enabled=1
- else:
- enabled=0
- else:
- if mysplit[mypos][0] == "!":
- myusevar = mysplit[mypos][1:-1]
- enabled = not myusevar in myuse
- #if myusevar in myuse:
- # enabled = 0
- #else:
- # enabled = 1
- else:
- myusevar=mysplit[mypos][:-1]
- enabled = myusevar in myuse
- #if myusevar in myuse:
- # enabled=1
- #else:
- # enabled=0
- if (mypos +2 < len(mysplit)) and (mysplit[mypos+2] == ":"):
- # colon mode
- if enabled:
- # choose the first option
- if type(mysplit[mypos+1]) == types.ListType:
- newsplit.append(dep_opconvert(mysplit[mypos+1],myuse))
- else:
- newsplit.append(mysplit[mypos+1])
- else:
- # choose the alternate option
- if type(mysplit[mypos+1]) == types.ListType:
- newsplit.append(dep_opconvert(mysplit[mypos+3],myuse))
- else:
- newsplit.append(mysplit[mypos+3])
- mypos += 4
- else:
- # normal use mode
- if enabled:
- if type(mysplit[mypos+1]) == types.ListType:
- newsplit.append(dep_opconvert(mysplit[mypos+1],myuse))
- else:
- newsplit.append(mysplit[mypos+1])
- # otherwise, continue
- mypos += 2
- else:
- # normal item
- newsplit.append(mysplit[mypos])
- mypos += 1
- return newsplit
-
-class digraph:
- """beautiful directed graph object"""
-
- def __init__(self):
- self.dict={}
- #okeys = keys, in order they were added (to optimize firstzero() ordering)
- self.okeys=[]
- self.__callback_cache=[]
-
- def __str__(self):
- str = ""
- for key in self.okeys:
- str += "%s:\t%s\n" % (key, self.dict[key][1])
- return str
-
- def addnode(self,mykey,myparent):
- if not mykey in self.dict:
- self.okeys.append(mykey)
- if myparent==None:
- self.dict[mykey]=[0,[]]
- else:
- self.dict[mykey]=[0,[myparent]]
- self.dict[myparent][0]=self.dict[myparent][0]+1
- return
- if myparent and (not myparent in self.dict[mykey][1]):
- self.dict[mykey][1].append(myparent)
- self.dict[myparent][0]=self.dict[myparent][0]+1
-
- def delnode(self,mykey, ref = 1):
- """Delete a node
-
- If ref is 1, remove references to this node from other nodes.
- If ref is 2, remove nodes that reference this node."""
- if not mykey in self.dict:
- return
- for x in self.dict[mykey][1]:
- self.dict[x][0]=self.dict[x][0]-1
- del self.dict[mykey]
- while 1:
- try:
- self.okeys.remove(mykey)
- except ValueError:
- break
- if ref:
- __kill = []
- for k in self.okeys:
- if mykey in self.dict[k][1]:
- if ref == 1 or ref == 2:
- self.dict[k][1].remove(mykey)
- if ref == 2:
- __kill.append(k)
- for l in __kill:
- self.delnode(l, ref)
-
- def allnodes(self):
- "returns all nodes in the dictionary"
- return self.dict.keys()
-
- def firstzero(self):
- "returns first node with zero references, or NULL if no such node exists"
- for x in self.okeys:
- if self.dict[x][0]==0:
- return x
- return None
-
- def firstnonzero(self):
- "returns first node with nonzero references, or NULL if no such node exists"
- for x in self.okeys:
- if self.dict[x][0]!=0:
- return x
- return None
-
-
- def allzeros(self):
- "returns all nodes with zero references, or NULL if no such node exists"
- zerolist = []
- for x in self.dict.keys():
- if self.dict[x][0]==0:
- zerolist.append(x)
- return zerolist
-
- def hasallzeros(self):
- "returns 0/1, Are all nodes zeros? 1 : 0"
- zerolist = []
- for x in self.dict.keys():
- if self.dict[x][0]!=0:
- return 0
- return 1
-
- def empty(self):
- if len(self.dict)==0:
- return 1
- return 0
-
- def hasnode(self,mynode):
- return mynode in self.dict
-
- def getparents(self, item):
- if not self.hasnode(item):
- return []
- return self.dict[item][1]
-
- def getchildren(self, item):
- if not self.hasnode(item):
- return []
- children = [i for i in self.okeys if item in self.getparents(i)]
- return children
-
- def walkdown(self, item, callback, debug = None, usecache = False):
- if not self.hasnode(item):
- return 0
-
- if usecache:
- if self.__callback_cache.count(item):
- if debug:
- print "hit cache for item: %s" % item
- return 1
-
- parents = self.getparents(item)
- children = self.getchildren(item)
- for p in parents:
- if p in children:
-# print "%s is both parent and child of %s" % (p, item)
- if usecache:
- self.__callback_cache.append(p)
- ret = callback(self, p)
- if ret == 0:
- return 0
- continue
- if item == p:
- print "eek, i'm my own parent!"
- return 0
- if debug:
- print "item: %s, p: %s" % (item, p)
- ret = self.walkdown(p, callback, debug, usecache)
- if ret == 0:
- return 0
- if usecache:
- self.__callback_cache.append(item)
- return callback(self, item)
-
- def walkup(self, item, callback):
- if not self.hasnode(item):
- return 0
-
- parents = self.getparents(item)
- children = self.getchildren(item)
- for c in children:
- if c in parents:
- ret = callback(self, item)
- if ret == 0:
- return 0
- continue
- if item == c:
- print "eek, i'm my own child!"
- return 0
- ret = self.walkup(c, callback)
- if ret == 0:
- return 0
- return callback(self, item)
-
- def copy(self):
- mygraph=digraph()
- for x in self.dict.keys():
- mygraph.dict[x]=self.dict[x][:]
- mygraph.okeys=self.okeys[:]
- return mygraph
-
-#######################################################################
-#######################################################################
-#
-# SECTION: Config
-#
-# PURPOSE: Reading and handling of system/target-specific/local configuration
-# reading of package configuration
-#
-#######################################################################
-#######################################################################
-
-def reader(cfgfile, feeder):
- """Generic configuration file reader that opens a file, reads the lines,
- handles continuation lines, comments, empty lines and feed all read lines
- into the function feeder(lineno, line).
- """
-
- f = open(cfgfile,'r')
- lineno = 0
- while 1:
- lineno = lineno + 1
- s = f.readline()
- if not s: break
- w = s.strip()
- if not w: continue # skip empty lines
- s = s.rstrip()
- if s[0] == '#': continue # skip comments
- while s[-1] == '\\':
- s2 = f.readline()[:-1].strip()
- s = s[:-1] + s2
- feeder(lineno, s)
-
-if __name__ == "__main__":
- import doctest, bb
- doctest.testmod(bb)
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
deleted file mode 100644
index 1fd3bbde0..000000000
--- a/bitbake/lib/bb/build.py
+++ /dev/null
@@ -1,403 +0,0 @@
-#!/usr/bin/env python
-# 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 as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-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
-
-Based on functions from the base bb module, Copyright 2003 Holger Schurig
-"""
-
-from bb import debug, data, fetch, fatal, error, note, event, mkdirhier
-import bb, os
-
-# data holds flags and function name for a given task
-_task_data = data.init()
-
-# graph represents task interdependencies
-_task_graph = bb.digraph()
-
-# stack represents execution order, excepting dependencies
-_task_stack = []
-
-# events
-class FuncFailed(Exception):
- """Executed function failed"""
-
-class EventException(Exception):
- """Exception which is associated with an Event."""
-
- def __init__(self, msg, event):
- self._event = event
-
- def getEvent(self):
- return self._event
-
- def setEvent(self, event):
- self._event = event
-
- event = property(getEvent, setEvent, None, "event property")
-
-
-class TaskBase(event.Event):
- """Base class for task events"""
-
- def __init__(self, t, d = {}):
- self._task = t
- event.Event.__init__(self, d)
-
- 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"""
-
-class InvalidTask(TaskBase):
- """Invalid Task"""
-
-# functions
-
-def init(data):
- global _task_data, _task_graph, _task_stack
- _task_data = data.init()
- _task_graph = bb.digraph()
- _task_stack = []
-
-
-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)
-
- adir = data.expand(adir, d)
-
- try:
- prevdir = os.getcwd()
- except OSError:
- prevdir = data.expand('${TOPDIR}', d)
- if adir and os.access(adir, os.F_OK):
- os.chdir(adir)
-
- if data.getVarFlag(func, "python", d):
- exec_func_python(func, d)
- else:
- exec_func_shell(func, d)
- os.chdir(prevdir)
-
-def exec_func_python(func, d):
- """Execute a python BB 'function'"""
- import re, os
-
- tmp = "def " + func + "():\n%s" % data.getVar(func, d)
- comp = compile(tmp + '\n' + func + '()', bb.data.getVar('FILE', d, 1) + ':' + func, "exec")
- prevdir = os.getcwd()
- g = {} # globals
- g['bb'] = bb
- g['os'] = os
- g['d'] = d
- exec comp in g
- if os.path.exists(prevdir):
- os.chdir(prevdir)
-
-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' varflag should contain a list
- of the directories you need created prior to execution. The last
- item in the list is where we will chdir/cd to.
- """
- import sys
-
- deps = data.getVarFlag(func, 'deps', d)
- check = data.getVarFlag(func, 'check', d)
- if check in globals():
- if globals()[check](func, deps):
- return
-
- global logfile
- t = data.getVar('T', d, 1)
- if not t:
- return 0
- mkdirhier(t)
- logfile = "%s/log.%s.%s" % (t, func, str(os.getpid()))
- runfile = "%s/run.%s.%s" % (t, func, str(os.getpid()))
-
- f = open(runfile, "w")
- f.write("#!/bin/sh -e\n")
- if bb.debug_level > 0: f.write("set -x\n")
- data.emit_env(f, d)
-
- f.write("cd %s\n" % os.getcwd())
- if func: f.write("%s\n" % func)
- f.close()
- os.chmod(runfile, 0775)
- if not func:
- error("Function not specified")
- raise FuncFailed()
-
- # open logs
- si = file('/dev/null', 'r')
- try:
- if bb.debug_level > 0:
- so = os.popen("tee \"%s\"" % logfile, "w")
- else:
- so = file(logfile, 'w')
- except OSError, e:
- bb.error("opening log file: %s" % e)
- pass
-
- se = so
-
- # dup the existing fds so we dont lose them
- osi = [os.dup(sys.stdin.fileno()), sys.stdin.fileno()]
- oso = [os.dup(sys.stdout.fileno()), sys.stdout.fileno()]
- ose = [os.dup(sys.stderr.fileno()), sys.stderr.fileno()]
-
- # replace those fds with our own
- os.dup2(si.fileno(), osi[1])
- os.dup2(so.fileno(), oso[1])
- os.dup2(se.fileno(), ose[1])
-
- # execute function
- prevdir = os.getcwd()
- if data.getVarFlag(func, "fakeroot", d):
- maybe_fakeroot = "PATH=\"%s\" fakeroot " % bb.data.getVar("PATH", d, 1)
- else:
- maybe_fakeroot = ''
- ret = os.system('%ssh -e %s' % (maybe_fakeroot, runfile))
- os.chdir(prevdir)
-
- # restore the backups
- os.dup2(osi[0], osi[1])
- os.dup2(oso[0], oso[1])
- os.dup2(ose[0], ose[1])
-
- # close our logs
- si.close()
- so.close()
- se.close()
-
- # close the backup fds
- os.close(osi[0])
- os.close(oso[0])
- os.close(ose[0])
-
- if ret==0:
- if bb.debug_level > 0:
- os.remove(runfile)
-# os.remove(logfile)
- return
- else:
- error("function %s failed" % func)
- if data.getVar("BBINCLUDELOGS", d):
- error("log data follows (%s)" % logfile)
- f = open(logfile, "r")
- while True:
- l = f.readline()
- if l == '':
- break
- l = l.rstrip()
- print '| %s' % l
- f.close()
- else:
- error("see log in %s" % logfile)
- raise FuncFailed()
-
-
-_task_cache = []
-
-def exec_task(task, d):
- """Execute an BB 'task'
-
- The primary difference between executing a task versus executing
- a function is that a task exists in the task digraph, and therefore
- has dependencies amongst other tasks."""
-
- # check if the task is in the graph..
- task_graph = data.getVar('_task_graph', d)
- if not task_graph:
- task_graph = bb.digraph()
- data.setVar('_task_graph', task_graph, d)
- task_cache = data.getVar('_task_cache', d)
- if not task_cache:
- task_cache = []
- data.setVar('_task_cache', task_cache, d)
- if not task_graph.hasnode(task):
- raise EventException("", InvalidTask(task, d))
-
- # check whether this task needs executing..
- if not data.getVarFlag(task, 'force', d):
- if stamp_is_current(task, d):
- return 1
-
- # follow digraph path up, then execute our way back down
- def execute(graph, item):
- if data.getVarFlag(item, 'task', d):
- if item in task_cache:
- return 1
-
- if task != item:
- # deeper than toplevel, exec w/ deps
- exec_task(item, d)
- return 1
-
- try:
- debug(1, "Executing task %s" % item)
- old_overrides = data.getVar('OVERRIDES', d, 0)
- localdata = data.createCopy(d)
- data.setVar('OVERRIDES', 'task_%s:%s' % (item, old_overrides), localdata)
- data.update_data(localdata)
- event.fire(TaskStarted(item, localdata))
- exec_func(item, localdata)
- event.fire(TaskSucceeded(item, localdata))
- task_cache.append(item)
- except FuncFailed, reason:
- note( "Task failed: %s" % reason )
- failedevent = TaskFailed(item, d)
- event.fire(failedevent)
- raise EventException(None, failedevent)
-
- # execute
- task_graph.walkdown(task, execute)
-
- # make stamp, or cause event and raise exception
- if not data.getVarFlag(task, 'nostamp', d):
- mkstamp(task, d)
-
-
-def stamp_is_current(task, d, checkdeps = 1):
- """Check status of a given task's stamp. returns 0 if it is not current and needs updating."""
- task_graph = data.getVar('_task_graph', d)
- if not task_graph:
- task_graph = bb.digraph()
- data.setVar('_task_graph', task_graph, d)
- stamp = data.getVar('STAMP', d)
- if not stamp:
- return 0
- stampfile = "%s.%s" % (data.expand(stamp, d), task)
- if not os.access(stampfile, os.F_OK):
- return 0
-
- if checkdeps == 0:
- return 1
-
- import stat
- tasktime = os.stat(stampfile)[stat.ST_MTIME]
-
- _deps = []
- def checkStamp(graph, task):
- # check for existance
- if data.getVarFlag(task, 'nostamp', d):
- return 1
-
- if not stamp_is_current(task, d, 0):
- return 0
-
- depfile = "%s.%s" % (data.expand(stamp, d), task)
- deptime = os.stat(depfile)[stat.ST_MTIME]
- if deptime > tasktime:
- return 0
- return 1
-
- return task_graph.walkdown(task, checkStamp)
-
-
-def md5_is_current(task):
- """Check if a md5 file for a given task is current"""
-
-
-def mkstamp(task, d):
- """Creates/updates a stamp for a given task"""
- stamp = data.getVar('STAMP', d)
- if not stamp:
- return
- stamp = "%s.%s" % (data.expand(stamp, d), task)
- mkdirhier(os.path.dirname(stamp))
- open(stamp, "w+")
-
-
-def add_task(task, deps, d):
- task_graph = data.getVar('_task_graph', d)
- if not task_graph:
- task_graph = bb.digraph()
- data.setVarFlag(task, 'task', 1, d)
- task_graph.addnode(task, None)
- for dep in deps:
- if not task_graph.hasnode(dep):
- task_graph.addnode(dep, None)
- task_graph.addnode(task, dep)
- # don't assume holding a reference
- data.setVar('_task_graph', task_graph, d)
-
-
-def remove_task(task, kill, d):
- """Remove an BB 'task'.
-
- If kill is 1, also remove tasks that depend on this task."""
-
- task_graph = data.getVar('_task_graph', d)
- if not task_graph:
- task_graph = bb.digraph()
- if not task_graph.hasnode(task):
- return
-
- data.delVarFlag(task, 'task', d)
- ref = 1
- if kill == 1:
- ref = 2
- task_graph.delnode(task, ref)
- data.setVar('_task_graph', task_graph, d)
-
-def task_exists(task, d):
- task_graph = data.getVar('_task_graph', d)
- if not task_graph:
- task_graph = bb.digraph()
- data.setVar('_task_graph', task_graph, d)
- return task_graph.hasnode(task)
-
-def get_task_data():
- return _task_data
diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py
deleted file mode 100644
index 8c89a7e82..000000000
--- a/bitbake/lib/bb/data.py
+++ /dev/null
@@ -1,526 +0,0 @@
-#!/usr/bin/env python
-# ex:ts=4:sw=4:sts=4:et
-# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
-"""
-BitBake 'Data' implementations
-
-Functions for interacting with the data structure used by the
-BitBake build tools.
-
-Copyright (C) 2003, 2004 Chris Larson
-Copyright (C) 2005 Holger Hans Peter Freyther
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-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., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA.
-
-Based on functions from the base bb module, Copyright 2003 Holger Schurig
-"""
-
-import sys, os, re, time, types
-if sys.argv[0][-5:] == "pydoc":
- path = os.path.dirname(os.path.dirname(sys.argv[1]))
-else:
- path = os.path.dirname(os.path.dirname(sys.argv[0]))
-sys.path.append(path)
-
-from bb import note, debug, data_smart
-
-_dict_type = data_smart.DataSmart
-_dict_p_type = data_smart.DataSmartPackage
-
-class DataDictCache:
- """
- Databacked Dictionary implementation
- """
- def __init__(self, cache_dir):
- self.cache_dir = cache_dir
- self.files = []
-
- def has_key(self,key):
- return key in self.files
-
- def keys(self):
- return self.files
-
- def __setitem__(self, key, data):
- """
- Add the key to the list of known files and
- place the data in the cache?
- """
- if key in self.files:
- return
-
- self.files.append(key)
-
- def __getitem__(self, key):
- if not key in self.files:
- return None
-
- # not cached yet
- return _dict_p_type(self.cache_dir, key,False,None)
-
-
-
-def init():
- return _dict_type()
-
-def init_db(cache,name,clean,parent = None):
- return _dict_p_type(cache,name,clean,parent)
-
-def init_db_mtime(cache,cache_bbfile):
- return _dict_p_type.mtime(cache,cache_bbfile)
-
-def pkgdata(use_cache, cache):
- """
- Return some sort of dictionary to lookup parsed dictionaires
- """
- if use_cache:
- return DataDictCache(cache)
- return {}
-
-def createCopy(source):
- """Link the source set to the destination
- If one does not find the value in the destination set,
- search will go on to the source set to get the value.
- Value from source are copy-on-write. i.e. any try to
- modify one of them will end up putting the modified value
- in the destination set.
- """
- return source.createCopy()
-
-def initVar(var, d):
- """Non-destructive var init for data structure"""
- d.initVar(var)
-
-
-def setVar(var, value, d):
- """Set a variable to a given value
-
- Example:
- >>> setVar('TEST', 'testcontents')
- >>> print getVar('TEST')
- testcontents
- """
- d.setVar(var,value)
-
-
-def getVar(var, d, exp = 0):
- """Gets the value of a variable
-
- Example:
- >>> setVar('TEST', 'testcontents')
- >>> print getVar('TEST')
- testcontents
- """
- return d.getVar(var,exp)
-
-def delVar(var, d):
- """Removes a variable from the data set
-
- Example:
- >>> setVar('TEST', 'testcontents')
- >>> print getVar('TEST')
- testcontents
- >>> delVar('TEST')
- >>> print getVar('TEST')
- None
- """
- d.delVar(var)
-
-def setVarFlag(var, flag, flagvalue, d):
- """Set a flag for a given variable to a given value
-
- Example:
- >>> setVarFlag('TEST', 'python', 1)
- >>> print getVarFlag('TEST', 'python')
- 1
- """
- d.setVarFlag(var,flag,flagvalue)
-
-def getVarFlag(var, flag, d):
- """Gets given flag from given var
-
- Example:
- >>> setVarFlag('TEST', 'python', 1)
- >>> print getVarFlag('TEST', 'python')
- 1
- """
- return d.getVarFlag(var,flag)
-
-def delVarFlag(var, flag, d):
- """Removes a given flag from the variable's flags
-
- Example:
- >>> setVarFlag('TEST', 'testflag', 1)
- >>> print getVarFlag('TEST', 'testflag')
- 1
- >>> delVarFlag('TEST', 'testflag')
- >>> print getVarFlag('TEST', 'testflag')
- None
-
- """
- d.delVarFlag(var,flag)
-
-def setVarFlags(var, flags, d):
- """Set the flags for a given variable
-
- Example:
- >>> myflags = {}
- >>> myflags['test'] = 'blah'
- >>> setVarFlags('TEST', myflags)
- >>> print getVarFlag('TEST', 'test')
- blah
- """
- d.setVarFlags(var,flags)
-
-def getVarFlags(var, d):
- """Gets a variable's flags
-
- Example:
- >>> setVarFlag('TEST', 'test', 'blah')
- >>> print getVarFlags('TEST')['test']
- blah
- """
- return d.getVarFlags(var)
-
-def delVarFlags(var, d):
- """Removes a variable's flags
-
- Example:
- >>> data = init()
- >>> setVarFlag('TEST', 'testflag', 1, data)
- >>> print getVarFlag('TEST', 'testflag', data)
- 1
- >>> delVarFlags('TEST', data)
- >>> print getVarFlags('TEST', data)
- None
-
- """
- d.delVarFlags(var)
-
-def keys(d):
- """Return a list of keys in d
-
- Example:
- >>> d = init()
- >>> setVar('TEST', 1, d)
- >>> setVar('MOO' , 2, d)
- >>> setVarFlag('TEST', 'test', 1, d)
- >>> keys(d)
- ['TEST', 'MOO']
- """
- return d.keys()
-
-def getData(d):
- """Returns the data object used"""
- return d
-
-def setData(newData, d):
- """Sets the data object to the supplied value"""
- d = newData
-
-__expand_var_regexp__ = re.compile(r"\${[^{}]+}")
-__expand_python_regexp__ = re.compile(r"\${@.+?}")
-
-def expand(s, d, varname = None):
- """Variable expansion using the data store.
-
- Example:
- Standard expansion:
- >>> setVar('A', 'sshd')
- >>> print expand('/usr/bin/${A}')
- /usr/bin/sshd
-
- Python expansion:
- >>> print expand('result: ${@37 * 72}')
- result: 2664
- """
- def var_sub(match):
- key = match.group()[2:-1]
- if varname and key:
- if varname == key:
- raise Exception("variable %s references itself!" % varname)
- var = getVar(key, d, 1)
- if var is not None:
- return var
- else:
- return match.group()
-
- def python_sub(match):
- import bb
- code = match.group()[3:-1]
- locals()['d'] = d
- s = eval(code)
- if type(s) == types.IntType: s = str(s)
- return s
-
- if type(s) is not types.StringType: # sanity check
- return s
-
- while s.find('$') != -1:
- olds = s
- try:
- s = __expand_var_regexp__.sub(var_sub, s)
- s = __expand_python_regexp__.sub(python_sub, s)
- if s == olds: break
- if type(s) is not types.StringType: # sanity check
- import bb
- bb.error('expansion of %s returned non-string %s' % (olds, s))
- except KeyboardInterrupt:
- raise
- except:
- note("%s:%s while evaluating:\n%s" % (sys.exc_info()[0], sys.exc_info()[1], s))
- raise
- return s
-
-def expandKeys(alterdata, readdata = None):
- if readdata == None:
- readdata = alterdata
-
- for key in keys(alterdata):
- ekey = expand(key, readdata)
- if key == ekey:
- continue
- val = getVar(key, alterdata)
- if val is None:
- continue
-# import copy
-# setVarFlags(ekey, copy.copy(getVarFlags(key, readdata)), alterdata)
- setVar(ekey, val, alterdata)
-
- for i in ('_append', '_prepend', '_delete'):
- dest = getVarFlag(ekey, i, alterdata) or []
- src = getVarFlag(key, i, readdata) or []
- dest.extend(src)
- setVarFlag(ekey, i, dest, alterdata)
-
- delVar(key, alterdata)
-
-def expandData(alterdata, readdata = None):
- """For each variable in alterdata, expand it, and update the var contents.
- Replacements use data from readdata.
-
- Example:
- >>> a=init()
- >>> b=init()
- >>> setVar("dlmsg", "dl_dir is ${DL_DIR}", a)
- >>> setVar("DL_DIR", "/path/to/whatever", b)
- >>> expandData(a, b)
- >>> print getVar("dlmsg", a)
- dl_dir is /path/to/whatever
- """
- if readdata == None:
- readdata = alterdata
-
- for key in keys(alterdata):
- val = getVar(key, alterdata)
- if type(val) is not types.StringType:
- continue
- expanded = expand(val, readdata)
-# print "key is %s, val is %s, expanded is %s" % (key, val, expanded)
- if val != expanded:
- setVar(key, expanded, alterdata)
-
-import os
-
-def inheritFromOS(d):
- """Inherit variables from the environment."""
-# fakeroot needs to be able to set these
- non_inherit_vars = [ "LD_LIBRARY_PATH", "LD_PRELOAD" ]
- for s in os.environ.keys():
- if not s in non_inherit_vars:
- try:
- setVar(s, os.environ[s], d)
- setVarFlag(s, 'matchesenv', '1', d)
- except TypeError:
- pass
-
-import sys
-
-def emit_var(var, o=sys.__stdout__, d = init(), all=False):
- """Emit a variable to be sourced by a shell."""
- if getVarFlag(var, "python", d):
- return 0
-
- try:
- if all:
- oval = getVar(var, d, 0)
- val = getVar(var, d, 1)
- except KeyboardInterrupt:
- raise
- except:
- excname = str(sys.exc_info()[0])
- if excname == "bb.build.FuncFailed":
- raise
- o.write('# expansion of %s threw %s\n' % (var, excname))
- return 0
-
- if all:
- o.write('# %s=%s\n' % (var, oval))
-
- if type(val) is not types.StringType:
- return 0
-
- if getVarFlag(var, 'matchesenv', d):
- return 0
-
- if (var.find("-") != -1 or var.find(".") != -1 or var.find('{') != -1 or var.find('}') != -1 or var.find('+') != -1) and not all:
- return 0
-
- val.rstrip()
- if not val:
- return 0
-
- if getVarFlag(var, "func", d):
-# NOTE: should probably check for unbalanced {} within the var
- o.write("%s() {\n%s\n}\n" % (var, val))
- else:
- if getVarFlag(var, "export", d):
- o.write('export ')
- else:
- if not all:
- return 0
-# if we're going to output this within doublequotes,
-# to a shell, we need to escape the quotes in the var
- alter = re.sub('"', '\\"', val.strip())
- o.write('%s="%s"\n' % (var, alter))
- return 1
-
-
-def emit_env(o=sys.__stdout__, d = init(), all=False):
- """Emits all items in the data store in a format such that it can be sourced by a shell."""
-
- env = keys(d)
-
- for e in env:
- if getVarFlag(e, "func", d):
- continue
- emit_var(e, o, d, all) and o.write('\n')
-
- for e in env:
- if not getVarFlag(e, "func", d):
- continue
- emit_var(e, o, d) and o.write('\n')
-
-def update_data(d):
- """Modifies the environment vars according to local overrides and commands.
- Examples:
- Appending to a variable:
- >>> setVar('TEST', 'this is a')
- >>> setVar('TEST_append', ' test')
- >>> setVar('TEST_append', ' of the emergency broadcast system.')
- >>> update_data()
- >>> print getVar('TEST')
- this is a test of the emergency broadcast system.
-
- Prepending to a variable:
- >>> setVar('TEST', 'virtual/libc')
- >>> setVar('TEST_prepend', 'virtual/tmake ')
- >>> setVar('TEST_prepend', 'virtual/patcher ')
- >>> update_data()
- >>> print getVar('TEST')
- virtual/patcher virtual/tmake virtual/libc
-
- Overrides:
- >>> setVar('TEST_arm', 'target')
- >>> setVar('TEST_ramses', 'machine')
- >>> setVar('TEST_local', 'local')
- >>> setVar('OVERRIDES', 'arm')
-
- >>> setVar('TEST', 'original')
- >>> update_data()
- >>> print getVar('TEST')
- target
-
- >>> setVar('OVERRIDES', 'arm:ramses:local')
- >>> setVar('TEST', 'original')
- >>> update_data()
- >>> print getVar('TEST')
- local
- """
-
- debug(2, "update_data()")
-
-# can't do delete env[...] while iterating over the dictionary, so remember them
- dodel = []
- overrides = (getVar('OVERRIDES', d, 1) or "").split(':') or []
-
- def applyOverrides(var, d):
- if not overrides:
- debug(1, "OVERRIDES not defined, nothing to do")
- return
- val = getVar(var, d)
- for o in overrides:
- if var.endswith("_" + o):
- l = len(o)+1
- name = var[:-l]
- d[name] = d[var]
-
- for s in keys(d):
- applyOverrides(s, d)
- sval = getVar(s, d) or ""
-
-# Handle line appends:
- for (a, o) in getVarFlag(s, '_append', d) or []:
- # maybe the OVERRIDE was not yet added so keep the append
- if (o and o in overrides) or not o:
- delVarFlag(s, '_append', d)
- if o:
- if not o in overrides:
- continue
- sval+=a
- setVar(s, sval, d)
-
-# Handle line prepends
- for (a, o) in getVarFlag(s, '_prepend', d) or []:
- # maybe the OVERRIDE was not yet added so keep the append
- if (o and o in overrides) or not o:
- delVarFlag(s, '_prepend', d)
- if o:
- if not o in overrides:
- continue
- sval=a+sval
- setVar(s, sval, d)
-
-# Handle line deletions
- name = s + "_delete"
- nameval = getVar(name, d)
- if nameval:
- sval = getVar(s, d)
- if sval:
- new = ''
- pattern = nameval.replace('\n','').strip()
- for line in sval.split('\n'):
- if line.find(pattern) == -1:
- new = new + '\n' + line
- setVar(s, new, d)
- dodel.append(name)
-
-# delete all environment vars no longer needed
- for s in dodel:
- delVar(s, d)
-
-def inherits_class(klass, d):
- val = getVar('__inherit_cache', d) or ""
- if os.path.join('classes', '%s.bbclass' % klass) in val.split():
- return True
- return False
-
-def _test():
- """Start a doctest run on this module"""
- import doctest
- from bb import data
- doctest.testmod(data)
-
-if __name__ == "__main__":
- _test()
diff --git a/bitbake/lib/bb/data_dict.py b/bitbake/lib/bb/data_dict.py
deleted file mode 100644
index b4d6fd73e..000000000
--- a/bitbake/lib/bb/data_dict.py
+++ /dev/null
@@ -1,244 +0,0 @@
-# ex:ts=4:sw=4:sts=4:et
-# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
-"""
-BitBake 'Data-Dict' implementation
-
-Functions for interacting with the data structure used by the
-BitBake build tools.
-
-Copyright (C) 2003, 2004 Chris Larson
-Copyright (C) 2005 Holger Hans Peter Freyther
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-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., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA.
-
-Based on functions from the base bb module, Copyright 2003 Holger Schurig
-"""
-
-import os, re, sys, types, copy
-from bb import note, debug, fatal
-
-try:
- import cPickle as pickle
-except ImportError:
- import pickle
- print "NOTE: Importing cPickle failed. Falling back to a very slow implementation."
-
-
-
-__setvar_regexp__ = {}
-__setvar_regexp__["_append"] = re.compile('(?P<base>.*?)%s(_(?P<add>.*))?' % "_append")
-__setvar_regexp__["_prepend"] = re.compile('(?P<base>.*?)%s(_(?P<add>.*))?' % "_prepend")
-__setvar_regexp__["_delete"] = re.compile('(?P<base>.*?)%s(_(?P<add>.*))?' % "_delete")
-
-__expand_var_regexp__ = re.compile(r"\${[^{}]+}")
-__expand_python_regexp__ = re.compile(r"\${@.+?}")
-
-
-class DataDict:
- def __init__(self):
- self.dict = {}
-
- def expand(self,s, varname):
- def var_sub(match):
- key = match.group()[2:-1]
- if varname and key:
- if varname == key:
- raise Exception("variable %s references itself!" % varname)
- var = self.getVar(key, 1)
- if var is not None:
- return var
- else:
- return match.group()
-
- def python_sub(match):
- import bb
- code = match.group()[3:-1]
- locals()['d'] = self
- s = eval(code)
- if type(s) == types.IntType: s = str(s)
- return s
-
- if type(s) is not types.StringType: # sanity check
- return s
-
- while s.find('$') != -1:
- olds = s
- try:
- s = __expand_var_regexp__.sub(var_sub, s)
- s = __expand_python_regexp__.sub(python_sub, s)
- if s == olds: break
- if type(s) is not types.StringType: # sanity check
- import bb
- bb.error('expansion of %s returned non-string %s' % (olds, s))
- except KeyboardInterrupt:
- raise
- except:
- note("%s:%s while evaluating:\n%s" % (sys.exc_info()[0], sys.exc_info()[1], s))
- raise
- return s
-
- def initVar(self, var):
- if not var in self.dict:
- self.dict[var] = {}
-
- if not "flags" in self.dict[var]:
- self.dict[var]["flags"] = {}
-
- def setVar(self,var,value):
- for v in ["_append", "_prepend", "_delete"]:
- match = __setvar_regexp__[v].match(var)
-
- if match:
- base = match.group('base')
- override = match.group('add')
- l = self.getVarFlag(base, v) or []
- if override == 'delete':
- if l.count([value, None]):
- del l[l.index([value, None])]
- l.append([value, override])
- self.setVarFlag(base, v, l)
- return
-
- self.initVar(var)
- if self.getVarFlag(var, 'matchesenv'):
- self.delVarFlag(var, 'matchesenv')
- self.setVarFlag(var, 'export', 1)
- self.dict[var]["content"] = value
-
- def getVar(self,var,exp):
- if not var in self.dict or not "content" in self.dict[var]:
- return None
-
- if exp:
- return self.expand(self.dict[var]["content"], var)
- return self.dict[var]["content"]
-
- def delVar(self,var):
- if var in self.dict:
- del self.dict[var]
-
- def setVarFlag(self,var,flag,flagvalue):
- self.initVar(var)
- self.dict[var]["flags"][flag] = flagvalue
-
- def getVarFlag(self,var,flag):
- if var in self.dict and "flags" in self.dict[var] and flag in self.dict[var]["flags"]:
- di = self.dict[var]
- di = di["flags"]
- return di[flag]
- return None
-
- def delVarFlag(self,var,flag):
- if var in self.dict and "flags" in self.dict[var] and flag in self.dict[var]["flags"]:
- del self.dict[var]["flags"][flag]
-
- def setVarFlags(self,var,flags):
- self.initVar(var)
- if flags == None:
- debug("Setting Null Flag %s" % var)
-
- self.dict[var]["flags"] = flags
-
- def getVarFlags(self,var):
- if var in self.dict and "flags" in self.dict[var]:
- return self.dict[var]["flags"]
-
- return None
-
- def delVarFlags(self,var):
- if var in self.dict and "flags" in self.dict[var]:
- del self.dict[var]["flags"]
-
- def createCopy(self):
- return copy.deepcopy(self)
-
- # Dictionary Methods
- def keys(self):
- return self.dict.keys()
-
- def iterkeys(self):
- return self.dict.iterkeys()
-
- def iteritems(self):
- return self.dict.iteritems()
-
- def items(self):
- return self.dict.items()
-
- def __getitem__(self,y):
- return self.dict.__getitem__(y)
-
- def __setitem__(self,x,y):
- self.dict.__setitem__(x,y)
-
-
-
-class DataDictPackage(DataDict):
- """
- Persistent Data Storage
- """
- def sanitize_filename(bbfile):
- return bbfile.replace( '/', '_' )
- sanitize_filename = staticmethod(sanitize_filename)
-
- def unpickle(self):
- """
- Restore the dict from memory
- """
- cache_bbfile = self.sanitize_filename(self.bbfile)
- p = pickle.Unpickler( file("%s/%s"%(self.cache,cache_bbfile),"rb"))
- self.dict = p.load()
- funcstr = self.getVar('__functions__', 0)
- if funcstr:
- comp = compile(funcstr, "<pickled>", "exec")
- exec comp in __builtins__
-
- def linkDataSet(self,parent):
- if not parent == None:
- self.initVar("_data")
- self.dict["_data"] = parent
-
-
- def __init__(self,cache,name,clean,parent):
- """
- Construct a persistent data instance
- """
- #Initialize the dictionary
- DataDict.__init__(self)
-
- self.cache = cache
- self.bbfile = name
-
- # Either unpickle the data or do copy on write
- if clean:
- self.linkDataSet(parent)
- else:
- self.unpickle()
-
- def commit(self, mtime):
- """
- Save the package to a permanent storage
- """
- cache_bbfile = self.sanitize_filename(self.bbfile)
- p = pickle.Pickler(file("%s/%s" %(self.cache,cache_bbfile), "wb" ), -1 )
- p.dump( self.dict )
-
- def mtime(cache,bbfile):
- cache_bbfile = DataDictPackage.sanitize_filename(bbfile)
- try:
- return os.stat( "%s/%s" % (cache,cache_bbfile) )
- except OSError:
- return 0
- mtime = staticmethod(mtime)
-
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
deleted file mode 100644
index 069fa0363..000000000
--- a/bitbake/lib/bb/data_smart.py
+++ /dev/null
@@ -1,329 +0,0 @@
-# ex:ts=4:sw=4:sts=4:et
-# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
-"""
-BitBake Smart Dictionary Implementation
-
-Functions for interacting with the data structure used by the
-BitBake build tools.
-
-Copyright (C) 2003, 2004 Chris Larson
-Copyright (C) 2004, 2005 Seb Frankengul
-Copyright (C) 2005 Holger Hans Peter Freyther
-Copyright (C) 2005 Uli Luckas
-Copyright (C) 2005 ROAD GmbH
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-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., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA.
-
-Based on functions from the base bb module, Copyright 2003 Holger Schurig
-"""
-
-import copy, os, re, sys, types
-from bb import note, debug, fatal
-
-try:
- import cPickle as pickle
-except ImportError:
- import pickle
- print "NOTE: Importing cPickle failed. Falling back to a very slow implementation."
-
-
-__setvar_keyword__ = ["_append","_prepend","_delete"]
-__setvar_regexp__ = re.compile('(?P<base>.*?)(?P<keyword>_append|_prepend|_delete)(_(?P<add>.*))?')
-__expand_var_regexp__ = re.compile(r"\${[^{}]+}")
-__expand_python_regexp__ = re.compile(r"\${@.+?}")
-
-
-class DataSmart:
- def __init__(self):
- self.dict = {}
-
- def expand(self,s, varname):
- def var_sub(match):
- key = match.group()[2:-1]
- if varname and key:
- if varname == key:
- raise Exception("variable %s references itself!" % varname)
- var = self.getVar(key, 1)
- if var is not None:
- return var
- else:
- return match.group()
-
- def python_sub(match):
- import bb
- code = match.group()[3:-1]
- locals()['d'] = self
- s = eval(code)
- if type(s) == types.IntType: s = str(s)
- return s
-
- if type(s) is not types.StringType: # sanity check
- return s
-
- while s.find('$') != -1:
- olds = s
- try:
- s = __expand_var_regexp__.sub(var_sub, s)
- s = __expand_python_regexp__.sub(python_sub, s)
- if s == olds: break
- if type(s) is not types.StringType: # sanity check
- import bb
- bb.error('expansion of %s returned non-string %s' % (olds, s))
- except KeyboardInterrupt:
- raise
- except:
- note("%s:%s while evaluating:\n%s" % (sys.exc_info()[0], sys.exc_info()[1], s))
- raise
- return s
-
- def initVar(self, var):
- if not var in self.dict:
- self.dict[var] = {}
-
- def pickle_prep(self, cfg):
- if "_data" in self.dict:
- if self.dict["_data"] == cfg:
- self.dict["_data"] = "cfg";
- else: # this is an unknown array for the moment
- pass
-
- def unpickle_prep(self, cfg):
- if "_data" in self.dict:
- if self.dict["_data"] == "cfg":
- self.dict["_data"] = cfg;
-
- def _findVar(self,var):
- _dest = self
-
- while (_dest and var not in _dest.dict):
- if not "_data" in _dest.dict:
- _dest = None
- break
- _dest = _dest["_data"]
-
- if _dest and var in _dest.dict:
- return _dest.dict[var]
- return None
-
- def _copyVar(self,var,name):
- local_var = self._findVar(var)
- if local_var:
- self.dict[name] = copy.copy(local_var)
- else:
- debug(1,"Warning, _copyVar %s to %s, %s does not exists" % (var,name,var))
-
-
- def _makeShadowCopy(self, var):
- if var in self.dict:
- return
-
- local_var = self._findVar(var)
-
- if local_var:
- self.dict[var] = copy.copy(local_var)
- else:
- self.initVar(var)
-
- def setVar(self,var,value):
- match = __setvar_regexp__.match(var)
- if match and match.group("keyword") in __setvar_keyword__:
- base = match.group('base')
- keyword = match.group("keyword")
- override = match.group('add')
- l = self.getVarFlag(base, keyword) or []
- if override == 'delete':
- if l.count([value, None]):
- del l[l.index([value, None])]
- l.append([value, override])
- self.setVarFlag(base, match.group("keyword"), l)
- return
-
- if not var in self.dict:
- self._makeShadowCopy(var)
- if self.getVarFlag(var, 'matchesenv'):
- self.delVarFlag(var, 'matchesenv')
- self.setVarFlag(var, 'export', 1)
-
- # setting var
- self.dict[var]["content"] = value
-
- def getVar(self,var,exp):
- value = self.getVarFlag(var,"content")
-
- if exp and value:
- return self.expand(value,var)
- return value
-
- def delVar(self,var):
- self.dict[var] = {}
-
- def setVarFlag(self,var,flag,flagvalue):
- if not var in self.dict:
- self._makeShadowCopy(var)
- self.dict[var][flag] = flagvalue
-
- def getVarFlag(self,var,flag):
- local_var = self._findVar(var)
- if local_var:
- if flag in local_var:
- return copy.copy(local_var[flag])
- return None
-
- def delVarFlag(self,var,flag):
- local_var = self._findVar(var)
- if not local_var:
- return
- if not var in self.dict:
- self._makeShadowCopy(var)
-
- if var in self.dict and flag in self.dict[var]:
- del self.dict[var][flag]
-
- def setVarFlags(self,var,flags):
- if not var in self.dict:
- self._makeShadowCopy(var)
-
- for i in flags.keys():
- if i == "content":
- continue
- self.dict[var][i] = flags[i]
-
- def getVarFlags(self,var):
- local_var = self._findVar(var)
- flags = {}
-
- if local_var:
- for i in self.dict[var].keys():
- if i == "content":
- continue
- flags[i] = self.dict[var][i]
-
- if len(flags) == 0:
- return None
- return flags
-
-
- def delVarFlags(self,var):
- if not var in self.dict:
- self._makeShadowCopy(var)
-
- if var in self.dict:
- content = None
-
- # try to save the content
- if "content" in self.dict[var]:
- content = self.dict[var]["content"]
- self.dict[var] = {}
- self.dict[var]["content"] = content
- else:
- del self.dict[var]
-
-
- def createCopy(self):
- """
- Create a copy of self by setting _data to self
- """
- # we really want this to be a DataSmart...
- data = DataSmart()
- data.initVar("_data")
- data.dict["_data"] = self
-
- return data
-
- # Dictionary Methods
- def keys(self):
- def _keys(d, mykey):
- if "_data" in d.dict:
- _keys(d.dict["_data"],mykey)
-
- for key in d.dict.keys():
- if key != "_data":
- mykey[key] = None
- keytab = {}
- _keys(self,keytab)
- return keytab.keys()
-
- def __getitem__(self,item):
- start = self
- while start:
- if item in start.dict:
- return start.dict[item]
- elif "_data" in start.dict:
- start = start.dict["_data"]
- else:
- start = None
- return None
-
- def __setitem__(self,var,data):
- self._makeShadowCopy(var)
- self.dict[var] = data
-
-
-class DataSmartPackage(DataSmart):
- """
- Persistent Data Storage
- """
- def sanitize_filename(bbfile):
- return bbfile.replace( '/', '_' )
- sanitize_filename = staticmethod(sanitize_filename)
-
- def unpickle(self):
- """
- Restore the dict from memory
- """
- cache_bbfile = self.sanitize_filename(self.bbfile)
- p = pickle.Unpickler( file("%s/%s"%(self.cache,cache_bbfile),"rb"))
- self.dict = p.load()
- funcstr = self.getVar('__functions__', 0)
- if funcstr:
- comp = compile(funcstr, "<pickled>", "exec")
- exec comp in __builtins__
-
- def linkDataSet(self,parent):
- if not parent == None:
- self.initVar("_data")
- self.dict["_data"] = parent
-
-
- def __init__(self,cache,name,clean,parent):
- """
- Construct a persistent data instance
- """
- #Initialize the dictionary
- DataSmart.__init__(self)
-
- self.cache = cache
- self.bbfile = name
-
- # Either unpickle the data or do copy on write
- if clean:
- self.linkDataSet(parent)
- else:
- self.unpickle()
-
- def commit(self, mtime):
- """
- Save the package to a permanent storage
- """
- cache_bbfile = self.sanitize_filename(self.bbfile)
- p = pickle.Pickler(file("%s/%s" %(self.cache,cache_bbfile), "wb" ), -1 )
- p.dump( self.dict )
-
- def mtime(cache,bbfile):
- cache_bbfile = DataSmartPackage.sanitize_filename(bbfile)
- try:
- return os.stat( "%s/%s" % (cache,cache_bbfile) )
- except OSError:
- return 0
- mtime = staticmethod(mtime)
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
deleted file mode 100644
index c4e88fa35..000000000
--- a/bitbake/lib/bb/event.py
+++ /dev/null
@@ -1,210 +0,0 @@
-#!/usr/bin/env python
-# ex:ts=4:sw=4:sts=4:et
-# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
-"""
-BitBake 'Event' implementation
-
-Classes and functions for manipulating 'events' in the
-BitBake build tools.
-
-Copyright (C) 2003, 2004 Chris Larson
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-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., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA.
-"""
-
-import os, re
-import bb.data
-
-class Event:
- """Base class for events"""
- type = "Event"
-
- def __init__(self, d = bb.data.init()):
- self._data = d
-
- def getData(self):
- return self._data
-
- def setData(self, data):
- self._data = data
-
- data = property(getData, setData, None, "data property")
-
-NotHandled = 0
-Handled = 1
-handlers = []
-
-def tmpHandler(event):
- """Default handler for code events"""
- return NotHandled
-
-def defaultTmpHandler():
- tmp = "def tmpHandler(e):\n\t\"\"\"heh\"\"\"\n\treturn 0"
- comp = compile(tmp, "tmpHandler(e)", "exec")
- return comp
-
-def fire(event):
- """Fire off an Event"""
- for h in handlers:
- if type(h).__name__ == "code":
- exec(h)
- if tmpHandler(event) == Handled:
- return Handled
- else:
- if h(event) == Handled:
- return Handled
- return NotHandled
-
-def register(handler):
- """Register an Event handler"""
- if handler is not None:
-# handle string containing python code
- if type(handler).__name__ == "str":
- return registerCode(handler)
-# prevent duplicate registration
- if not handler in handlers:
- handlers.append(handler)
-
-def registerCode(handlerStr):
- """Register a 'code' Event.
- Deprecated interface; call register instead.
-
- Expects to be passed python code as a string, which will
- be passed in turn to compile() and then exec(). Note that
- the code will be within a function, so should have had
- appropriate tabbing put in place."""
- tmp = "def tmpHandler(e):\n%s" % handlerStr
- comp = compile(tmp, "tmpHandler(e)", "exec")
-# prevent duplicate registration
- if not comp in handlers:
- handlers.append(comp)
-
-def remove(handler):
- """Remove an Event handler"""
- for h in handlers:
- if type(handler).__name__ == "str":
- return removeCode(handler)
-
- if handler is h:
- handlers.remove(handler)
-
-def removeCode(handlerStr):
- """Remove a 'code' Event handler
- Deprecated interface; call remove instead."""
- tmp = "def tmpHandler(e):\n%s" % handlerStr
- comp = compile(tmp, "tmpHandler(e)", "exec")
- handlers.remove(comp)
-
-def getName(e):
- """Returns the name of a class or class instance"""
- if getattr(e, "__name__", None) == None:
- return e.__class__.__name__
- else:
- return e.__name__
-
-
-class PkgBase(Event):
- """Base class for package events"""
-
- def __init__(self, t, d = {}):
- self._pkg = t
- Event.__init__(self, d)
-
- def getPkg(self):
- return self._pkg
-
- def setPkg(self, pkg):
- self._pkg = pkg
-
- pkg = property(getPkg, setPkg, None, "pkg property")
-
-
-class BuildBase(Event):
- """Base class for bbmake run events"""
-
- def __init__(self, n, p, c):
- self._name = n
- self._pkgs = p
- Event.__init__(self, c)
-
- def getPkgs(self):
- return self._pkgs
-
- def setPkgs(self, pkgs):
- self._pkgs = pkgs
-
- def getName(self):
- return self._name
-
- def setName(self, name):
- self._name = name
-
- def getCfg(self):
- return self.data
-
- def setCfg(self, cfg):
- self.data = cfg
-
- pkgs = property(getPkgs, setPkgs, None, "pkgs property")
- name = property(getName, setName, None, "name property")
- cfg = property(getCfg, setCfg, None, "cfg property")
-
-
-class DepBase(PkgBase):
- """Base class for dependency events"""
-
- def __init__(self, t, data, d):
- self._dep = d
- PkgBase.__init__(self, t, data)
-
- def getDep(self):
- return self._dep
-
- def setDep(self, dep):
- self._dep = dep
-
- dep = property(getDep, setDep, None, "dep property")
-
-
-class PkgStarted(PkgBase):
- """Package build started"""
-
-
-class PkgFailed(PkgBase):
- """Package build failed"""
-
-
-class PkgSucceeded(PkgBase):
- """Package build completed"""
-
-
-class BuildStarted(BuildBase):
- """bbmake build run started"""
-
-
-class BuildCompleted(BuildBase):
- """bbmake build run completed"""
-
-
-class UnsatisfiedDep(DepBase):
- """Unsatisfied Dependency"""
-
-
-class RecursiveDep(DepBase):
- """Recursive Dependency"""
-
-
-class MultipleProviders(PkgBase):
- """Multiple Providers"""
-
diff --git a/bitbake/lib/bb/fetch.py b/bitbake/lib/bb/fetch.py
deleted file mode 100644
index 8b981efa9..000000000
--- a/bitbake/lib/bb/fetch.py
+++ /dev/null
@@ -1,635 +0,0 @@
-#!/usr/bin/env python
-# ex:ts=4:sw=4:sts=4:et
-# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
-"""
-BitBake 'Fetch' implementations
-
-Classes for obtaining upstream sources for the
-BitBake build tools.
-
-Copyright (C) 2003, 2004 Chris Larson
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-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., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA.
-
-Based on functions from the base bb module, Copyright 2003 Holger Schurig
-"""
-
-import os, re
-import bb
-import bb.data
-
-class FetchError(Exception):
- """Exception raised when a download fails"""
-
-class NoMethodError(Exception):
- """Exception raised when there is no method to obtain a supplied url or set of urls"""
-
-class MissingParameterError(Exception):
- """Exception raised when a fetch method is missing a critical parameter in the url"""
-
-#decodeurl("cvs://anoncvs:anonymous@cvs.handhelds.org/cvs;module=familiar/dist/ipkg;tag=V0-99-81")
-#('cvs', 'cvs.handhelds.org', '/cvs', 'anoncvs', 'anonymous', {'tag': 'V0-99-81', 'module': 'familiar/dist/ipkg'})
-
-def uri_replace(uri, uri_find, uri_replace, d):
-# bb.note("uri_replace: operating on %s" % uri)
- if not uri or not uri_find or not uri_replace:
- bb.debug(1, "uri_replace: passed an undefined value, not replacing")
- uri_decoded = list(bb.decodeurl(uri))
- uri_find_decoded = list(bb.decodeurl(uri_find))
- uri_replace_decoded = list(bb.decodeurl(uri_replace))
- result_decoded = ['','','','','',{}]
- for i in uri_find_decoded:
- loc = uri_find_decoded.index(i)
- result_decoded[loc] = uri_decoded[loc]
- import types
- if type(i) == types.StringType:
- import re
- if (re.match(i, uri_decoded[loc])):
- result_decoded[loc] = re.sub(i, uri_replace_decoded[loc], uri_decoded[loc])
- if uri_find_decoded.index(i) == 2:
- if d:
- localfn = bb.fetch.localpath(uri, d)
- if localfn:
- result_decoded[loc] = os.path.dirname(result_decoded[loc]) + "/" + os.path.basename(bb.fetch.localpath(uri, d))
-# bb.note("uri_replace: matching %s against %s and replacing with %s" % (i, uri_decoded[loc], uri_replace_decoded[loc]))
- else:
-# bb.note("uri_replace: no match")
- return uri
-# else:
-# for j in i.keys():
-# FIXME: apply replacements against options
- return bb.encodeurl(result_decoded)
-
-methods = []
-
-def init(urls = [], d = None):
- 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)
-
-def go(d):
- """Fetch all urls"""
- for m in methods:
- if m.urls:
- m.go(d)
-
-def localpaths(d):
- """Return a list of the local filenames, assuming successful fetch"""
- local = []
- for m in methods:
- for u in m.urls:
- local.append(m.localpath(u, d))
- return local
-
-def localpath(url, d):
- for m in methods:
- if m.supports(url, d):
- return m.localpath(url, d)
- return url
-
-class Fetch(object):
- """Base class for 'fetch'ing data"""
-
- def __init__(self, urls = []):
- self.urls = []
- for url in urls:
- if self.supports(bb.decodeurl(url), d) is 1:
- self.urls.append(url)
-
- def supports(url, d):
- """Check to see if this fetch class supports a given url.
- Expects supplied url in list form, as outputted by bb.decodeurl().
- """
- return 0
- supports = staticmethod(supports)
-
- def localpath(url, d):
- """Return the local filename of a given url assuming a successful fetch.
- """
- return url
- localpath = staticmethod(localpath)
-
- def setUrls(self, urls):
- self.__urls = urls
-
- def getUrls(self):
- return self.__urls
-
- urls = property(getUrls, setUrls, None, "Urls property")
-
- def setData(self, data):
- self.__data = data
-
- def getData(self):
- return self.__data
-
- data = property(getData, setData, None, "Data property")
-
- def go(self, urls = []):
- """Fetch urls"""
- raise NoMethodError("Missing implementation for url")
-
-class Wget(Fetch):
- """Class to fetch urls via 'wget'"""
- def supports(url, d):
- """Check to see if a given url can be fetched using wget.
- Expects supplied url in list form, as outputted by bb.decodeurl().
- """
- (type, host, path, user, pswd, parm) = bb.decodeurl(bb.data.expand(url, d))
- return type in ['http','https','ftp']
- supports = staticmethod(supports)
-
- def localpath(url, d):
-# strip off parameters
- (type, host, path, user, pswd, parm) = bb.decodeurl(bb.data.expand(url, d))
- if "localpath" in parm:
-# if user overrides local path, use it.
- return parm["localpath"]
- url = bb.encodeurl([type, host, path, user, pswd, {}])
-
- return os.path.join(bb.data.getVar("DL_DIR", d), os.path.basename(url))
- localpath = staticmethod(localpath)
-
- def go(self, d, urls = []):
- """Fetch urls"""
- def fetch_uri(uri, basename, dl, md5, d):
- if os.path.exists(dl):
-# file exists, but we didnt complete it.. trying again..
- fetchcmd = bb.data.getVar("RESUMECOMMAND", d, 1)
- else:
- fetchcmd = bb.data.getVar("FETCHCOMMAND", d, 1)
-
- bb.note("fetch " + uri)
- fetchcmd = fetchcmd.replace("${URI}", uri)
- fetchcmd = fetchcmd.replace("${FILE}", basename)
- bb.debug(2, "executing " + fetchcmd)
- ret = os.system(fetchcmd)
- if ret != 0:
- return False
-
-# supposedly complete.. write out md5sum
- if bb.which(bb.data.getVar('PATH', d), 'md5sum'):
- try:
- md5pipe = os.popen('md5sum ' + dl)
- md5data = (md5pipe.readline().split() or [ "" ])[0]
- md5pipe.close()
- except OSError:
- md5data = ""
- md5out = file(md5, 'w')
- md5out.write(md5data)
- md5out.close()
- else:
- md5out = file(md5, 'w')
- md5out.write("")
- md5out.close()
- return True
-
- if not urls:
- urls = self.urls
-
- localdata = bb.data.createCopy(d)
- bb.data.setVar('OVERRIDES', "wget:" + bb.data.getVar('OVERRIDES', localdata), localdata)
- bb.data.update_data(localdata)
-
- for uri in urls:
- completed = 0
- (type, host, path, user, pswd, parm) = bb.decodeurl(bb.data.expand(uri, localdata))
- basename = os.path.basename(path)
- dl = self.localpath(uri, d)
- dl = bb.data.expand(dl, localdata)
- md5 = dl + '.md5'
-
- if os.path.exists(md5):
-# complete, nothing to see here..
- continue
-
- premirrors = [ i.split() for i in (bb.data.getVar('PREMIRRORS', localdata, 1) or "").split('\n') if i ]
- for (find, replace) in premirrors:
- newuri = uri_replace(uri, find, replace, d)
- if newuri != uri:
- if fetch_uri(newuri, basename, dl, md5, localdata):
- completed = 1
- break
-
- if completed:
- continue
-
- if fetch_uri(uri, basename, dl, md5, localdata):
- continue
-
-# try mirrors
- mirrors = [ i.split() for i in (bb.data.getVar('MIRRORS', localdata, 1) or "").split('\n') if i ]
- for (find, replace) in mirrors:
- newuri = uri_replace(uri, find, replace, d)
- if newuri != uri:
- if fetch_uri(newuri, basename, dl, md5, localdata):
- completed = 1
- break
-
- if not completed:
- raise FetchError(uri)
-
- del localdata
-
-
-methods.append(Wget())
-
-class Cvs(Fetch):
- """Class to fetch a module or modules from cvs repositories"""
- def supports(url, d):
- """Check to see if a given url can be fetched with cvs.
- Expects supplied url in list form, as outputted by bb.decodeurl().
- """
- (type, host, path, user, pswd, parm) = bb.decodeurl(bb.data.expand(url, d))
- return type in ['cvs', 'pserver']
- supports = staticmethod(supports)
-
- def localpath(url, d):
- (type, host, path, user, pswd, parm) = bb.decodeurl(bb.data.expand(url, d))
- if "localpath" in parm:
-# if user overrides local path, use it.
- return parm["localpath"]
-
- if not "module" in parm:
- raise MissingParameterError("cvs method needs a 'module' parameter")
- else:
- module = parm["module"]
- if 'tag' in parm:
- tag = parm['tag']
- else:
- tag = ""
- if 'date' in parm:
- date = parm['date']
- else:
- if not tag:
- date = bb.data.getVar("CVSDATE", d, 1) or bb.data.getVar("DATE", d, 1)
- else:
- date = ""
-
- return os.path.join(bb.data.getVar("DL_DIR", d, 1),bb.data.expand('%s_%s_%s_%s.tar.gz' % ( module.replace('/', '.'), host, tag, date), d))
- localpath = staticmethod(localpath)
-
- def go(self, d, urls = []):
- """Fetch urls"""
- if not urls:
- urls = self.urls
-
- localdata = bb.data.createCopy(d)
- bb.data.setVar('OVERRIDES', "cvs:%s" % bb.data.getVar('OVERRIDES', localdata), localdata)
- bb.data.update_data(localdata)
-
- for loc in urls:
- (type, host, path, user, pswd, parm) = bb.decodeurl(bb.data.expand(loc, localdata))
- if not "module" in parm:
- raise MissingParameterError("cvs method needs a 'module' parameter")
- else:
- module = parm["module"]
-
- dlfile = self.localpath(loc, localdata)
- dldir = bb.data.getVar('DL_DIR', localdata, 1)
-# if local path contains the cvs
-# module, consider the dir above it to be the
-# download directory
-# pos = dlfile.find(module)
-# if pos:
-# dldir = dlfile[:pos]
-# else:
-# dldir = os.path.dirname(dlfile)
-
-# setup cvs options
- options = []
- if 'tag' in parm:
- tag = parm['tag']
- else:
- tag = ""
-
- if 'date' in parm:
- date = parm['date']
- else:
- if not tag:
- date = bb.data.getVar("CVSDATE", d, 1) or bb.data.getVar("DATE", d, 1)
- else:
- date = ""
-
- if "method" in parm:
- method = parm["method"]
- else:
- method = "pserver"
-
- if "localdir" in parm:
- localdir = parm["localdir"]
- else:
- localdir = module
-
- cvs_rsh = None
- if method == "ext":
- if "rsh" in parm:
- cvs_rsh = parm["rsh"]
-
- tarfn = bb.data.expand('%s_%s_%s_%s.tar.gz' % (module.replace('/', '.'), host, tag, date), localdata)
- bb.data.setVar('TARFILES', dlfile, localdata)
- bb.data.setVar('TARFN', tarfn, localdata)
-
- dl = os.path.join(dldir, tarfn)
- if os.access(dl, os.R_OK):
- bb.debug(1, "%s already exists, skipping cvs checkout." % tarfn)
- continue
-
- pn = bb.data.getVar('PN', d, 1)
- cvs_tarball_stash = None
- if pn:
- cvs_tarball_stash = bb.data.getVar('CVS_TARBALL_STASH_%s' % pn, d, 1)
- if cvs_tarball_stash == None:
- cvs_tarball_stash = bb.data.getVar('CVS_TARBALL_STASH', d, 1)
- if cvs_tarball_stash:
- fetchcmd = bb.data.getVar("FETCHCOMMAND_wget", d, 1)
- uri = cvs_tarball_stash + tarfn
- bb.note("fetch " + uri)
- fetchcmd = fetchcmd.replace("${URI}", uri)
- ret = os.system(fetchcmd)
- if ret == 0:
- bb.note("Fetched %s from tarball stash, skipping checkout" % tarfn)
- continue
-
- if date:
- options.append("-D %s" % date)
- if tag:
- options.append("-r %s" % tag)
-
- olddir = os.path.abspath(os.getcwd())
- os.chdir(bb.data.expand(dldir, localdata))
-
-# setup cvsroot
- if method == "dir":
- cvsroot = path
- else:
- cvsroot = ":" + method + ":" + user
- if pswd:
- cvsroot += ":" + pswd
- cvsroot += "@" + host + ":" + path
-
- bb.data.setVar('CVSROOT', cvsroot, localdata)
- bb.data.setVar('CVSCOOPTS', " ".join(options), localdata)
- bb.data.setVar('CVSMODULE', module, localdata)
- cvscmd = bb.data.getVar('FETCHCOMMAND', localdata, 1)
- cvsupdatecmd = bb.data.getVar('UPDATECOMMAND', localdata, 1)
-
- if cvs_rsh:
- cvscmd = "CVS_RSH=\"%s\" %s" % (cvs_rsh, cvscmd)
- cvsupdatecmd = "CVS_RSH=\"%s\" %s" % (cvs_rsh, cvsupdatecmd)
-
-# create module directory
- bb.debug(2, "Fetch: checking for module directory")
- pkg=bb.data.expand('${PN}', d)
- pkgdir=os.path.join(bb.data.expand('${CVSDIR}', localdata), pkg)
- moddir=os.path.join(pkgdir,localdir)
- if os.access(os.path.join(moddir,'CVS'), os.R_OK):
- bb.note("Update " + loc)
-# update sources there
- os.chdir(moddir)
- myret = os.system(cvsupdatecmd)
- else:
- bb.note("Fetch " + loc)
-# check out sources there
- bb.mkdirhier(pkgdir)
- os.chdir(pkgdir)
- bb.debug(1, "Running %s" % cvscmd)
- myret = os.system(cvscmd)
-
- if myret != 0:
- try:
- os.rmdir(moddir)
- except OSError:
- pass
- raise FetchError(module)
-
- os.chdir(moddir)
- os.chdir('..')
-# tar them up to a defined filename
- myret = os.system("tar -czf %s %s" % (os.path.join(dldir,tarfn), os.path.basename(moddir)))
- if myret != 0:
- try:
- os.unlink(tarfn)
- except OSError:
- pass
- os.chdir(olddir)
- del localdata
-
-methods.append(Cvs())
-
-class Bk(Fetch):
- def supports(url, d):
- """Check to see if a given url can be fetched via bitkeeper.
- Expects supplied url in list form, as outputted by bb.decodeurl().
- """
- (type, host, path, user, pswd, parm) = bb.decodeurl(bb.data.expand(url, d))
- return type in ['bk']
- supports = staticmethod(supports)
-
-methods.append(Bk())
-
-class Local(Fetch):
- def supports(url, d):
- """Check to see if a given url can be fetched in the local filesystem.
- Expects supplied url in list form, as outputted by bb.decodeurl().
- """
- (type, host, path, user, pswd, parm) = bb.decodeurl(bb.data.expand(url, d))
- return type in ['file','patch']
- supports = staticmethod(supports)
-
- def localpath(url, d):
- """Return the local filename of a given url assuming a successful fetch.
- """
- path = url.split("://")[1]
- newpath = path
- if path[0] != "/":
- filespath = bb.data.getVar('FILESPATH', d, 1)
- if filespath:
- newpath = bb.which(filespath, path)
- if not newpath:
- filesdir = bb.data.getVar('FILESDIR', d, 1)
- if filesdir:
- newpath = os.path.join(filesdir, path)
- return newpath
- localpath = staticmethod(localpath)
-
- def go(self, urls = []):
- """Fetch urls (no-op for Local method)"""
-# no need to fetch local files, we'll deal with them in place.
- return 1
-
-methods.append(Local())
-
-class Svn(Fetch):
- """Class to fetch a module or modules from svn repositories"""
- def supports(url, d):
- """Check to see if a given url can be fetched with svn.
- Expects supplied url in list form, as outputted by bb.decodeurl().
- """
- (type, host, path, user, pswd, parm) = bb.decodeurl(bb.data.expand(url, d))
- return type in ['svn']
- supports = staticmethod(supports)
-
- def localpath(url, d):
- (type, host, path, user, pswd, parm) = bb.decodeurl(bb.data.expand(url, d))
- if "localpath" in parm:
-# if user overrides local path, use it.
- return parm["localpath"]
-
- if not "module" in parm:
- raise MissingParameterError("svn method needs a 'module' parameter")
- else:
- module = parm["module"]
- if 'rev' in parm:
- revision = parm['rev']
- else:
- revision = ""
-
- date = bb.data.getVar("CVSDATE", d, 1) or bb.data.getVar("DATE", d, 1)
-
- return os.path.join(bb.data.getVar("DL_DIR", d, 1),bb.data.expand('%s_%s_%s_%s.tar.gz' % ( module.replace('/', '.'), host, revision, date), d))
- localpath = staticmethod(localpath)
-
- def go(self, d, urls = []):
- """Fetch urls"""
- if not urls:
- urls = self.urls
-
- localdata = bb.data.createCopy(d)
- bb.data.setVar('OVERRIDES', "svn:%s" % bb.data.getVar('OVERRIDES', localdata), localdata)
- bb.data.update_data(localdata)
-
- for loc in urls:
- (type, host, path, user, pswd, parm) = bb.decodeurl(bb.data.expand(loc, localdata))
- if not "module" in parm:
- raise MissingParameterError("svn method needs a 'module' parameter")
- else:
- module = parm["module"]
-
- dlfile = self.localpath(loc, localdata)
- dldir = bb.data.getVar('DL_DIR', localdata, 1)
-# if local path contains the svn
-# module, consider the dir above it to be the
-# download directory
-# pos = dlfile.find(module)
-# if pos:
-# dldir = dlfile[:pos]
-# else:
-# dldir = os.path.dirname(dlfile)
-
-# setup svn options
- options = []
- if 'rev' in parm:
- revision = parm['rev']
- else:
- revision = ""
-
- date = bb.data.getVar("CVSDATE", d, 1) or bb.data.getVar("DATE", d, 1)
-
- if "method" in parm:
- method = parm["method"]
- else:
- method = "pserver"
-
- if "proto" in parm:
- proto = parm["proto"]
- else:
- proto = "svn"
-
- svn_rsh = None
- if method == "ext":
- if "rsh" in parm:
- svn_rsh = parm["rsh"]
-
- tarfn = bb.data.expand('%s_%s_%s_%s.tar.gz' % (module.replace('/', '.'), host, revision, date), localdata)
- bb.data.setVar('TARFILES', dlfile, localdata)
- bb.data.setVar('TARFN', tarfn, localdata)
-
- dl = os.path.join(dldir, tarfn)
- if os.access(dl, os.R_OK):
- bb.debug(1, "%s already exists, skipping svn checkout." % tarfn)
- continue
-
- svn_tarball_stash = bb.data.getVar('CVS_TARBALL_STASH', d, 1)
- if svn_tarball_stash:
- fetchcmd = bb.data.getVar("FETCHCOMMAND_wget", d, 1)
- uri = svn_tarball_stash + tarfn
- bb.note("fetch " + uri)
- fetchcmd = fetchcmd.replace("${URI}", uri)
- ret = os.system(fetchcmd)
- if ret == 0:
- bb.note("Fetched %s from tarball stash, skipping checkout" % tarfn)
- continue
-
- olddir = os.path.abspath(os.getcwd())
- os.chdir(bb.data.expand(dldir, localdata))
-
-# setup svnroot
-# svnroot = ":" + method + ":" + user
-# if pswd:
-# svnroot += ":" + pswd
- svnroot = host + path
-
- bb.data.setVar('SVNROOT', svnroot, localdata)
- bb.data.setVar('SVNCOOPTS', " ".join(options), localdata)
- bb.data.setVar('SVNMODULE', module, localdata)
- svncmd = bb.data.getVar('FETCHCOMMAND', localdata, 1)
- svncmd = "svn co %s://%s/%s" % (proto, svnroot, module)
-
- if revision:
- svncmd = "svn co -r %s %s://%s/%s" % (revision, proto, svnroot, module)
- if svn_rsh:
- svncmd = "svn_RSH=\"%s\" %s" % (svn_rsh, svncmd)
-
-# create temp directory
- bb.debug(2, "Fetch: creating temporary directory")
- bb.mkdirhier(bb.data.expand('${WORKDIR}', localdata))
- bb.data.setVar('TMPBASE', bb.data.expand('${WORKDIR}/oesvn.XXXXXX', localdata), localdata)
- tmppipe = os.popen(bb.data.getVar('MKTEMPDIRCMD', localdata, 1) or "false")
- tmpfile = tmppipe.readline().strip()
- if not tmpfile:
- bb.error("Fetch: unable to create temporary directory.. make sure 'mktemp' is in the PATH.")
- raise FetchError(module)
-
-# check out sources there
- os.chdir(tmpfile)
- bb.note("Fetch " + loc)
- bb.debug(1, "Running %s" % svncmd)
- myret = os.system(svncmd)
- if myret != 0:
- try:
- os.rmdir(tmpfile)
- except OSError:
- pass
- raise FetchError(module)
-
- os.chdir(os.path.join(tmpfile, os.path.dirname(module)))
-# tar them up to a defined filename
- myret = os.system("tar -czf %s %s" % (os.path.join(dldir,tarfn), os.path.basename(module)))
- if myret != 0:
- try:
- os.unlink(tarfn)
- except OSError:
- pass
-# cleanup
- os.system('rm -rf %s' % tmpfile)
- os.chdir(olddir)
- del localdata
-
-methods.append(Svn())
diff --git a/bitbake/lib/bb/make.py b/bitbake/lib/bb/make.py
deleted file mode 100644
index f7235f415..000000000
--- a/bitbake/lib/bb/make.py
+++ /dev/null
@@ -1,237 +0,0 @@
-# ex:ts=4:sw=4:sts=4:et
-# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
-"""
-BitBake 'Make' implementations
-
-Functions for reading BB files, building a dependency graph and
-building a set of BB files while walking along the dependency graph.
-
-Copyright (C) 2003, 2004 Mickey Lauer
-Copyright (C) 2003, 2004 Phil Blundell
-Copyright (C) 2003, 2004 Chris Larson
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-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., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA.
-
-This file is part of the BitBake build tools.
-"""
-
-from bb import debug, digraph, data, fetch, fatal, error, note, event, parse
-import copy, bb, re, sys, os, glob, sre_constants
-
-pkgdata = None
-cfg = data.init()
-cache = None
-digits = "0123456789"
-ascii_letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
-mtime_cache = {}
-
-def get_bbfiles( path = os.getcwd() ):
- """Get list of default .bb files by reading out the current directory"""
- contents = os.listdir(path)
- bbfiles = []
- for f in contents:
- (root, ext) = os.path.splitext(f)
- if ext == ".bb":
- bbfiles.append(os.path.abspath(os.path.join(os.getcwd(),f)))
- return bbfiles
-
-def find_bbfiles( 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()
-
-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
-
-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 collect_bbfiles( progressCallback ):
- """Collect all available .bb build files"""
-
- parsed, cached, skipped, masked = 0, 0, 0, 0
- global cache, pkgdata
- cache = bb.data.getVar( "CACHE", cfg, 1 )
- pkgdata = data.pkgdata( not cache in [None, ''], cache )
-
- if not cache in [None, '']:
- print "NOTE: Using cache in '%s'" % cache
- try:
- os.stat( cache )
- except OSError:
- bb.mkdirhier( cache )
- else: print "NOTE: Not using a cache. Set CACHE = <directory> to enable."
- files = (data.getVar( "BBFILES", cfg, 1 ) or "").split()
- data.setVar("BBFILES", " ".join(files), cfg)
-
- if not len(files):
- files = get_bbfiles()
-
- if not len(files):
- bb.error("no files to build.")
-
- newfiles = []
- for f in files:
- if os.path.isdir(f):
- dirfiles = find_bbfiles(f)
- if dirfiles:
- newfiles += dirfiles
- continue
- newfiles += glob.glob(f) or [ f ]
-
- bbmask = bb.data.getVar('BBMASK', cfg, 1) or ""
- try:
- bbmask_compiled = re.compile(bbmask)
- except sre_constants.error:
- bb.fatal("BBMASK is not a valid regular expression.")
-
- for i in xrange( len( newfiles ) ):
- f = newfiles[i]
- if bbmask and bbmask_compiled.search(f):
- bb.debug(1, "bbmake: skipping %s" % f)
- masked += 1
- continue
- progressCallback( i + 1, len( newfiles ), f )
- debug(1, "bbmake: parsing %s" % f)
-
- # read a file's metadata
- try:
- bb_data, fromCache = load_bbfile(f)
- if fromCache: cached += 1
- else: parsed += 1
- deps = None
- if bb_data is not None:
- # allow metadata files to add items to BBFILES
- #data.update_data(pkgdata[f])
- addbbfiles = data.getVar('BBFILES', bb_data) or None
- if addbbfiles:
- for aof in addbbfiles.split():
- if not files.count(aof):
- if not os.path.isabs(aof):
- aof = os.path.join(os.path.dirname(f),aof)
- files.append(aof)
- for var in bb_data.keys():
- if data.getVarFlag(var, "handler", bb_data) and data.getVar(var, bb_data):
- event.register(data.getVar(var, bb_data))
- pkgdata[f] = bb_data
- except IOError, e:
- bb.error("opening %s: %s" % (f, e))
- pass
- except bb.parse.SkipPackage:
- skipped += 1
- pass
- except KeyboardInterrupt:
- raise
- except Exception, e:
- bb.error("%s while parsing %s" % (e, f))
- print "\rNOTE: Parsing finished. %d cached, %d parsed, %d skipped, %d masked." % ( cached, parsed, skipped, masked ),
-
-def explode_version(s):
- import string
- r = []
- alpha_regexp = re.compile('^([a-zA-Z]+)(.*)$')
- numeric_regexp = re.compile('^(\d+)(.*)$')
- while (s != ''):
- if s[0] in digits:
- m = numeric_regexp.match(s)
- r.append(int(m.group(1)))
- s = m.group(2)
- continue
- if s[0] in ascii_letters:
- m = alpha_regexp.match(s)
- r.append(m.group(1))
- s = m.group(2)
- continue
- s = s[1:]
- return r
-
-def vercmp_part(a, b):
- va = explode_version(a)
- vb = explode_version(b)
- while True:
- if va == []:
- ca = None
- else:
- ca = va.pop(0)
- if vb == []:
- cb = None
- else:
- cb = vb.pop(0)
- if ca == None and cb == None:
- return 0
- if ca > cb:
- return 1
- if ca < cb:
- return -1
-
-def vercmp(ta, tb):
- (va, ra) = ta
- (vb, rb) = tb
-
- r = vercmp_part(va, vb)
- if (r == 0):
- r = vercmp_part(ra, rb)
- return r
diff --git a/bitbake/lib/bb/manifest.py b/bitbake/lib/bb/manifest.py
deleted file mode 100644
index 30bb45472..000000000
--- a/bitbake/lib/bb/manifest.py
+++ /dev/null
@@ -1,144 +0,0 @@
-# ex:ts=4:sw=4:sts=4:et
-# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
-#
-# Copyright (C) 2003, 2004 Chris Larson
-#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# 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., 59 Temple
-# Place, Suite 330, Boston, MA 02111-1307 USA.
-
-import os, sys
-import bb, bb.data
-
-def getfields(line):
- fields = {}
- fieldmap = ( "pkg", "src", "dest", "type", "mode", "uid", "gid", "major", "minor", "start", "inc", "count" )
- for f in xrange(len(fieldmap)):
- fields[fieldmap[f]] = None
-
- if not line:
- return None
-
- splitline = line.split()
- if not len(splitline):
- return None
-
- try:
- for f in xrange(len(fieldmap)):
- if splitline[f] == '-':
- continue
- fields[fieldmap[f]] = splitline[f]
- except IndexError:
- pass
- return fields
-
-def parse (mfile, d):
- manifest = []
- while 1:
- line = mfile.readline()
- if not line:
- break
- if line.startswith("#"):
- continue
- fields = getfields(line)
- if not fields:
- continue
- manifest.append(fields)
- return manifest
-
-def emit (func, manifest, d):
-#str = "%s () {\n" % func
- str = ""
- for line in manifest:
- emittedline = emit_line(func, line, d)
- if not emittedline:
- continue
- str += emittedline + "\n"
-# str += "}\n"
- return str
-
-def mangle (func, line, d):
- import copy
- newline = copy.copy(line)
- src = bb.data.expand(newline["src"], d)
-
- if src:
- if not os.path.isabs(src):
- src = "${WORKDIR}/" + src
-
- dest = newline["dest"]
- if not dest:
- return
-
- if dest.startswith("/"):
- dest = dest[1:]
-
- if func is "do_install":
- dest = "${D}/" + dest
-
- elif func is "do_populate":
- dest = "${WORKDIR}/install/" + newline["pkg"] + "/" + dest
-
- elif func is "do_stage":
- varmap = {}
- varmap["${bindir}"] = "${STAGING_DIR}/${HOST_SYS}/bin"
- varmap["${libdir}"] = "${STAGING_DIR}/${HOST_SYS}/lib"
- varmap["${includedir}"] = "${STAGING_DIR}/${HOST_SYS}/include"
- varmap["${datadir}"] = "${STAGING_DATADIR}"
-
- matched = 0
- for key in varmap.keys():
- if dest.startswith(key):
- dest = varmap[key] + "/" + dest[len(key):]
- matched = 1
- if not matched:
- newline = None
- return
- else:
- newline = None
- return
-
- newline["src"] = src
- newline["dest"] = dest
- return newline
-
-def emit_line (func, line, d):
- import copy
- newline = copy.deepcopy(line)
- newline = mangle(func, newline, d)
- if not newline:
- return None
-
- str = ""
- type = newline["type"]
- mode = newline["mode"]
- src = newline["src"]
- dest = newline["dest"]
- if type is "d":
- str = "install -d "
- if mode:
- str += "-m %s " % mode
- str += dest
- elif type is "f":
- if not src:
- return None
- if dest.endswith("/"):
- str = "install -d "
- str += dest + "\n"
- str += "install "
- else:
- str = "install -D "
- if mode:
- str += "-m %s " % mode
- str += src + " " + dest
- del newline
- return str
diff --git a/bitbake/lib/bb/parse/BBHandler.py b/bitbake/lib/bb/parse/BBHandler.py
deleted file mode 100644
index 8e7f9c0c5..000000000
--- a/bitbake/lib/bb/parse/BBHandler.py
+++ /dev/null
@@ -1,378 +0,0 @@
-#!/usr/bin/env python
-# ex:ts=4:sw=4:sts=4:et
-# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
-"""class for handling .bb files
-
- Reads a .bb file and obtains its metadata
-
- Copyright (C) 2003, 2004 Chris Larson
- Copyright (C) 2003, 2004 Phil Blundell
-
- This program is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any later
- version.
-
- 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., 59 Temple
- Place, Suite 330, Boston, MA 02111-1307 USA."""
-
-import re, bb, os, sys
-import bb.fetch, bb.build
-from bb import debug, data, fetch, fatal
-
-from bb.parse.ConfHandler import include, localpath, obtain, init
-from bb.parse import ParseError
-
-__func_start_regexp__ = re.compile( r"(((?P<py>python)|(?P<fr>fakeroot))\s*)*(?P<func>[\w\-\+]+)?\s*\(\s*\)\s*{$" )
-__inherit_regexp__ = re.compile( r"inherit\s+(.+)" )
-__export_func_regexp__ = re.compile( r"EXPORT_FUNCTIONS\s+(.+)" )
-__addtask_regexp__ = re.compile("addtask\s+(?P<func>\w+)\s*((before\s*(?P<before>((.*(?=after))|(.*))))|(after\s*(?P<after>((.*(?=before))|(.*)))))*")
-__addhandler_regexp__ = re.compile( r"addhandler\s+(.+)" )
-__def_regexp__ = re.compile( r"def\s+(\w+).*:" )
-__python_func_regexp__ = re.compile( r"(\s+.*)|(^$)" )
-__word__ = re.compile(r"\S+")
-
-__infunc__ = ""
-__inpython__ = False
-__body__ = []
-__bbpath_found__ = 0
-__classname__ = ""
-classes = [ None, ]
-
-def supports(fn, d):
- localfn = localpath(fn, d)
- return localfn[-3:] == ".bb" or localfn[-8:] == ".bbclass" or localfn[-4:] == ".inc"
-
-def inherit(files, d):
- __inherit_cache = data.getVar('__inherit_cache', d) or ""
- fn = ""
- lineno = 0
- for f in files:
- file = data.expand(f, d)
- if file[0] != "/" and file[-8:] != ".bbclass":
- file = os.path.join('classes', '%s.bbclass' % file)
-
- if not file in __inherit_cache.split():
- debug(2, "BB %s:%d: inheriting %s" % (fn, lineno, file))
- __inherit_cache += " %s" % file
- include(fn, file, d)
- data.setVar('__inherit_cache', __inherit_cache, d)
-
-
-def handle(fn, d, include = 0):
- global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __bbpath_found__, __residue__
- __body__ = []
- __bbpath_found__ = 0
- __infunc__ = ""
- __classname__ = ""
- __residue__ = []
-
- if include == 0:
- debug(2, "BB " + fn + ": handle(data)")
- else:
- debug(2, "BB " + fn + ": handle(data, include)")
-
- (root, ext) = os.path.splitext(os.path.basename(fn))
- init(d)
-
- if ext == ".bbclass":
- __classname__ = root
- classes.append(__classname__)
-
- if include != 0:
- oldfile = data.getVar('FILE', d)
- else:
- oldfile = None
-
- fn = obtain(fn, d)
- bbpath = (data.getVar('BBPATH', d, 1) or '').split(':')
- if not os.path.isabs(fn):
- f = None
- for p in bbpath:
- p = data.expand(p, d)
- j = os.path.join(p, fn)
- if os.access(j, os.R_OK):
- abs_fn = j
- f = open(j, 'r')
- break
- if f is None:
- raise IOError("file not found")
- else:
- f = open(fn,'r')
- abs_fn = fn
-
- if ext != ".bbclass":
- bbpath.insert(0, os.path.dirname(abs_fn))
- data.setVar('BBPATH', ":".join(bbpath), d)
-
- if include:
- bb.parse.mark_dependency(d, abs_fn)
-
- if ext != ".bbclass":
- data.setVar('FILE', fn, d)
- i = (data.getVar("INHERIT", d, 1) or "").split()
- if not "base" in i and __classname__ != "base":
- i[0:0] = ["base"]
- inherit(i, d)
-
- lineno = 0
- while 1:
- lineno = lineno + 1
- s = f.readline()
- if not s: break
- s = s.rstrip()
- feeder(lineno, s, fn, d)
- if __inpython__:
- # add a blank line to close out any python definition
- feeder(lineno + 1, "", fn, d)
- if ext == ".bbclass":
- classes.remove(__classname__)
- else:
- if include == 0:
- data.expandKeys(d)
- data.update_data(d)
- anonqueue = data.getVar("__anonqueue", d, 1) or []
- for anon in anonqueue:
- data.setVar("__anonfunc", anon["content"], d)
- data.setVarFlags("__anonfunc", anon["flags"], d)
- from bb import build
- try:
- t = data.getVar('T', d)
- data.setVar('T', '${TMPDIR}/', d)
- build.exec_func("__anonfunc", d)
- data.delVar('T', d)
- if t:
- data.setVar('T', t, d)
- except Exception, e:
- bb.debug(1, "executing anonymous function: %s" % e)
- raise
- data.delVar("__anonqueue", d)
- data.delVar("__anonfunc", d)
- set_additional_vars(fn, d, include)
- data.update_data(d)
-
- for var in data.keys(d):
- if data.getVarFlag(var, 'handler', d):
- bb.event.register(data.getVar(var, d))
- continue
-
- if not data.getVarFlag(var, 'task', d):
- continue
-
- deps = data.getVarFlag(var, 'deps', d) or []
- postdeps = data.getVarFlag(var, 'postdeps', d) or []
- bb.build.add_task(var, deps, d)
- for p in postdeps:
- pdeps = data.getVarFlag(p, 'deps', d) or []
- pdeps.append(var)
- data.setVarFlag(p, 'deps', pdeps, d)
- bb.build.add_task(p, pdeps, d)
- bbpath.pop(0)
- if oldfile:
- bb.data.setVar("FILE", oldfile, d)
- return d
-
-def feeder(lineno, s, fn, d):
- global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __def_regexp__, __python_func_regexp__, __inpython__,__infunc__, __body__, __bbpath_found__, classes, bb, __residue__
- if __infunc__:
- if s == '}':
- __body__.append('')
- data.setVar(__infunc__, '\n'.join(__body__), d)
- data.setVarFlag(__infunc__, "func", 1, d)
- if __infunc__ == "__anonymous":
- anonqueue = bb.data.getVar("__anonqueue", d) or []
- anonitem = {}
- anonitem["content"] = bb.data.getVar("__anonymous", d)
- anonitem["flags"] = bb.data.getVarFlags("__anonymous", d)
- anonqueue.append(anonitem)
- bb.data.setVar("__anonqueue", anonqueue, d)
- bb.data.delVarFlags("__anonymous", d)
- bb.data.delVar("__anonymous", d)
- __infunc__ = ""
- __body__ = []
- else:
- __body__.append(s)
- return
-
- if __inpython__:
- m = __python_func_regexp__.match(s)
- if m:
- __body__.append(s)
- return
- else:
- text = '\n'.join(__body__)
- comp = compile(text, "<bb>", "exec")
- exec comp in __builtins__
- __body__ = []
- __inpython__ = False
- funcs = data.getVar('__functions__', d) or ""
- data.setVar('__functions__', "%s\n%s" % (funcs, text), d)
-# fall through
-
- if s == '' or s[0] == '#': return # skip comments and empty lines
-
- if s[-1] == '\\':
- __residue__.append(s[:-1])
- return
-
- s = "".join(__residue__) + s
- __residue__ = []
-
- m = __func_start_regexp__.match(s)
- if m:
- __infunc__ = m.group("func") or "__anonymous"
- key = __infunc__
- if data.getVar(key, d):
-# clean up old version of this piece of metadata, as its
-# flags could cause problems
- data.setVarFlag(key, 'python', None, d)
- data.setVarFlag(key, 'fakeroot', None, d)
- if m.group("py") is not None:
- data.setVarFlag(key, "python", "1", d)
- else:
- data.delVarFlag(key, "python", d)
- if m.group("fr") is not None:
- data.setVarFlag(key, "fakeroot", "1", d)
- else:
- data.delVarFlag(key, "fakeroot", d)
- return
-
- m = __def_regexp__.match(s)
- if m:
- __body__.append(s)
- __inpython__ = True
- return
-
- m = __export_func_regexp__.match(s)
- if m:
- fns = m.group(1)
- n = __word__.findall(fns)
- for f in n:
- allvars = []
- allvars.append(f)
- allvars.append(classes[-1] + "_" + f)
-
- vars = [[ allvars[0], allvars[1] ]]
- if len(classes) > 1 and classes[-2] is not None:
- allvars.append(classes[-2] + "_" + f)
- vars = []
- vars.append([allvars[2], allvars[1]])
- vars.append([allvars[0], allvars[2]])
-
- for (var, calledvar) in vars:
- if data.getVar(var, d) and not data.getVarFlag(var, 'export_func', d):
- continue
-
- if data.getVar(var, d):
- data.setVarFlag(var, 'python', None, d)
- data.setVarFlag(var, 'func', None, d)
-
- for flag in [ "func", "python" ]:
- if data.getVarFlag(calledvar, flag, d):
- data.setVarFlag(var, flag, data.getVarFlag(calledvar, flag, d), d)
- for flag in [ "dirs" ]:
- if data.getVarFlag(var, flag, d):
- data.setVarFlag(calledvar, flag, data.getVarFlag(var, flag, d), d)
-
- if data.getVarFlag(calledvar, "python", d):
- data.setVar(var, "\tbb.build.exec_func('" + calledvar + "', d)\n", d)
- else:
- data.setVar(var, "\t" + calledvar + "\n", d)
- data.setVarFlag(var, 'export_func', '1', d)
-
- return
-
- m = __addtask_regexp__.match(s)
- if m:
- func = m.group("func")
- before = m.group("before")
- after = m.group("after")
- if func is None:
- return
- var = "do_" + func
-
- data.setVarFlag(var, "task", 1, d)
-
- if after is not None:
-# set up deps for function
- data.setVarFlag(var, "deps", after.split(), d)
- if before is not None:
-# set up things that depend on this func
- data.setVarFlag(var, "postdeps", before.split(), d)
- return
-
- m = __addhandler_regexp__.match(s)
- if m:
- fns = m.group(1)
- hs = __word__.findall(fns)
- for h in hs:
- data.setVarFlag(h, "handler", 1, d)
- return
-
- m = __inherit_regexp__.match(s)
- if m:
-
- files = m.group(1)
- n = __word__.findall(files)
- inherit(n, d)
- return
-
- from bb.parse import ConfHandler
- return ConfHandler.feeder(lineno, s, fn, d)
-
-__pkgsplit_cache__={}
-def vars_from_file(mypkg, d):
- if not mypkg:
- return (None, None, None)
- if mypkg in __pkgsplit_cache__:
- return __pkgsplit_cache__[mypkg]
-
- myfile = os.path.splitext(os.path.basename(mypkg))
- parts = myfile[0].split('_')
- __pkgsplit_cache__[mypkg] = parts
- exp = 3 - len(parts)
- tmplist = []
- while exp != 0:
- exp -= 1
- tmplist.append(None)
- parts.extend(tmplist)
- return parts
-
-def set_additional_vars(file, d, include):
- """Deduce rest of variables, e.g. ${A} out of ${SRC_URI}"""
-
- debug(2,"BB %s: set_additional_vars" % file)
-
- src_uri = data.getVar('SRC_URI', d)
- if not src_uri:
- return
- src_uri = data.expand(src_uri, d)
-
- a = data.getVar('A', d)
- if a:
- a = data.expand(a, d).split()
- else:
- a = []
-
- from bb import fetch
- try:
- fetch.init(src_uri.split())
- except fetch.NoMethodError:
- pass
- except bb.MalformedUrl,e:
- raise ParseError("Unable to generate local paths for SRC_URI due to malformed uri: %s" % e)
-
- a += fetch.localpaths(d)
- del fetch
- data.setVar('A', " ".join(a), d)
-
-
-# Add us to the handlers list
-from bb.parse import handlers
-handlers.append({'supports': supports, 'handle': handle, 'init': init})
-del handlers
diff --git a/bitbake/lib/bb/parse/ConfHandler.py b/bitbake/lib/bb/parse/ConfHandler.py
deleted file mode 100644
index 70451d649..000000000
--- a/bitbake/lib/bb/parse/ConfHandler.py
+++ /dev/null
@@ -1,194 +0,0 @@
-#!/usr/bin/env python
-# ex:ts=4:sw=4:sts=4:et
-# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
-"""class for handling configuration data files
-
- Reads a .conf file and obtains its metadata
-
- Copyright (C) 2003, 2004 Chris Larson
- Copyright (C) 2003, 2004 Phil Blundell
-
- This program is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any later
- version.
-
- 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., 59 Temple
- Place, Suite 330, Boston, MA 02111-1307 USA."""
-
-import re, bb.data, os, sys
-from bb import debug, fatal
-
-#__config_regexp__ = re.compile( r"(?P<exp>export\s*)?(?P<var>[a-zA-Z0-9\-_+.${}]+)\s*(?P<colon>:)?(?P<ques>\?)?=\s*(?P<apo>['\"]?)(?P<value>.*)(?P=apo)$")
-__config_regexp__ = re.compile( r"(?P<exp>export\s*)?(?P<var>[a-zA-Z0-9\-_+.${}/]+)(\[(?P<flag>[a-zA-Z0-9\-_+.]+)\])?\s*((?P<colon>:=)|(?P<ques>\?=)|(?P<append>\+=)|(?P<prepend>=\+)|=)\s*(?P<apo>['\"]?)(?P<value>.*)(?P=apo)$")
-__include_regexp__ = re.compile( r"include\s+(.+)" )
-
-def init(data):
- if not bb.data.getVar('TOPDIR', data):
- bb.data.setVar('TOPDIR', os.getcwd(), data)
- if not bb.data.getVar('BBPATH', data):
- bb.data.setVar('BBPATH', os.path.join(sys.prefix, 'share', 'bitbake'), data)
-
-def supports(fn, d):
- return localpath(fn, d)[-5:] == ".conf"
-
-def localpath(fn, d):
- if os.path.exists(fn):
- return fn
-
- localfn = None
- try:
- localfn = bb.fetch.localpath(fn, d)
- except bb.MalformedUrl:
- pass
-
- if not localfn:
- localfn = fn
- return localfn
-
-def obtain(fn, data = bb.data.init()):
- import sys, bb
- fn = bb.data.expand(fn, data)
- localfn = bb.data.expand(localpath(fn, data), data)
-
- if localfn != fn:
- dldir = bb.data.getVar('DL_DIR', data, 1)
- if not dldir:
- debug(1, "obtain: DL_DIR not defined")
- return localfn
- bb.mkdirhier(dldir)
- try:
- bb.fetch.init([fn])
- except bb.fetch.NoMethodError:
- (type, value, traceback) = sys.exc_info()
- debug(1, "obtain: no method: %s" % value)
- return localfn
-
- try:
- bb.fetch.go(data)
- except bb.fetch.MissingParameterError:
- (type, value, traceback) = sys.exc_info()
- debug(1, "obtain: missing parameters: %s" % value)
- return localfn
- except bb.fetch.FetchError:
- (type, value, traceback) = sys.exc_info()
- debug(1, "obtain: failed: %s" % value)
- return localfn
- return localfn
-
-
-def include(oldfn, fn, data = bb.data.init()):
- if oldfn == fn: # prevent infinate recursion
- return None
-
- import bb
- fn = bb.data.expand(fn, data)
- oldfn = bb.data.expand(oldfn, data)
-
- from bb.parse import handle
- try:
- ret = handle(fn, data, 1)
- except IOError:
- debug(2, "CONF file '%s' not found" % fn)
-
-def handle(fn, data = bb.data.init(), include = 0):
- if include:
- inc_string = "including"
- else:
- inc_string = "reading"
- init(data)
-
- if include == 0:
- bb.data.inheritFromOS(data)
- oldfile = None
- else:
- oldfile = bb.data.getVar('FILE', data)
-
- fn = obtain(fn, data)
- bbpath = []
- if not os.path.isabs(fn):
- f = None
- vbbpath = bb.data.getVar("BBPATH", data)
- if vbbpath:
- bbpath += vbbpath.split(":")
- for p in bbpath:
- currname = os.path.join(bb.data.expand(p, data), fn)
- if os.access(currname, os.R_OK):
- f = open(currname, 'r')
- abs_fn = currname
- debug(1, "CONF %s %s" % (inc_string, currname))
- break
- if f is None:
- raise IOError("file not found")
- else:
- f = open(fn,'r')
- debug(1, "CONF %s %s" % (inc_string,fn))
- abs_fn = fn
-
- if include:
- bb.parse.mark_dependency(data, abs_fn)
-
- lineno = 0
- bb.data.setVar('FILE', fn, data)
- while 1:
- lineno = lineno + 1
- s = f.readline()
- if not s: break
- w = s.strip()
- if not w: continue # skip empty lines
- s = s.rstrip()
- if s[0] == '#': continue # skip comments
- while s[-1] == '\\':
- s2 = f.readline()[:-1].strip()
- lineno = lineno + 1
- s = s[:-1] + s2
- feeder(lineno, s, fn, data)
-
- if oldfile:
- bb.data.setVar('FILE', oldfile, data)
- return data
-
-def feeder(lineno, s, fn, data = bb.data.init()):
- m = __config_regexp__.match(s)
- if m:
- groupd = m.groupdict()
- key = groupd["var"]
- if "exp" in groupd and groupd["exp"] != None:
- bb.data.setVarFlag(key, "export", 1, data)
- if "ques" in groupd and groupd["ques"] != None:
- val = bb.data.getVar(key, data)
- if val == None:
- val = groupd["value"]
- elif "colon" in groupd and groupd["colon"] != None:
- val = bb.data.expand(groupd["value"], data)
- elif "append" in groupd and groupd["append"] != None:
- val = "%s %s" % ((bb.data.getVar(key, data) or ""), groupd["value"])
- elif "prepend" in groupd and groupd["prepend"] != None:
- val = "%s %s" % (groupd["value"], (bb.data.getVar(key, data) or ""))
- else:
- val = groupd["value"]
- if 'flag' in groupd and groupd['flag'] != None:
-# bb.note("setVarFlag(%s, %s, %s, data)" % (key, groupd['flag'], val))
- bb.data.setVarFlag(key, groupd['flag'], val, data)
- else:
- bb.data.setVar(key, val, data)
- return
-
- m = __include_regexp__.match(s)
- if m:
- s = bb.data.expand(m.group(1), data)
-# debug(2, "CONF %s:%d: including %s" % (fn, lineno, s))
- include(fn, s, data)
- return
-
- raise ParseError("%s:%d: unparsed line: '%s'" % (fn, lineno, s));
-
-# Add us to the handlers list
-from bb.parse import handlers
-handlers.append({'supports': supports, 'handle': handle, 'init': init})
-del handlers
diff --git a/bitbake/lib/bb/parse/__init__.py b/bitbake/lib/bb/parse/__init__.py
deleted file mode 100644
index a61630478..000000000
--- a/bitbake/lib/bb/parse/__init__.py
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/env python
-# ex:ts=4:sw=4:sts=4:et
-# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
-"""
-BitBake Parsers
-
-File parsers for the BitBake build tools.
-
-Copyright (C) 2003, 2004 Chris Larson
-Copyright (C) 2003, 2004 Phil Blundell
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-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., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA.
-
-Based on functions from the base bb module, Copyright 2003 Holger Schurig
-"""
-__version__ = '1.0'
-
-__all__ = [ 'handlers', 'supports', 'handle', 'init', 'ConfHandler', 'BBHandler', 'ParseError' ]
-handlers = []
-
-class ParseError(Exception):
- """Exception raised when parsing fails"""
-
-class SkipPackage(Exception):
- """Exception raised to skip this package"""
-
-import ConfHandler
-ConfHandler.ParseError = ParseError
-import BBHandler
-BBHandler.ParseError = ParseError
-
-__mtime_cache = {}
-
-def cached_mtime(f):
- import os
- if not __mtime_cache.has_key(f):
- __mtime_cache[f] = os.stat(f)[8]
- return __mtime_cache[f]
-
-def mark_dependency(d, f):
- import bb, os
- if f.startswith('./'):
- f = "%s/%s" % (os.getcwd(), f[2:])
- deps = (bb.data.getVar('__depends', d) or "").split()
- deps.append("%s@%s" % (f, cached_mtime(f)))
- bb.data.setVar('__depends', " ".join(deps), d)
-
-def supports(fn, data):
- """Returns true if we have a handler for this file, false otherwise"""
- for h in handlers:
- if h['supports'](fn, data):
- return 1
- return 0
-
-def handle(fn, data, include = 0):
- """Call the handler that is appropriate for this file"""
- for h in handlers:
- if h['supports'](fn, data):
- return h['handle'](fn, data, include)
- return None
-
-def init(fn, data):
- for h in handlers:
- if h['supports'](fn):
- return h['init'](data)
diff --git a/bitbake/setup.py b/bitbake/setup.py
deleted file mode 100755
index 43a9aea66..000000000
--- a/bitbake/setup.py
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/env python
-# ex:ts=4:sw=4:sts=4:et
-# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
-#
-# Copyright (C) 2003 Chris Larson
-#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# 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., 59 Temple
-# Place, Suite 330, Boston, MA 02111-1307 USA.
-
-from distutils.core import setup
-import os, sys
-
-# bbdir = os.path.join(sys.prefix, 'share', 'bitbake')
-# docdir = os.path.join(sys.prefix, 'share', 'doc')
-bbdir = os.path.join('bitbake')
-docdir = os.path.join('doc')
-
-def clean_doc(type):
- origpath = os.path.abspath(os.curdir)
- os.chdir(os.path.join(origpath, 'doc', 'manual'))
- make = os.environ.get('MAKE') or 'make'
- os.system('%s clean-%s' % (make, type))
-
-def generate_doc(type):
- origpath = os.path.abspath(os.curdir)
- os.chdir(os.path.join(origpath, 'doc', 'manual'))
- make = os.environ.get('MAKE') or 'make'
- ret = os.system('%s %s' % (make, type))
- if ret != 0:
- print "ERROR: Unable to generate html documentation."
- sys.exit(ret)
- os.chdir(origpath)
-
-if 'bdist' in sys.argv[1:]:
- generate_doc('html')
-
-sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), 'lib'))
-import bb
-import glob
-setup(name='bitbake',
- version=bb.__version__,
- license='GPL',
- url='http://developer.berlios.de/projects/bitbake/',
- description='BitBake build tool',
- long_description='BitBake is a simple tool for the execution of tasks. It is derived from Portage, which is the package management system used by the Gentoo Linux distribution. It is most commonly used to build packages, as it can easily use its rudamentary inheritence to abstract common operations, such as fetching sources, unpacking them, patching them, compiling them, and so on. It is the basis of the OpenEmbedded project, which is being used for OpenZaurus, Familiar, and a number of other Linux distributions.',
- author='Chris Larson',
- author_email='clarson@elinux.org',
- packages=['bb', 'bb.parse'],
- package_dir={'bb': os.path.join('lib', 'bb')},
- scripts=[os.path.join('bin', 'bitbake'),
- os.path.join('bin', 'bbread'),
- os.path.join('bin', 'bbimage')],
- data_files=[(os.path.join(bbdir, 'conf'), [os.path.join('conf', 'bitbake.conf')]),
- (os.path.join(bbdir, 'classes'), [os.path.join('classes', 'base.bbclass')]),
- (os.path.join(docdir, 'bitbake-%s' % bb.__version__, 'html'), glob.glob(os.path.join('doc', 'manual', 'html', '*.html'))),
- (os.path.join(docdir, 'bitbake-%s' % bb.__version__, 'pdf'), glob.glob(os.path.join('doc', 'manual', 'pdf', '*.pdf'))),],
- )
-
-if 'bdist' in sys.argv[1:]:
- clean_doc('html')
diff --git a/lib/bb/__init__.py b/lib/bb/__init__.py
index 1188145f5..c5ac9a772 100644
--- a/lib/bb/__init__.py
+++ b/lib/bb/__init__.py
@@ -23,7 +23,7 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA.
"""
-__version__ = "1.1"
+__version__ = "1.2.1"
__all__ = [
diff --git a/setup.py b/setup.py
index 8ceb95ad0..43a9aea66 100755
--- a/setup.py
+++ b/setup.py
@@ -44,10 +44,11 @@ def generate_doc(type):
if 'bdist' in sys.argv[1:]:
generate_doc('html')
+sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), 'lib'))
+import bb
import glob
-__version__ = '1.2svn'
setup(name='bitbake',
- version=__version__,
+ version=bb.__version__,
license='GPL',
url='http://developer.berlios.de/projects/bitbake/',
description='BitBake build tool',
@@ -61,8 +62,8 @@ setup(name='bitbake',
os.path.join('bin', 'bbimage')],
data_files=[(os.path.join(bbdir, 'conf'), [os.path.join('conf', 'bitbake.conf')]),
(os.path.join(bbdir, 'classes'), [os.path.join('classes', 'base.bbclass')]),
- (os.path.join(docdir, 'bitbake-%s' % __version__, 'html'), glob.glob(os.path.join('doc', 'manual', 'html', '*.html'))),
- (os.path.join(docdir, 'bitbake-%s' % __version__, 'pdf'), glob.glob(os.path.join('doc', 'manual', 'pdf', '*.pdf'))),],
+ (os.path.join(docdir, 'bitbake-%s' % bb.__version__, 'html'), glob.glob(os.path.join('doc', 'manual', 'html', '*.html'))),
+ (os.path.join(docdir, 'bitbake-%s' % bb.__version__, 'pdf'), glob.glob(os.path.join('doc', 'manual', 'pdf', '*.pdf'))),],
)
if 'bdist' in sys.argv[1:]: