lib: tighten repolock

when repolocked package has newer version in other repository and other
package depend on that newer version, repolocked package was updated and
swiched to other repo, while repolock status was left enabled
This commit is contained in:
Piotr Wójcik 2021-07-19 21:29:32 +02:00 committed by Duncan Overbruck
parent ee2b5fb56f
commit 59ea6a5388
No known key found for this signature in database
GPG Key ID: 335C1D17EC3D6E35

View File

@ -308,8 +308,23 @@ repo_deps(struct xbps_handle *xhp,
* If dependency does not match add pkg into the missing
* deps array and pass to next one.
*/
if (((curpkgd = xbps_rpool_get_pkg(xhp, reqpkg)) == NULL) &&
((curpkgd = xbps_rpool_get_virtualpkg(xhp, reqpkg)) == NULL)) {
if (xbps_dictionary_get(curpkgd, "repolock")) {
const char *repourl = NULL;
struct xbps_repo *repo = NULL;
xbps_dbg_printf(xhp, "`%s' is repolocked, looking at single repository.\n", reqpkg);
xbps_dictionary_get_cstring_nocopy(curpkgd, "repository", &repourl);
if (repourl && (repo = xbps_regget_repo(xhp, repourl))) {
curpkgd = xbps_repo_get_pkg(repo, reqpkg);
} else {
curpkg = NULL;
}
} else {
curpkgd = xbps_rpool_get_pkg(xhp, reqpkg);
if (!curpkgd) {
curpkgd = xbps_rpool_get_virtualpkg(xhp, reqpkg);
}
}
if (curpkgd == NULL) {
/* pkg not found, there was some error */
if (errno && errno != ENOENT) {
xbps_dbg_printf(xhp, "failed to find pkg for `%s' in rpool: %s\n", reqpkg, strerror(errno));