Initial work on getting bitbake working under pypy

- use os.chmod, not os.fchmod, as the latter is missing under pypy
- rearrange our imports a bit
- don't die if sqlite3 is missing shared cache support

(Bitbake rev: f229824dc9c453adf6067500e2bf6761536e4f2f)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Chris Larson 2011-03-16 08:07:29 -07:00 committed by Richard Purdie
parent 628bd54d93
commit 88dbb0523c
4 changed files with 23 additions and 22 deletions

View File

@ -224,7 +224,8 @@ def exec_func_shell(function, d, runfile, cwd=None):
if cwd:
script.write("cd %s\n" % cwd)
script.write("%s\n" % function)
os.fchmod(script.fileno(), 0775)
os.chmod(runfile, 0775)
env = {
'PATH': d.getVar('PATH', True),

View File

@ -153,7 +153,7 @@ def fetcher_init(d):
Called to initialize the fetchers once the configuration data is known.
Calls before this must not hit the cache.
"""
pd = persist_data.persist(d)
pd = bb.persist_data.persist(d)
# When to drop SCM head revisions controlled by user policy
srcrev_policy = bb.data.getVar('BB_SRCREV_POLICY', d, 1) or "clear"
if srcrev_policy == "cache":
@ -178,7 +178,7 @@ def fetcher_compare_revisions(d):
return true/false on whether they've changed.
"""
pd = persist_data.persist(d)
pd = bb.persist_data.persist(d)
data = pd['BB_URI_HEADREVS'].items()
data2 = bb.fetch.saved_headrevs
@ -756,7 +756,7 @@ class Fetch(object):
if not hasattr(self, "_latest_revision"):
raise ParameterError
pd = persist_data.persist(d)
pd = bb.persist_data.persist(d)
revs = pd['BB_URI_HEADREVS']
key = self.generate_revision_key(url, ud, d)
rev = revs[key]
@ -773,7 +773,7 @@ class Fetch(object):
if hasattr(self, "_sortable_revision"):
return self._sortable_revision(url, ud, d)
pd = persist_data.persist(d)
pd = bb.persist_data.persist(d)
localcounts = pd['BB_URI_LOCALCOUNT']
key = self.generate_revision_key(url, ud, d)

View File

@ -28,10 +28,8 @@ from __future__ import absolute_import
from __future__ import print_function
import os, re
import logging
import bb
from bb import data
from bb import persist_data
from bb import utils
import bb.data, bb.persist_data, bb.utils
from bb import data
__version__ = "2"
@ -352,7 +350,7 @@ def get_srcrev(d):
def localpath(url, d):
fetcher = bb.fetch2.Fetch([url], d)
return fetcher.localpath(url)
return fetcher.localpath(url)
def runfetchcmd(cmd, d, quiet = False, cleanup = []):
"""
@ -372,7 +370,7 @@ def runfetchcmd(cmd, d, quiet = False, cleanup = []):
'SSH_AUTH_SOCK', 'SSH_AGENT_PID', 'HOME']
for var in exportvars:
val = data.getVar(var, d, True)
val = bb.data.getVar(var, d, True)
if val:
cmd = 'export ' + var + '=\"%s\"; %s' % (val, cmd)
@ -498,15 +496,15 @@ def srcrev_internal_helper(ud, d, name):
return ud.parm['tag']
rev = None
pn = data.getVar("PN", d, True)
pn = bb.data.getVar("PN", d, True)
if name != '':
rev = data.getVar("SRCREV_%s_pn-%s" % (name, pn), d, True)
rev = bb.data.getVar("SRCREV_%s_pn-%s" % (name, pn), d, True)
if not rev:
rev = data.getVar("SRCREV_%s" % name, d, True)
rev = bb.data.getVar("SRCREV_%s" % name, d, True)
if not rev:
rev = data.getVar("SRCREV_pn-%s" % pn, d, True)
rev = bb.data.getVar("SRCREV_pn-%s" % pn, d, True)
if not rev:
rev = data.getVar("SRCREV", d, True)
rev = bb.data.getVar("SRCREV", d, True)
if rev == "INVALID":
raise FetchError("Please set SRCREV to a valid value", ud.url)
if rev == "AUTOINC":
@ -592,12 +590,12 @@ class FetchData(object):
if "srcdate" in self.parm:
return self.parm['srcdate']
pn = data.getVar("PN", d, True)
pn = bb.data.getVar("PN", d, True)
if pn:
return data.getVar("SRCDATE_%s" % pn, d, True) or data.getVar("SRCDATE", d, True) or data.getVar("DATE", d, True)
return bb.data.getVar("SRCDATE_%s" % pn, d, True) or bb.data.getVar("SRCDATE", d, True) or bb.data.getVar("DATE", d, True)
return data.getVar("SRCDATE", d, True) or data.getVar("DATE", d, True)
return bb.data.getVar("SRCDATE", d, True) or bb.data.getVar("DATE", d, True)
class FetchMethod(object):
"""Base class for 'fetch'ing data"""
@ -790,10 +788,10 @@ class FetchMethod(object):
localcount = None
if name != '':
pn = data.getVar("PN", d, True)
localcount = data.getVar("LOCALCOUNT_" + name, d, True)
pn = bb.data.getVar("PN", d, True)
localcount = bb.data.getVar("LOCALCOUNT_" + name, d, True)
if not localcount:
localcount = data.getVar("LOCALCOUNT", d, True)
localcount = bb.data.getVar("LOCALCOUNT", d, True)
return localcount
localcount_internal_helper = staticmethod(localcount_internal_helper)

View File

@ -39,6 +39,8 @@ if sqlversion[0] < 3 or (sqlversion[0] == 3 and sqlversion[1] < 3):
logger = logging.getLogger("BitBake.PersistData")
if hasattr(sqlite3, 'enable_shared_cache'):
sqlite3.enable_shared_cache(True)
class SQLTable(collections.MutableMapping):