Added support to check SHA256 integrity for binary pkgs.

This currently checks:
 - While removing, any file is checked and if hash doesn't match the
   file is ignored and not removed.
 - While installing, if a binary pkg file doesn't match with the one
   reported by the repository's pkg index file, the process will be
   stopped.

--HG--
extra : convert_revision : 42bb64e89a092f0ff3e7d951e5b26e45d63a60fe
This commit is contained in:
Juan RP 2009-02-26 05:41:49 +01:00
parent 99ba792509
commit 255c48b198
7 changed files with 144 additions and 83 deletions

View file

@ -54,29 +54,24 @@ xbps_install_binary_pkg_fini(prop_dictionary_t repo, prop_dictionary_t pkg,
prop_dictionary_get_cstring_nocopy(pkg, "pkgname", &pkgname);
prop_dictionary_get_cstring_nocopy(pkg, "version", &version);
prop_dictionary_get_cstring_nocopy(pkg, "short_desc", &desc);
assert(pkgname != NULL);
assert(version != NULL);
assert(desc != NULL);
if (repo == false)
automatic = true;
printf("Installing %s%s: found version %s ... ",
printf("Installing %s%s: found version %s ...\n",
automatic ? "dependency " : "", pkgname, version);
(void)fflush(stdout);
rv = xbps_unpack_binary_pkg(repo, pkg, destdir, flags);
if (rv == 0) {
rv = xbps_register_pkg(pkg, pkgname, version, desc, automatic);
if (rv != 0) {
printf("failed!\n");
printf("ERROR: couldn't register %s-%s! (%s)\n",
pkgname, version, strerror(rv));
return rv;
}
}
printf("done.\n");
return 0;
}