diff options
| author | Peter Kjellerstedt <pkj@axis.com> | 2020-02-15 04:29:54 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-02-19 11:26:12 +0000 |
| commit | 96074fa9bdabf7fe7a47412c2739b77d73a94c64 (patch) | |
| tree | 4c0849e883391a401de9b9792efdade57e79cfd1 /bitbake/lib/bb/fetch2 | |
| parent | f8d1ac6653192f54ffdc372b223fff6b46344320 (diff) | |
| download | poky-96074fa9bdabf7fe7a47412c2739b77d73a94c64.tar.gz | |
bitbake: fetch2: Make fetcher_compare_revisions() work
This seems to have been broken for a very long time. Now it also works
regardless of BB_SRCREV_POLICY.
(Bitbake rev: ffd663a8e07e2e39e8ca2d2493f4f98037c5f9e4)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2')
| -rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index 1b7f573642..56462767e5 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py | |||
| @@ -485,17 +485,22 @@ def fetcher_init(d): | |||
| 485 | Called to initialize the fetchers once the configuration data is known. | 485 | Called to initialize the fetchers once the configuration data is known. |
| 486 | Calls before this must not hit the cache. | 486 | Calls before this must not hit the cache. |
| 487 | """ | 487 | """ |
| 488 | |||
| 489 | revs = bb.persist_data.persist('BB_URI_HEADREVS', d) | ||
| 490 | try: | ||
| 491 | # fetcher_init is called multiple times, so make sure we only save the | ||
| 492 | # revs the first time it is called. | ||
| 493 | if not bb.fetch2.saved_headrevs: | ||
| 494 | bb.fetch2.saved_headrevs = dict(revs) | ||
| 495 | except: | ||
| 496 | pass | ||
| 497 | |||
| 488 | # When to drop SCM head revisions controlled by user policy | 498 | # When to drop SCM head revisions controlled by user policy |
| 489 | srcrev_policy = d.getVar('BB_SRCREV_POLICY') or "clear" | 499 | srcrev_policy = d.getVar('BB_SRCREV_POLICY') or "clear" |
| 490 | if srcrev_policy == "cache": | 500 | if srcrev_policy == "cache": |
| 491 | logger.debug(1, "Keeping SRCREV cache due to cache policy of: %s", srcrev_policy) | 501 | logger.debug(1, "Keeping SRCREV cache due to cache policy of: %s", srcrev_policy) |
| 492 | elif srcrev_policy == "clear": | 502 | elif srcrev_policy == "clear": |
| 493 | logger.debug(1, "Clearing SRCREV cache due to cache policy of: %s", srcrev_policy) | 503 | logger.debug(1, "Clearing SRCREV cache due to cache policy of: %s", srcrev_policy) |
| 494 | revs = bb.persist_data.persist('BB_URI_HEADREVS', d) | ||
| 495 | try: | ||
| 496 | bb.fetch2.saved_headrevs = revs.items() | ||
| 497 | except: | ||
| 498 | pass | ||
| 499 | revs.clear() | 504 | revs.clear() |
| 500 | else: | 505 | else: |
| 501 | raise FetchError("Invalid SRCREV cache policy of: %s" % srcrev_policy) | 506 | raise FetchError("Invalid SRCREV cache policy of: %s" % srcrev_policy) |
| @@ -514,22 +519,12 @@ def fetcher_parse_done(): | |||
| 514 | 519 | ||
| 515 | def fetcher_compare_revisions(d): | 520 | def fetcher_compare_revisions(d): |
| 516 | """ | 521 | """ |
| 517 | Compare the revisions in the persistant cache with current values and | 522 | Compare the revisions in the persistent cache with the saved values from |
| 518 | return true/false on whether they've changed. | 523 | when bitbake was started and return true if they have changed. |
| 519 | """ | 524 | """ |
| 520 | 525 | ||
| 521 | data = bb.persist_data.persist('BB_URI_HEADREVS', d).items() | 526 | headrevs = dict(bb.persist_data.persist('BB_URI_HEADREVS', d)) |
| 522 | data2 = bb.fetch2.saved_headrevs | 527 | return headrevs != bb.fetch2.saved_headrevs |
| 523 | |||
| 524 | changed = False | ||
| 525 | for key in data: | ||
| 526 | if key not in data2 or data2[key] != data[key]: | ||
| 527 | logger.debug(1, "%s changed", key) | ||
| 528 | changed = True | ||
| 529 | return True | ||
| 530 | else: | ||
| 531 | logger.debug(2, "%s did not change", key) | ||
| 532 | return False | ||
| 533 | 528 | ||
| 534 | def mirror_from_string(data): | 529 | def mirror_from_string(data): |
| 535 | mirrors = (data or "").replace('\\n',' ').split() | 530 | mirrors = (data or "").replace('\\n',' ').split() |
