When downloading/importing packages, enforce all checksums

This commit is contained in:
Andrey Smirnov
2017-04-15 01:33:08 +03:00
parent c40025a335
commit 1f3cb2db5d
12 changed files with 57 additions and 16 deletions
+8
View File
@@ -142,6 +142,14 @@ func (pool *PackagePool) Import(srcPath, basename string, checksums *utils.Check
return "", err
}
if checksums.MD5 == "" || checksums.SHA256 == "" || checksums.Size != sourceInfo.Size() {
// need to update checksums, MD5 and SHA256 should be always defined
*checksums, err = utils.ChecksumsForFile(srcPath)
if err != nil {
return "", err
}
}
// build target path
// TODO: replace with new build scheme
poolPath, err := pool.LegacyPath(basename, checksums)