packager: Compare checksum before skipping tar in upload
Earlier, we solely checked if a tarball was present before skipping
the tarring of the autotest tarball. But this tarball might be stale.
So, we additionally compare the checksum of the tarball against what
checksum the pacakger dictionary has. If there is a mismatch,
then we perform the tar again, and upload the new tarball (and update
the corresponding checksum).
This is a speculative patch. There doesn't seem to be a way to reproduce
the Bug in question locally, and so this CL is being pushed.
At the very least it should not lead to any further degradation in
performance or functionality.
Commit-Ready: Prashant Malani <email@example.com>
Tested-by: Prashant Malani <firstname.lastname@example.org>
Reviewed-by: Aviv Keshet <email@example.com>
diff --git a/utils/packager.py b/utils/packager.py
index fdf0abf..4d9c1c1 100755
@@ -169,10 +169,11 @@
"enough space available: %s" % (temp_dir, e))
- # Check if tarball already exists. If it does, don't duplicate
- # the effort.
+ # Check if tarball already exists. If it does, and the checksum
+ # is the same as what is in the checksum dictionary, then don't
+ # create a tarball again.
tarball_path = os.path.join(pkg_dir, pkg_name);
- if os.path.exists(tarball_path):
+ if os.path.exists(tarball_path) and pkgmgr.compare_checksum(tarball_path):
print("process_packages: Tarball %s already exists" %