summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2006-03-20 17:45:11 +0000
committerRichard Purdie <richard@openedhand.com>2006-03-20 17:45:11 +0000
commitb26a945734ce271aa7d443ff9e96fe2851b21138 (patch)
treef540b8d58a7411cf0cabe5c8f4ad40f9f597352a
parent3cd47ad235d54a9c539ae6fe4a5a2b4b5f7e5621 (diff)
downloadopenembedded-core-b26a945734ce271aa7d443ff9e96fe2851b21138.tar.gz
openembedded-core-b26a945734ce271aa7d443ff9e96fe2851b21138.tar.bz2
openembedded-core-b26a945734ce271aa7d443ff9e96fe2851b21138.zip
Update to latest bitbake
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@309 311d38ba-8fff-0310-9ca6-ca027cbcb966
-rw-r--r--bitbake/ChangeLog7
-rw-r--r--bitbake/MANIFEST1
-rwxr-xr-xbitbake/bin/bitbake31
-rwxr-xr-xbitbake/bin/bitdoc55
-rw-r--r--bitbake/doc/manual/usermanual.xml88
-rw-r--r--bitbake/lib/bb/__init__.py34
-rw-r--r--bitbake/lib/bb/build.py9
-rw-r--r--bitbake/lib/bb/data.py7
-rw-r--r--bitbake/lib/bb/data_smart.py6
-rw-r--r--bitbake/lib/bb/event.py66
-rw-r--r--bitbake/lib/bb/fetch/__init__.py35
-rw-r--r--bitbake/lib/bb/fetch/bk.py40
-rw-r--r--bitbake/lib/bb/fetch/cvs.py20
-rw-r--r--bitbake/lib/bb/fetch/git.py95
-rw-r--r--bitbake/lib/bb/fetch/svn.py27
-rw-r--r--bitbake/lib/bb/parse/parse_c/BBHandler.py65
-rw-r--r--bitbake/lib/bb/parse/parse_c/README.build12
-rw-r--r--bitbake/lib/bb/parse/parse_c/__init__.py28
-rw-r--r--bitbake/lib/bb/parse/parse_c/bitbakeparser.cc1105
-rw-r--r--bitbake/lib/bb/parse/parse_c/bitbakeparser.h27
-rw-r--r--bitbake/lib/bb/parse/parse_c/bitbakeparser.py133
-rw-r--r--bitbake/lib/bb/parse/parse_c/bitbakeparser.y66
-rw-r--r--bitbake/lib/bb/parse/parse_c/bitbakescanner.cc3126
-rw-r--r--bitbake/lib/bb/parse/parse_c/bitbakescanner.l (renamed from bitbake/lib/bb/parse/parse_c/bitbakeparser.l)22
-rw-r--r--bitbake/lib/bb/parse/parse_c/lexer.h20
-rw-r--r--bitbake/lib/bb/parse/parse_c/python_output.h51
-rw-r--r--bitbake/lib/bb/parse/parse_c/token.h23
-rw-r--r--bitbake/lib/bb/parse/parse_py/BBHandler.py6
-rw-r--r--bitbake/lib/bb/utils.py73
29 files changed, 4868 insertions, 410 deletions
diff --git a/bitbake/ChangeLog b/bitbake/ChangeLog
index c05ff96ab9..3dfba1ed81 100644
--- a/bitbake/ChangeLog
+++ b/bitbake/ChangeLog
@@ -1,3 +1,10 @@
+Changes in BitBake 1.3.x:
+ - Fix to check both RDEPENDS and RDEPENDS_${PN}
+ - Fix a RDEPENDS parsing bug in utils:explode_deps()
+ - Update git fetcher behaviour to match git changes
+ - ASSUME_PROVIDED allowed to include runtime packages
+ - git fetcher cleanup and efficency improvements
+
Changes in BitBake 1.3.3:
- Create a new Fetcher module to ease the
development of new Fetchers.
diff --git a/bitbake/MANIFEST b/bitbake/MANIFEST
index cf0aac99d9..14a21d7bf4 100644
--- a/bitbake/MANIFEST
+++ b/bitbake/MANIFEST
@@ -14,6 +14,7 @@ lib/bb/fetch/cvs.py
lib/bb/fetch/git.py
lib/bb/fetch/__init__.py
lib/bb/fetch/local.py
+lib/bb/fetch/svk.py
lib/bb/fetch/svn.py
lib/bb/fetch/wget.py
lib/bb/manifest.py
diff --git a/bitbake/bin/bitbake b/bitbake/bin/bitbake
index 63bd07fe34..457fbb7527 100755
--- a/bitbake/bin/bitbake
+++ b/bitbake/bin/bitbake
@@ -22,7 +22,7 @@
# Place, Suite 330, Boston, MA 02111-1307 USA.
import sys, os, getopt, glob, copy, os.path, re, time
-sys.path.append(os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib'))
+sys.path.insert(0,os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib'))
import bb
from bb import utils, data, parse, debug, event, fatal
from sets import Set
@@ -31,7 +31,7 @@ import itertools, optparse
parsespin = itertools.cycle( r'|/-\\' )
bbdebug = 0
-__version__ = "1.3.3"
+__version__ = "1.3.3.2"
#============================================================================#
# BBParsingStatus
@@ -80,7 +80,7 @@ class BBParsingStatus:
depends = (bb.data.getVar("DEPENDS", bb_data, True) or "").split()
packages = (bb.data.getVar('PACKAGES', bb_data, True) or "").split()
packages_dynamic = (bb.data.getVar('PACKAGES_DYNAMIC', bb_data, True) or "").split()
- rprovides = Set((bb.data.getVar("RPROVIDES_%s" % pn, bb_data, 1) or "").split() + (bb.data.getVar("RPROVIDES", bb_data, 1) or "").split())
+ rprovides = (bb.data.getVar("RPROVIDES", bb_data, 1) or "").split()
# build PackageName to FileName lookup table
@@ -110,11 +110,11 @@ class BBParsingStatus:
# Build reverse hash for PACKAGES, so runtime dependencies
# can be be resolved (RDEPENDS, RRECOMMENDS etc.)
-
for package in packages:
if not package in self.packages:
self.packages[package] = []
self.packages[package].append(file_name)
+ rprovides += (bb.data.getVar("RPROVIDES_%s" % package, bb_data, 1) or "").split()
for package in packages_dynamic:
if not package in self.packages_dynamic:
@@ -493,6 +493,7 @@ class BBCooker:
if not item in self.status.providers:
bb.error("Nothing provides dependency %s" % item)
+ bb.event.fire(bb.event.NoProvider(item,self.configuration.data))
return 0
all_p = self.status.providers[item]
@@ -529,6 +530,7 @@ class BBCooker:
providers_list.append(self.status.pkg_fn[fn])
bb.note("multiple providers are available (%s);" % ", ".join(providers_list))
bb.note("consider defining PREFERRED_PROVIDER_%s" % item)
+ bb.event.fire(bb.event.MultipleProviders(item,providers_list,self.configuration.data))
self.consider_msgs_cache.append(item)
@@ -539,6 +541,7 @@ class BBCooker:
return 1
bb.note("no buildable providers for %s" % item)
+ bb.event.fire(bb.event.NoProvider(item,self.configuration.data))
return 0
def buildRProvider( self, item , buildAllDeps ):
@@ -558,6 +561,7 @@ class BBCooker:
if not all_p:
bb.error("Nothing provides runtime dependency %s" % (item))
+ bb.event.fire(bb.event.NoProvider(item,self.configuration.data,runtime=True))
return False
for p in all_p:
@@ -592,6 +596,7 @@ class BBCooker:
providers_list.append(self.status.pkg_fn[fn])
bb.note("multiple providers are available (%s);" % ", ".join(providers_list))
bb.note("consider defining a PREFERRED_PROVIDER to match runtime %s" % item)
+ bb.event.fire(bb.event.MultipleProviders(item,providers_list,self.configuration.data,runtime=True))
self.consider_msgs_cache.append(item)
if len(preferred) > 1:
@@ -601,6 +606,7 @@ class BBCooker:
providers_list.append(self.status.pkg_fn[fn])
bb.note("multiple preferred providers are available (%s);" % ", ".join(providers_list))
bb.note("consider defining only one PREFERRED_PROVIDER to match runtime %s" % item)
+ bb.event.fire(bb.event.MultipleProviders(item,providers_list,self.configuration.data,runtime=True))
self.consider_msgs_cache.append(item)
# run through the list until we find one that we can build
@@ -610,6 +616,7 @@ class BBCooker:
return True
bb.error("No buildable providers for runtime %s" % item)
+ bb.event.fire(bb.event.NoProvider(item,self.configuration.data))
return False
def getProvidersRun(self, rdepend):
@@ -666,7 +673,9 @@ class BBCooker:
bb.debug(2, "Additional runtime dependencies for %s are: %s" % (item, " ".join(rdepends)))
- for rdepend in rdepends:
+ for rdepend in rdepends:
+ if rdepend in self.status.ignored_dependencies:
+ continue
if not self.buildRProvider(rdepend, buildAllDeps):
return False
return True
@@ -880,6 +889,7 @@ class BBCooker:
bb.event.fire(bb.event.BuildStarted(buildname, pkgs_to_build, self.configuration.data))
+ failures = 0
for k in pkgs_to_build:
failed = False
try:
@@ -891,10 +901,11 @@ class BBCooker:
failed = True
if failed:
+ failures += failures
if self.configuration.abort:
sys.exit(1)
- bb.event.fire(bb.event.BuildCompleted(buildname, pkgs_to_build, self.configuration.data))
+ bb.event.fire(bb.event.BuildCompleted(buildname, pkgs_to_build, self.configuration.data, failures))
sys.exit( self.stats.show() )
@@ -1067,8 +1078,7 @@ class BBCooker:
# main
#============================================================================#
-if __name__ == "__main__":
-
+def main():
parser = optparse.OptionParser( version = "BitBake Build Tool Core version %s, %%prog version %s" % ( bb.__version__, __version__ ),
usage = """%prog [options] [package ...]
@@ -1120,3 +1130,8 @@ Default BBFILES are the .bb files in the current directory.""" )
cooker = BBCooker()
cooker.cook( BBConfiguration( options ), args[1:] )
+
+
+
+if __name__ == "__main__":
+ main()
diff --git a/bitbake/bin/bitdoc b/bitbake/bin/bitdoc
index 64d32945ba..84d2ee23ce 100755
--- a/bitbake/bin/bitdoc
+++ b/bitbake/bin/bitdoc
@@ -30,7 +30,7 @@ import optparse, os, sys
# bitbake
sys.path.append(os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib'))
import bb
-from bb import make
+import bb.parse
from string import split, join
__version__ = "0.0.2"
@@ -45,8 +45,8 @@ class HTMLFormatter:
one site for each key with links to the relations and groups.
index.html
- keys.html
- groups.html
+ all_keys.html
+ all_groups.html
groupNAME.html
keyNAME.html
"""
@@ -75,8 +75,8 @@ class HTMLFormatter:
return """<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="g" href="index.html">Home</a></td>
-<td><a accesskey="n" href="groups.html">Groups</a></td>
-<td><a accesskey="u" href="keys.html">Keys</a></td>
+<td><a accesskey="n" href="all_groups.html">Groups</a></td>
+<td><a accesskey="u" href="all_keys.html">Keys</a></td>
</tr></table>
"""
@@ -89,10 +89,11 @@ class HTMLFormatter:
return ""
txt = "<p><b>See also:</b><br>"
+ txts = []
for it in item.related():
- txt += """<a href="key%s.html">%s</a>, """ % (it, it)
+ txts.append("""<a href="key%(it)s.html">%(it)s</a>""" % vars() )
- return txt
+ return txt + ",".join(txts)
def groups(self,item):
"""
@@ -103,11 +104,12 @@ class HTMLFormatter:
return ""
- txt = "<p><b>Seel also:</b><br>"
+ txt = "<p><b>See also:</b><br>"
+ txts = []
for group in item.groups():
- txt += """<a href="group%s.html">%s</a>, """ % (group,group)
+ txts.append( """<a href="group%s.html">%s</a> """ % (group,group) )
- return txt
+ return txt + ",".join(txts)
def createKeySite(self,item):
@@ -125,23 +127,23 @@ class HTMLFormatter:
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
-<pre class="synopsis">
+<p>
%s
-</pre>
+</p>
</div>
<div class="refsynopsisdiv">
<h2>Related Keys</h2>
-<pre class="synopsis">
+<p>
%s
-</pre>
+</p>
</div>
<div class="refsynopsisdiv">
<h2>Groups</h2>
-<pre class="synopsis">
+<p>
%s
-</pre>
+</p>
</div>
@@ -181,8 +183,8 @@ class HTMLFormatter:
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
%s
<h2>Documentation Entrance</h2>
-<a href="groups.html">All available groups</a><br>
-<a href="keys.html">All available keys</a><br>
+<a href="all_groups.html">All available groups</a><br>
+<a href="all_keys.html">All available keys</a><br>
</body>
""" % self.createNavigator()
@@ -206,13 +208,21 @@ class HTMLFormatter:
</body>
""" % (self.createNavigator(), keys)
- def createGroupSite(self,gr, items):
+ def createGroupSite(self, gr, items, _description = None):
"""
Create a site for a group:
Group the name of the group, items contain the name of the keys
inside this group
"""
groups = ""
+ description = ""
+
+ # create a section with the group descriptions
+ if _description:
+ description += "<h2 Description of Grozp %s</h2>" % gr
+ description += _description
+
+ items.sort(lambda x,y:cmp(x.name(),y.name()))
for group in items:
groups += """<a href="key%s.html">%s</a><br>""" % (group.name(), group.name())
@@ -221,6 +231,7 @@ class HTMLFormatter:
<link rel="stylesheet" href="style.css" type="text/css">
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
%s
+%s
<div class="refsynopsisdiv">
<h2>Keys in Group %s</h2>
<pre class="synopsis">
@@ -228,7 +239,7 @@ class HTMLFormatter:
</pre>
</div>
</body>
-""" % (gr, self.createNavigator(), gr, groups)
+""" % (gr, self.createNavigator(), description, gr, groups)
@@ -508,10 +519,10 @@ def main():
f = file('index.html', 'w')
print >> f, html_slave.createIndex()
- f = file('groups.html', 'w')
+ f = file('all_groups.html', 'w')
print >> f, html_slave.createGroupsSite(doc)
- f = file('keys.html', 'w')
+ f = file('all_keys.html', 'w')
print >> f, html_slave.createKeysSite(doc)
# now for each group create the site
diff --git a/bitbake/doc/manual/usermanual.xml b/bitbake/doc/manual/usermanual.xml
index 277e615100..33150b10f2 100644
--- a/bitbake/doc/manual/usermanual.xml
+++ b/bitbake/doc/manual/usermanual.xml
@@ -12,7 +12,7 @@
<corpauthor>BitBake Team</corpauthor>
</authorgroup>
<copyright>
- <year>2004, 2005</year>
+ <year>2004, 2005, 2006</year>
<holder>Chris Larson</holder>
<holder>Phil Blundell</holder>
</copyright>
@@ -111,9 +111,9 @@ share common metadata between many packages.</para></listitem>
<section>
<title>Appending (.=) and prepending (=.) without spaces</title>
<para><screen><varname>B</varname> = "bval"
-<varname>B</varname> += "additionaldata"
+<varname>B</varname> .= "additionaldata"
<varname>C</varname> = "cval"
-<varname>C</varname> =+ "test"</screen></para>
+<varname>C</varname> =. "test"</screen></para>
<para>In this example, <varname>B</varname> is now <literal>bvaladditionaldata</literal> and <varname>C</varname> is <literal>testcval</literal>. In contrast to the above Appending and Prepending operators no additional space
will be introduced.</para>
</section>
@@ -228,6 +228,86 @@ of the event and the content of the <varname>FILE</varname> variable.</para>
</section>
</section>
</chapter>
+
+ <chapter>
+ <title>File Download support</title>
+ <section>
+ <title>Overview</title>
+ <para>BitBake provides support to download files this procedure is called fetching. The SRC_URI is normally used to indicate BitBake which files to fetch. The next sections will describe th available fetchers and the options they have. Each Fetcher honors a set of Variables and
+a per URI parameters separated by a <quote>;</quote> consisting of a key and a value. The semantic of the Variables and Parameters are defined by the Fetcher. BitBakes tries to have a consistent semantic between the different Fetchers.
+ </para>
+ </section>
+
+ <section>
+ <title>Local File Fetcher</title>
+ <para>The URN for the Local File Fetcher is <emphasis>file</emphasis>. The filename can be either absolute or relative. If the filename is relative <varname>FILESPATH</varname> and <varname>FILESDIR</varname> will be used to find the appropriate relative file depending on the <varname>OVERRIDES</varname>. Single files and complete directories can be specified.
+<screen><varname>SRC_URI</varname>= "file://relativefile.patch"
+<varname>SRC_URI</varname>= "file://relativefile.patch;this=ignored"
+<varname>SRC_URI</varname>= "file:///Users/ich/very_important_software"
+</screen>
+ </para>
+ </section>
+
+ <section>
+ <title>CVS File Fetcher</title>
+ <para>The URN for the CVS Fetcher is <emphasis>cvs</emphasis>. This Fetcher honors the variables <varname>DL_DIR</varname>, <varname>SRCDATE</varname>, <varname>FETCHCOMMAND_cvs</varname>, <varname>UPDATECOMMAND_cvs</varname>. <varname>DL_DIRS</varname> specifies where a temporary checkout is saved, <varname>SRCDATE</varname> specifies which date to use when doing the fetching, <varname>FETCHCOMMAND</varname> and <varname>UPDATECOMMAND</varname> specify which executables should be used when doing the CVS checkout or update.
+ </para>
+ <para>The supported Parameters are <varname>module</varname>, <varname>tag</varname>, <varname>date</varname>, <varname>method</varname>, <varname>localdir</varname>, <varname>rsh</varname>. The <varname>module</varname> specifies which module to check out, the <varname>tag</varname> describes which CVS TAG should be used for the checkout by default the TAG is empty. A <varname>date</varname> can be specified to override the SRCDATE of the configuration to checkout a specific date. <varname>method</varname> is by default <emphasis>pserver</emphasis>, if <emphasis>ext</emphasis> is used the <varname>rsh</varname> parameter will be evaluated and <varname>CVS_RSH</varname> will be set. Finally <varname>localdir</varname> is used to checkout into a special directory relative to <varname>CVSDIR></varname>.
+<screen><varname>SRC_URI</varname> = "cvs://CVSROOT;module=mymodule;tag=some-version;method=ext"
+<varname>SRC_URI</varname> = "cvs://CVSROOT;module=mymodule;date=20060126;localdir=usethat"
+</screen>
+ </para>
+ </section>
+
+ <section>
+ <title>HTTP/FTP Fetcher</title>
+ <para>The URNs for the HTTP/FTP are <emphasis>http</emphasis>, <emphasis>https</emphasis> and <emphasis>ftp</emphasis>. This Fetcher honors the variables <varname>DL_DIR</varname>, <varname>FETCHCOMMAND_wget</varname>, <varname>PREMIRRORS</varname>, <varname>MIRRORS</varname>. The <varname>DL_DIR</varname> defines where to store the fetched file, <varname>FETCHCOMMAND</varname> contains the command used for fetching. <quote>${URI}</quote> and <quote>${FILES}</quote> will be replaced by the uri and basename of the to be fetched file. <varname>PREMIRRORS</varname>
+will be tried first when fetching a file if that fails the actual file will be tried and finally all <varname>MIRRORS</varname> will be tried.
+ </para>
+ <para>The only supported Parameter is <varname>md5sum</varname>. After a fetch the <varname>md5sum</varname> of the file will be calculated and the two sums will be compared.
+ </para>
+ <para><screen><varname>SRC_URI</varname> = "http://oe.handhelds.org/not_there.aac;md5sum=12343"
+<varname>SRC_URI</varname> = "ftp://oe.handhelds.org/not_there_as_well.aac;md5sum=1234"
+<varname>SRC_URI</varname> = "ftp://you@oe.handheld.sorg/home/you/secret.plan;md5sum=1234"
+</screen></para>
+ </section>
+
+ <section>
+ <title>SVK Fetcher</title>
+ <para>
+ <emphasis>Currently NOT suppoered</emphasis>
+ </para>
+ </section>
+
+ <section>
+ <title>SVN Fetcher</title>
+ <para>The URN for the SVN Fetcher is <emphasis>svn</emphasis>.
+ </para>
+ <para>The Variables <varname>FETCHCOMMAND_svn</varname>, <varname>DL_DIR</varname> are used by the SVN Fetcher. <varname>FETCHCOMMAND</varname> contains the subversion command, <varname>DL_DIR</varname> is the directory where tarballs will be saved.
+ </para>
+ <para>The supported Parameters are <varname>proto</varname>, <varname>rev</varname>. <varname>proto</varname> is the subversion prototype, <varname>rev</varname> is the subversions revision.
+ </para>
+ <para><screen><varname>SRC_URI</varname> = "svn://svn.oe.handhelds.org/svn;module=vip;proto=http;rev=667"
+<varname>SRC_URI</varname> = "svn://svn.oe.handhelds.org/svn/;module=opie;proto=svn+ssh;date=20060126"
+</screen></para>
+ </section>
+
+ <section>
+ <title>GIT Fetcher</title>
+ <para>The URN for the GIT Fetcher is <emphasis>git</emphasis>.
+ </para>
+ <para>The Variables <varname>DL_DIR</varname>, <varname>GITDIR</varname> are used. <varname>DL_DIR</varname> will be used to store the checkedout version. <varname>GITDIR</varname> will be used as the base directory where the git tree is cloned to.
+ </para>
+ <para>The Parameters are <emphasis>tag</emphasis>, <emphasis>protocol</emphasis>. <emphasis>tag</emphasis> is a git tag, the default is <quote>master</quote>. <emphasis>protocol</emphasis> is the git protocol to use and defaults to <quote>rsync</quote>.
+ </para>
+ <para><screen><varname>SRC_URI</varname> = "git://git.oe.handhelds.org/git/vip.git;tag=version-1"
+<varname>SRC_URI</varname> = "git://git.oe.handhelds.org/git/vip.git;protocol=http"
+ </screen></para>
+ </section>
+
+ </chapter>
+
+
<chapter>
<title>Commands</title>
<section>
@@ -320,7 +400,7 @@ options:
<title>Depending on another .bb</title>
<para>a.bb:
<screen>PN = "package-a"
- DEPENDS += "package-b"</screen>
+DEPENDS += "package-b"</screen>
</para>
<para>b.bb:
<screen>PN = "package-b"</screen>
diff --git a/bitbake/lib/bb/__init__.py b/bitbake/lib/bb/__init__.py
index dabe978bf5..c6c0beb792 100644
--- a/bitbake/lib/bb/__init__.py
+++ b/bitbake/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.3.3.0"
+__version__ = "1.3.3.4"
__all__ = [
@@ -1229,38 +1229,6 @@ class digraph:
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
index 599b45d9d3..b59473bc23 100644
--- a/bitbake/lib/bb/build.py
+++ b/bitbake/lib/bb/build.py
@@ -25,7 +25,7 @@ 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
+from bb import debug, data, fetch, fatal, error, note, event, mkdirhier, utils
import bb, os
# data holds flags and function name for a given task
@@ -122,14 +122,15 @@ 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")
+ tmp = "def " + func + "():\n%s" % data.getVar(func, d)
+ tmp += '\n' + func + '()'
+ comp = utils.better_compile(tmp, func, bb.data.getVar('FILE', d, 1) )
prevdir = os.getcwd()
g = {} # globals
g['bb'] = bb
g['os'] = os
g['d'] = d
- exec comp in g
+ utils.better_exec(comp,g,tmp, bb.data.getVar('FILE',d,1))
if os.path.exists(prevdir):
os.chdir(prevdir)
diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py
index b7d707a920..56ee977f66 100644
--- a/bitbake/lib/bb/data.py
+++ b/bitbake/lib/bb/data.py
@@ -31,7 +31,7 @@ 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)
+sys.path.insert(0,path)
from bb import note, debug, data_smart
@@ -211,6 +211,11 @@ def delVarFlag(var, flag, d):
def setVarFlags(var, flags, d):
"""Set the flags for a given variable
+ Note:
+ setVarFlags will not clear previous
+ flags. Think of this method as
+ addVarFlags
+
Example:
>>> d = init()
>>> myflags = {}
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index 741790502f..52f391dec1 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/lib/bb/data_smart.py
@@ -29,7 +29,7 @@ Based on functions from the base bb module, Copyright 2003 Holger Schurig
"""
import copy, os, re, sys, time, types
-from bb import note, debug, fatal
+from bb import note, debug, fatal, utils
try:
import cPickle as pickle
@@ -287,8 +287,8 @@ class DataSmartPackage(DataSmart):
self.unpickle_prep()
funcstr = self.getVar('__functions__', 0)
if funcstr:
- comp = compile(funcstr, "<pickled>", "exec")
- exec comp in __builtins__
+ comp = utils.better_compile(funcstr, "<pickled>", self.bbfile)
+ utils.better_exec(comp, __builtins__, funcstr, self.bbfile)
def linkDataSet(self):
if not self.parent == None:
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index c4e88fa35d..cbe6d2a11a 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -25,6 +25,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
import os, re
import bb.data
+import bb.utils
class Event:
"""Base class for events"""
@@ -50,8 +51,8 @@ def tmpHandler(event):
return NotHandled
def defaultTmpHandler():
- tmp = "def tmpHandler(e):\n\t\"\"\"heh\"\"\"\n\treturn 0"
- comp = compile(tmp, "tmpHandler(e)", "exec")
+ tmp = "def tmpHandler(e):\n\t\"\"\"heh\"\"\"\n\treturn NotHandled"
+ comp = bb.utils.better_compile(tmp, "tmpHandler(e)", "bb.event.defaultTmpHandler")
return comp
def fire(event):
@@ -71,12 +72,12 @@ def register(handler):
if handler is not None:
# handle string containing python code
if type(handler).__name__ == "str":
- return registerCode(handler)
+ return _registerCode(handler)
# prevent duplicate registration
if not handler in handlers:
handlers.append(handler)
-def registerCode(handlerStr):
+def _registerCode(handlerStr):
"""Register a 'code' Event.
Deprecated interface; call register instead.
@@ -85,7 +86,7 @@ def registerCode(handlerStr):
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")
+ comp = bb.utils.better_compile(tmp, "tmpHandler(e)", "bb.event._registerCode")
# prevent duplicate registration
if not comp in handlers:
handlers.append(comp)
@@ -94,16 +95,16 @@ def remove(handler):
"""Remove an Event handler"""
for h in handlers:
if type(handler).__name__ == "str":
- return removeCode(handler)
+ return _removeCode(handler)
if handler is h:
handlers.remove(handler)
-def removeCode(handlerStr):
+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")
+ comp = bb.utils.better_compile(tmp, "tmpHandler(e)", "bb.event._removeCode")
handlers.remove(comp)
def getName(e):
@@ -117,7 +118,7 @@ def getName(e):
class PkgBase(Event):
"""Base class for package events"""
- def __init__(self, t, d = {}):
+ def __init__(self, t, d = bb.data.init()):
self._pkg =