1 |
commit: 0a88e57c8ed363aee8c30a6dd66a50d928cfcbd8 |
2 |
Author: Joakim Tjernlund <Joakim.Tjernlund <AT> infinera <DOT> com> |
3 |
AuthorDate: Mon Sep 27 18:12:36 2021 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Sep 27 18:12:36 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=0a88e57c |
7 |
|
8 |
qmerge: run pkg_prerm right before merging files from replacing version |
9 |
|
10 |
ensure that pkg_prerm can run with the files from the package it was |
11 |
defined at, that is run it right before any files are replaced |
12 |
|
13 |
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> |
14 |
|
15 |
qmerge.c | 22 ++++++++++++++++++++-- |
16 |
1 file changed, 20 insertions(+), 2 deletions(-) |
17 |
|
18 |
diff --git a/qmerge.c b/qmerge.c |
19 |
index cf511ad..406121c 100644 |
20 |
--- a/qmerge.c |
21 |
+++ b/qmerge.c |
22 |
@@ -1428,6 +1428,22 @@ pkg_merge(int level, const depend_atom *qatom, const tree_match_ctx *mpkg) |
23 |
makeargv(config_protect, &cp_argc, &cp_argv); |
24 |
makeargv(config_protect_mask, &cpm_argc, &cpm_argv); |
25 |
|
26 |
+ /* call pkg_prerm right before we merge the replacment version such |
27 |
+ * that any logic it defines, can use stuff installed by the package */ |
28 |
+ switch (replacing) { |
29 |
+ case NEWER: |
30 |
+ case OLDER: |
31 |
+ case EQUAL: |
32 |
+ if (!pretend) |
33 |
+ pkg_run_func("vdb", pm_phases, PKG_PRERM, D, T, eapi, replver); |
34 |
+ break; |
35 |
+ default: |
36 |
+ warn("no idea how we reached here."); |
37 |
+ case ERROR: |
38 |
+ case NOT_EQUAL: |
39 |
+ break; |
40 |
+ } |
41 |
+ |
42 |
objs = NULL; |
43 |
if ((contents = fopen("vdb/CONTENTS", "w")) == NULL) { |
44 |
errf("could not open vdb/CONTENTS for writing"); |
45 |
@@ -1546,8 +1562,10 @@ pkg_unmerge(tree_pkg_ctx *pkg_ctx, depend_atom *rpkg, set *keep, |
46 |
|
47 |
portroot_fd = cat_ctx->ctx->portroot_fd; |
48 |
|
49 |
- /* execute the pkg_prerm step */ |
50 |
- if (!pretend) { |
51 |
+ /* execute the pkg_prerm step if we're just unmerging, not when |
52 |
+ * replacing, pkg_merge will have called prerm right before merging |
53 |
+ * the replacement package */ |
54 |
+ if (!pretend && rpkg == NULL) { |
55 |
buf = tree_pkg_meta_get(pkg_ctx, EAPI); |
56 |
phases = tree_pkg_meta_get(pkg_ctx, DEFINED_PHASES); |
57 |
buf = tree_pkg_meta_get(pkg_ctx, EAPI); /* when phases caused ralloc */ |