Don't download patch archive if already download

the behavior of download patch should
keep same as download package.
pull/2259/merge
liugang 7 years ago committed by Jussi Pakkanen
parent 5e47739633
commit c93bce7839
  1. 6
      mesonbuild/wrap/wrap.py

@ -292,6 +292,11 @@ class Resolver:
raise RuntimeError('Incorrect hash for source %s:\n %s expected\n %s actual.' % (packagename, expected, dhash)) raise RuntimeError('Incorrect hash for source %s:\n %s expected\n %s actual.' % (packagename, expected, dhash))
os.rename(tmpfile, ofname) os.rename(tmpfile, ofname)
if p.has_patch(): if p.has_patch():
patch_filename = p.get('patch_filename')
filename = os.path.join(self.cachedir, patch_filename)
if os.path.exists(filename):
mlog.log('Using', mlog.bold(patch_filename), 'from cache.')
else:
purl = p.get('patch_url') purl = p.get('patch_url')
mlog.log('Downloading patch from', mlog.bold(purl)) mlog.log('Downloading patch from', mlog.bold(purl))
phash, tmpfile = self.get_data(purl) phash, tmpfile = self.get_data(purl)
@ -299,7 +304,6 @@ class Resolver:
if phash != expected: if phash != expected:
os.remove(tmpfile) os.remove(tmpfile)
raise RuntimeError('Incorrect hash for patch %s:\n %s expected\n %s actual' % (packagename, expected, phash)) raise RuntimeError('Incorrect hash for patch %s:\n %s expected\n %s actual' % (packagename, expected, phash))
filename = os.path.join(self.cachedir, p.get('patch_filename'))
os.rename(tmpfile, filename) os.rename(tmpfile, filename)
else: else:
mlog.log('Package does not require patch.') mlog.log('Package does not require patch.')

Loading…
Cancel
Save