Mega-commit with improvements and changes done in the past days.
- Introduce package states: unpacked, broken, installed, etc. Not yet finished, only unpacked and installed are used for now. - Move package metadata files in binary packages directly to the top directory, this speeds up some ops and makes easier to continue working in future changes. - xbps-bin: -C flag to check the hash of package files has been superseded by the 'check' target, which verifies the integrity of an installed package. - Use the 'essential' object when upgrading packages, overwritting current files. This is needed for critical packages like sh, libc and others. - Miscellaneous tweaks and improvements thorough the code. --HG-- extra : convert_revision : 2073fcc123efc24b3e9327b5e22aa91752f20df6
This commit is contained in:
@@ -197,14 +197,14 @@ show_pkg_info_from_metadir(const char *pkgname)
|
||||
}
|
||||
|
||||
int
|
||||
show_pkg_files_from_metadir(const char *pkgname, bool hash)
|
||||
show_pkg_files_from_metadir(const char *pkgname)
|
||||
{
|
||||
prop_dictionary_t pkgd;
|
||||
prop_array_t array;
|
||||
prop_object_iterator_t iter = NULL;
|
||||
prop_object_t obj;
|
||||
const char *destdir, *file, *sha256;
|
||||
char *plist, *path = NULL, *array_str = "files";
|
||||
const char *destdir, *file;
|
||||
char *plist, *array_str = "files";
|
||||
int i, rv = 0;
|
||||
|
||||
destdir = xbps_get_rootdir();
|
||||
@@ -233,7 +233,6 @@ show_pkg_files_from_metadir(const char *pkgname, bool hash)
|
||||
printf("%s\n", file);
|
||||
}
|
||||
prop_object_iterator_release(iter);
|
||||
iter = NULL;
|
||||
}
|
||||
|
||||
/* Files and configuration files. */
|
||||
@@ -254,41 +253,10 @@ show_pkg_files_from_metadir(const char *pkgname, bool hash)
|
||||
}
|
||||
while ((obj = prop_object_iterator_next(iter))) {
|
||||
prop_dictionary_get_cstring_nocopy(obj, "file", &file);
|
||||
if (hash == false) {
|
||||
printf("%s\n", file);
|
||||
continue;
|
||||
}
|
||||
|
||||
printf("%s", file);
|
||||
if (destdir) {
|
||||
path = xbps_xasprintf("%s/%s", destdir, file);
|
||||
if (path == NULL) {
|
||||
rv = EINVAL;
|
||||
goto out2;
|
||||
}
|
||||
}
|
||||
prop_dictionary_get_cstring_nocopy(obj,
|
||||
"sha256", &sha256);
|
||||
if (destdir)
|
||||
rv = xbps_check_file_hash(path, sha256);
|
||||
else
|
||||
rv = xbps_check_file_hash(file, sha256);
|
||||
|
||||
if (rv != 0 && rv != ERANGE)
|
||||
printf(" (can't check: %s)", strerror(rv));
|
||||
else if (rv == ERANGE)
|
||||
printf(" WARNING! SHA256 HASH MISMATCH!");
|
||||
|
||||
printf("\n");
|
||||
if (destdir)
|
||||
free(path);
|
||||
printf("%s\n", file);
|
||||
}
|
||||
prop_object_iterator_release(iter);
|
||||
iter = NULL;
|
||||
}
|
||||
out2:
|
||||
if (iter != NULL)
|
||||
prop_object_iterator_release(iter);
|
||||
out:
|
||||
prop_object_release(pkgd);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user