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