fix patch archive never download on some case

Fix issue #2359
pull/2365/head
liugang 7 years ago
parent bea6b1a6f6
commit 7060b15773
  1. 20
      mesonbuild/wrap/wrap.py

@ -272,16 +272,16 @@ class Resolver:
ofname = os.path.join(self.cachedir, p.get('source_filename'))
if os.path.exists(ofname):
mlog.log('Using', mlog.bold(packagename), 'from cache.')
return
srcurl = p.get('source_url')
mlog.log('Downloading', mlog.bold(packagename), 'from', mlog.bold(srcurl))
srcdata = self.get_data(srcurl)
dhash = self.get_hash(srcdata)
expected = p.get('source_hash')
if dhash != expected:
raise RuntimeError('Incorrect hash for source %s:\n %s expected\n %s actual.' % (packagename, expected, dhash))
with open(ofname, 'wb') as f:
f.write(srcdata)
else:
srcurl = p.get('source_url')
mlog.log('Downloading', mlog.bold(packagename), 'from', mlog.bold(srcurl))
srcdata = self.get_data(srcurl)
dhash = self.get_hash(srcdata)
expected = p.get('source_hash')
if dhash != expected:
raise RuntimeError('Incorrect hash for source %s:\n %s expected\n %s actual.' % (packagename, expected, dhash))
with open(ofname, 'wb') as f:
f.write(srcdata)
if p.has_patch():
purl = p.get('patch_url')
mlog.log('Downloading patch from', mlog.bold(purl))

Loading…
Cancel
Save