diff options
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 38 |
1 files changed, 8 insertions, 30 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index 10c1e73554..bdec67776f 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py | |||
@@ -357,17 +357,18 @@ def download(d, urls = None): | |||
357 | 357 | ||
358 | download_update(localpath, ud.localpath) | 358 | download_update(localpath, ud.localpath) |
359 | 359 | ||
360 | if os.path.exists(ud.md5): | 360 | if os.path.exists(ud.donestamp): |
361 | # Touch the md5 file to show active use of the download | 361 | # Touch the done stamp file to show active use of the download |
362 | try: | 362 | try: |
363 | os.utime(ud.md5, None) | 363 | os.utime(ud.donestamp, None) |
364 | except: | 364 | except: |
365 | # Errors aren't fatal here | 365 | # Errors aren't fatal here |
366 | pass | 366 | pass |
367 | else: | 367 | else: |
368 | # Only check the checksums if we've not seen this item before | 368 | # Only check the checksums if we've not seen this item before, then create the stamp |
369 | verify_checksum(u, ud, d) | 369 | verify_checksum(u, ud, d) |
370 | Fetch.write_md5sum(u, ud, d) | 370 | open(ud.donestamp, 'w').close() |
371 | |||
371 | 372 | ||
372 | bb.utils.unlockfile(lf) | 373 | bb.utils.unlockfile(lf) |
373 | 374 | ||
@@ -636,7 +637,7 @@ class FetchData(object): | |||
636 | if self.localfile and self.localpath: | 637 | if self.localfile and self.localpath: |
637 | # Note: These files should always be in DL_DIR whereas localpath may not be. | 638 | # Note: These files should always be in DL_DIR whereas localpath may not be. |
638 | basepath = bb.data.expand("${DL_DIR}/%s" % os.path.basename(self.localpath), d) | 639 | basepath = bb.data.expand("${DL_DIR}/%s" % os.path.basename(self.localpath), d) |
639 | self.md5 = basepath + '.md5' | 640 | self.donestamp = basepath + '.done' |
640 | self.lockfile = basepath + '.lock' | 641 | self.lockfile = basepath + '.lock' |
641 | 642 | ||
642 | def setup_localpath(self, d): | 643 | def setup_localpath(self, d): |
@@ -779,7 +780,7 @@ class Fetch(object): | |||
779 | """ | 780 | """ |
780 | if urldata.method.forcefetch(url, urldata, d): | 781 | if urldata.method.forcefetch(url, urldata, d): |
781 | return True | 782 | return True |
782 | elif os.path.exists(urldata.md5) and os.path.exists(urldata.localfile): | 783 | elif os.path.exists(urldata.donestamp) and os.path.exists(urldata.localfile): |
783 | return False | 784 | return False |
784 | else: | 785 | else: |
785 | return True | 786 | return True |
@@ -859,29 +860,6 @@ class Fetch(object): | |||
859 | 860 | ||
860 | localcount_internal_helper = staticmethod(localcount_internal_helper) | 861 | localcount_internal_helper = staticmethod(localcount_internal_helper) |
861 | 862 | ||
862 | def verify_md5sum(ud, got_sum): | ||
863 | """ | ||
864 | Verify the md5sum we wanted with the one we got | ||
865 | """ | ||
866 | wanted_sum = ud.parm.get('md5sum') | ||
867 | if not wanted_sum: | ||
868 | return True | ||
869 | |||
870 | if wanted_sum != got_sum: | ||
871 | raise MD5SumError(ud.localpath, wanted_sum, got_sum, ud.url) | ||
872 | |||
873 | verify_md5sum = staticmethod(verify_md5sum) | ||
874 | |||
875 | def write_md5sum(url, ud, d): | ||
876 | md5data = bb.utils.md5_file(ud.localpath) | ||
877 | |||
878 | Fetch.verify_md5sum(ud, md5data) | ||
879 | |||
880 | md5out = file(ud.md5, 'w') | ||
881 | md5out.write(md5data) | ||
882 | md5out.close() | ||
883 | write_md5sum = staticmethod(write_md5sum) | ||
884 | |||
885 | def latest_revision(self, url, ud, d, name): | 863 | def latest_revision(self, url, ud, d, name): |
886 | """ | 864 | """ |
887 | Look in the cache for the latest revision, if not present ask the SCM. | 865 | Look in the cache for the latest revision, if not present ask the SCM. |