Improve 869466278b
for non virtual packages.
If dependency is installed but does not satisfy the requirements, mark it
as an update and not install. The commit 869466278b
changed the logic
for virtual and non virtual packages.
This commit is contained in:
parent
cafbca06e7
commit
d94995eb5a
@ -235,8 +235,7 @@ find_repo_deps(struct xbps_handle *xhp,
|
|||||||
state = XBPS_PKG_STATE_NOT_INSTALLED;
|
state = XBPS_PKG_STATE_NOT_INSTALLED;
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* Check if installed version matches the
|
* Check if installed version matches the required pkgdep version.
|
||||||
* required pkgdep version.
|
|
||||||
*/
|
*/
|
||||||
xbps_dictionary_get_cstring_nocopy(curpkgd,
|
xbps_dictionary_get_cstring_nocopy(curpkgd,
|
||||||
"pkgver", &pkgver_q);
|
"pkgver", &pkgver_q);
|
||||||
@ -249,9 +248,8 @@ find_repo_deps(struct xbps_handle *xhp,
|
|||||||
|
|
||||||
if (foundvpkg && xbps_match_virtual_pkg_in_dict(curpkgd, reqpkg)) {
|
if (foundvpkg && xbps_match_virtual_pkg_in_dict(curpkgd, reqpkg)) {
|
||||||
/*
|
/*
|
||||||
* Check if required dependency is a virtual
|
* Check if required dependency is a virtual package and is satisfied
|
||||||
* package and is satisfied by an
|
* by an installed package.
|
||||||
* installed package.
|
|
||||||
*/
|
*/
|
||||||
xbps_dbg_printf_append(xhp, "[virtual] satisfied by `%s'.\n", pkgver_q);
|
xbps_dbg_printf_append(xhp, "[virtual] satisfied by `%s'.\n", pkgver_q);
|
||||||
free(pkgname);
|
free(pkgname);
|
||||||
@ -259,16 +257,17 @@ find_repo_deps(struct xbps_handle *xhp,
|
|||||||
}
|
}
|
||||||
rv = xbps_pkgpattern_match(pkgver_q, reqpkg);
|
rv = xbps_pkgpattern_match(pkgver_q, reqpkg);
|
||||||
if (rv == 0) {
|
if (rv == 0) {
|
||||||
|
if (foundvpkg) {
|
||||||
|
/*
|
||||||
|
* Dependency is installed and is a virtual package; check
|
||||||
|
* if the virtual package should replace it and then
|
||||||
|
* update it, otherwise install dependency.
|
||||||
|
*/
|
||||||
xbps_array_t replaces;
|
xbps_array_t replaces;
|
||||||
const char *pkgdep;
|
const char *pkgdep;
|
||||||
char *pkgdepname;
|
char *pkgdepname;
|
||||||
bool matching_vpkg = false;
|
bool matching_vpkg = false;
|
||||||
/*
|
|
||||||
* Package is installed but does not match
|
|
||||||
* the dependency pattern, if dependency does not
|
|
||||||
* replace the provided vpkg, update it.
|
|
||||||
*/
|
|
||||||
if (foundvpkg) {
|
|
||||||
replaces = xbps_dictionary_get(curpkgd, "replaces");
|
replaces = xbps_dictionary_get(curpkgd, "replaces");
|
||||||
for (unsigned int x = 0; x < xbps_array_count(replaces); x++) {
|
for (unsigned int x = 0; x < xbps_array_count(replaces); x++) {
|
||||||
xbps_array_get_cstring_nocopy(replaces, x, &pkgdep);
|
xbps_array_get_cstring_nocopy(replaces, x, &pkgdep);
|
||||||
@ -281,35 +280,46 @@ find_repo_deps(struct xbps_handle *xhp,
|
|||||||
}
|
}
|
||||||
free(pkgdepname);
|
free(pkgdepname);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (matching_vpkg) {
|
if (matching_vpkg) {
|
||||||
xbps_dbg_printf_append(xhp, "installed `%s', must be updated.", pkgver_q);
|
xbps_dbg_printf_append(xhp, "installed `%s', must be updated.", pkgver_q);
|
||||||
if (xbps_dictionary_get(curpkgd, "hold"))
|
if (xbps_dictionary_get(curpkgd, "hold")) {
|
||||||
xbps_dbg_printf_append(xhp, " on hold state! ignoring update.\n");
|
xbps_dbg_printf_append(xhp, " on hold state! ignoring update.\n");
|
||||||
else {
|
} else {
|
||||||
xbps_dbg_printf_append(xhp, "\n");
|
xbps_dbg_printf_append(xhp, "\n");
|
||||||
reason = "update";
|
reason = "update";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
xbps_dbg_printf_append(xhp, "\n");
|
xbps_dbg_printf_append(xhp, "installed `%s (vpkg)', but does not replace it.\n", pkgver_q);
|
||||||
reason = "install";
|
reason = "install";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
xbps_dbg_printf_append(xhp, "installed `%s', must be updated.", pkgver_q);
|
||||||
|
/*
|
||||||
|
* Dependency is installed but its version does not
|
||||||
|
* satisfy the requirements, update it to a greater version.
|
||||||
|
*/
|
||||||
|
if (xbps_dictionary_get(curpkgd, "hold")) {
|
||||||
|
xbps_dbg_printf_append(xhp, " on hold state! ignoring update.\n");
|
||||||
|
} else {
|
||||||
|
xbps_dbg_printf_append(xhp, "\n");
|
||||||
|
reason = "update";
|
||||||
|
}
|
||||||
|
}
|
||||||
free(pkgname);
|
free(pkgname);
|
||||||
} else if (rv == 1) {
|
} else if (rv == 1) {
|
||||||
free(pkgname);
|
free(pkgname);
|
||||||
rv = 0;
|
rv = 0;
|
||||||
if (state == XBPS_PKG_STATE_UNPACKED) {
|
if (state == XBPS_PKG_STATE_UNPACKED) {
|
||||||
/*
|
/*
|
||||||
* Package matches the dependency
|
* Package matches the dependency pattern but was only unpacked,
|
||||||
* pattern but was only unpacked,
|
|
||||||
* configure pkg.
|
* configure pkg.
|
||||||
*/
|
*/
|
||||||
xbps_dbg_printf_append(xhp, "installed `%s', must be configured.\n", pkgver_q);
|
xbps_dbg_printf_append(xhp, "installed `%s', must be configured.\n", pkgver_q);
|
||||||
reason = "configure";
|
reason = "configure";
|
||||||
} else if (state == XBPS_PKG_STATE_INSTALLED) {
|
} else if (state == XBPS_PKG_STATE_INSTALLED) {
|
||||||
/*
|
/*
|
||||||
* Package matches the dependency
|
* Package matches the dependency pattern and is fully installed,
|
||||||
* pattern and is fully installed,
|
|
||||||
* skip to next one.
|
* skip to next one.
|
||||||
*/
|
*/
|
||||||
xbps_dbg_printf_append(xhp, "installed `%s'.\n", pkgver_q);
|
xbps_dbg_printf_append(xhp, "installed `%s'.\n", pkgver_q);
|
||||||
|
Loading…
Reference in New Issue
Block a user