Accepting request 1272673 from Base:System

print scriptlet messages in --runposttrans

OBS-URL: https://build.opensuse.org/request/show/1272673
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/rpm?expand=0&rev=322
This commit is contained in:
2025-04-27 20:54:05 +00:00
committed by Git OBS Bridge
7 changed files with 192 additions and 30 deletions

28
archcheck.diff Normal file
View File

@@ -0,0 +1,28 @@
--- build/parsePreamble.c.orig 2025-04-25 09:33:36.850778834 +0000
+++ build/parsePreamble.c 2025-04-25 09:33:51.002755713 +0000
@@ -1332,6 +1332,11 @@ int parsePreamble(rpmSpec spec, int init
"%{dirname:%{buildroot}}", RMIL_GLOBAL, 0);
}
+ /* XXX Skip valid arch check if not building binary package */
+ if (!(spec->flags & RPMSPEC_ANYARCH) && checkForValidArchitectures(spec)) {
+ goto exit;
+ }
+
/* if we get down here nextPart has been set to non-error */
res = nextPart;
--- build/parseSpec.c.orig 2025-04-25 09:34:05.770731591 +0000
+++ build/parseSpec.c 2025-04-25 09:34:20.242707943 +0000
@@ -1355,11 +1355,6 @@ static rpmRC finalizeSpec(rpmSpec spec)
char *os = rpmExpand("%{_target_os}", NULL);
char *optflags = rpmExpand("%{optflags}", NULL);
- /* XXX Skip valid arch check if not building binary package */
- if (!(spec->flags & RPMSPEC_ANYARCH) && checkForValidArchitectures(spec)) {
- goto exit;
- }
-
fillOutMainPackage(spec->packages->header);
/* Define group tag to something when group is undefined in main package*/
if (!headerIsEntry(spec->packages->header, RPMTAG_GROUP)) {

33
buildsysprep.diff Normal file
View File

@@ -0,0 +1,33 @@
--- build/parseSpec.c.orig 2025-04-25 09:58:26.712300888 +0000
+++ build/parseSpec.c 2025-04-25 09:58:54.224255916 +0000
@@ -987,7 +987,7 @@ int checkBuildsystem(rpmSpec spec, const
}
static rpmRC parseBuildsysSect(rpmSpec spec, const char *prefix,
- struct sectname_s *sc, FD_t fd)
+ struct sectname_s *sc, FD_t fd, int *foundp)
{
rpmRC rc = RPMRC_OK;
@@ -1015,6 +1015,7 @@ static rpmRC parseBuildsysSect(rpmSpec s
}
free(buf);
free(args);
+ *foundp = 1;
}
free(mn);
}
@@ -1038,9 +1039,10 @@ static rpmRC parseBuildsystem(rpmSpec sp
}
for (struct sectname_s *sc = sectList; !rc && sc->name; sc++) {
- rc = parseBuildsysSect(spec, buildsystem, sc, fd);
- if (!rc && spec->sections[sc->section] == NULL)
- rc = parseBuildsysSect(spec, "default", sc, fd);
+ int found = 0;
+ rc = parseBuildsysSect(spec, buildsystem, sc, fd, &found);
+ if (!rc && !found)
+ rc = parseBuildsysSect(spec, "default", sc, fd, &found);
}
if (!rc)

34
emptypw.diff Normal file
View File

@@ -0,0 +1,34 @@
--- lib/rpmug.c.orig 2025-04-25 09:48:27.153273090 +0000
+++ lib/rpmug.c 2025-04-25 09:50:00.113122450 +0000
@@ -1,6 +1,7 @@
#include "system.h"
#include <errno.h>
+#include <rpm/argv.h>
#include <rpm/rpmlog.h>
#include <rpm/rpmstring.h>
#include <rpm/rpmmacro.h>
@@ -62,12 +63,11 @@ static int lookup_field(const char *path
while ((str = fgets(buf, sizeof(buf), f)) != NULL) {
int nf = vcol > rcol ? vcol : rcol;
const char *fields[nf + 1];
- char *tok, *save = NULL;
int col = -1;
- while ((tok = strtok_r(str, ":", &save)) != NULL) {
- fields[++col] = tok;
- str = NULL;
+ ARGV_t tokens = argvSplitString(str, ":", ARGV_NONE);
+ for (ARGV_const_t tok = tokens; tok && *tok; tok++) {
+ fields[++col] = *tok;
if (col >= nf)
break;
}
@@ -78,6 +78,7 @@ static int lookup_field(const char *path
rc = 0;
}
}
+ argvFree(tokens);
}
fclose(f);

View File

@@ -1,8 +1,8 @@
Convert output to the current locale. Assumes utf8 input if the
decoding works, otherwise iso-8859-1.
--- lib/tagexts.c.orig 2021-06-21 12:00:44.615612184 +0000
+++ lib/tagexts.c 2021-09-23 18:58:58.461872258 +0000
--- lib/tagexts.c.orig 2025-02-19 15:29:33.000000000 +0000
+++ lib/tagexts.c 2025-04-25 11:59:49.808794382 +0000
@@ -2,6 +2,7 @@
* \file lib/formats.c
*/
@@ -11,7 +11,7 @@ decoding works, otherwise iso-8859-1.
#include "system.h"
#include <rpm/rpmtypes.h>
@@ -197,6 +198,114 @@ typedef enum tMode_e {
@@ -192,6 +193,115 @@ typedef enum tMode_e {
TRANSFILETRIGGER = 2,
} tMode;
@@ -94,6 +94,7 @@ decoding works, otherwise iso-8859-1.
+ if (wcrtomb(cc, 0x20ac, &ps) != 3 || memcmp(cc, "\342\202\254", 3))
+ locisutf8 = 0;
+ if (locisutf8 == strisutf8) {
+ _free(cc);
+ wstr = _free(wstr);
+ return str;
+ }
@@ -126,7 +127,7 @@ decoding works, otherwise iso-8859-1.
/**
* Retrieve trigger info.
* @param mode type of trigger (see tMode_e)
@@ -607,10 +716,41 @@ static int i18nTag(Header h, rpmTag tag,
@@ -606,10 +716,41 @@ static int i18nTag(Header h, rpmTag tag,
#endif
rc = headerGet(h, tag, td, HEADERGET_ALLOC);
@@ -168,7 +169,7 @@ decoding works, otherwise iso-8859-1.
* Retrieve summary text.
* @param h header
* @param[out] td tag data container
@@ -634,6 +774,16 @@ static int descriptionTag(Header h, rpmt
@@ -633,6 +774,16 @@ static int descriptionTag(Header h, rpmt
return i18nTag(h, RPMTAG_DESCRIPTION, td, hgflags);
}
@@ -185,7 +186,7 @@ decoding works, otherwise iso-8859-1.
/**
* Retrieve group text.
* @param h header
@@ -971,6 +1121,8 @@ static const struct headerTagFunc_s rpmH
@@ -1022,6 +1173,8 @@ static const struct headerTagFunc_s rpmH
{ RPMTAG_LONGARCHIVESIZE, longarchivesizeTag },
{ RPMTAG_LONGSIZE, longsizeTag },
{ RPMTAG_LONGSIGSIZE, longsigsizeTag },

View File

@@ -1,5 +1,5 @@
--- include/rpm/rpmcli.h.orig 2024-10-07 09:35:46.000000000 +0000
+++ include/rpm/rpmcli.h 2024-12-16 09:31:12.446494695 +0000
--- include/rpm/rpmcli.h.orig 2025-02-19 15:29:33.000000000 +0000
+++ include/rpm/rpmcli.h 2025-04-14 13:20:00.048365266 +0000
@@ -306,6 +306,7 @@ enum rpmInstallFlags_e {
INSTALL_ALLMATCHES = (1 << 9), /*!< from --allmatches */
INSTALL_REINSTALL = (1 << 10), /*!< from --reinstall */
@@ -24,8 +24,8 @@
*/
extern struct rpmInstallArguments_s rpmIArgs;
--- include/rpm/rpmts.h.orig 2024-12-16 09:30:58.714522978 +0000
+++ include/rpm/rpmts.h 2024-12-16 09:31:12.446494695 +0000
--- include/rpm/rpmts.h.orig 2025-04-14 13:19:55.520372147 +0000
+++ include/rpm/rpmts.h 2025-04-14 13:20:00.052365260 +0000
@@ -253,6 +253,15 @@ int rpmtsOrder(rpmts ts);
int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet);
@@ -42,8 +42,8 @@
* Reference a transaction set instance.
* @param ts transaction set
* @return new transaction set reference
--- lib/poptI.c.orig 2024-10-07 09:35:46.000000000 +0000
+++ lib/poptI.c 2024-12-16 09:31:12.446494695 +0000
--- lib/poptI.c.orig 2025-02-19 15:29:33.000000000 +0000
+++ lib/poptI.c 2025-04-14 13:20:00.052365260 +0000
@@ -283,6 +283,10 @@ struct poptOption rpmInstallPoptTable[]
&rpmIArgs.installInterfaceFlags, (INSTALL_RESTORE),
N_("restore package(s)"),
@@ -55,9 +55,9 @@
POPT_TABLEEND
};
--- lib/psm.c.orig 2024-12-16 09:30:58.694523019 +0000
+++ lib/psm.c 2024-12-16 09:31:12.446494695 +0000
@@ -1000,7 +1000,7 @@ static rpmRC rpmPackageErase(rpmts ts, r
--- lib/psm.c.orig 2025-04-14 13:19:55.504372171 +0000
+++ lib/psm.c 2025-04-14 13:20:00.052365260 +0000
@@ -1009,7 +1009,7 @@ static rpmRC rpmPackageErase(rpmts ts, r
}
if (rc) break;
@@ -66,8 +66,8 @@
/* Prepare post transaction uninstall triggers */
rpmtriggersPrepPostUnTransFileTrigs(psm->ts, psm->te);
}
--- lib/rpminstall.c.orig 2024-10-07 09:35:46.000000000 +0000
+++ lib/rpminstall.c 2024-12-16 09:31:12.446494695 +0000
--- lib/rpminstall.c.orig 2025-02-19 15:29:33.000000000 +0000
+++ lib/rpminstall.c 2025-04-25 09:21:50.799906982 +0000
@@ -6,6 +6,8 @@
#include <string.h>
@@ -77,7 +77,53 @@
#include <rpm/rpmcli.h>
#include <rpm/rpmtag.h>
#include <rpm/rpmlib.h> /* rpmReadPackageFile, vercmp etc */
@@ -830,3 +832,32 @@ int rpmInstallSource(rpmts ts, const cha
@@ -90,6 +92,24 @@ static rpmVSFlags setvsFlags(struct rpmI
return vsflags;
}
+static const char *
+posttranstag2str(rpmTagVal stag)
+{
+ switch (stag) {
+ case RPMTAG_POSTTRANS:
+ return "posttrans";
+ case RPMTAG_POSTUNTRANS:
+ return "postuntrans";
+ case RPMTAG_TRIGGERIN:
+ return "transfiletriggerin";
+ case RPMTAG_TRIGGERUN:
+ return "transfiletriggerun";
+ case RPMTAG_TRIGGERPOSTUN:
+ return "transfiletriggerpostun";
+ }
+ return rpmTagGetName(stag);
+}
+
void * rpmShowProgress(const void * arg,
const rpmCallbackType what,
const rpm_loff_t amount,
@@ -213,8 +233,20 @@ void * rpmShowProgress(const void * arg,
case RPMCALLBACK_CPIO_ERROR:
break;
case RPMCALLBACK_SCRIPT_ERROR:
+ if (flags & INSTALL_RUNPOSTTRANS) {
+ rpmTagVal stag = (rpmTagVal)amount;
+ char *s = headerGetAsString(h, RPMTAG_NEVRA);
+ fprintf(stdout, "Error from %%%s(%s)\n", posttranstag2str(stag), s);
+ free(s);
+ }
break;
case RPMCALLBACK_SCRIPT_START:
+ if (flags & INSTALL_RUNPOSTTRANS) {
+ rpmTagVal stag = (rpmTagVal)amount;
+ char *s = headerGetAsString(h, RPMTAG_NEVRA);
+ fprintf(stdout, "Running %%%s(%s)\n", posttranstag2str(stag), s);
+ free(s);
+ }
break;
case RPMCALLBACK_SCRIPT_STOP:
break;
@@ -831,3 +863,33 @@ int rpmInstallSource(rpmts ts, const cha
return rc;
}
@@ -105,13 +151,14 @@
+ fclose(f);
+ rpmlog(RPMLOG_DEBUG, "running posttrans scriptlets\n");
+ rpmtsClean(ts);
+ setNotifyFlag(ia, ts);
+ rc = rpmtsRunPostTrans(ts, manifest);
+exit:
+ argvFree(manifest);
+ return rc;
+}
--- lib/rpmtriggers.c.orig 2024-10-07 09:35:46.000000000 +0000
+++ lib/rpmtriggers.c 2024-12-16 09:31:12.446494695 +0000
--- lib/rpmtriggers.c.orig 2025-02-19 15:29:33.000000000 +0000
+++ lib/rpmtriggers.c 2025-04-14 13:20:00.052365260 +0000
@@ -1,5 +1,6 @@
#include "system.h"
@@ -143,7 +190,7 @@
/* Prepare and run script */
script = rpmScriptFromTriggerTag(trigH,
triggertag(RPMSENSE_TRIGGERPOSTUN),
@@ -610,6 +619,16 @@ rpmRC runImmedFileTriggers(rpmts ts, rpm
@@ -613,6 +622,16 @@ rpmRC runImmedFileTriggers(rpmts ts, rpm
rpmTagVal priorityTag;
rpmtriggers triggers;
@@ -160,8 +207,8 @@
if (tm == RPMSCRIPT_FILETRIGGER) {
priorityTag = RPMTAG_FILETRIGGERPRIORITIES;
} else {
--- lib/rpmtriggers.h.orig 2024-10-07 09:35:46.000000000 +0000
+++ lib/rpmtriggers.h 2024-12-16 09:31:12.446494695 +0000
--- lib/rpmtriggers.h.orig 2025-02-19 15:29:33.000000000 +0000
+++ lib/rpmtriggers.h 2025-04-14 13:20:00.052365260 +0000
@@ -24,6 +24,10 @@ rpmtriggers rpmtriggersCreate(unsigned i
RPM_GNUC_INTERNAL
rpmtriggers rpmtriggersFree(rpmtriggers triggers);
@@ -173,8 +220,8 @@
/*
* Prepare post trans uninstall file triggers. After transcation uninstalled
* files are not saved anywhere. So we need during uninstalation of every
--- lib/rpmts_internal.h.orig 2024-10-07 09:35:46.000000000 +0000
+++ lib/rpmts_internal.h 2024-12-16 09:31:12.446494695 +0000
--- lib/rpmts_internal.h.orig 2025-02-19 15:29:33.000000000 +0000
+++ lib/rpmts_internal.h 2025-04-14 13:20:00.052365260 +0000
@@ -83,6 +83,8 @@ struct rpmts_s {
int min_writes; /*!< macro minimize_writes used */
@@ -184,8 +231,8 @@
};
/** \ingroup rpmts
--- lib/transaction.c.orig 2024-10-07 09:35:46.000000000 +0000
+++ lib/transaction.c 2024-12-16 09:37:17.425742632 +0000
--- lib/transaction.c.orig 2025-02-19 15:29:33.000000000 +0000
+++ lib/transaction.c 2025-04-14 13:20:00.056365254 +0000
@@ -1475,6 +1475,8 @@ static int rpmtsSetup(rpmts ts, rpmprobF
/* Get available space on mounted file systems. */
(void) rpmtsInitDSI(ts);
@@ -329,8 +376,8 @@
+ rpmtsEmpty(ts);
+ return rc;
+}
--- tools/rpm.c.orig 2024-10-07 09:35:46.000000000 +0000
+++ tools/rpm.c 2024-12-16 09:31:12.446494695 +0000
--- tools/rpm.c.orig 2025-02-19 15:29:33.000000000 +0000
+++ tools/rpm.c 2025-04-14 13:20:00.056365254 +0000
@@ -21,6 +21,7 @@ enum modes {
MODE_ERASE = (1 << 2),
MODE_RESTORE = (1 << 4),

View File

@@ -1,3 +1,18 @@
-------------------------------------------------------------------
Fri Apr 25 11:29:35 CEST 2025 - mls@suse.de
- print scriptlet messages in --runposttrans
* needed to fix leaking tmp files [bsc#1218459]
* updated patch: posttrans.diff
- backport architecture check fix from upstream
* new patch: archcheck.diff
- backport empty password fix from upstream
* new patch: emptypw.diff
- backport buildsys specific prep fix from upstream
* new patch: buildsysprep.diff
- fix memory leak in str2locale [bsc#1241052]
* updated patch: localetag.diff
-------------------------------------------------------------------
Wed Mar 26 14:48:09 CET 2025 - mls@suse.de

View File

@@ -124,6 +124,9 @@ Patch154: undefbuildroot.diff
Patch155: rpm2archive.diff
Patch156: mtime_policy_set.diff
Patch157: cmake_fhardened.diff
Patch158: archcheck.diff
Patch159: emptypw.diff
Patch160: buildsysprep.diff
Patch6464: auto-config-update-aarch64-ppc64le.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#
@@ -242,7 +245,8 @@ rm -rf sqlite
%patch -P 131 -P 133 -P 134 -P 135 -P 136 -P 138
%patch -P 139
%patch -P 141 -P 142
%patch -P 150 -P 151 -P 154 -P 155 -P 156 -P 157
%patch -P 150 -P 151 -P 154 -P 155 -P 156 -P 157 -P 158 -P 159
%patch -P 160
%ifarch aarch64 ppc64le riscv64 loongarch64
%patch -P 6464