Added start/stop callbacks and minor fixes

This commit is contained in:
Denis Silakov 2014-01-14 07:20:10 -05:00
parent 124cc52ede
commit d83661c6de
7 changed files with 165 additions and 1 deletions

View file

@ -0,0 +1,12 @@
--- rpm-5.4.10/rpmio/rpmiotypes.h.cb2~ 2013-03-18 04:37:50.985920598 +0100
+++ rpm-5.4.10/rpmio/rpmiotypes.h 2013-03-18 04:37:05.729281072 +0100
@@ -140,7 +140,8 @@ typedef enum rpmCallbackType_e {
RPMCALLBACK_CPIO_ERROR = (1 << 14),
RPMCALLBACK_SCRIPT_ERROR = (1 << 15),
RPMCALLBACK_SCRIPT_START = (1 << 16),
- RPMCALLBACK_SCRIPT_STOP = (1 << 17)
+ RPMCALLBACK_SCRIPT_STOP = (1 << 17),
+ RPMCALLBACK_INST_STOP = (1 << 18)
} rpmCallbackType;
/**

View file

@ -0,0 +1,10 @@
--- rpm-5.4.10/rpmio/rpmmalloc.c~ 2013-03-04 10:30:01.765906904 +0100
+++ rpm-5.4.10/rpmio/rpmmalloc.c 2013-03-04 10:30:03.707920379 +0100
@@ -28,6 +28,7 @@ GENfree(rpmioItem)
/*@only@*/ void *vmefail(size_t size)
{
fprintf(stderr, _("memory alloc (%u bytes) returned NULL.\n"), (unsigned)size);
+ assert(0);
exit(EXIT_FAILURE);
/*@notreached@*/
/*@-nullret@*/

View file

@ -0,0 +1,11 @@
--- rpm-5.4.10/rpmdb/header.c.ui64p~ 2013-03-18 12:43:09.043950947 +0100
+++ rpm-5.4.10/rpmdb/header.c 2013-03-18 12:44:35.059800829 +0100
@@ -398,7 +398,7 @@ static unsigned char * tagSwab(/*@out@*/
switch (he->t) {
case RPM_UINT64_TYPE:
{ rpmuint32_t * tt = (rpmuint32_t *)t;
-assert(nb == (he->c * sizeof(*tt)));
+assert(nb == (he->c * sizeof(rpmuint64_t)));
for (i = 0; i < he->c; i++) {
rpmuint32_t j = 2 * i;
rpmuint32_t b = (rpmuint32_t) htonl(he->p.ui32p[j]);

View file

@ -0,0 +1,11 @@
--- rpm-5.4.10/lib/rpmfc.c.fontdep_sure~ 2013-04-16 02:17:42.052532219 +0200
+++ rpm-5.4.10/lib/rpmfc.c 2013-04-16 02:18:44.003630165 +0200
@@ -971,7 +971,7 @@ static int rpmfcSCRIPT(rpmfc fc)
if (is_executable || (fc->fcolor->vals[fc->ix] & RPMFC_MODULE))
xx = rpmfcHelper(fc, 'R', "ruby");
} else
- if (fc->fcolor->vals[fc->ix] & RPMFC_FONT) {
+ if ((fc->fcolor->vals[fc->ix] == (RPMFC_FONT|RPMFC_INCLUDE))) {
xx = rpmfcHelper(fc, 'P', "font");
/* XXX: currently of no use, but for the sake of consistency... */
xx = rpmfcHelper(fc, 'R', "font");

View file

@ -0,0 +1,12 @@
--- rpm-5.4.10/rpmdb/rpmdb.c.xrealloc~ 2013-03-19 10:57:50.188039986 +0100
+++ rpm-5.4.10/rpmdb/rpmdb.c 2013-03-26 15:16:47.114499354 +0100
@@ -2660,7 +2660,8 @@ assert(keylen == sizeof(hdrNum));
}
if(set && set->count != size) {
set->count = size;
- set->recs = xrealloc(set->recs, size * sizeof(*set->recs));
+ if (size)
+ set->recs = xrealloc(set->recs, size * sizeof(*set->recs));
}
xx = dbiCclose(pdbi, pdbc, 0);

View file

@ -0,0 +1,67 @@
--- rpm-5.4.10/lib/psm.c.cb~ 2013-03-18 03:54:33.548013203 +0100
+++ rpm-5.4.10/lib/psm.c 2013-03-18 03:39:40.643465724 +0100
@@ -842,6 +842,8 @@ assert(he->p.str != NULL);
psm->NVRA = NVRA = he->p.str;
}
+ scriptFd = rpmtsNotify(psm->ts, psm->te, RPMCALLBACK_SCRIPT_START, psm->scriptTag, 0);
+
if (op != NULL)
(void) rpmswEnter(op, 0);
@@ -1003,7 +1006,8 @@ assert(he->p.str != NULL);
break;
}
- scriptFd = rpmtsScriptFd(ts);
+ if (scriptFd == NULL)
+ scriptFd = rpmtsScriptFd(ts);
if (scriptFd != NULL) {
if (rpmIsVerbose()) {
out = fdDup(Fileno(scriptFd));
@@ -1165,6 +1169,8 @@ exit:
if (ix >= 0 && ix < RPMSCRIPT_MAX)
psm->smetrics[ix] += op->usecs / scale;
}
+ rpmtsNotify(psm->ts, psm->te, RPMCALLBACK_SCRIPT_STOP, psm->scriptTag,
+ rc != RPMRC_OK ? RPMRC_NOTFOUND : rc);
if (out)
xx = Fclose(out); /* XXX dup'd STDOUT_FILENO */
--- rpm-5.4.10/lib/rpminstall.c.cb~ 2013-03-18 03:54:48.316206560 +0100
+++ rpm-5.4.10/lib/rpminstall.c 2013-03-17 09:19:38.855870381 +0100
@@ -293,6 +293,10 @@ void * rpmShowProgress(/*@null@*/ const
break;
case RPMCALLBACK_SCRIPT_ERROR:
break;
+ case RPMCALLBACK_SCRIPT_START:
+ break;
+ case RPMCALLBACK_SCRIPT_STOP:
+ break;
case RPMCALLBACK_UNKNOWN:
default:
break;
--- rpm-5.4.10/python/rpmmodule.c.cb~ 2013-03-18 03:55:29.704746913 +0100
+++ rpm-5.4.10/python/rpmmodule.c 2013-03-17 09:19:38.855870381 +0100
@@ -559,6 +559,8 @@ void init_rpm(void)
REGISTER_ENUM(RPMCALLBACK_UNPACK_ERROR);
REGISTER_ENUM(RPMCALLBACK_CPIO_ERROR);
REGISTER_ENUM(RPMCALLBACK_SCRIPT_ERROR);
+ REGISTER_ENUM(RPMCALLBACK_SCRIPT_START);
+ REGISTER_ENUM(RPMCALLBACK_SCRIPT_STOP);
REGISTER_ENUM(RPMPROB_BADARCH);
REGISTER_ENUM(RPMPROB_BADOS);
--- rpm-5.4.10/rpmio/rpmiotypes.h.cb~ 2013-03-18 03:54:05.472641157 +0100
+++ rpm-5.4.10/rpmio/rpmiotypes.h 2013-03-18 03:53:36.692228344 +0100
@@ -138,7 +138,9 @@ typedef enum rpmCallbackType_e {
RPMCALLBACK_REPACKAGE_STOP = (1 << 12),
RPMCALLBACK_UNPACK_ERROR = (1 << 13),
RPMCALLBACK_CPIO_ERROR = (1 << 14),
- RPMCALLBACK_SCRIPT_ERROR = (1 << 15)
+ RPMCALLBACK_SCRIPT_ERROR = (1 << 15),
+ RPMCALLBACK_SCRIPT_START = (1 << 16),
+ RPMCALLBACK_SCRIPT_STOP = (1 << 17)
} rpmCallbackType;
/**

View file

@ -59,7 +59,7 @@ Summary: The RPM package management system
Name: rpm
Epoch: 1
Version: %{libver}.%{minorver}
Release: %{?prereldate:0.%{prereldate}.}19
Release: %{?prereldate:0.%{prereldate}.}20
License: LGPLv2.1+
Group: System/Configuration/Packaging
URL: http://rpm5.org/
@ -393,7 +393,42 @@ Patch186: rpm-5.4.10-dont-repackage-if-justdb-is-specified.patch
Patch191: rpm-5.4.10-enhance-rename-macro-to-accept-optional-second-version-arg.patch
Patch192: rpm-5.4.10-do-assert-rather-than-just-exit-on-memalloc-filaure.patch
# fixes issue where querying a package with >= 3 '-' in the name with an extra '-' behind
# status: ready
Patch193: rpm-5.4.10-fix-memalloc-realloc-to-0.patch
#From ce2ce4c19724879b9ea469e7760c7922660b9698 Mon Sep 17 00:00:00 2001
#From: Panu Matilainen <pmatilai@redhat.com>
#Date: Tue, 3 Jan 2012 13:10:26 +0200
#Subject: [PATCH] Implement scriptlet start and stop callbacks (RhBug:606239)
#
#- Adds two new transaction callbacks: RPMCALLBACK_SCRIPT_START and
# RPMCALLBACK_SCRIPT_STOP which get issued for every scriptlet we run.
#- On script start, callback can optionally return an FD which will
# override transaction-wide script fd to make it easier to accurately
# collect per-scriptlet output (eg per-scriptlet temporary file).
# Callback is also responsible for closing the fd if it returns one.
#- For both callbacks, "amount" holds the script tag number. On stop
# callback, "total" holds the scriptlet exit status mapped into
# OK/NOTFOUND/FAIL for success/non-fatal/fatal errors. Abusing "notfound"
# for warning result is ugly but differentiating it from the other
# cases allows callers to ignore SCRIPT_ERROR if they choose to
# implement stop and start..
# status: ready
Patch194: rpm-5.4.10-implement-start-and-stop-callbacks.patch
#From ff0ece3f6be58c8c28a766bdee5ed36daf1727b1 Mon Sep 17 00:00:00 2001
#From: Panu Matilainen <pmatilai@redhat.com>
#Date: Thu, 5 Jan 2012 14:34:46 +0200
#Subject: [PATCH] Add enum for RPMCALLBACK_INST_STOP callback event
#
#- Unused atm but we'll be adding this shortly
Patch195: rpm-5.4.10-add-enum-for-RPMCALLBACK_INST_STOP-callback-event.patch
# this fixes tagSwab to properly handle RPM_UINT64_TYPE, fixing headerPut with
# status: ready
Patch196: rpm-5.4.10-fix-64bit-tagSwab.patch
Patch198: rpm-5.4.10-enable-nofsync-for-rpm-rebuilddb.patch
Patch199: rpm-5.4.10-fix-font-dep-misidentification.patch
# ROSA stuff
Patch501: rpm-5.3.12.vendor.ROSA.patch
@ -786,8 +821,14 @@ This package contains the RPM API documentation generated in HTML format.
%patch186 -p1 -b .rpkg_justdb~
%patch191 -p1 -b .rename~
%patch192 -p1 -b .mem_assert~
%patch193 -p1 -b .xrealloc~
%patch194 -p1 -b .cb~
%patch195 -p1 -b .cb2~
%patch196 -p1 -b .ui64p~
%patch198 -p1 -b .rpmdbnofsync~
%patch199 -p1 -b .fontdep_sure~
%patch501 -p1 -b .rosa_vendor~
%patch502 -p1 -b .package_name~