From 59ea6a5388d8f702e5d0c0a405d8f2d190b062f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= Date: Mon, 19 Jul 2021 21:29:32 +0200 Subject: [PATCH] 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 --- lib/transaction_pkg_deps.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/transaction_pkg_deps.c b/lib/transaction_pkg_deps.c index 7c2ace2e..2ea8d61b 100644 --- a/lib/transaction_pkg_deps.c +++ b/lib/transaction_pkg_deps.c @@ -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));