From 0462e61041bb0d4c267049eca93ed117a4ccced3 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 3 Apr 2014 11:14:17 +0300 Subject: [PATCH] Minimally resurrect fine-grained progress callbacks on install - Add an internal version where we can pass the psm for notifications for now, the callbacks will need a major rework but now is not the time... --- lib/fsm.c | 2 +- lib/fsm.h | 3 +++ lib/rpmfi.c | 9 ++++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/fsm.c b/lib/fsm.c index f09fb7b19..7ae4747a2 100644 --- a/lib/fsm.c +++ b/lib/fsm.c @@ -222,7 +222,7 @@ static int expandRegular(rpmfi fi, const char *dest, rpmpsm psm, int nodigest, i } if (!nocontent) - rc = rpmfiArchiveReadToFile(fi, wfd, nodigest); + rc = rpmfiArchiveReadToFilePsm(fi, wfd, nodigest, psm); exit: if (wfd) { int myerrno = errno; diff --git a/lib/fsm.h b/lib/fsm.h index 86f571e97..301ed8b8d 100644 --- a/lib/fsm.h +++ b/lib/fsm.h @@ -30,6 +30,9 @@ int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfiles files, int rpmPackageFilesRemove(rpmts ts, rpmte te, rpmfiles files, rpmpsm psm, char ** failedFile); +RPM_GNUC_INTERNAL +int rpmfiArchiveReadToFilePsm(rpmfi fi, FD_t fd, int nodigest, rpmpsm psm); + RPM_GNUC_INTERNAL void rpmpsmNotify(rpmpsm psm, int what, rpm_loff_t amount); #ifdef __cplusplus diff --git a/lib/rpmfi.c b/lib/rpmfi.c index e860ef4b2..9582c1027 100644 --- a/lib/rpmfi.c +++ b/lib/rpmfi.c @@ -16,6 +16,7 @@ #include "lib/rpmfi_internal.h" #include "lib/rpmte_internal.h" /* relocations */ #include "lib/cpio.h" /* XXX CPIO_FOO */ +#include "lib/fsm.h" /* rpmpsm stuff for now */ #include "lib/rpmug.h" #include "rpmio/rpmio_internal.h" /* fdInit/FiniDigest */ @@ -2038,7 +2039,7 @@ size_t rpmfiArchiveRead(rpmfi fi, void * buf, size_t size) return rpmcpioRead(fi->archive, buf, size); } -int rpmfiArchiveReadToFile(rpmfi fi, FD_t fd, int nodigest) +int rpmfiArchiveReadToFilePsm(rpmfi fi, FD_t fd, int nodigest, rpmpsm psm) { if (fi == NULL || fi->archive == NULL || fd == NULL) return -1; @@ -2067,6 +2068,7 @@ int rpmfiArchiveReadToFile(rpmfi fi, FD_t fd, int nodigest) goto exit; } + rpmpsmNotify(psm, RPMCALLBACK_INST_PROGRESS, rpmfiArchiveTell(fi)); left -= len; } @@ -2091,6 +2093,11 @@ exit: return rc; } +int rpmfiArchiveReadToFile(rpmfi fi, FD_t fd, int nodigest) +{ + return rpmfiArchiveReadToFilePsm(fi, fd, nodigest, NULL); +} + char * rpmfileStrerror(int rc) { char *msg = NULL;