From ba8e017ac035cc36e63fbce173d3f6c715639c33 Mon Sep 17 00:00:00 2001 From: jbj Date: Mon, 22 Feb 1999 22:15:19 +0000 Subject: [PATCH] Add notifys for msw. CVS patchset: 2827 CVS date: 1999/02/22 22:15:19 --- lib/rpmlib.h | 2 ++ lib/transaction.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- po/rpm.pot | 44 ++++++++++++++++++++++---------------------- rpm.spec | 2 +- 4 files changed, 74 insertions(+), 24 deletions(-) diff --git a/lib/rpmlib.h b/lib/rpmlib.h index 9b5d35c..0623cad 100644 --- a/lib/rpmlib.h +++ b/lib/rpmlib.h @@ -275,6 +275,8 @@ typedef /*@abstract@*/ struct rpmdb_s * rpmdb; typedef enum rpmCallbackType_e { RPMCALLBACK_INST_PROGRESS, RPMCALLBACK_INST_START, RPMCALLBACK_INST_OPEN_FILE, RPMCALLBACK_INST_CLOSE_FILE, + RPMCALLBACK_TRANS_PROGRESS, RPMCALLBACK_TRANS_START, + RPMCALLBACK_UNINST_PROGRESS, RPMCALLBACK_UNINST_START, } rpmCallbackType; typedef void * (*rpmCallbackFunction)(const Header h, const rpmCallbackType what, diff --git a/lib/transaction.c b/lib/transaction.c index b66f818..dd73c5c 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -67,7 +67,8 @@ static void skipFiles(struct fileInfo * fi, int noDocs); happened */ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, void * notifyData, rpmProblemSet okProbs, - rpmProblemSet * newProbs, int flags) { + rpmProblemSet * newProbs, int flags) +{ int i, j; struct availableList * al = &ts->addedPackages; int rc, ourrc = 0; @@ -93,6 +94,8 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, *newProbs = probs; hdrs = alloca(sizeof(*hdrs) * al->size); +notify(NULL, RPMCALLBACK_TRANS_START, 1, al->size, NULL, notifyData); + for (alp = al->list; (alp - al->list) < al->size; alp++) { if (!archOkay(alp->h)) psAppend(probs, RPMPROB_BADARCH, alp->key, alp->h, NULL, NULL); @@ -101,6 +104,9 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, psAppend(probs, RPMPROB_BADOS, alp->key, alp->h, NULL, NULL); } +notify(alp->h, RPMCALLBACK_TRANS_PROGRESS, (alp - al->list), al->size, + NULL, notifyData); + rc = rpmdbFindPackage(ts->db, alp->name, &dbi); if (rc == 2) { return -1; @@ -125,6 +131,9 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, totalFileCount += fileCount; } +notify(NULL, RPMCALLBACK_TRANS_START, 2, ts->numRemovedPackages, + NULL, notifyData); + /* FIXME: it seems a bit silly to read in all of these headers twice */ for (i = 0; i < ts->numRemovedPackages; i++, fi++) { Header h; @@ -134,6 +143,10 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, &fileCount)) totalFileCount += fileCount; } + +notify(h, RPMCALLBACK_TRANS_PROGRESS, i, ts->numRemovedPackages, + NULL, notifyData); + } flEntries = al->size + ts->numRemovedPackages; @@ -141,6 +154,8 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, ht = htCreate(totalFileCount * 2, 0, fpHashFunction, fpEqual); +notify(NULL, RPMCALLBACK_TRANS_START, 3, al->size, NULL, notifyData); + /* FIXME?: we'd be better off assembling one very large file list and calling fpLookupList only once. I'm not sure that the speedup is worth the trouble though. */ @@ -158,6 +173,9 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, fi->h = hdrs[alp - al->list] = relocateFileList(alp, probs, alp->h, fi->actions); +notify(fi->h, RPMCALLBACK_TRANS_PROGRESS, (alp - al->list), al->size, + NULL, notifyData); + headerGetEntryMinMemory(fi->h, RPMTAG_FILENAMES, NULL, (void *) &fi->fl, &fi->fc); @@ -178,7 +196,11 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, fi->replaced = NULL; } +notify(NULL, RPMCALLBACK_TRANS_START, 4, ts->numRemovedPackages, + NULL, notifyData); + for (i = 0; i < ts->numRemovedPackages; i++, fi++) { + fi->type = REMOVED; fi->record = ts->removedPackages[i]; fi->h = rpmdbGetRecord(ts->db, fi->record); @@ -186,6 +208,10 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, /* ACK! */ continue; } + +notify(fi->h, RPMCALLBACK_TRANS_PROGRESS, i, ts->numRemovedPackages, + NULL, notifyData); + if (!headerGetEntryMinMemory(fi->h, RPMTAG_FILENAMES, NULL, (void *) &fi->fl, &fi->fc)) { fi->fc = 0; @@ -212,7 +238,13 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, chdir("/"); chroot(ts->root); +notify(NULL, RPMCALLBACK_TRANS_START, 5, flEntries, NULL, notifyData); + for (fi = flList; (fi - flList) < flEntries; fi++) { + +notify(NULL, RPMCALLBACK_TRANS_PROGRESS, (fi - flList), flEntries, + NULL, notifyData); + fpLookupList(fi->fl, fi->fps, fi->fc, 1); for (i = 0; i < fi->fc; i++) { if (fi->actions[i] != FA_SKIP && fi->actions[i] != FA_SKIPNSTATE) @@ -220,6 +252,8 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, } } +notify(NULL, RPMCALLBACK_TRANS_START, 6, flEntries, NULL, notifyData); + for (fi = flList; (fi - flList) < flEntries; fi++) { matches = malloc(sizeof(*matches) * fi->fc); if (rpmdbFindFpList(ts->db, fi->fps, matches, fi->fc)) return 1; @@ -275,6 +309,8 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, htFree(ht); +notify(NULL, RPMCALLBACK_TRANS_START, 7, al->size, NULL, notifyData); + for (alp = al->list, fi = flList; (alp - al->list) < al->size; alp++, fi++) { if (fi->fc) { @@ -290,6 +326,8 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, (probs->numProblems && (!okProbs || psTrim(okProbs, probs)))) { *newProbs = probs; +notify(NULL, RPMCALLBACK_TRANS_START, 8, al->size, NULL, notifyData); + for (alp = al->list, fi = flList; (alp - al->list) < al->size; alp++, fi++) { if (fi->fc) { @@ -301,6 +339,8 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, return al->size + ts->numRemovedPackages; } +notify(NULL, RPMCALLBACK_TRANS_START, 9, al->size, NULL, notifyData); + for (alp = al->list, fi = flList; (alp - al->list) < al->size; alp++, fi++) { if (alp->fd) { @@ -347,10 +387,18 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, notifyData); } +notify(NULL, RPMCALLBACK_UNINST_START, 0, ts->numRemovedPackages, + NULL, notifyData); + /* fi is left at the first package which is to be removed */ for (i = 0; i < ts->numRemovedPackages; i++, fi++) { + + notify(fi->h, RPMCALLBACK_UNINST_PROGRESS, i, ts->numRemovedPackages, + NULL, notifyData); + if (removeBinaryPackage(ts->root, ts->db, ts->removedPackages[i], flags, fi->actions, ts->scriptFd)) + ourrc++; } diff --git a/po/rpm.pot b/po/rpm.pot index 52864f2..4847482 100644 --- a/po/rpm.pot +++ b/po/rpm.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 1999-02-22 12:47-0500\n" +"POT-Creation-Date: 1999-02-22 17:05-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -294,7 +294,7 @@ msgstr "" msgid "cannot open file %s\n" msgstr "" -#: ../install.c:185 ../lib/query.c:541 +#: ../install.c:185 ../lib/query.c:540 #, c-format msgid "%s does not appear to be a RPM package\n" msgstr "" @@ -322,7 +322,7 @@ msgstr "" msgid "installing binary packages\n" msgstr "" -#: ../install.c:342 ../lib/query.c:685 ../verify.c:243 +#: ../install.c:342 ../lib/query.c:684 ../verify.c:243 #, c-format msgid "package %s is not installed\n" msgstr "" @@ -1470,11 +1470,11 @@ msgstr "" msgid "error: could not read database record\n" msgstr "" -#: ../lib/query.c:595 ../verify.c:179 +#: ../lib/query.c:594 ../verify.c:179 msgid "could not read database record!\n" msgstr "" -#: ../lib/query.c:520 ../verify.c:198 +#: ../lib/query.c:519 ../verify.c:198 #, c-format msgid "open of %s failed\n" msgstr "" @@ -1484,17 +1484,17 @@ msgstr "" msgid "%s is not an RPM\n" msgstr "" -#: ../lib/query.c:606 ../verify.c:222 +#: ../lib/query.c:605 ../verify.c:222 #, c-format msgid "group %s does not contain any packages\n" msgstr "" -#: ../lib/query.c:654 ../verify.c:232 +#: ../lib/query.c:653 ../verify.c:232 #, c-format msgid "file %s is not owned by any package\n" msgstr "" -#: ../lib/query.c:688 ../verify.c:245 +#: ../lib/query.c:687 ../verify.c:245 #, c-format msgid "error looking for package %s\n" msgstr "" @@ -2711,55 +2711,55 @@ msgstr "" msgid "querying record number %d\n" msgstr "" -#: ../lib/query.c:505 +#: ../lib/query.c:504 msgid "rpmQuery: rpmdbOpen() failed\n" msgstr "" -#: ../lib/query.c:533 +#: ../lib/query.c:532 msgid "old format source packages cannot be queried\n" msgstr "" -#: ../lib/query.c:544 +#: ../lib/query.c:543 #, c-format msgid "query of %s failed\n" msgstr "" -#: ../lib/query.c:563 +#: ../lib/query.c:562 #, c-format msgid "query of specfile %s failed, can't parse\n" msgstr "" -#: ../lib/query.c:616 +#: ../lib/query.c:615 #, c-format msgid "no package provides %s\n" msgstr "" -#: ../lib/query.c:626 +#: ../lib/query.c:625 #, c-format msgid "no package triggers %s\n" msgstr "" -#: ../lib/query.c:636 +#: ../lib/query.c:635 #, c-format msgid "no package requires %s\n" msgstr "" -#: ../lib/query.c:651 +#: ../lib/query.c:650 #, c-format msgid "file %s: %s\n" msgstr "" -#: ../lib/query.c:667 +#: ../lib/query.c:666 #, c-format msgid "invalid package number: %s\n" msgstr "" -#: ../lib/query.c:670 +#: ../lib/query.c:669 #, c-format msgid "showing package: %d\n" msgstr "" -#: ../lib/query.c:673 +#: ../lib/query.c:672 #, c-format msgid "record %d could not be read\n" msgstr "" @@ -3137,17 +3137,17 @@ msgstr "" msgid "Invalid signature spec in rc file" msgstr "" -#: ../lib/transaction.c:576 +#: ../lib/transaction.c:624 #, c-format msgid "relocating %s to %s\n" msgstr "" -#: ../lib/transaction.c:582 +#: ../lib/transaction.c:630 #, c-format msgid "excluding %s\n" msgstr "" -#: ../lib/transaction.c:670 +#: ../lib/transaction.c:718 #, c-format msgid "%s skipped due to missingok flag\n" msgstr "" diff --git a/rpm.spec b/rpm.spec index b634c36..dc86577 100644 --- a/rpm.spec +++ b/rpm.spec @@ -2,7 +2,7 @@ Summary: Red Hat Package Manager Name: rpm %define version 2.91 Version: %{version} -Release: 11 +Release: 12 Group: Utilities/System Source: ftp://ftp.rpm.org/pub/rpm/dist/rpm-2.5.x/rpm-%{version}.tar.gz Copyright: GPL -- 2.7.4