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:
parent
75cac4a637
commit
17404bdb42
24 changed files with 1216 additions and 529 deletions
17
lib/util.c
17
lib/util.c
|
@ -116,6 +116,7 @@ xbps_check_is_installed_pkg(const char *pkg)
|
|||
const char *reqver, *instver;
|
||||
char *pkgname;
|
||||
int rv = 0;
|
||||
pkg_state_t state = 0;
|
||||
|
||||
assert(pkg != NULL);
|
||||
|
||||
|
@ -125,16 +126,28 @@ xbps_check_is_installed_pkg(const char *pkg)
|
|||
dict = xbps_find_pkg_installed_from_plist(pkgname);
|
||||
if (dict == NULL) {
|
||||
free(pkgname);
|
||||
return -2; /* not installed */
|
||||
return -1; /* not installed */
|
||||
}
|
||||
|
||||
/*
|
||||
* Check that package state is fully installed, not
|
||||
* unpacked or something else.
|
||||
*/
|
||||
if (xbps_get_pkg_state_installed(pkgname, &state) != 0) {
|
||||
free(pkgname);
|
||||
return -1;
|
||||
}
|
||||
free(pkgname);
|
||||
|
||||
if (state != XBPS_PKG_STATE_INSTALLED)
|
||||
return -1;
|
||||
|
||||
/* Get version from installed package */
|
||||
prop_dictionary_get_cstring_nocopy(dict, "version", &instver);
|
||||
|
||||
/* Compare installed and required version. */
|
||||
rv = xbps_cmpver(instver, reqver);
|
||||
|
||||
free(pkgname);
|
||||
prop_object_release(dict);
|
||||
|
||||
return rv;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue