change dump_posttrans mechanism to imply --noposttrans

OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=581
This commit is contained in:
Michael Schröder 2021-04-09 11:37:24 +00:00 committed by Git OBS Bridge
parent 7cf402eda6
commit 8c896c25d5
2 changed files with 52 additions and 37 deletions

View File

@ -1,5 +1,5 @@
--- ./lib/poptI.c.orig 2020-06-23 12:13:01.896628395 +0000
+++ ./lib/poptI.c 2021-03-30 09:33:10.054524821 +0000
--- ./lib/poptI.c.orig 2021-04-09 11:28:12.359647290 +0000
+++ ./lib/poptI.c 2021-04-09 11:28:15.523640983 +0000
@@ -265,6 +265,10 @@ struct poptOption rpmInstallPoptTable[]
&rpmIArgs.installInterfaceFlags, (INSTALL_REINSTALL|INSTALL_INSTALL),
N_("reinstall package(s)"),
@ -11,8 +11,8 @@
POPT_TABLEEND
};
--- ./lib/psm.c.orig 2021-03-30 09:33:05.862532224 +0000
+++ ./lib/psm.c 2021-03-30 09:33:10.054524821 +0000
--- ./lib/psm.c.orig 2021-04-09 11:28:12.359647290 +0000
+++ ./lib/psm.c 2021-04-09 11:28:15.527640975 +0000
@@ -810,7 +810,7 @@ static rpmRC rpmPackageErase(rpmts ts, r
}
if (rc) break;
@ -22,8 +22,8 @@
/* Prepare post transaction uninstall triggers */
rpmtriggersPrepPostUnTransFileTrigs(psm->ts, psm->te);
}
--- ./lib/rpmcli.h.orig 2020-05-28 10:04:25.037136686 +0000
+++ ./lib/rpmcli.h 2021-03-30 09:33:10.054524821 +0000
--- ./lib/rpmcli.h.orig 2021-04-09 11:28:12.359647290 +0000
+++ ./lib/rpmcli.h 2021-04-09 11:28:15.527640975 +0000
@@ -304,6 +304,7 @@ enum rpmInstallFlags_e {
INSTALL_ERASE = (1 << 8), /*!< from --erase */
INSTALL_ALLMATCHES = (1 << 9), /*!< from --allmatches */
@ -48,8 +48,8 @@
*/
extern struct rpmInstallArguments_s rpmIArgs;
--- ./lib/rpminstall.c.orig 2020-05-28 10:04:25.040136702 +0000
+++ ./lib/rpminstall.c 2021-03-30 09:33:10.054524821 +0000
--- ./lib/rpminstall.c.orig 2021-04-09 11:28:12.363647282 +0000
+++ ./lib/rpminstall.c 2021-04-09 11:28:15.527640975 +0000
@@ -4,6 +4,8 @@
#include "system.h"
@ -92,8 +92,8 @@
+ argvFree(manifest);
+ return rc;
+}
--- ./lib/rpmtriggers.c.orig 2020-05-28 10:04:25.043136719 +0000
+++ ./lib/rpmtriggers.c 2021-03-30 09:33:10.054524821 +0000
--- ./lib/rpmtriggers.c.orig 2021-04-09 11:28:12.363647282 +0000
+++ ./lib/rpmtriggers.c 2021-04-09 11:31:46.999219563 +0000
@@ -1,5 +1,6 @@
#include "system.h"
@ -110,7 +110,7 @@
unsigned int tix, unsigned int priority)
{
if (trigs->count == trigs->alloced) {
@@ -177,6 +178,16 @@ int runPostUnTransFileTrigs(rpmts ts)
@@ -177,6 +178,14 @@ int runPostUnTransFileTrigs(rpmts ts)
if (trigH == NULL)
continue;
@ -118,16 +118,14 @@
+ char *trigNEVRA = headerGetAsString(trigH, RPMTAG_NEVRA);
+ rpmlog(RPMLOG_NOTICE, "dump_posttrans: transfiletriggerpostun %u %u %s\n", trigs->triggerInfo[i].tix, trigs->triggerInfo[i].hdrNum, trigNEVRA);
+ free(trigNEVRA);
+ if ((rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS|RPMTRANS_FLAG_NOTRIGGERPOSTUN)) != 0) {
+ headerFree(trigH);
+ continue;
+ }
+ headerFree(trigH);
+ continue;
+ }
+
/* Prepare and run script */
script = rpmScriptFromTriggerTag(trigH,
triggertag(RPMSENSE_TRIGGERPOSTUN),
@@ -583,6 +594,19 @@ rpmRC runImmedFileTriggers(rpmts ts, rpm
@@ -583,6 +592,16 @@ rpmRC runImmedFileTriggers(rpmts ts, rpm
rpmTagVal priorityTag;
rpmtriggers triggers;
@ -138,17 +136,14 @@
+ rpmlog(RPMLOG_NOTICE, "dump_posttrans: install %u %s\n", hdrNum, trigNEVRA);
+ free(trigNEVRA);
+ }
+ if ((rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS|RPMTRANS_FLAG_NOTRIGGERIN)) != 0) {
+
+ headerFree(trigH);
+ return RPMRC_OK;
+ }
+ headerFree(trigH);
+ return RPMRC_OK;
+ }
if (tm == RPMSCRIPT_FILETRIGGER) {
priorityTag = RPMTAG_FILETRIGGERPRIORITIES;
} else {
--- ./lib/rpmtriggers.h.orig 2020-05-28 10:04:25.043136719 +0000
+++ ./lib/rpmtriggers.h 2021-03-30 09:33:10.054524821 +0000
--- ./lib/rpmtriggers.h.orig 2021-04-09 11:28:12.363647282 +0000
+++ ./lib/rpmtriggers.h 2021-04-09 11:28:15.527640975 +0000
@@ -27,6 +27,10 @@ rpmtriggers rpmtriggersCreate(unsigned i
RPM_GNUC_INTERNAL
rpmtriggers rpmtriggersFree(rpmtriggers triggers);
@ -160,8 +155,8 @@
/*
* Prepare post trans uninstall file triggers. After transcation uninstalled
* files are not saved anywhere. So we need during uninstalation of every
--- ./lib/rpmts.h.orig 2021-03-30 09:33:05.886532181 +0000
+++ ./lib/rpmts.h 2021-03-30 09:33:10.054524821 +0000
--- ./lib/rpmts.h.orig 2021-04-09 11:28:12.363647282 +0000
+++ ./lib/rpmts.h 2021-04-09 11:28:15.527640975 +0000
@@ -229,6 +229,15 @@ int rpmtsOrder(rpmts ts);
int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet);
@ -178,8 +173,8 @@
* Reference a transaction set instance.
* @param ts transaction set
* @return new transaction set reference
--- ./lib/rpmts_internal.h.orig 2020-05-28 10:04:25.043136719 +0000
+++ ./lib/rpmts_internal.h 2021-03-30 09:33:10.054524821 +0000
--- ./lib/rpmts_internal.h.orig 2021-04-09 11:28:12.363647282 +0000
+++ ./lib/rpmts_internal.h 2021-04-09 11:28:15.527640975 +0000
@@ -87,6 +87,7 @@ struct rpmts_s {
rpmtriggers trigs2run; /*!< Transaction file triggers */
@ -188,8 +183,8 @@
};
#ifdef __cplusplus
--- ./lib/transaction.c.orig 2021-03-30 09:33:05.866532216 +0000
+++ ./lib/transaction.c 2021-03-30 09:33:10.054524821 +0000
--- ./lib/transaction.c.orig 2021-04-09 11:28:12.363647282 +0000
+++ ./lib/transaction.c 2021-04-09 11:33:22.247029757 +0000
@@ -1468,6 +1468,8 @@ static int rpmtsSetup(rpmts ts, rpmprobF
/* Get available space on mounted file systems. */
(void) rpmtsInitDSI(ts);
@ -199,14 +194,27 @@
return 0;
}
@@ -1856,12 +1858,15 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rp
if (!(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS|RPMTRANS_FLAG_NOTRIGGERIN))) {
runFileTriggers(ts, NULL, RPMSENSE_TRIGGERIN, RPMSCRIPT_TRANSFILETRIGGER, 0);
}
- if (!(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS|RPMTRANS_FLAG_NOTRIGGERPOSTUN))) {
@@ -1846,22 +1848,26 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rp
/* Actually install and remove packages */
nfailed = rpmtsProcess(ts);
+ if (ts->dump_posttrans) {
+ rpmlog(RPMLOG_NOTICE, "dump_posttrans: enabled\n");
+ }
+
/* Run %posttrans scripts unless disabled */
- if (!(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS))) {
+ if (!ts->dump_posttrans && !(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS))) {
rpmlog(RPMLOG_DEBUG, "running post-transaction scripts\n");
runTransScripts(ts, PKG_POSTTRANS);
}
/* Run %transfiletriggerpostun scripts unless disabled */
- if (!(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS|RPMTRANS_FLAG_NOTRIGGERIN))) {
+ if (!ts->dump_posttrans && !(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS|RPMTRANS_FLAG_NOTRIGGERIN))) {
runFileTriggers(ts, NULL, RPMSENSE_TRIGGERIN, RPMSCRIPT_TRANSFILETRIGGER, 0);
}
- if (!(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS|RPMTRANS_FLAG_NOTRIGGERPOSTUN))) {
+ if (ts->dump_posttrans || !(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS|RPMTRANS_FLAG_NOTRIGGERPOSTUN))) {
runPostUnTransFileTrigs(ts);
}
@ -217,7 +225,7 @@
runTransScripts(ts, PKG_TRANSFILETRIGGERIN);
}
/* Final exit code */
@@ -1884,3 +1889,110 @@ exit:
@@ -1884,3 +1890,110 @@ exit:
rpmsqSetAction(SIGPIPE, oact);
return rc;
}
@ -328,8 +336,8 @@
+ rpmtsEmpty(ts);
+ return rc;
+}
--- ./rpm.c.orig 2020-05-28 10:04:25.070136867 +0000
+++ ./rpm.c 2021-03-30 09:33:10.054524821 +0000
--- ./rpm.c.orig 2021-04-09 11:28:12.363647282 +0000
+++ ./rpm.c 2021-04-09 11:28:15.527640975 +0000
@@ -19,6 +19,7 @@ enum modes {
MODE_INSTALL = (1 << 1),
MODE_ERASE = (1 << 2),

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Apr 9 13:34:24 CEST 2021 - mls@suse.de
- change dump_posttrans mechanism to imply --noposttrans so that
libzypp can be compatible with older rpm versions
changed patch: posttrans.diff
-------------------------------------------------------------------
Tue Apr 6 08:42:29 UTC 2021 - Andreas Schwab <schwab@suse.de>