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...
This commit is contained in:
Panu Matilainen 2014-04-03 11:14:17 +03:00
parent 1097227842
commit 0462e61041
3 changed files with 12 additions and 2 deletions

View File

@ -222,7 +222,7 @@ static int expandRegular(rpmfi fi, const char *dest, rpmpsm psm, int nodigest, i
} }
if (!nocontent) if (!nocontent)
rc = rpmfiArchiveReadToFile(fi, wfd, nodigest); rc = rpmfiArchiveReadToFilePsm(fi, wfd, nodigest, psm);
exit: exit:
if (wfd) { if (wfd) {
int myerrno = errno; int myerrno = errno;

View File

@ -30,6 +30,9 @@ int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfiles files,
int rpmPackageFilesRemove(rpmts ts, rpmte te, rpmfiles files, int rpmPackageFilesRemove(rpmts ts, rpmte te, rpmfiles files,
rpmpsm psm, char ** failedFile); rpmpsm psm, char ** failedFile);
RPM_GNUC_INTERNAL
int rpmfiArchiveReadToFilePsm(rpmfi fi, FD_t fd, int nodigest, rpmpsm psm);
RPM_GNUC_INTERNAL RPM_GNUC_INTERNAL
void rpmpsmNotify(rpmpsm psm, int what, rpm_loff_t amount); void rpmpsmNotify(rpmpsm psm, int what, rpm_loff_t amount);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -16,6 +16,7 @@
#include "lib/rpmfi_internal.h" #include "lib/rpmfi_internal.h"
#include "lib/rpmte_internal.h" /* relocations */ #include "lib/rpmte_internal.h" /* relocations */
#include "lib/cpio.h" /* XXX CPIO_FOO */ #include "lib/cpio.h" /* XXX CPIO_FOO */
#include "lib/fsm.h" /* rpmpsm stuff for now */
#include "lib/rpmug.h" #include "lib/rpmug.h"
#include "rpmio/rpmio_internal.h" /* fdInit/FiniDigest */ #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); 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) if (fi == NULL || fi->archive == NULL || fd == NULL)
return -1; return -1;
@ -2067,6 +2068,7 @@ int rpmfiArchiveReadToFile(rpmfi fi, FD_t fd, int nodigest)
goto exit; goto exit;
} }
rpmpsmNotify(psm, RPMCALLBACK_INST_PROGRESS, rpmfiArchiveTell(fi));
left -= len; left -= len;
} }
@ -2091,6 +2093,11 @@ exit:
return rc; return rc;
} }
int rpmfiArchiveReadToFile(rpmfi fi, FD_t fd, int nodigest)
{
return rpmfiArchiveReadToFilePsm(fi, fd, nodigest, NULL);
}
char * rpmfileStrerror(int rc) char * rpmfileStrerror(int rc)
{ {
char *msg = NULL; char *msg = NULL;