]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
Initial work on getting bitbake working under pypy
authorChris Larson <chris_larson@mentor.com>
Wed, 16 Mar 2011 15:07:29 +0000 (08:07 -0700)
committerChris Larson <chris_larson@mentor.com>
Wed, 16 Mar 2011 15:31:52 +0000 (08:31 -0700)
- 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

Signed-off-by: Chris Larson <chris_larson@mentor.com>
lib/bb/build.py
lib/bb/fetch2/__init__.py
lib/bb/persist_data.py

index 20906377fc039b44b131e87154ad46f7cbd5527e..042edb8f816a1d93b3d55bf59f03960d9fbc9f3c 100644 (file)
@@ -219,7 +219,8 @@ def exec_func_shell(function, d, runfile, cwd=None, fakeroot=False):
         if cwd:
             script.write("cd %s\n" % cwd)
         script.write("%s\n" % function)
-        os.fchmod(script.fileno(), 0775)
+
+    os.chmod(runfile, 0775)
 
     if fakeroot:
         cmd = ['fakeroot', runfile]
index d4f28e82352d4d6ac0ae9bd94a071ee1222356d2..9768b087b279d81f570db84ce0bc06c052668250 100644 (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"
 
@@ -230,7 +228,7 @@ def fetcher_init(d):
         logger.debug(1, "Keeping SRCREV cache due to cache policy of: %s", srcrev_policy)
     elif srcrev_policy == "clear":
         logger.debug(1, "Clearing SRCREV cache due to cache policy of: %s", srcrev_policy)
-        revs = persist_data.persist('BB_URI_HEADREVS', d)
+        revs = bb.persist_data.persist('BB_URI_HEADREVS', d)
         try:
             bb.fetch2.saved_headrevs = revs.items()
         except:
@@ -249,7 +247,7 @@ def fetcher_compare_revisions(d):
     return true/false on whether they've changed.
     """
 
-    data = persist_data.persist('BB_URI_HEADREVS', d).items()
+    data = bb.persist_data.persist('BB_URI_HEADREVS', d).items()
     data2 = bb.fetch2.saved_headrevs
 
     changed = False
@@ -351,7 +349,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 = []):
     """
@@ -371,7 +369,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)
 
@@ -497,15 +495,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":
@@ -591,12 +589,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"""
@@ -789,10 +787,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)
@@ -804,7 +802,7 @@ class FetchMethod(object):
         if not hasattr(self, "_latest_revision"):
             raise ParameterError("The fetcher for this URL does not support _latest_revision", url)
 
-        revs = persist_data.persist('BB_URI_HEADREVS', d)
+        revs = bb.persist_data.persist('BB_URI_HEADREVS', d)
         key = self.generate_revision_key(url, ud, d, name)
         rev = revs[key]
         if rev != None:
@@ -820,7 +818,7 @@ class FetchMethod(object):
         if hasattr(self, "_sortable_revision"):
             return self._sortable_revision(url, ud, d)
 
-        localcounts = persist_data.persist('BB_URI_LOCALCOUNT', d)
+        localcounts = bb.persist_data.persist('BB_URI_LOCALCOUNT', d)
         key = self.generate_revision_key(url, ud, d, name)
 
         latest_rev = self._build_revision(url, ud, d, name)
index bd60fca7c7b6f65228c02378a96d3f5199e9e5bb..38ad354900d2d599e7110c71e54ef7e733766962 100644 (file)
@@ -39,7 +39,8 @@ if sqlversion[0] < 3 or (sqlversion[0] == 3 and sqlversion[1] < 3):
 
 
 logger = logging.getLogger("BitBake.PersistData")
-sqlite3.enable_shared_cache(True)
+if hasattr(sqlite3, 'enable_shared_cache'):
+    sqlite3.enable_shared_cache(True)
 
 
 class SQLTable(collections.MutableMapping):