00001
00005 #include "system.h"
00006 #include <rpmlib.h>
00007
00008 #include <rpmmacro.h>
00009
00010 #include "fsm.h"
00011 #include "psm.h"
00012
00013 #include "rpmdb.h"
00014
00015 #include "rpmds.h"
00016
00017 #define _RPMFI_INTERNAL
00018 #include "rpmfi.h"
00019
00020 #define _RPMTE_INTERNAL
00021 #include "rpmte.h"
00022
00023 #define _RPMTS_INTERNAL
00024 #include "rpmts.h"
00025
00026 #include "cpio.h"
00027 #include "fprint.h"
00028 #include "legacy.h"
00029 #include "misc.h"
00030
00031 #include "debug.h"
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00050 static int archOkay( const char * pkgArch)
00051
00052 {
00053 if (pkgArch == NULL) return 0;
00054 return (rpmMachineScore(RPM_MACHTABLE_INSTARCH, pkgArch) ? 1 : 0);
00055 }
00056
00059 static int osOkay( const char * pkgOs)
00060
00061 {
00062 if (pkgOs == NULL) return 0;
00063 return (rpmMachineScore(RPM_MACHTABLE_INSTOS, pkgOs) ? 1 : 0);
00064 }
00065
00068 static int sharedCmp(const void * one, const void * two)
00069
00070 {
00071 sharedFileInfo a = (sharedFileInfo) one;
00072 sharedFileInfo b = (sharedFileInfo) two;
00073
00074 if (a->otherPkg < b->otherPkg)
00075 return -1;
00076 else if (a->otherPkg > b->otherPkg)
00077 return 1;
00078
00079 return 0;
00080 }
00081
00090
00091
00092 static int handleInstInstalledFiles(const rpmts ts,
00093 rpmte p, rpmfi fi,
00094 sharedFileInfo shared,
00095 int sharedCount, int reportConflicts)
00096
00097
00098 {
00099 uint_32 tscolor = rpmtsColor(ts);
00100 uint_32 otecolor, tecolor;
00101 uint_32 oFColor, FColor;
00102 const char * altNEVR = NULL;
00103 rpmfi otherFi = NULL;
00104 int numReplaced = 0;
00105 rpmps ps;
00106 int i;
00107
00108 { rpmdbMatchIterator mi;
00109 Header h;
00110 int scareMem = 0;
00111
00112 mi = rpmtsInitIterator(ts, RPMDBI_PACKAGES,
00113 &shared->otherPkg, sizeof(shared->otherPkg));
00114 while ((h = rpmdbNextIterator(mi)) != NULL) {
00115 altNEVR = hGetNEVR(h, NULL);
00116 otherFi = rpmfiNew(ts, h, RPMTAG_BASENAMES, scareMem);
00117 break;
00118 }
00119 mi = rpmdbFreeIterator(mi);
00120 }
00121
00122
00123 tecolor = rpmteColor(p);
00124 tecolor &= tscolor;
00125
00126
00127 otecolor = 0;
00128 otherFi = rpmfiInit(otherFi, 0);
00129 if (otherFi != NULL)
00130 while (rpmfiNext(otherFi) >= 0)
00131 otecolor |= rpmfiFColor(otherFi);
00132 otecolor &= tscolor;
00133
00134 if (otherFi == NULL)
00135 return 1;
00136
00137 fi->replaced = xcalloc(sharedCount, sizeof(*fi->replaced));
00138
00139 ps = rpmtsProblems(ts);
00140 for (i = 0; i < sharedCount; i++, shared++) {
00141 int otherFileNum, fileNum;
00142 int isCfgFile;
00143
00144 otherFileNum = shared->otherFileNum;
00145 (void) rpmfiSetFX(otherFi, otherFileNum);
00146 oFColor = rpmfiFColor(otherFi);
00147 oFColor &= tscolor;
00148
00149 fileNum = shared->pkgFileNum;
00150 (void) rpmfiSetFX(fi, fileNum);
00151 FColor = rpmfiFColor(fi);
00152 FColor &= tscolor;
00153
00154 isCfgFile = ((rpmfiFFlags(otherFi) | rpmfiFFlags(fi)) & RPMFILE_CONFIG);
00155
00156 #ifdef DYING
00157
00158 if (otherStates && otherStates[otherFileNum] != RPMFILE_STATE_NORMAL)
00159 continue;
00160 #endif
00161
00162 if (XFA_SKIPPING(fi->actions[fileNum]))
00163 continue;
00164
00165 if (rpmfiCompare(otherFi, fi)) {
00166
00167
00168 if (tscolor != 0 && FColor != 0 && FColor != oFColor
00169 && reportConflicts)
00170 {
00171 if (oFColor & 0x2) {
00172 fi->actions[fileNum] = FA_SKIP;
00173 reportConflicts = 0;
00174 } else
00175 if (FColor & 0x2) {
00176 fi->actions[fileNum] = FA_CREATE;
00177 reportConflicts = 0;
00178 }
00179 }
00180
00181 if (reportConflicts) {
00182 rpmpsAppend(ps, RPMPROB_FILE_CONFLICT,
00183 rpmteNEVR(p), rpmteKey(p),
00184 rpmfiDN(fi), rpmfiBN(fi),
00185 altNEVR,
00186 0);
00187 }
00188
00189 if ( !(isCfgFile || XFA_SKIPPING(fi->actions[fileNum])) ) {
00190
00191 if (!shared->isRemoved)
00192 fi->replaced[numReplaced++] = *shared;
00193
00194 }
00195 }
00196
00197
00198 if (isCfgFile) {
00199 int skipMissing =
00200 ((rpmtsFlags(ts) & RPMTRANS_FLAG_ALLFILES) ? 0 : 1);
00201 fileAction action = rpmfiDecideFate(otherFi, fi, skipMissing);
00202 fi->actions[fileNum] = action;
00203 }
00204 fi->replacedSizes[fileNum] = rpmfiFSize(otherFi);
00205 }
00206 ps = rpmpsFree(ps);
00207
00208 altNEVR = _free(altNEVR);
00209 otherFi = rpmfiFree(otherFi);
00210
00211 fi->replaced = xrealloc(fi->replaced,
00212 sizeof(*fi->replaced) * (numReplaced + 1));
00213 fi->replaced[numReplaced].otherPkg = 0;
00214
00215 return 0;
00216 }
00217
00218
00221
00222 static int handleRmvdInstalledFiles(const rpmts ts, rpmfi fi,
00223 sharedFileInfo shared, int sharedCount)
00224
00225
00226 {
00227 HGE_t hge = fi->hge;
00228 Header h;
00229 const char * otherStates;
00230 int i, xx;
00231
00232 rpmdbMatchIterator mi;
00233
00234 mi = rpmtsInitIterator(ts, RPMDBI_PACKAGES,
00235 &shared->otherPkg, sizeof(shared->otherPkg));
00236 h = rpmdbNextIterator(mi);
00237 if (h == NULL) {
00238 mi = rpmdbFreeIterator(mi);
00239 return 1;
00240 }
00241
00242 xx = hge(h, RPMTAG_FILESTATES, NULL, (void **) &otherStates, NULL);
00243
00244
00245 for (i = 0; i < sharedCount; i++, shared++) {
00246 int otherFileNum, fileNum;
00247 otherFileNum = shared->otherFileNum;
00248 fileNum = shared->pkgFileNum;
00249
00250 if (otherStates[otherFileNum] != RPMFILE_STATE_NORMAL)
00251 continue;
00252
00253 fi->actions[fileNum] = FA_SKIP;
00254 }
00255
00256
00257 mi = rpmdbFreeIterator(mi);
00258
00259 return 0;
00260 }
00261
00262 #define ISROOT(_d) (((_d)[0] == '/' && (_d)[1] == '\0') ? "" : (_d))
00263
00264
00265 int _fps_debug = 0;
00266
00267 static int fpsCompare (const void * one, const void * two)
00268
00269 {
00270 const struct fingerPrint_s * a = (const struct fingerPrint_s *)one;
00271 const struct fingerPrint_s * b = (const struct fingerPrint_s *)two;
00272 int adnlen = strlen(a->entry->dirName);
00273 int asnlen = (a->subDir ? strlen(a->subDir) : 0);
00274 int abnlen = strlen(a->baseName);
00275 int bdnlen = strlen(b->entry->dirName);
00276 int bsnlen = (b->subDir ? strlen(b->subDir) : 0);
00277 int bbnlen = strlen(b->baseName);
00278 char * afn, * bfn, * t;
00279 int rc = 0;
00280
00281 if (adnlen == 1 && asnlen != 0) adnlen = 0;
00282 if (bdnlen == 1 && bsnlen != 0) bdnlen = 0;
00283
00284
00285 afn = t = alloca(adnlen+asnlen+abnlen+2);
00286 if (adnlen) t = stpcpy(t, a->entry->dirName);
00287 *t++ = '/';
00288 if (a->subDir && asnlen) t = stpcpy(t, a->subDir);
00289 if (abnlen) t = stpcpy(t, a->baseName);
00290 if (afn[0] == '/' && afn[1] == '/') afn++;
00291
00292 bfn = t = alloca(bdnlen+bsnlen+bbnlen+2);
00293 if (bdnlen) t = stpcpy(t, b->entry->dirName);
00294 *t++ = '/';
00295 if (b->subDir && bsnlen) t = stpcpy(t, b->subDir);
00296 if (bbnlen) t = stpcpy(t, b->baseName);
00297 if (bfn[0] == '/' && bfn[1] == '/') bfn++;
00298
00299
00300 rc = strcmp(afn, bfn);
00301
00302 if (_fps_debug)
00303 fprintf(stderr, "\trc(%d) = strcmp(\"%s\", \"%s\")\n", rc, afn, bfn);
00304
00305
00306
00307 if (_fps_debug)
00308 fprintf(stderr, "\t%s/%s%s\trc %d\n",
00309 ISROOT(b->entry->dirName),
00310 (b->subDir ? b->subDir : ""),
00311 b->baseName,
00312 rc
00313 );
00314
00315
00316 return rc;
00317 }
00318
00319
00320 static int _linear_fps_search = 0;
00321
00322 static int findFps(const struct fingerPrint_s * fiFps,
00323 const struct fingerPrint_s * otherFps,
00324 int otherFc)
00325
00326 {
00327 int otherFileNum;
00328
00329
00330 if (_fps_debug)
00331 fprintf(stderr, "==> %s/%s%s\n",
00332 ISROOT(fiFps->entry->dirName),
00333 (fiFps->subDir ? fiFps->subDir : ""),
00334 fiFps->baseName);
00335
00336
00337 if (_linear_fps_search) {
00338
00339 linear:
00340 for (otherFileNum = 0; otherFileNum < otherFc; otherFileNum++, otherFps++) {
00341
00342
00343 if (_fps_debug)
00344 fprintf(stderr, "\t%4d %s/%s%s\n", otherFileNum,
00345 ISROOT(otherFps->entry->dirName),
00346 (otherFps->subDir ? otherFps->subDir : ""),
00347 otherFps->baseName);
00348
00349
00350
00351 if (fiFps == otherFps)
00352 break;
00353
00354
00355
00356 if (FP_EQUAL((*fiFps), (*otherFps)))
00357 break;
00358
00359 }
00360
00361 if (otherFileNum == otherFc) {
00362
00363 if (_fps_debug)
00364 fprintf(stderr, "*** FP_EQUAL NULL %s/%s%s\n",
00365 ISROOT(fiFps->entry->dirName),
00366 (fiFps->subDir ? fiFps->subDir : ""),
00367 fiFps->baseName);
00368
00369 }
00370
00371 return otherFileNum;
00372
00373 } else {
00374
00375 const struct fingerPrint_s * bingoFps;
00376
00377
00378 bingoFps = bsearch(fiFps, otherFps, otherFc, sizeof(*otherFps), fpsCompare);
00379
00380 if (bingoFps == NULL) {
00381
00382 if (_fps_debug)
00383 fprintf(stderr, "*** bingoFps NULL %s/%s%s\n",
00384 ISROOT(fiFps->entry->dirName),
00385 (fiFps->subDir ? fiFps->subDir : ""),
00386 fiFps->baseName);
00387
00388 goto linear;
00389 }
00390
00391
00392
00393 if (!(fiFps == bingoFps || FP_EQUAL((*fiFps), (*bingoFps)))) {
00394
00395 if (_fps_debug)
00396 fprintf(stderr, "*** BAD %s/%s%s\n",
00397 ISROOT(bingoFps->entry->dirName),
00398 (bingoFps->subDir ? bingoFps->subDir : ""),
00399 bingoFps->baseName);
00400
00401 goto linear;
00402 }
00403
00404 otherFileNum = (bingoFps != NULL ? (bingoFps - otherFps) : 0);
00405
00406 }
00407
00408 return otherFileNum;
00409 }
00410
00414
00415 static void handleOverlappedFiles(const rpmts ts,
00416 const rpmte p, rpmfi fi)
00417
00418
00419 {
00420 uint_32 fixupSize = 0;
00421 rpmps ps;
00422 const char * fn;
00423 int i, j;
00424
00425 ps = rpmtsProblems(ts);
00426 fi = rpmfiInit(fi, 0);
00427 if (fi != NULL)
00428 while ((i = rpmfiNext(fi)) >= 0) {
00429 uint_32 tscolor = rpmtsColor(ts);
00430 uint_32 oFColor, FColor;
00431 struct fingerPrint_s * fiFps;
00432 int otherPkgNum, otherFileNum;
00433 rpmfi otherFi;
00434 int_32 FFlags;
00435 int_16 FMode;
00436 const rpmfi * recs;
00437 int numRecs;
00438
00439 if (XFA_SKIPPING(fi->actions[i]))
00440 continue;
00441
00442 fn = rpmfiFN(fi);
00443 fiFps = fi->fps + i;
00444 FFlags = rpmfiFFlags(fi);
00445 FMode = rpmfiFMode(fi);
00446 FColor = rpmfiFColor(fi);
00447 FColor &= tscolor;
00448
00449 fixupSize = 0;
00450
00451
00452
00453
00454
00455
00456
00457 (void) htGetEntry(ts->ht, fiFps,
00458 (const void ***) &recs, &numRecs, NULL);
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482 for (j = 0; j < numRecs && recs[j] != fi; j++)
00483 {};
00484
00485
00486 otherFileNum = -1;
00487 otherFi = NULL;
00488 for (otherPkgNum = j - 1; otherPkgNum >= 0; otherPkgNum--) {
00489 struct fingerPrint_s * otherFps;
00490 int otherFc;
00491
00492 otherFi = recs[otherPkgNum];
00493
00494
00495 if (rpmteType(p) == TR_ADDED && rpmteType(otherFi->te) != TR_ADDED)
00496 continue;
00497
00498 otherFps = otherFi->fps;
00499 otherFc = rpmfiFC(otherFi);
00500
00501 otherFileNum = findFps(fiFps, otherFps, otherFc);
00502 (void) rpmfiSetFX(otherFi, otherFileNum);
00503
00504
00505 if (otherFi->actions[otherFileNum] != FA_UNKNOWN)
00506 break;
00507 }
00508
00509 oFColor = rpmfiFColor(otherFi);
00510 oFColor &= tscolor;
00511
00512
00513 switch (rpmteType(p)) {
00514 case TR_ADDED:
00515 { struct stat sb;
00516 int reportConflicts =
00517 !(rpmtsFilterFlags(ts) & RPMPROB_FILTER_REPLACENEWFILES);
00518 int done = 0;
00519
00520 if (otherPkgNum < 0) {
00521
00522 if (fi->actions[i] != FA_UNKNOWN)
00523 break;
00524 if ((FFlags & RPMFILE_CONFIG) && !lstat(fn, &sb)) {
00525
00526 fi->actions[i] = (FFlags & RPMFILE_NOREPLACE)
00527 ? FA_ALTNAME : FA_BACKUP;
00528 } else {
00529 fi->actions[i] = FA_CREATE;
00530 }
00531 break;
00532 }
00533
00534 assert(otherFi != NULL);
00535
00536 if (rpmfiCompare(otherFi, fi)) {
00537
00538
00539 if (tscolor != 0 && reportConflicts) {
00540 if (FColor & 0x2) {
00541
00542 if (!XFA_SKIPPING(fi->actions[i]))
00543 otherFi->actions[otherFileNum] = FA_SKIP;
00544 fi->actions[i] = FA_CREATE;
00545 reportConflicts = 0;
00546 } else
00547 if (oFColor & 0x2) {
00548
00549 if (XFA_SKIPPING(fi->actions[i]))
00550 otherFi->actions[otherFileNum] = FA_CREATE;
00551 fi->actions[i] = FA_SKIP;
00552 reportConflicts = 0;
00553 } else
00554 if (FColor == 0 && oFColor == 0) {
00555
00556 otherFi->actions[otherFileNum] = FA_CREATE;
00557 fi->actions[i] = FA_CREATE;
00558 reportConflicts = 0;
00559 }
00560 done = 1;
00561 }
00562
00563 if (reportConflicts) {
00564 rpmpsAppend(ps, RPMPROB_NEW_FILE_CONFLICT,
00565 rpmteNEVR(p), rpmteKey(p),
00566 fn, NULL,
00567 rpmteNEVR(otherFi->te),
00568 0);
00569 }
00570 }
00571
00572
00573 fixupSize = rpmfiFSize(otherFi);
00574
00575 if ((FFlags & RPMFILE_CONFIG) && !lstat(fn, &sb)) {
00576
00577 fi->actions[i] = (FFlags & RPMFILE_NOREPLACE)
00578 ? FA_ALTNAME : FA_SKIP;
00579 } else {
00580 if (!done)
00581 fi->actions[i] = FA_CREATE;
00582 }
00583 } break;
00584
00585 case TR_REMOVED:
00586 if (otherPkgNum >= 0) {
00587 assert(otherFi != NULL);
00588
00589 if (otherFi->actions[otherFileNum] != FA_ERASE) {
00590
00591 fi->actions[i] = FA_SKIP;
00592 break;
00593 }
00594
00595 otherFi->actions[otherFileNum] = FA_SKIP;
00596 }
00597 if (XFA_SKIPPING(fi->actions[i]))
00598 break;
00599 if (rpmfiFState(fi) != RPMFILE_STATE_NORMAL)
00600 break;
00601 if (!(S_ISREG(FMode) && (FFlags & RPMFILE_CONFIG))) {
00602 fi->actions[i] = FA_ERASE;
00603 break;
00604 }
00605
00606
00607 { char md5sum[50];
00608 const unsigned char * MD5 = rpmfiMD5(fi);
00609 if (!domd5(fn, md5sum, 0, NULL) && memcmp(MD5, md5sum, 16)) {
00610 fi->actions[i] = FA_BACKUP;
00611 break;
00612 }
00613 }
00614 fi->actions[i] = FA_ERASE;
00615 break;
00616 }
00617
00618
00619
00620 rpmtsUpdateDSI(ts, fiFps->entry->dev, rpmfiFSize(fi),
00621 fi->replacedSizes[i], fixupSize, fi->actions[i]);
00622
00623 }
00624 ps = rpmpsFree(ps);
00625 }
00626
00634 static int ensureOlder(rpmts ts,
00635 const rpmte p, const Header h)
00636
00637 {
00638 int_32 reqFlags = (RPMSENSE_LESS | RPMSENSE_EQUAL);
00639 const char * reqEVR;
00640 rpmds req;
00641 char * t;
00642 int nb;
00643 int rc;
00644
00645 if (p == NULL || h == NULL)
00646 return 1;
00647
00648
00649 nb = strlen(rpmteNEVR(p)) + (rpmteE(p) != NULL ? strlen(rpmteE(p)) : 0) + 1;
00650 t = alloca(nb);
00651 *t = '\0';
00652 reqEVR = t;
00653 if (rpmteE(p) != NULL) t = stpcpy( stpcpy(t, rpmteE(p)), ":");
00654 if (rpmteV(p) != NULL) t = stpcpy(t, rpmteV(p));
00655 *t++ = '-';
00656 if (rpmteR(p) != NULL) t = stpcpy(t, rpmteR(p));
00657
00658
00659 req = rpmdsSingle(RPMTAG_REQUIRENAME, rpmteN(p), reqEVR, reqFlags);
00660 rc = rpmdsNVRMatchesDep(h, req, _rpmds_nopromote);
00661 req = rpmdsFree(req);
00662
00663 if (rc == 0) {
00664 rpmps ps = rpmtsProblems(ts);
00665 const char * altNEVR = hGetNEVR(h, NULL);
00666 rpmpsAppend(ps, RPMPROB_OLDPACKAGE,
00667 rpmteNEVR(p), rpmteKey(p),
00668 NULL, NULL,
00669 altNEVR,
00670 0);
00671 altNEVR = _free(altNEVR);
00672 ps = rpmpsFree(ps);
00673 rc = 1;
00674 } else
00675 rc = 0;
00676
00677 return rc;
00678 }
00679
00685
00686
00687 static void skipFiles(const rpmts ts, rpmfi fi)
00688
00689
00690 {
00691 uint_32 tscolor = rpmtsColor(ts);
00692 uint_32 FColor;
00693 int noConfigs = (rpmtsFlags(ts) & RPMTRANS_FLAG_NOCONFIGS);
00694 int noDocs = (rpmtsFlags(ts) & RPMTRANS_FLAG_NODOCS);
00695 char ** netsharedPaths = NULL;
00696 const char ** languages;
00697 const char * dn, * bn;
00698 int dnlen, bnlen, ix;
00699 const char * s;
00700 int * drc;
00701 char * dff;
00702 int dc;
00703 int i, j;
00704
00705 if (!noDocs)
00706 noDocs = rpmExpandNumeric("%{_excludedocs}");
00707
00708 { const char *tmpPath = rpmExpand("%{_netsharedpath}", NULL);
00709
00710 if (tmpPath && *tmpPath != '%')
00711 netsharedPaths = splitString(tmpPath, strlen(tmpPath), ':');
00712
00713 tmpPath = _free(tmpPath);
00714 }
00715
00716 s = rpmExpand("%{_install_langs}", NULL);
00717
00718 if (!(s && *s != '%'))
00719 s = _free(s);
00720 if (s) {
00721 languages = (const char **) splitString(s, strlen(s), ':');
00722 s = _free(s);
00723 } else
00724 languages = NULL;
00725
00726
00727
00728 dc = rpmfiDC(fi);
00729 drc = alloca(dc * sizeof(*drc));
00730 memset(drc, 0, dc * sizeof(*drc));
00731 dff = alloca(dc * sizeof(*dff));
00732 memset(dff, 0, dc * sizeof(*dff));
00733
00734 fi = rpmfiInit(fi, 0);
00735 if (fi != NULL)
00736 while ((i = rpmfiNext(fi)) >= 0)
00737 {
00738 char ** nsp;
00739
00740 bn = rpmfiBN(fi);
00741 bnlen = strlen(bn);
00742 ix = rpmfiDX(fi);
00743 dn = rpmfiDN(fi);
00744 dnlen = strlen(dn);
00745 if (dn == NULL)
00746 continue;
00747
00748 drc[ix]++;
00749
00750
00751 if (XFA_SKIPPING(fi->actions[i])) {
00752 drc[ix]--; dff[ix] = 1;
00753 continue;
00754 }
00755
00756
00757 FColor = rpmfiFColor(fi);
00758 if (tscolor && FColor && !(tscolor & FColor)) {
00759 drc[ix]--; dff[ix] = 1;
00760 fi->actions[i] = FA_SKIPCOLOR;
00761 continue;
00762 }
00763
00764
00765
00766
00767
00768
00769 for (nsp = netsharedPaths; nsp && *nsp; nsp++) {
00770 int len;
00771
00772 len = strlen(*nsp);
00773 if (dnlen >= len) {
00774 if (strncmp(dn, *nsp, len))
00775 continue;
00776
00777 if (!(dn[len] == '/' || dn[len] == '\0'))
00778 continue;
00779 } else {
00780 if (len < (dnlen + bnlen))
00781 continue;
00782 if (strncmp(dn, *nsp, dnlen))
00783 continue;
00784 if (strncmp(bn, (*nsp) + dnlen, bnlen))
00785 continue;
00786 len = dnlen + bnlen;
00787
00788 if (!((*nsp)[len] == '/' || (*nsp)[len] == '\0'))
00789 continue;
00790 }
00791
00792 break;
00793 }
00794
00795 if (nsp && *nsp) {
00796 drc[ix]--; dff[ix] = 1;
00797 fi->actions[i] = FA_SKIPNETSHARED;
00798 continue;
00799 }
00800
00801
00802
00803
00804 if (fi->flangs && languages && *fi->flangs[i]) {
00805 const char **lang, *l, *le;
00806 for (lang = languages; *lang != NULL; lang++) {
00807 if (!strcmp(*lang, "all"))
00808 break;
00809 for (l = fi->flangs[i]; *l != '\0'; l = le) {
00810 for (le = l; *le != '\0' && *le != '|'; le++)
00811 {};
00812 if ((le-l) > 0 && !strncmp(*lang, l, (le-l)))
00813 break;
00814 if (*le == '|') le++;
00815 }
00816 if (*l != '\0')
00817 break;
00818 }
00819 if (*lang == NULL) {
00820 drc[ix]--; dff[ix] = 1;
00821 fi->actions[i] = FA_SKIPNSTATE;
00822 continue;
00823 }
00824 }
00825
00826
00827
00828
00829 if (noConfigs && (rpmfiFFlags(fi) & RPMFILE_CONFIG)) {
00830 drc[ix]--; dff[ix] = 1;
00831 fi->actions[i] = FA_SKIPNSTATE;
00832 continue;
00833 }
00834
00835
00836
00837
00838 if (noDocs && (rpmfiFFlags(fi) & RPMFILE_DOC)) {
00839 drc[ix]--; dff[ix] = 1;
00840 fi->actions[i] = FA_SKIPNSTATE;
00841 continue;
00842 }
00843 }
00844
00845
00846 #ifndef NOTYET
00847 if (fi != NULL)
00848 for (j = 0; j < dc; j++)
00849 #else
00850 if ((fi = rpmfiInitD(fi)) != NULL)
00851 while (j = rpmfiNextD(fi) >= 0)
00852 #endif
00853 {
00854
00855 if (drc[j]) continue;
00856 if (!dff[j]) continue;
00857
00858
00859 dn = fi->dnl[j]; dnlen = strlen(dn) - 1;
00860 bn = dn + dnlen; bnlen = 0;
00861 while (bn > dn && bn[-1] != '/') {
00862 bnlen++;
00863 dnlen--;
00864 bn--;
00865 }
00866
00867
00868 fi = rpmfiInit(fi, 0);
00869 if (fi != NULL)
00870 while ((i = rpmfiNext(fi)) >= 0) {
00871 const char * fdn, * fbn;
00872 int_16 fFMode;
00873
00874 if (XFA_SKIPPING(fi->actions[i]))
00875 continue;
00876
00877 fFMode = rpmfiFMode(fi);
00878
00879 if (whatis(fFMode) != XDIR)
00880 continue;
00881 fdn = rpmfiDN(fi);
00882 if (strlen(fdn) != dnlen)
00883 continue;
00884 if (strncmp(fdn, dn, dnlen))
00885 continue;
00886 fbn = rpmfiBN(fi);
00887 if (strlen(fbn) != bnlen)
00888 continue;
00889 if (strncmp(fbn, bn, bnlen))
00890 continue;
00891 rpmMessage(RPMMESS_DEBUG, _("excluding directory %s\n"), dn);
00892 fi->actions[i] = FA_SKIPNSTATE;
00893 break;
00894 }
00895 }
00896
00897 if (netsharedPaths) freeSplitString(netsharedPaths);
00898 #ifdef DYING
00899 fi->flangs = _free(fi->flangs);
00900 #endif
00901 if (languages) freeSplitString((char **)languages);
00902 }
00903
00904
00905
00912 static
00913 rpmfi rpmtsiFi(const rpmtsi tsi)
00914
00915 {
00916 rpmfi fi = NULL;
00917
00918 if (tsi != NULL && tsi->ocsave != -1) {
00919
00920 rpmte te = rpmtsElement(tsi->ts, tsi->ocsave);
00921
00922 if (te != NULL && (fi = te->fi) != NULL)
00923 fi->te = te;
00924
00925
00926 }
00927
00928 return fi;
00929
00930 }
00931
00932 #define NOTIFY(_ts, _al) if ((_ts)->notify) (void) (_ts)->notify _al
00933
00934 int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
00935 {
00936 uint_32 tscolor = rpmtsColor(ts);
00937 int i, j;
00938 int ourrc = 0;
00939 int totalFileCount = 0;
00940 rpmfi fi;
00941 sharedFileInfo shared, sharedList;
00942 int numShared;
00943 int nexti;
00944 alKey lastFailKey;
00945 fingerPrintCache fpc;
00946 rpmps ps;
00947 rpmpsm psm;
00948 rpmtsi pi; rpmte p;
00949 rpmtsi qi; rpmte q;
00950 int numAdded;
00951 int numRemoved;
00952 int xx;
00953
00954
00955 if (rpmtsNElements(ts) <= 0)
00956 return -1;
00957
00958 if (rpmtsFlags(ts) & RPMTRANS_FLAG_NOSCRIPTS)
00959 (void) rpmtsSetFlags(ts, (rpmtsFlags(ts) | _noTransScripts | _noTransTriggers));
00960 if (rpmtsFlags(ts) & RPMTRANS_FLAG_NOTRIGGERS)
00961 (void) rpmtsSetFlags(ts, (rpmtsFlags(ts) | _noTransTriggers));
00962
00963 if (rpmtsFlags(ts) & RPMTRANS_FLAG_JUSTDB)
00964 (void) rpmtsSetFlags(ts, (rpmtsFlags(ts) | _noTransScripts | _noTransTriggers));
00965
00966 ts->probs = rpmpsFree(ts->probs);
00967 ts->probs = rpmpsCreate();
00968
00969
00970 { int dbmode = (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)
00971 ? O_RDONLY : (O_RDWR|O_CREAT);
00972
00973
00974 if (rpmtsOpenDB(ts, dbmode))
00975 return -1;
00976 }
00977
00978 ts->ignoreSet = ignoreSet;
00979 { const char * currDir = currentDirectory();
00980 rpmtsSetCurrDir(ts, currDir);
00981 currDir = _free(currDir);
00982 }
00983
00984 (void) rpmtsSetChrootDone(ts, 0);
00985
00986 { int_32 tid = (int_32) time(NULL);
00987 (void) rpmtsSetTid(ts, tid);
00988 }
00989
00990
00991 xx = rpmtsInitDSI(ts);
00992
00993
00994
00995
00996
00997
00998
00999
01000
01001
01002 rpmMessage(RPMMESS_DEBUG, _("sanity checking %d elements\n"), rpmtsNElements(ts));
01003 ps = rpmtsProblems(ts);
01004
01005 pi = rpmtsiInit(ts);
01006 while ((p = rpmtsiNext(pi, TR_ADDED)) != NULL) {
01007 rpmdbMatchIterator mi;
01008 int fc;
01009
01010 if ((fi = rpmtsiFi(pi)) == NULL)
01011 continue;
01012 fc = rpmfiFC(fi);
01013
01014 if (!(rpmtsFilterFlags(ts) & RPMPROB_FILTER_IGNOREARCH) && !tscolor)
01015 if (!archOkay(rpmteA(p)))
01016 rpmpsAppend(ps, RPMPROB_BADARCH,
01017 rpmteNEVR(p), rpmteKey(p),
01018 rpmteA(p), NULL,
01019 NULL, 0);
01020
01021 if (!(rpmtsFilterFlags(ts) & RPMPROB_FILTER_IGNOREOS))
01022 if (!osOkay(rpmteO(p)))
01023 rpmpsAppend(ps, RPMPROB_BADOS,
01024 rpmteNEVR(p), rpmteKey(p),
01025 rpmteO(p), NULL,
01026 NULL, 0);
01027
01028 if (!(rpmtsFilterFlags(ts) & RPMPROB_FILTER_OLDPACKAGE)) {
01029 Header h;
01030 mi = rpmtsInitIterator(ts, RPMTAG_NAME, rpmteN(p), 0);
01031 while ((h = rpmdbNextIterator(mi)) != NULL)
01032 xx = ensureOlder(ts, p, h);
01033 mi = rpmdbFreeIterator(mi);
01034 }
01035
01036 if (!(rpmtsFilterFlags(ts) & RPMPROB_FILTER_REPLACEPKG)) {
01037 mi = rpmtsInitIterator(ts, RPMTAG_NAME, rpmteN(p), 0);
01038 xx = rpmdbSetIteratorRE(mi, RPMTAG_EPOCH, RPMMIRE_DEFAULT,
01039 rpmteE(p));
01040 xx = rpmdbSetIteratorRE(mi, RPMTAG_VERSION, RPMMIRE_DEFAULT,
01041 rpmteV(p));
01042 xx = rpmdbSetIteratorRE(mi, RPMTAG_RELEASE, RPMMIRE_DEFAULT,
01043 rpmteR(p));
01044 if (tscolor) {
01045 xx = rpmdbSetIteratorRE(mi, RPMTAG_ARCH, RPMMIRE_DEFAULT,
01046 rpmteA(p));
01047 xx = rpmdbSetIteratorRE(mi, RPMTAG_OS, RPMMIRE_DEFAULT,
01048 rpmteO(p));
01049 }
01050
01051 while (rpmdbNextIterator(mi) != NULL) {
01052 rpmpsAppend(ps, RPMPROB_PKG_INSTALLED,
01053 rpmteNEVR(p), rpmteKey(p),
01054 NULL, NULL,
01055 NULL, 0);
01056 break;
01057 }
01058 mi = rpmdbFreeIterator(mi);
01059 }
01060
01061
01062 totalFileCount += fc;
01063
01064 }
01065 pi = rpmtsiFree(pi);
01066 ps = rpmpsFree(ps);
01067
01068
01069 pi = rpmtsiInit(ts);
01070 while ((p = rpmtsiNext(pi, TR_REMOVED)) != NULL) {
01071 int fc;
01072
01073 if ((fi = rpmtsiFi(pi)) == NULL)
01074 continue;
01075 fc = rpmfiFC(fi);
01076
01077 totalFileCount += fc;
01078 }
01079 pi = rpmtsiFree(pi);
01080
01081
01082
01083
01084
01085
01086
01087
01088
01089
01090 rpmMessage(RPMMESS_DEBUG, _("computing %d file fingerprints\n"), totalFileCount);
01091 numAdded = numRemoved = 0;
01092 pi = rpmtsiInit(ts);
01093 while ((p = rpmtsiNext(pi, 0)) != NULL) {
01094 int fc;
01095
01096 if ((fi = rpmtsiFi(pi)) == NULL)
01097 continue;
01098 fc = rpmfiFC(fi);
01099
01100
01101 switch (rpmteType(p)) {
01102 case TR_ADDED:
01103 numAdded++;
01104 fi->record = 0;
01105
01106 if (fc > 0)
01107 skipFiles(ts, fi);
01108 break;
01109 case TR_REMOVED:
01110 numRemoved++;
01111 fi->record = rpmteDBOffset(p);
01112 break;
01113 }
01114
01115
01116 fi->fps = (fc > 0 ? xmalloc(fc * sizeof(*fi->fps)) : NULL);
01117 }
01118 pi = rpmtsiFree(pi);
01119
01120 if (!rpmtsChrootDone(ts)) {
01121 const char * rootDir = rpmtsRootDir(ts);
01122 xx = chdir("/");
01123
01124 if (rootDir != NULL)
01125 xx = chroot(rootDir);
01126
01127 (void) rpmtsSetChrootDone(ts, 1);
01128 }
01129
01130 ts->ht = htCreate(totalFileCount * 2, 0, 0, fpHashFunction, fpEqual);
01131 fpc = fpCacheCreate(totalFileCount);
01132
01133
01134
01135
01136 pi = rpmtsiInit(ts);
01137 while ((p = rpmtsiNext(pi, 0)) != NULL) {
01138 int fc;
01139
01140 (void) rpmdbCheckSignals();
01141
01142 if ((fi = rpmtsiFi(pi)) == NULL)
01143 continue;
01144 fc = rpmfiFC(fi);
01145
01146 (void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_FINGERPRINT), 0);
01147 fpLookupList(fpc, fi->dnl, fi->bnl, fi->dil, fc, fi->fps);
01148
01149 fi = rpmfiInit(fi, 0);
01150 if (fi != NULL)
01151 while ((i = rpmfiNext(fi)) >= 0) {
01152 if (XFA_SKIPPING(fi->actions[i]))
01153 continue;
01154
01155 htAddEntry(ts->ht, fi->fps + i, (void *) fi);
01156
01157 }
01158
01159 (void) rpmswExit(rpmtsOp(ts, RPMTS_OP_FINGERPRINT), fc);
01160 }
01161 pi = rpmtsiFree(pi);
01162
01163 NOTIFY(ts, (NULL, RPMCALLBACK_TRANS_START, 6, ts->orderCount,
01164 NULL, ts->notifyData));
01165
01166
01167
01168
01169 rpmMessage(RPMMESS_DEBUG, _("computing file dispositions\n"));
01170 ps = rpmtsProblems(ts);
01171 pi = rpmtsiInit(ts);
01172 while ((p = rpmtsiNext(pi, 0)) != NULL) {
01173 dbiIndexSet * matches;
01174 int knownBad;
01175 int fc;
01176
01177 (void) rpmdbCheckSignals();
01178
01179 if ((fi = rpmtsiFi(pi)) == NULL)
01180 continue;
01181 fc = rpmfiFC(fi);
01182
01183 NOTIFY(ts, (NULL, RPMCALLBACK_TRANS_PROGRESS, rpmtsiOc(pi),
01184 ts->orderCount, NULL, ts->notifyData));
01185
01186 if (fc == 0) continue;
01187
01188 (void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_FINGERPRINT), 0);
01189
01190 matches = xcalloc(fc, sizeof(*matches));
01191 if (rpmdbFindFpList(rpmtsGetRdb(ts), fi->fps, matches, fc)) {
01192 ps = rpmpsFree(ps);
01193 return 1;
01194 }
01195
01196 numShared = 0;
01197 fi = rpmfiInit(fi, 0);
01198 while ((i = rpmfiNext(fi)) >= 0)
01199 numShared += dbiIndexSetCount(matches[i]);
01200
01201
01202 shared = sharedList = xcalloc((numShared + 1), sizeof(*sharedList));
01203
01204 fi = rpmfiInit(fi, 0);
01205 while ((i = rpmfiNext(fi)) >= 0) {
01206
01207
01208
01209
01210 for (j = 0; j < dbiIndexSetCount(matches[i]); j++) {
01211 int ro;
01212 ro = dbiIndexRecordOffset(matches[i], j);
01213 knownBad = 0;
01214 qi = rpmtsiInit(ts);
01215 while ((q = rpmtsiNext(qi, TR_REMOVED)) != NULL) {
01216 if (ro == knownBad)
01217 break;
01218 if (rpmteDBOffset(q) == ro)
01219 knownBad = ro;
01220 }
01221 qi = rpmtsiFree(qi);
01222
01223 shared->pkgFileNum = i;
01224 shared->otherPkg = dbiIndexRecordOffset(matches[i], j);
01225 shared->otherFileNum = dbiIndexRecordFileNumber(matches[i], j);
01226 shared->isRemoved = (knownBad == ro);
01227 shared++;
01228 }
01229 matches[i] = dbiFreeIndexSet(matches[i]);
01230 }
01231 numShared = shared - sharedList;
01232 shared->otherPkg = -1;
01233 matches = _free(matches);
01234
01235
01236 qsort(sharedList, numShared, sizeof(*shared), sharedCmp);
01237
01238
01239
01240 for (i = 0; i < numShared; i = nexti) {
01241 int beingRemoved;
01242
01243 shared = sharedList + i;
01244
01245
01246 for (nexti = i + 1; nexti < numShared; nexti++) {
01247 if (sharedList[nexti].otherPkg != shared->otherPkg)
01248 break;
01249 }
01250
01251
01252 beingRemoved = 0;
01253 if (ts->removedPackages != NULL)
01254 for (j = 0; j < ts->numRemovedPackages; j++) {
01255 if (ts->removedPackages[j] != shared->otherPkg)
01256 continue;
01257 beingRemoved = 1;
01258 break;
01259 }
01260
01261
01262 switch (rpmteType(p)) {
01263 case TR_ADDED:
01264 xx = handleInstInstalledFiles(ts, p, fi, shared, nexti - i,
01265 !(beingRemoved || (rpmtsFilterFlags(ts) & RPMPROB_FILTER_REPLACEOLDFILES)));
01266 break;
01267 case TR_REMOVED:
01268 if (!beingRemoved)
01269 xx = handleRmvdInstalledFiles(ts, fi, shared, nexti - i);
01270 break;
01271 }
01272 }
01273
01274
01275 free(sharedList);
01276
01277
01278 handleOverlappedFiles(ts, p, fi);
01279
01280
01281 switch (rpmteType(p)) {
01282 case TR_ADDED:
01283 rpmtsCheckDSIProblems(ts, p);
01284 break;
01285 case TR_REMOVED:
01286 break;
01287 }
01288 (void) rpmswExit(rpmtsOp(ts, RPMTS_OP_FINGERPRINT), fc);
01289 }
01290 pi = rpmtsiFree(pi);
01291 ps = rpmpsFree(ps);
01292
01293 if (rpmtsChrootDone(ts)) {
01294 const char * currDir = rpmtsCurrDir(ts);
01295
01296 xx = chroot(".");
01297
01298 (void) rpmtsSetChrootDone(ts, 0);
01299 if (currDir != NULL)
01300 xx = chdir(currDir);
01301 }
01302
01303 NOTIFY(ts, (NULL, RPMCALLBACK_TRANS_STOP, 6, ts->orderCount,
01304 NULL, ts->notifyData));
01305
01306
01307
01308
01309 pi = rpmtsiInit(ts);
01310 while ((p = rpmtsiNext(pi, 0)) != NULL) {
01311 if ((fi = rpmtsiFi(pi)) == NULL)
01312 continue;
01313 if (rpmfiFC(fi) == 0)
01314 continue;
01315 fi->fps = _free(fi->fps);
01316 }
01317 pi = rpmtsiFree(pi);
01318
01319 fpc = fpCacheFree(fpc);
01320 ts->ht = htFree(ts->ht);
01321
01322
01323
01324
01325 if ((rpmtsFlags(ts) & RPMTRANS_FLAG_BUILD_PROBS)
01326 || (ts->probs->numProblems &&
01327 (okProbs != NULL || rpmpsTrim(ts->probs, okProbs)))
01328 )
01329 {
01330 return ts->orderCount;
01331 }
01332
01333
01334
01335
01336 if (rpmtsFlags(ts) & (RPMTRANS_FLAG_DIRSTASH | RPMTRANS_FLAG_REPACKAGE)) {
01337 int progress;
01338 progress = 0;
01339 pi = rpmtsiInit(ts);
01340 while ((p = rpmtsiNext(pi, 0)) != NULL) {
01341
01342 (void) rpmdbCheckSignals();
01343
01344 if ((fi = rpmtsiFi(pi)) == NULL)
01345 continue;
01346 switch (rpmteType(p)) {
01347 case TR_ADDED:
01348 break;
01349 case TR_REMOVED:
01350 if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_REPACKAGE))
01351 break;
01352 if (!progress)
01353 NOTIFY(ts, (NULL, RPMCALLBACK_REPACKAGE_START,
01354 7, numRemoved, NULL, ts->notifyData));
01355
01356 NOTIFY(ts, (NULL, RPMCALLBACK_REPACKAGE_PROGRESS, progress,
01357 numRemoved, NULL, ts->notifyData));
01358 progress++;
01359
01360 (void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_REPACKAGE), 0);
01361
01362
01363 fi->mapflags |= CPIO_MAP_ABSOLUTE;
01364 fi->mapflags |= CPIO_MAP_ADDDOT;
01365 fi->mapflags |= CPIO_ALL_HARDLINKS;
01366 psm = rpmpsmNew(ts, p, fi);
01367 xx = rpmpsmStage(psm, PSM_PKGSAVE);
01368 psm = rpmpsmFree(psm);
01369 fi->mapflags &= ~CPIO_MAP_ABSOLUTE;
01370 fi->mapflags &= ~CPIO_MAP_ADDDOT;
01371 fi->mapflags &= ~CPIO_ALL_HARDLINKS;
01372
01373 (void) rpmswExit(rpmtsOp(ts, RPMTS_OP_REPACKAGE), 0);
01374
01375 break;
01376 }
01377 }
01378 pi = rpmtsiFree(pi);
01379 if (progress) {
01380 NOTIFY(ts, (NULL, RPMCALLBACK_REPACKAGE_STOP, 7, numRemoved,
01381 NULL, ts->notifyData));
01382 }
01383 }
01384
01385
01386
01387
01388 lastFailKey = (alKey)-2;
01389 pi = rpmtsiInit(ts);
01390
01391 while ((p = rpmtsiNext(pi, 0)) != NULL) {
01392 alKey pkgKey;
01393 int gotfd;
01394
01395 (void) rpmdbCheckSignals();
01396
01397 gotfd = 0;
01398 if ((fi = rpmtsiFi(pi)) == NULL)
01399 continue;
01400
01401 psm = rpmpsmNew(ts, p, fi);
01402 assert(psm != NULL);
01403 psm->unorderedSuccessor =
01404 (rpmtsiOc(pi) >= rpmtsUnorderedSuccessors(ts, -1) ? 1 : 0);
01405
01406 switch (rpmteType(p)) {
01407 case TR_ADDED:
01408 (void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_INSTALL), 0);
01409
01410 pkgKey = rpmteAddedKey(p);
01411
01412 rpmMessage(RPMMESS_DEBUG, "========== +++ %s %s-%s 0x%x\n",
01413 rpmteNEVR(p), rpmteA(p), rpmteO(p), rpmteColor(p));
01414
01415 p->h = NULL;
01416
01417 {
01418
01419 p->fd = ts->notify(p->h, RPMCALLBACK_INST_OPEN_FILE, 0, 0,
01420 rpmteKey(p), ts->notifyData);
01421
01422 if (rpmteFd(p) != NULL) {
01423 rpmVSFlags ovsflags = rpmtsVSFlags(ts);
01424 rpmVSFlags vsflags = ovsflags | RPMVSF_NEEDPAYLOAD;
01425 rpmRC rpmrc;
01426
01427 ovsflags = rpmtsSetVSFlags(ts, vsflags);
01428 rpmrc = rpmReadPackageFile(ts, rpmteFd(p),
01429 rpmteNEVR(p), &p->h);
01430 vsflags = rpmtsSetVSFlags(ts, ovsflags);
01431
01432 switch (rpmrc) {
01433 default:
01434
01435 p->fd = ts->notify(p->h, RPMCALLBACK_INST_CLOSE_FILE,
01436 0, 0,
01437 rpmteKey(p), ts->notifyData);
01438
01439 p->fd = NULL;
01440 ourrc++;
01441 break;
01442 case RPMRC_NOTTRUSTED:
01443 case RPMRC_NOKEY:
01444 case RPMRC_OK:
01445 break;
01446 }
01447 if (rpmteFd(p) != NULL) gotfd = 1;
01448 }
01449 }
01450
01451
01452 if (rpmteFd(p) != NULL) {
01453
01454
01455
01456
01457 psm->fi = rpmfiFree(psm->fi);
01458 {
01459 char * fstates = fi->fstates;
01460 fileAction * actions = fi->actions;
01461 rpmte savep;
01462
01463 fi->fstates = NULL;
01464 fi->actions = NULL;
01465 fi = rpmfiFree(fi);
01466
01467 savep = rpmtsSetRelocateElement(ts, p);
01468 fi = rpmfiNew(ts, p->h, RPMTAG_BASENAMES, 1);
01469 (void) rpmtsSetRelocateElement(ts, savep);
01470
01471 if (fi != NULL) {
01472 fi->te = p;
01473 fi->fstates = _free(fi->fstates);
01474 fi->fstates = fstates;
01475 fi->actions = _free(fi->actions);
01476 fi->actions = actions;
01477 p->fi = fi;
01478 }
01479 }
01480 psm->fi = rpmfiLink(p->fi, NULL);
01481
01482
01483 if (rpmpsmStage(psm, PSM_PKGINSTALL)) {
01484 ourrc++;
01485 lastFailKey = pkgKey;
01486 }
01487
01488 } else {
01489 ourrc++;
01490 lastFailKey = pkgKey;
01491 }
01492
01493 if (gotfd) {
01494
01495 (void) ts->notify(p->h, RPMCALLBACK_INST_CLOSE_FILE, 0, 0,
01496 rpmteKey(p), ts->notifyData);
01497
01498
01499 p->fd = NULL;
01500
01501 }
01502
01503 p->h = headerFree(p->h);
01504
01505 (void) rpmswExit(rpmtsOp(ts, RPMTS_OP_INSTALL), 0);
01506
01507 break;
01508 case TR_REMOVED:
01509 (void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_ERASE), 0);
01510
01511 rpmMessage(RPMMESS_DEBUG, "========== --- %s %s-%s 0x%x\n",
01512 rpmteNEVR(p), rpmteA(p), rpmteO(p), rpmteColor(p));
01513
01514
01515
01516
01517 if (rpmteDependsOnKey(p) != lastFailKey) {
01518 if (rpmpsmStage(psm, PSM_PKGERASE))
01519 ourrc++;
01520 }
01521
01522 (void) rpmswExit(rpmtsOp(ts, RPMTS_OP_ERASE), 0);
01523
01524 break;
01525 }
01526 xx = rpmdbSync(rpmtsGetRdb(ts));
01527
01528
01529 psm = rpmpsmFree(psm);
01530
01531
01532
01533 p->fi = rpmfiFree(p->fi);
01534
01535
01536 }
01537
01538 pi = rpmtsiFree(pi);
01539
01540
01541 if (ourrc)
01542 return -1;
01543 else
01544 return 0;
01545
01546 }