diff options
author | Chris Larson <chris_larson@mentor.com> | 2010-12-17 11:53:54 -0700 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2011-01-05 00:58:24 +0000 |
commit | e9f4ed01731308c52bf4bc407bb21b5e85b4c53f (patch) | |
tree | 6897266582f5c371ed21cb8455c0e63e42e368a1 /bitbake/lib | |
parent | 478677fb624ff6093004a43a2cb9f9ce35cb4e1b (diff) | |
download | poky-e9f4ed01731308c52bf4bc407bb21b5e85b4c53f.tar.gz |
Update persist_data usage to the new API
(Bitbake rev: 9723a1c474b72b096c5a3136bf446ed69f3a749e)
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/fetch/__init__.py | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py index d8f5f167fc..67e5addfe0 100644 --- a/bitbake/lib/bb/fetch/__init__.py +++ b/bitbake/lib/bb/fetch/__init__.py | |||
@@ -150,7 +150,7 @@ def fetcher_init(d): | |||
150 | Called to initialize the fetchers once the configuration data is known. | 150 | Called to initialize the fetchers once the configuration data is known. |
151 | Calls before this must not hit the cache. | 151 | Calls before this must not hit the cache. |
152 | """ | 152 | """ |
153 | pd = persist_data.PersistData(d) | 153 | pd = persist_data.persist(d) |
154 | # When to drop SCM head revisions controlled by user policy | 154 | # When to drop SCM head revisions controlled by user policy |
155 | srcrev_policy = bb.data.getVar('BB_SRCREV_POLICY', d, 1) or "clear" | 155 | srcrev_policy = bb.data.getVar('BB_SRCREV_POLICY', d, 1) or "clear" |
156 | if srcrev_policy == "cache": | 156 | if srcrev_policy == "cache": |
@@ -158,10 +158,10 @@ def fetcher_init(d): | |||
158 | elif srcrev_policy == "clear": | 158 | elif srcrev_policy == "clear": |
159 | logger.debug(1, "Clearing SRCREV cache due to cache policy of: %s", srcrev_policy) | 159 | logger.debug(1, "Clearing SRCREV cache due to cache policy of: %s", srcrev_policy) |
160 | try: | 160 | try: |
161 | bb.fetch.saved_headrevs = pd.getKeyValues("BB_URI_HEADREVS") | 161 | bb.fetch.saved_headrevs = pd['BB_URI_HEADREVS'].items() |
162 | except: | 162 | except: |
163 | pass | 163 | pass |
164 | pd.delDomain("BB_URI_HEADREVS") | 164 | del pd['BB_URI_HEADREVS'] |
165 | else: | 165 | else: |
166 | raise FetchError("Invalid SRCREV cache policy of: %s" % srcrev_policy) | 166 | raise FetchError("Invalid SRCREV cache policy of: %s" % srcrev_policy) |
167 | 167 | ||
@@ -169,18 +169,14 @@ def fetcher_init(d): | |||
169 | if hasattr(m, "init"): | 169 | if hasattr(m, "init"): |
170 | m.init(d) | 170 | m.init(d) |
171 | 171 | ||
172 | # Make sure our domains exist | ||
173 | pd.addDomain("BB_URI_HEADREVS") | ||
174 | pd.addDomain("BB_URI_LOCALCOUNT") | ||
175 | |||
176 | def fetcher_compare_revisions(d): | 172 | def fetcher_compare_revisions(d): |
177 | """ | 173 | """ |
178 | Compare the revisions in the persistant cache with current values and | 174 | Compare the revisions in the persistant cache with current values and |
179 | return true/false on whether they've changed. | 175 | return true/false on whether they've changed. |
180 | """ | 176 | """ |
181 | 177 | ||
182 | pd = persist_data.PersistData(d) | 178 | pd = persist_data.persist(d) |
183 | data = pd.getKeyValues("BB_URI_HEADREVS") | 179 | data = pd['BB_URI_HEADREVS'].items() |
184 | data2 = bb.fetch.saved_headrevs | 180 | data2 = bb.fetch.saved_headrevs |
185 | 181 | ||
186 | changed = False | 182 | changed = False |
@@ -757,14 +753,14 @@ class Fetch(object): | |||
757 | if not hasattr(self, "_latest_revision"): | 753 | if not hasattr(self, "_latest_revision"): |
758 | raise ParameterError | 754 | raise ParameterError |
759 | 755 | ||
760 | pd = persist_data.PersistData(d) | 756 | pd = persist_data.persist(d) |
757 | revs = pd['BB_URI_HEADREVS'] | ||
761 | key = self.generate_revision_key(url, ud, d) | 758 | key = self.generate_revision_key(url, ud, d) |
762 | rev = pd.getValue("BB_URI_HEADREVS", key) | 759 | rev = revs[key] |
763 | if rev != None: | 760 | if rev != None: |
764 | return str(rev) | 761 | return str(rev) |
765 | 762 | ||
766 | rev = self._latest_revision(url, ud, d) | 763 | revs[key] = rev = self._latest_revision(url, ud, d) |
767 | pd.setValue("BB_URI_HEADREVS", key, rev) | ||
768 | return rev | 764 | return rev |
769 | 765 | ||
770 | def sortable_revision(self, url, ud, d): | 766 | def sortable_revision(self, url, ud, d): |
@@ -774,17 +770,18 @@ class Fetch(object): | |||
774 | if hasattr(self, "_sortable_revision"): | 770 | if hasattr(self, "_sortable_revision"): |
775 | return self._sortable_revision(url, ud, d) | 771 | return self._sortable_revision(url, ud, d) |
776 | 772 | ||
777 | pd = persist_data.PersistData(d) | 773 | pd = persist_data.persist(d) |
774 | localcounts = pd['BB_URI_LOCALCOUNT'] | ||
778 | key = self.generate_revision_key(url, ud, d) | 775 | key = self.generate_revision_key(url, ud, d) |
779 | 776 | ||
780 | latest_rev = self._build_revision(url, ud, d) | 777 | latest_rev = self._build_revision(url, ud, d) |
781 | last_rev = pd.getValue("BB_URI_LOCALCOUNT", key + "_rev") | 778 | last_rev = localcounts[key + '_rev'] |
782 | uselocalcount = bb.data.getVar("BB_LOCALCOUNT_OVERRIDE", d, True) or False | 779 | uselocalcount = bb.data.getVar("BB_LOCALCOUNT_OVERRIDE", d, True) or False |
783 | count = None | 780 | count = None |
784 | if uselocalcount: | 781 | if uselocalcount: |
785 | count = Fetch.localcount_internal_helper(ud, d) | 782 | count = Fetch.localcount_internal_helper(ud, d) |
786 | if count is None: | 783 | if count is None: |
787 | count = pd.getValue("BB_URI_LOCALCOUNT", key + "_count") | 784 | count = localcounts[key + '_count'] |
788 | 785 | ||
789 | if last_rev == latest_rev: | 786 | if last_rev == latest_rev: |
790 | return str(count + "+" + latest_rev) | 787 | return str(count + "+" + latest_rev) |
@@ -800,8 +797,8 @@ class Fetch(object): | |||
800 | else: | 797 | else: |
801 | count = str(int(count) + 1) | 798 | count = str(int(count) + 1) |
802 | 799 | ||
803 | pd.setValue("BB_URI_LOCALCOUNT", key + "_rev", latest_rev) | 800 | localcounts[key + '_rev'] = latest_rev |
804 | pd.setValue("BB_URI_LOCALCOUNT", key + "_count", count) | 801 | localcounts[key + '_count'] = count |
805 | 802 | ||
806 | return str(count + "+" + latest_rev) | 803 | return str(count + "+" + latest_rev) |
807 | 804 | ||