From 74b71864fed79ce60e721945c8e239b3ebf49200 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Fri, 4 Feb 2011 10:30:54 +0000 Subject: bitbake/fetch2: Drop old md5 handling code Drop some old md5 functions since we have improved functionality now which includes sha256 checksum support. This stops each download being md5 checksumed twice. Also change ".md5" stamp extentions to ".done" to better describe its use as a download complete marker file and no longer write the md5 sum to the files. Signed-off-by: Richard Purdie --- bitbake/lib/bb/fetch2/__init__.py | 38 ++++++++------------------------------ 1 file changed, 8 insertions(+), 30 deletions(-) (limited to 'bitbake') diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index 10c1e7355..bdec67776 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py @@ -357,17 +357,18 @@ def download(d, urls = None): download_update(localpath, ud.localpath) - if os.path.exists(ud.md5): - # Touch the md5 file to show active use of the download + if os.path.exists(ud.donestamp): + # Touch the done stamp file to show active use of the download try: - os.utime(ud.md5, None) + os.utime(ud.donestamp, None) except: # Errors aren't fatal here pass else: - # Only check the checksums if we've not seen this item before + # Only check the checksums if we've not seen this item before, then create the stamp verify_checksum(u, ud, d) - Fetch.write_md5sum(u, ud, d) + open(ud.donestamp, 'w').close() + bb.utils.unlockfile(lf) @@ -636,7 +637,7 @@ class FetchData(object): if self.localfile and self.localpath: # Note: These files should always be in DL_DIR whereas localpath may not be. basepath = bb.data.expand("${DL_DIR}/%s" % os.path.basename(self.localpath), d) - self.md5 = basepath + '.md5' + self.donestamp = basepath + '.done' self.lockfile = basepath + '.lock' def setup_localpath(self, d): @@ -779,7 +780,7 @@ class Fetch(object): """ if urldata.method.forcefetch(url, urldata, d): return True - elif os.path.exists(urldata.md5) and os.path.exists(urldata.localfile): + elif os.path.exists(urldata.donestamp) and os.path.exists(urldata.localfile): return False else: return True @@ -859,29 +860,6 @@ class Fetch(object): localcount_internal_helper = staticmethod(localcount_internal_helper) - def verify_md5sum(ud, got_sum): - """ - Verify the md5sum we wanted with the one we got - """ - wanted_sum = ud.parm.get('md5sum') - if not wanted_sum: - return True - - if wanted_sum != got_sum: - raise MD5SumError(ud.localpath, wanted_sum, got_sum, ud.url) - - verify_md5sum = staticmethod(verify_md5sum) - - def write_md5sum(url, ud, d): - md5data = bb.utils.md5_file(ud.localpath) - - Fetch.verify_md5sum(ud, md5data) - - md5out = file(ud.md5, 'w') - md5out.write(md5data) - md5out.close() - write_md5sum = staticmethod(write_md5sum) - def latest_revision(self, url, ud, d, name): """ Look in the cache for the latest revision, if not present ask the SCM. -- cgit v1.2.3