Add checksum support for downloaded files.

File download by http, ftp, pw support checksum. The %hash
directive provides a means of setting a hash used to
checksum the file.

Files on disk or just downloaded are checked.
This commit is contained in:
Chris Johns
2014-07-29 16:35:43 +10:00
parent c49e500042
commit a083b52921
28 changed files with 159 additions and 10 deletions

View File

@@ -308,6 +308,8 @@ class build:
for l in _prep:
args = l.split()
if len(args):
def err(msg):
raise error.general('%s: %s' % (package, msg))
if args[0] == '%setup':
if len(args) == 1:
raise error.general('invalid %%setup directive: %s' % (' '.join(args)))
@@ -315,8 +317,11 @@ class build:
self.source_setup(package, args[1:])
elif args[1] == 'patch':
self.patch_setup(package, args[1:])
elif args[0].startswith('%patch'):
self.patch(package, args)
elif args[0] in ['%patch', '%source']:
sources.process(args[0][1:], args[1:], self.macros, err)
elif args[0] == '%hash':
sources.hash(args[1:], self.macros, err)
self.hash(package, args)
else:
self.script.append(' '.join(args))