diff options
author | Joakim Tjernlund <Joakim.Tjernlund@infinera.com> | 2021-09-27 20:12:36 +0200 |
---|---|---|
committer | Fabian Groffen <grobian@gentoo.org> | 2021-09-27 20:12:36 +0200 |
commit | 0a88e57c8ed363aee8c30a6dd66a50d928cfcbd8 (patch) | |
tree | 501210a6001316da48646e9d58cfceadc7f21f77 | |
parent | libq/atom: introduce atom_compare_flg (diff) | |
download | portage-utils-0a88e57c.tar.gz portage-utils-0a88e57c.tar.bz2 portage-utils-0a88e57c.zip |
qmerge: run pkg_prerm right before merging files from replacing version
ensure that pkg_prerm can run with the files from the package it was
defined at, that is run it right before any files are replaced
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
-rw-r--r-- | qmerge.c | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -1428,6 +1428,22 @@ pkg_merge(int level, const depend_atom *qatom, const tree_match_ctx *mpkg) makeargv(config_protect, &cp_argc, &cp_argv); makeargv(config_protect_mask, &cpm_argc, &cpm_argv); + /* call pkg_prerm right before we merge the replacment version such + * that any logic it defines, can use stuff installed by the package */ + switch (replacing) { + case NEWER: + case OLDER: + case EQUAL: + if (!pretend) + pkg_run_func("vdb", pm_phases, PKG_PRERM, D, T, eapi, replver); + break; + default: + warn("no idea how we reached here."); + case ERROR: + case NOT_EQUAL: + break; + } + objs = NULL; if ((contents = fopen("vdb/CONTENTS", "w")) == NULL) { errf("could not open vdb/CONTENTS for writing"); @@ -1546,8 +1562,10 @@ pkg_unmerge(tree_pkg_ctx *pkg_ctx, depend_atom *rpkg, set *keep, portroot_fd = cat_ctx->ctx->portroot_fd; - /* execute the pkg_prerm step */ - if (!pretend) { + /* execute the pkg_prerm step if we're just unmerging, not when + * replacing, pkg_merge will have called prerm right before merging + * the replacement package */ + if (!pretend && rpkg == NULL) { buf = tree_pkg_meta_get(pkg_ctx, EAPI); phases = tree_pkg_meta_get(pkg_ctx, DEFINED_PHASES); buf = tree_pkg_meta_get(pkg_ctx, EAPI); /* when phases caused ralloc */ |