diff options
author | Chris Larson <chris_larson@mentor.com> | 2011-03-16 08:07:29 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-05-06 15:42:03 +0100 |
commit | 88dbb0523cfdc46c8f7e4484ce57c3f46fd475a1 (patch) | |
tree | 6d713979334869df56ee14acdb39ca742b9d2798 | |
parent | 628bd54d936650d03ba2ffd0a08aade2f84529b1 (diff) | |
download | poky-88dbb0523cfdc46c8f7e4484ce57c3f46fd475a1.tar.gz |
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>
-rw-r--r-- | bitbake/lib/bb/build.py | 3 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch/__init__.py | 8 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 32 | ||||
-rw-r--r-- | 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): | |||
224 | if cwd: | 224 | if cwd: |
225 | script.write("cd %s\n" % cwd) | 225 | script.write("cd %s\n" % cwd) |
226 | script.write("%s\n" % function) | 226 | script.write("%s\n" % function) |
227 | os.fchmod(script.fileno(), 0775) | 227 | |
228 | os.chmod(runfile, 0775) | ||
228 | 229 | ||
229 | env = { | 230 | env = { |
230 | 'PATH': d.getVar('PATH', True), | 231 | '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): | |||
153 | Called to initialize the fetchers once the configuration data is known. | 153 | Called to initialize the fetchers once the configuration data is known. |
154 | Calls before this must not hit the cache. | 154 | Calls before this must not hit the cache. |
155 | """ | 155 | """ |
156 | pd = persist_data.persist(d) | 156 | pd = bb.persist_data.persist(d) |
157 | # When to drop SCM head revisions controlled by user policy | 157 | # When to drop SCM head revisions controlled by user policy |
158 | srcrev_policy = bb.data.getVar('BB_SRCREV_POLICY', d, 1) or "clear" | 158 | srcrev_policy = bb.data.getVar('BB_SRCREV_POLICY', d, 1) or "clear" |
159 | if srcrev_policy == "cache": | 159 | if srcrev_policy == "cache": |
@@ -178,7 +178,7 @@ def fetcher_compare_revisions(d): | |||
178 | return true/false on whether they've changed. | 178 | return true/false on whether they've changed. |
179 | """ | 179 | """ |
180 | 180 | ||
181 | pd = persist_data.persist(d) | 181 | pd = bb.persist_data.persist(d) |
182 | data = pd['BB_URI_HEADREVS'].items() | 182 | data = pd['BB_URI_HEADREVS'].items() |
183 | data2 = bb.fetch.saved_headrevs | 183 | data2 = bb.fetch.saved_headrevs |
184 | 184 | ||
@@ -756,7 +756,7 @@ class Fetch(object): | |||
756 | if not hasattr(self, "_latest_revision"): | 756 | if not hasattr(self, "_latest_revision"): |
757 | raise ParameterError | 757 | raise ParameterError |
758 | 758 | ||
759 | pd = persist_data.persist(d) | 759 | pd = bb.persist_data.persist(d) |
760 | revs = pd['BB_URI_HEADREVS'] | 760 | revs = pd['BB_URI_HEADREVS'] |
761 | key = self.generate_revision_key(url, ud, d) | 761 | key = self.generate_revision_key(url, ud, d) |
762 | rev = revs[key] | 762 | rev = revs[key] |
@@ -773,7 +773,7 @@ class Fetch(object): | |||
773 | if hasattr(self, "_sortable_revision"): | 773 | if hasattr(self, "_sortable_revision"): |
774 | return self._sortable_revision(url, ud, d) | 774 | return self._sortable_revision(url, ud, d) |
775 | 775 | ||
776 | pd = persist_data.persist(d) | 776 | pd = bb.persist_data.persist(d) |
777 | localcounts = pd['BB_URI_LOCALCOUNT'] | 777 | localcounts = pd['BB_URI_LOCALCOUNT'] |
778 | key = self.generate_revision_key(url, ud, d) | 778 | key = self.generate_revision_key(url, ud, d) |
779 | 779 | ||
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 | |||
28 | from __future__ import print_function | 28 | from __future__ import print_function |
29 | import os, re | 29 | import os, re |
30 | import logging | 30 | import logging |
31 | import bb | 31 | import bb.data, bb.persist_data, bb.utils |
32 | from bb import data | 32 | from bb import data |
33 | from bb import persist_data | ||
34 | from bb import utils | ||
35 | 33 | ||
36 | __version__ = "2" | 34 | __version__ = "2" |
37 | 35 | ||
@@ -352,7 +350,7 @@ def get_srcrev(d): | |||
352 | 350 | ||
353 | def localpath(url, d): | 351 | def localpath(url, d): |
354 | fetcher = bb.fetch2.Fetch([url], d) | 352 | fetcher = bb.fetch2.Fetch([url], d) |
355 | return fetcher.localpath(url) | 353 | return fetcher.localpath(url) |
356 | 354 | ||
357 | def runfetchcmd(cmd, d, quiet = False, cleanup = []): | 355 | def runfetchcmd(cmd, d, quiet = False, cleanup = []): |
358 | """ | 356 | """ |
@@ -372,7 +370,7 @@ def runfetchcmd(cmd, d, quiet = False, cleanup = []): | |||
372 | 'SSH_AUTH_SOCK', 'SSH_AGENT_PID', 'HOME'] | 370 | 'SSH_AUTH_SOCK', 'SSH_AGENT_PID', 'HOME'] |
373 | 371 | ||
374 | for var in exportvars: | 372 | for var in exportvars: |
375 | val = data.getVar(var, d, True) | 373 | val = bb.data.getVar(var, d, True) |
376 | if val: | 374 | if val: |
377 | cmd = 'export ' + var + '=\"%s\"; %s' % (val, cmd) | 375 | cmd = 'export ' + var + '=\"%s\"; %s' % (val, cmd) |
378 | 376 | ||
@@ -498,15 +496,15 @@ def srcrev_internal_helper(ud, d, name): | |||
498 | return ud.parm['tag'] | 496 | return ud.parm['tag'] |
499 | 497 | ||
500 | rev = None | 498 | rev = None |
501 | pn = data.getVar("PN", d, True) | 499 | pn = bb.data.getVar("PN", d, True) |
502 | if name != '': | 500 | if name != '': |
503 | rev = data.getVar("SRCREV_%s_pn-%s" % (name, pn), d, True) | 501 | rev = bb.data.getVar("SRCREV_%s_pn-%s" % (name, pn), d, True) |
504 | if not rev: | 502 | if not rev: |
505 | rev = data.getVar("SRCREV_%s" % name, d, True) | 503 | rev = bb.data.getVar("SRCREV_%s" % name, d, True) |
506 | if not rev: | 504 | if not rev: |
507 | rev = data.getVar("SRCREV_pn-%s" % pn, d, True) | 505 | rev = bb.data.getVar("SRCREV_pn-%s" % pn, d, True) |
508 | if not rev: | 506 | if not rev: |
509 | rev = data.getVar("SRCREV", d, True) | 507 | rev = bb.data.getVar("SRCREV", d, True) |
510 | if rev == "INVALID": | 508 | if rev == "INVALID": |
511 | raise FetchError("Please set SRCREV to a valid value", ud.url) | 509 | raise FetchError("Please set SRCREV to a valid value", ud.url) |
512 | if rev == "AUTOINC": | 510 | if rev == "AUTOINC": |
@@ -592,12 +590,12 @@ class FetchData(object): | |||
592 | if "srcdate" in self.parm: | 590 | if "srcdate" in self.parm: |
593 | return self.parm['srcdate'] | 591 | return self.parm['srcdate'] |
594 | 592 | ||
595 | pn = data.getVar("PN", d, True) | 593 | pn = bb.data.getVar("PN", d, True) |
596 | 594 | ||
597 | if pn: | 595 | if pn: |
598 | return data.getVar("SRCDATE_%s" % pn, d, True) or data.getVar("SRCDATE", d, True) or data.getVar("DATE", d, True) | 596 | return bb.data.getVar("SRCDATE_%s" % pn, d, True) or bb.data.getVar("SRCDATE", d, True) or bb.data.getVar("DATE", d, True) |
599 | 597 | ||
600 | return data.getVar("SRCDATE", d, True) or data.getVar("DATE", d, True) | 598 | return bb.data.getVar("SRCDATE", d, True) or bb.data.getVar("DATE", d, True) |
601 | 599 | ||
602 | class FetchMethod(object): | 600 | class FetchMethod(object): |
603 | """Base class for 'fetch'ing data""" | 601 | """Base class for 'fetch'ing data""" |
@@ -790,10 +788,10 @@ class FetchMethod(object): | |||
790 | 788 | ||
791 | localcount = None | 789 | localcount = None |
792 | if name != '': | 790 | if name != '': |
793 | pn = data.getVar("PN", d, True) | 791 | pn = bb.data.getVar("PN", d, True) |
794 | localcount = data.getVar("LOCALCOUNT_" + name, d, True) | 792 | localcount = bb.data.getVar("LOCALCOUNT_" + name, d, True) |
795 | if not localcount: | 793 | if not localcount: |
796 | localcount = data.getVar("LOCALCOUNT", d, True) | 794 | localcount = bb.data.getVar("LOCALCOUNT", d, True) |
797 | return localcount | 795 | return localcount |
798 | 796 | ||
799 | localcount_internal_helper = staticmethod(localcount_internal_helper) | 797 | 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): | |||
39 | 39 | ||
40 | 40 | ||
41 | logger = logging.getLogger("BitBake.PersistData") | 41 | logger = logging.getLogger("BitBake.PersistData") |
42 | if hasattr(sqlite3, 'enable_shared_cache'): | ||
43 | sqlite3.enable_shared_cache(True) | ||
42 | 44 | ||
43 | 45 | ||
44 | class SQLTable(collections.MutableMapping): | 46 | class SQLTable(collections.MutableMapping): |