Created
January 26, 2026 18:52
-
-
Save jperkin/b9b84a178c1cc6ac56be26eab265def9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/actions.c b/actions.c | |
| index 41a0cc4..b373b65 100644 | |
| --- a/actions.c | |
| +++ b/actions.c | |
| @@ -653,6 +653,34 @@ pkgin_install(char **pkgargs, int do_inst, int upgrade) | |
| break; | |
| } | |
| } | |
| + /* | |
| + * Filter out ACTION_REFRESH packages that were | |
| + * explicitly passed as corepkgs. They were | |
| + * included only to check for upgrades, not for | |
| + * installation. Note that pkg_impact() modifies | |
| + * corepkgs to contain full package names, so we | |
| + * check for both exact match and prefix match. | |
| + */ | |
| + if (coreupg) { | |
| + Pkglist *tmpp; | |
| + char **cp; | |
| + size_t len; | |
| + SLIST_FOREACH_SAFE(p, impacthead, next, tmpp) { | |
| + if (p->action != ACTION_REFRESH) | |
| + continue; | |
| + for (cp = corepkgs; *cp != NULL; cp++) { | |
| + len = strlen(*cp); | |
| + if (strcmp(p->rpkg->full, *cp) == 0 || | |
| + (strncmp(p->rpkg->full, *cp, len) == 0 && | |
| + p->rpkg->full[len] == '-')) { | |
| + SLIST_REMOVE(impacthead, p, | |
| + Pkglist, next); | |
| + free_pkglist_entry(&p); | |
| + break; | |
| + } | |
| + } | |
| + } | |
| + } | |
| } | |
| } | |
| } | |
| diff --git a/impact.c b/impact.c | |
| index 154a6f1..073ceaf 100644 | |
| --- a/impact.c | |
| +++ b/impact.c | |
| @@ -416,11 +416,14 @@ resolve_forward_deps(Plisthead *upgrades, Plistarray *impacthead, Pkglist *pkg) | |
| { | |
| Plisthead *deps; | |
| Pkglist *p, *npkg, *save; | |
| + action_t action; | |
| deps = init_head(); | |
| get_depends(pkg->rpkg->full, deps, DEPENDS_REMOTE); | |
| SLIST_FOREACH_SAFE(p, deps, next, save) { | |
| + Pkglist *lpkg; | |
| + | |
| SLIST_REMOVE(deps, p, Pkglist, next); | |
| /* | |
| * If we've already seen this package then we're done. | |
| @@ -430,13 +433,29 @@ resolve_forward_deps(Plisthead *upgrades, Plistarray *impacthead, Pkglist *pkg) | |
| continue; | |
| } | |
| + /* | |
| + * Skip forward deps that are already installed and satisfy | |
| + * the requirement (ACTION_REFRESH). ABI concerns apply to | |
| + * reverse dependencies, not forward dependencies. | |
| + */ | |
| + lpkg = find_local_pkg(p->rpkg->name, p->rpkg->name); | |
| + if (lpkg != NULL && | |
| + calculate_action(lpkg, p->rpkg) == ACTION_REFRESH) { | |
| + free_pkglist_entry(&p); | |
| + continue; | |
| + } | |
| + | |
| /* | |
| * Otherwise set the dependency to the next level, add to | |
| - * impact, and if it's going to be an upgrade then add it to | |
| - * upgrades so it is considered in the next loop. | |
| + * impact, and if it's going to be an upgrade, refresh, or | |
| + * install then add it to upgrades so it is considered in | |
| + * the next loop. Install packages need their forward deps | |
| + * processed too. | |
| */ | |
| p->level = pkg->level + 1; | |
| - if ((add_remote_to_impact(impacthead, p)) == ACTION_UPGRADE) { | |
| + action = add_remote_to_impact(impacthead, p); | |
| + if (action == ACTION_UPGRADE || action == ACTION_REFRESH || | |
| + action == ACTION_INSTALL) { | |
| npkg = malloc_pkglist(); | |
| npkg->ipkg = p; | |
| SLIST_INSERT_HEAD(upgrades, npkg, next); | |
| @@ -451,6 +470,18 @@ resolve_reverse_deps(Plisthead *upgrades, Plistarray *impacthead, Pkglist *pkg) | |
| { | |
| Plisthead *revdeps; | |
| Pkglist *p, *npkg, *save; | |
| + action_t action; | |
| + | |
| + /* | |
| + * New packages (ACTION_INSTALL) don't have local package info, | |
| + * so there are no reverse dependencies to process. | |
| + * | |
| + * ACTION_REFRESH packages have no ABI changes, so their reverse | |
| + * dependencies don't need to be rebuilt. We still need to check | |
| + * their forward dependencies for changes (handled elsewhere). | |
| + */ | |
| + if (pkg->lpkg == NULL || pkg->action == ACTION_REFRESH) | |
| + return; | |
| revdeps = init_head(); | |
| get_depends(pkg->lpkg->full, revdeps, DEPENDS_REVERSE); | |
| @@ -480,11 +511,12 @@ resolve_reverse_deps(Plisthead *upgrades, Plistarray *impacthead, Pkglist *pkg) | |
| /* | |
| * Otherwise set the dependency to a lower level, add to | |
| - * impact, and if it's going to be an upgrade then add it to | |
| - * upgrades so it is considered in the next loop. | |
| + * impact, and if it's going to be an upgrade or refresh then | |
| + * add it to upgrades so it is considered in the next loop. | |
| */ | |
| p->level = pkg->level - 1; | |
| - if ((add_remote_to_impact(impacthead, p)) == ACTION_UPGRADE) { | |
| + action = add_remote_to_impact(impacthead, p); | |
| + if (action == ACTION_UPGRADE || action == ACTION_REFRESH) { | |
| npkg = malloc_pkglist(); | |
| npkg->ipkg = p; | |
| SLIST_INSERT_HEAD(upgrades, npkg, next); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment