From 88dbb0523cfdc46c8f7e4484ce57c3f46fd475a1 Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Wed, 16 Mar 2011 08:07:29 -0700 Subject: 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 Signed-off-by: Richard Purdie --- bitbake/lib/bb/build.py | 3 ++- bitbake/lib/bb/fetch/__init__.py | 8 ++++---- bitbake/lib/bb/fetch2/__init__.py | 32 +++++++++++++++----------------- bitbake/lib/bb/persist_data.py | 2 ++ 4 files changed, 23 insertions(+), 22 deletions(-) diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py index 83a378febb..194a28b38c 100644 --- a/bitbake/lib/bb/build.py +++ b/bitbake/lib/bb/build.py @@ -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), diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py index 2f92d87d96..684e83dcad 100644 --- a/bitbake/lib/bb/fetch/__init__.py +++ b/bitbake/lib/bb/fetch/__init__.py @@ -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) diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index 0bb90976e3..ca0197e220 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py @@ -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) diff --git a/bitbake/lib/bb/persist_data.py b/bitbake/lib/bb/persist_data.py index da05752311..f51a42efd2 100644 --- a/bitbake/lib/bb/persist_data.py +++ b/bitbake/lib/bb/persist_data.py @@ -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): -- cgit v1.2.3-54-g00ecf