1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-02 13:29:49 +00:00

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
+2 -1
View File
@@ -224,7 +224,8 @@ def exec_func_shell(function, d, runfile, cwd=None):
if cwd: if cwd:
script.write("cd %s\n" % cwd) script.write("cd %s\n" % cwd)
script.write("%s\n" % function) script.write("%s\n" % function)
os.fchmod(script.fileno(), 0775)
os.chmod(runfile, 0775)
env = { env = {
'PATH': d.getVar('PATH', True), 'PATH': d.getVar('PATH', True),
+4 -4
View File
@@ -153,7 +153,7 @@ def fetcher_init(d):
Called to initialize the fetchers once the configuration data is known. Called to initialize the fetchers once the configuration data is known.
Calls before this must not hit the cache. 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 # When to drop SCM head revisions controlled by user policy
srcrev_policy = bb.data.getVar('BB_SRCREV_POLICY', d, 1) or "clear" srcrev_policy = bb.data.getVar('BB_SRCREV_POLICY', d, 1) or "clear"
if srcrev_policy == "cache": if srcrev_policy == "cache":
@@ -178,7 +178,7 @@ def fetcher_compare_revisions(d):
return true/false on whether they've changed. 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() data = pd['BB_URI_HEADREVS'].items()
data2 = bb.fetch.saved_headrevs data2 = bb.fetch.saved_headrevs
@@ -756,7 +756,7 @@ class Fetch(object):
if not hasattr(self, "_latest_revision"): if not hasattr(self, "_latest_revision"):
raise ParameterError raise ParameterError
pd = persist_data.persist(d) pd = bb.persist_data.persist(d)
revs = pd['BB_URI_HEADREVS'] revs = pd['BB_URI_HEADREVS']
key = self.generate_revision_key(url, ud, d) key = self.generate_revision_key(url, ud, d)
rev = revs[key] rev = revs[key]
@@ -773,7 +773,7 @@ class Fetch(object):
if hasattr(self, "_sortable_revision"): if hasattr(self, "_sortable_revision"):
return self._sortable_revision(url, ud, d) return self._sortable_revision(url, ud, d)
pd = persist_data.persist(d) pd = bb.persist_data.persist(d)
localcounts = pd['BB_URI_LOCALCOUNT'] localcounts = pd['BB_URI_LOCALCOUNT']
key = self.generate_revision_key(url, ud, d) key = self.generate_revision_key(url, ud, d)
+15 -17
View File
@@ -28,10 +28,8 @@ from __future__ import absolute_import
from __future__ import print_function from __future__ import print_function
import os, re import os, re
import logging import logging
import bb import bb.data, bb.persist_data, bb.utils
from bb import data from bb import data
from bb import persist_data
from bb import utils
__version__ = "2" __version__ = "2"
@@ -352,7 +350,7 @@ def get_srcrev(d):
def localpath(url, d): def localpath(url, d):
fetcher = bb.fetch2.Fetch([url], d) fetcher = bb.fetch2.Fetch([url], d)
return fetcher.localpath(url) return fetcher.localpath(url)
def runfetchcmd(cmd, d, quiet = False, cleanup = []): 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'] 'SSH_AUTH_SOCK', 'SSH_AGENT_PID', 'HOME']
for var in exportvars: for var in exportvars:
val = data.getVar(var, d, True) val = bb.data.getVar(var, d, True)
if val: if val:
cmd = 'export ' + var + '=\"%s\"; %s' % (val, cmd) cmd = 'export ' + var + '=\"%s\"; %s' % (val, cmd)
@@ -498,15 +496,15 @@ def srcrev_internal_helper(ud, d, name):
return ud.parm['tag'] return ud.parm['tag']
rev = None rev = None
pn = data.getVar("PN", d, True) pn = bb.data.getVar("PN", d, True)
if name != '': 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: if not rev:
rev = data.getVar("SRCREV_%s" % name, d, True) rev = bb.data.getVar("SRCREV_%s" % name, d, True)
if not rev: 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: if not rev:
rev = data.getVar("SRCREV", d, True) rev = bb.data.getVar("SRCREV", d, True)
if rev == "INVALID": if rev == "INVALID":
raise FetchError("Please set SRCREV to a valid value", ud.url) raise FetchError("Please set SRCREV to a valid value", ud.url)
if rev == "AUTOINC": if rev == "AUTOINC":
@@ -592,12 +590,12 @@ class FetchData(object):
if "srcdate" in self.parm: if "srcdate" in self.parm:
return self.parm['srcdate'] return self.parm['srcdate']
pn = data.getVar("PN", d, True) pn = bb.data.getVar("PN", d, True)
if pn: 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): class FetchMethod(object):
"""Base class for 'fetch'ing data""" """Base class for 'fetch'ing data"""
@@ -790,10 +788,10 @@ class FetchMethod(object):
localcount = None localcount = None
if name != '': if name != '':
pn = data.getVar("PN", d, True) pn = bb.data.getVar("PN", d, True)
localcount = data.getVar("LOCALCOUNT_" + name, d, True) localcount = bb.data.getVar("LOCALCOUNT_" + name, d, True)
if not localcount: if not localcount:
localcount = data.getVar("LOCALCOUNT", d, True) localcount = bb.data.getVar("LOCALCOUNT", d, True)
return localcount return localcount
localcount_internal_helper = staticmethod(localcount_internal_helper) localcount_internal_helper = staticmethod(localcount_internal_helper)
+2
View File
@@ -39,6 +39,8 @@ if sqlversion[0] < 3 or (sqlversion[0] == 3 and sqlversion[1] < 3):
logger = logging.getLogger("BitBake.PersistData") logger = logging.getLogger("BitBake.PersistData")
if hasattr(sqlite3, 'enable_shared_cache'):
sqlite3.enable_shared_cache(True)
class SQLTable(collections.MutableMapping): class SQLTable(collections.MutableMapping):