summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-03-17 14:10:11 +0200
committerPanu Matilainen <pmatilai@redhat.com>2008-03-17 14:10:11 +0200
commitd89482a7c7777d379ab415ebba747b6af19babdb (patch)
tree086729e83518cbac0b829f6cb8d6e7054ebcead4 /lib
parent37543ee0405c38a9d54a12bf0d54698773a3933c (diff)
downloadrpm-d89482a7c7777d379ab415ebba747b6af19babdb.tar.gz
rpm-d89482a7c7777d379ab415ebba747b6af19babdb.tar.bz2
rpm-d89482a7c7777d379ab415ebba747b6af19babdb.zip
Remove repackage support to finish off with rollback
The two main classes of rollback/repackage need are 1) Gimme back the previous version, this broke XYZ on my system. This is better handled by downgrading to the previous version of original package instead of repackaged garbage. We should maintain real package (version) history somewhere. 2) Upgrade messed up my configuration. Instead of repackaging everything we could be far more intelligent wrt config files, stick them into real version control or at least have hooks to do so. RPMCALLBACK_REPACKAGE_* and RPMTRANS_FLAG_REPACKAGE definitions left around to avoid needlessly breaking everybodys callbacks (for now)
Diffstat (limited to 'lib')
-rw-r--r--lib/poptI.c6
-rw-r--r--lib/psm.c174
-rw-r--r--lib/psm.h1
-rw-r--r--lib/rpmcallback.h6
-rw-r--r--lib/rpminstall.c40
-rw-r--r--lib/rpmts.c1
-rw-r--r--lib/rpmts.h5
-rw-r--r--lib/transaction.c52
8 files changed, 11 insertions, 274 deletions
diff --git a/lib/poptI.c b/lib/poptI.c
index 9c72d8c8b..9aff68528 100644
--- a/lib/poptI.c
+++ b/lib/poptI.c
@@ -148,9 +148,6 @@ struct poptOption rpmInstallPoptTable[] = {
&rpmIArgs.transFlags, RPMTRANS_FLAG_DEPLOOPS,
N_("print dependency loops as warning"), NULL},
- { "dirstash", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
- &rpmIArgs.transFlags, RPMTRANS_FLAG_DIRSTASH,
- N_("save erased package files by renaming into sub-directory"), NULL},
{ "erase", 'e', POPT_BIT_SET,
&rpmIArgs.installInterfaceFlags, INSTALL_ERASE,
N_("erase (uninstall) package"), N_("<package>+") },
@@ -268,9 +265,6 @@ struct poptOption rpmInstallPoptTable[] = {
{ "relocate", '\0', POPT_ARG_STRING, 0, POPT_RELOCATE,
N_("relocate files from path <old> to <new>"),
N_("<old>=<new>") },
- { "repackage", '\0', POPT_BIT_SET,
- &rpmIArgs.transFlags, RPMTRANS_FLAG_REPACKAGE,
- N_("save erased package files by repackaging"), NULL},
{ "replacefiles", '\0', POPT_BIT_SET, &rpmIArgs.probFilter,
(RPMPROB_FILTER_REPLACEOLDFILES | RPMPROB_FILTER_REPLACENEWFILES),
N_("ignore file conflicts between packages"), NULL},
diff --git a/lib/psm.c b/lib/psm.c
index b5379e244..cb53957b0 100644
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -39,14 +39,10 @@ struct rpmpsm_s {
rpmte te; /*!< current transaction element */
rpmfi fi; /*!< transaction element file info */
FD_t cfd; /*!< Payload file handle. */
- FD_t fd; /*!< Repackage file handle. */
- Header oh; /*!< Repackage header. */
rpmdbMatchIterator mi;
const char * stepName;
char * rpmio_flags;
char * failedFile;
- char * pkgURL; /*!< Repackage URL. */
- const char * pkgfn; /*!< Repackage file name. */
int scriptTag; /*!< Scriptlet data tag. */
int progTag; /*!< Scriptlet interpreter tag. */
int npkgs_installed; /*!< No. of installed instances. */
@@ -1138,7 +1134,6 @@ static const char * pkgStageString(pkgStage a)
case PSM_PKGINSTALL: return " install";
case PSM_PKGERASE: return " erase";
case PSM_PKGCOMMIT: return " commit";
- case PSM_PKGSAVE: return "repackage";
case PSM_INIT: return "init";
case PSM_PRE: return "pre";
@@ -1311,6 +1306,7 @@ rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
}
if (psm->goal == PSM_PKGINSTALL) {
+ Header oh;
int fc = rpmfiFC(fi);
psm->scriptArg = psm->npkgs_installed + 1;
@@ -1330,9 +1326,9 @@ assert(psm->mi == NULL);
rpmteO(psm->te));
}
- while ((psm->oh = rpmdbNextIterator(psm->mi)) != NULL) {
+ while ((oh = rpmdbNextIterator(psm->mi)) != NULL) {
fi->record = rpmdbGetIteratorOffset(psm->mi);
- psm->oh = NULL;
+ oh = NULL;
break;
}
psm->mi = rpmdbFreeIterator(psm->mi);
@@ -1372,7 +1368,7 @@ assert(psm->mi == NULL);
(rpm_data_t *) &fi->fgroup, NULL);
rc = RPMRC_OK;
}
- if (psm->goal == PSM_PKGERASE || psm->goal == PSM_PKGSAVE) {
+ if (psm->goal == PSM_PKGERASE) {
psm->scriptArg = psm->npkgs_installed - 1;
/* Retrieve installed header. */
@@ -1380,25 +1376,6 @@ assert(psm->mi == NULL);
if (rc == RPMRC_OK && psm->te)
rpmteSetHeader(psm->te, fi->h);
}
- if (psm->goal == PSM_PKGSAVE) {
- /* Open output package for writing. */
- { char * bfmt = rpmGetPath("%{_repackage_name_fmt}", NULL);
- char * pkgbn =
- headerSprintf(fi->h, bfmt, rpmTagTable, rpmHeaderFormats, NULL);
-
- bfmt = _free(bfmt);
- psm->pkgURL = rpmGenPath("%{?_repackage_root}",
- "%{?_repackage_dir}",
- pkgbn);
- pkgbn = _free(pkgbn);
- (void) urlPath(psm->pkgURL, &psm->pkgfn);
- psm->fd = Fopen(psm->pkgfn, "w.ufdio");
- if (psm->fd == NULL || Ferror(psm->fd)) {
- rc = RPMRC_FAIL;
- break;
- }
- }
- }
break;
case PSM_PRE:
if (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST) break;
@@ -1464,91 +1441,6 @@ assert(psm->mi == NULL);
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOPREUN))
rc = rpmpsmNext(psm, PSM_SCRIPT);
}
- if (psm->goal == PSM_PKGSAVE) {
- int noArchiveSize = 0;
-
- /* Regenerate original header. */
- { void * uh = NULL;
- rpmTagType uht;
- rpm_count_t uhc;
-
- if (headerGetEntry(fi->h, RPMTAG_HEADERIMMUTABLE, &uht, &uh, &uhc)) {
- psm->oh = headerCopyLoad(uh);
- uh = hfd(uh, uht);
- } else
- if (headerGetEntry(fi->h, RPMTAG_HEADERIMAGE, &uht, &uh, &uhc))
- {
- HeaderIterator hi;
- rpmTagType type;
- rpmTag tag;
- rpm_count_t count;
- rpm_data_t ptr;
- Header oh;
-
- /* Load the original header from the blob. */
- oh = headerCopyLoad(uh);
-
- /* XXX this is headerCopy w/o headerReload() */
- psm->oh = headerNew();
-
- for (hi = headerInitIterator(oh);
- headerNextIterator(hi, &tag, &type, &ptr, &count);
- ptr = headerFreeData(ptr, type))
- {
- if (tag == RPMTAG_ARCHIVESIZE)
- noArchiveSize = 1;
- if (ptr) (void) headerAddEntry(psm->oh, tag, type, ptr, count);
- }
- hi = headerFreeIterator(hi);
-
- oh = headerFree(oh);
- uh = hfd(uh, uht);
- } else
- break; /* XXX shouldn't ever happen */
- }
-
- /* Retrieve type of payload compression. */
- /* FIX: psm->oh may be NULL */
- rc = rpmpsmNext(psm, PSM_RPMIO_FLAGS);
-
- /* Write the lead section into the package. */
- {
- rpmlead lead = rpmLeadFromHeader(psm->oh);
- rc = rpmLeadWrite(psm->fd, lead);
- lead = rpmLeadFree(lead);
- if (rc != RPMRC_OK) {
- rpmlog(RPMLOG_ERR, _("Unable to write package: %s\n"),
- Fstrerror(psm->fd));
- break;
- }
- }
-
- /* Write the signature section into the package. */
- /* XXX rpm-4.1 and later has archive size in signature header. */
- { Header sigh = headerRegenSigHeader(fi->h, noArchiveSize);
- /* Reallocate the signature into one contiguous region. */
- sigh = headerReload(sigh, RPMTAG_HEADERSIGNATURES);
- if (sigh == NULL) {
- rpmlog(RPMLOG_ERR, _("Unable to reload signature header\n"));
- rc = RPMRC_FAIL;
- break;
- }
- rc = rpmWriteSignature(psm->fd, sigh);
- sigh = rpmFreeSignature(sigh);
- if (rc) break;
- }
-
- /* Add remove transaction id to header. */
- if (psm->oh != NULL)
- { rpm_tid_t tid = rpmtsGetTid(ts);
- xx = headerAddEntry(psm->oh, RPMTAG_REMOVETID,
- RPM_INT32_TYPE, &tid, 1);
- }
-
- /* Write the metadata section into the package. */
- rc = headerWrite(psm->fd, psm->oh, HEADER_MAGIC_YES);
- if (rc) break;
- }
break;
case PSM_PROCESS:
if (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST) break;
@@ -1648,47 +1540,6 @@ assert(psm->mi == NULL);
xx = rpmpsmNext(psm, PSM_NOTIFY);
}
- if (psm->goal == PSM_PKGSAVE) {
- rpmFileAction * actions = fi->actions;
- rpmFileAction action = fi->action;
-
- fi->action = FA_COPYOUT;
- fi->actions = NULL;
-
- if (psm->fd == NULL) { /* XXX can't happen */
- rc = RPMRC_FAIL;
- break;
- }
- /* FIX: fdDup mey return NULL. */
- xx = Fflush(psm->fd);
- psm->cfd = Fdopen(fdDup(Fileno(psm->fd)), psm->rpmio_flags);
- if (psm->cfd == NULL) { /* XXX can't happen */
- rc = RPMRC_FAIL;
- break;
- }
-
- rc = fsmSetup(fi->fsm, FSM_PKGBUILD, ts, fi, psm->cfd,
- NULL, &psm->failedFile);
- (void) rpmswAdd(rpmtsOp(ts, RPMTS_OP_COMPRESS),
- fdOp(psm->cfd, FDSTAT_WRITE));
- (void) rpmswAdd(rpmtsOp(ts, RPMTS_OP_DIGEST),
- fdOp(psm->cfd, FDSTAT_DIGEST));
- xx = fsmTeardown(fi->fsm);
-
- saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */
- xx = Fclose(psm->cfd);
- psm->cfd = NULL;
- errno = saveerrno;
-
- /* XXX make sure progress is closed out */
- psm->what = RPMCALLBACK_INST_PROGRESS;
- psm->amount = (fi->archiveSize ? fi->archiveSize : 100);
- psm->total = psm->amount;
- xx = rpmpsmNext(psm, PSM_NOTIFY);
-
- fi->action = action;
- fi->actions = actions;
- }
break;
case PSM_POST:
if (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST) break;
@@ -1764,8 +1615,6 @@ assert(psm->mi == NULL);
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_APPLYONLY))
rc = rpmpsmNext(psm, PSM_RPMDB_REMOVE);
}
- if (psm->goal == PSM_PKGSAVE) {
- }
/* Restore root directory if changed. */
xx = rpmpsmNext(psm, PSM_CHROOT_OUT);
@@ -1776,13 +1625,6 @@ assert(psm->mi == NULL);
/* Restore root directory if changed. */
xx = rpmpsmNext(psm, PSM_CHROOT_OUT);
- if (psm->fd != NULL) {
- saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */
- xx = Fclose(psm->fd);
- psm->fd = NULL;
- errno = saveerrno;
- }
-
if (rc) {
if (psm->failedFile)
rpmlog(RPMLOG_ERR,
@@ -1796,18 +1638,15 @@ assert(psm->mi == NULL);
psm->what = RPMCALLBACK_CPIO_ERROR;
psm->amount = 0;
psm->total = 0;
- /* FIX: psm->fd may be NULL. */
xx = rpmpsmNext(psm, PSM_NOTIFY);
}
- if (psm->goal == PSM_PKGERASE || psm->goal == PSM_PKGSAVE) {
+ if (psm->goal == PSM_PKGERASE) {
if (psm->te != NULL)
rpmteSetHeader(psm->te, NULL);
if (fi->h != NULL)
fi->h = headerFree(fi->h);
}
- psm->oh = headerFree(psm->oh);
- psm->pkgURL = _free(psm->pkgURL);
psm->rpmio_flags = _free(psm->rpmio_flags);
psm->failedFile = _free(psm->failedFile);
@@ -1819,7 +1658,6 @@ assert(psm->mi == NULL);
case PSM_PKGINSTALL:
case PSM_PKGERASE:
- case PSM_PKGSAVE:
psm->goal = stage;
psm->rc = RPMRC_OK;
psm->stepName = pkgStageString(stage);
@@ -1912,7 +1750,7 @@ assert(psm->mi == NULL);
payload_compressor = "gzip";
psm->rpmio_flags = t = xmalloc(sizeof("w9.gzdio"));
*t = '\0';
- t = stpcpy(t, ((psm->goal == PSM_PKGSAVE) ? "w9" : "r"));
+ t = stpcpy(t, "r");
if (!strcmp(payload_compressor, "gzip"))
t = stpcpy(t, ".gzdio");
if (!strcmp(payload_compressor, "bzip2"))
diff --git a/lib/psm.h b/lib/psm.h
index d5ba5445a..c19b536d4 100644
--- a/lib/psm.h
+++ b/lib/psm.h
@@ -36,7 +36,6 @@ typedef enum pkgStage_e {
PSM_PKGINSTALL = 7,
PSM_PKGERASE = 8,
PSM_PKGCOMMIT = 10,
- PSM_PKGSAVE = 12,
PSM_CREATE = 17,
PSM_NOTIFY = 22,
diff --git a/lib/rpmcallback.h b/lib/rpmcallback.h
index 0a6c9ec9f..9c46a3aac 100644
--- a/lib/rpmcallback.h
+++ b/lib/rpmcallback.h
@@ -22,9 +22,9 @@ typedef enum rpmCallbackType_e {
RPMCALLBACK_UNINST_PROGRESS = (1 << 7),
RPMCALLBACK_UNINST_START = (1 << 8),
RPMCALLBACK_UNINST_STOP = (1 << 9),
- RPMCALLBACK_REPACKAGE_PROGRESS = (1 << 10),
- RPMCALLBACK_REPACKAGE_START = (1 << 11),
- RPMCALLBACK_REPACKAGE_STOP = (1 << 12),
+ RPMCALLBACK_REPACKAGE_PROGRESS = (1 << 10), /* obsolete, unused */
+ RPMCALLBACK_REPACKAGE_START = (1 << 11), /* obsolete, unused */
+ RPMCALLBACK_REPACKAGE_STOP = (1 << 12), /* obsolete, unused */
RPMCALLBACK_UNPACK_ERROR = (1 << 13),
RPMCALLBACK_CPIO_ERROR = (1 << 14),
RPMCALLBACK_SCRIPT_ERROR = (1 << 15)
diff --git a/lib/rpminstall.c b/lib/rpminstall.c
index 38b22c0dc..d192b8258 100644
--- a/lib/rpminstall.c
+++ b/lib/rpminstall.c
@@ -167,40 +167,6 @@ void * rpmShowProgress(const void * arg,
rpmcliProgressCurrent = 0;
break;
- case RPMCALLBACK_REPACKAGE_START:
- rpmcliHashesCurrent = 0;
- rpmcliProgressTotal = total;
- rpmcliProgressCurrent = 0;
- if (!(flags & INSTALL_LABEL))
- break;
- if (flags & INSTALL_HASH)
- fprintf(stdout, "%-28s\n", _("Repackaging..."));
- else
- fprintf(stdout, "%s\n", _("Repackaging erased files..."));
- (void) fflush(stdout);
- break;
-
- case RPMCALLBACK_REPACKAGE_PROGRESS:
- if (amount && (flags & INSTALL_HASH))
- printHash(1, 1); /* Fixes "preparing..." progress bar */
- break;
-
- case RPMCALLBACK_REPACKAGE_STOP:
- rpmcliProgressTotal = total;
- rpmcliProgressCurrent = total;
- if (flags & INSTALL_HASH)
- printHash(1, 1); /* Fixes "preparing..." progress bar */
- rpmcliProgressTotal = rpmcliPackagesTotal;
- rpmcliProgressCurrent = 0;
- if (!(flags & INSTALL_LABEL))
- break;
- if (flags & INSTALL_HASH)
- fprintf(stdout, "%-28s\n", _("Upgrading..."));
- else
- fprintf(stdout, "%s\n", _("Upgrading packages..."));
- (void) fflush(stdout);
- break;
-
case RPMCALLBACK_UNINST_PROGRESS:
break;
case RPMCALLBACK_UNINST_START:
@@ -265,9 +231,6 @@ int rpmInstall(rpmts ts,
rpmcliPackagesTotal = 0;
- if (rpmExpandNumeric("%{?_repackage_all_erasures}"))
- ia->transFlags |= RPMTRANS_FLAG_REPACKAGE;
-
(void) rpmtsSetFlags(ts, ia->transFlags);
probFilter = ia->probFilter;
@@ -708,9 +671,6 @@ int rpmErase(rpmts ts, struct rpmInstallArguments_s * ia,
vsflags |= RPMVSF_NOHDRCHK;
ovsflags = rpmtsSetVSFlags(ts, vsflags);
- if (rpmExpandNumeric("%{?_repackage_all_erasures}"))
- ia->transFlags |= RPMTRANS_FLAG_REPACKAGE;
-
/* XXX suggest mechanism only meaningful when installing */
ia->transFlags |= RPMTRANS_FLAG_NOSUGGEST;
diff --git a/lib/rpmts.c b/lib/rpmts.c
index 401c70b11..b1f539150 100644
--- a/lib/rpmts.c
+++ b/lib/rpmts.c
@@ -848,7 +848,6 @@ static void rpmtsPrintStats(rpmts ts)
rpmtsPrintStat("check: ", rpmtsOp(ts, RPMTS_OP_CHECK));
rpmtsPrintStat("order: ", rpmtsOp(ts, RPMTS_OP_ORDER));
rpmtsPrintStat("fingerprint: ", rpmtsOp(ts, RPMTS_OP_FINGERPRINT));
- rpmtsPrintStat("repackage: ", rpmtsOp(ts, RPMTS_OP_REPACKAGE));
rpmtsPrintStat("install: ", rpmtsOp(ts, RPMTS_OP_INSTALL));
rpmtsPrintStat("erase: ", rpmtsOp(ts, RPMTS_OP_ERASE));
rpmtsPrintStat("scriptlets: ", rpmtsOp(ts, RPMTS_OP_SCRIPTLETS));
diff --git a/lib/rpmts.h b/lib/rpmts.h
index d3895b7dc..1a51562e2 100644
--- a/lib/rpmts.h
+++ b/lib/rpmts.h
@@ -37,8 +37,8 @@ typedef enum rpmtransFlags_e {
RPMTRANS_FLAG_ALLFILES = (1 << 6), /*!< from --allfiles */
RPMTRANS_FLAG_KEEPOBSOLETE = (1 << 7), /*!< @todo Document. */
RPMTRANS_FLAG_NOCONTEXTS = (1 << 8), /*!< from --nocontexts */
- RPMTRANS_FLAG_DIRSTASH = (1 << 9), /*!< from --dirstash */
- RPMTRANS_FLAG_REPACKAGE = (1 << 10), /*!< from --repackage */
+ RPMTRANS_FLAG_DIRSTASH = (1 << 9), /*!< obsolete, unused */
+ RPMTRANS_FLAG_REPACKAGE = (1 << 10), /*!< obsolete, unused */
RPMTRANS_FLAG_PKGCOMMIT = (1 << 11),
RPMTRANS_FLAG_PKGUNDO = (1 << 12),
@@ -130,7 +130,6 @@ typedef enum rpmtsOpX_e {
RPMTS_OP_CHECK = 1,
RPMTS_OP_ORDER = 2,
RPMTS_OP_FINGERPRINT = 3,
- RPMTS_OP_REPACKAGE = 4,
RPMTS_OP_INSTALL = 5,
RPMTS_OP_ERASE = 6,
RPMTS_OP_SCRIPTLETS = 7,
diff --git a/lib/transaction.c b/lib/transaction.c
index 39e96f726..78791aba4 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -1372,58 +1372,6 @@ assert(psm != NULL);
}
/* ===============================================
- * Save removed files before erasing.
- */
- if (rpmtsFlags(ts) & (RPMTRANS_FLAG_DIRSTASH | RPMTRANS_FLAG_REPACKAGE)) {
- int progress;
-
- progress = 0;
- pi = rpmtsiInit(ts);
- while ((p = rpmtsiNext(pi, 0)) != NULL) {
-
- if ((fi = rpmtsiFi(pi)) == NULL)
- continue; /* XXX can't happen */
- switch (rpmteType(p)) {
- case TR_ADDED:
- break;
- case TR_REMOVED:
- if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_REPACKAGE))
- break;
- if (!progress)
- NOTIFY(ts, (NULL, RPMCALLBACK_REPACKAGE_START,
- 7, numRemoved, NULL, ts->notifyData));
-
- NOTIFY(ts, (NULL, RPMCALLBACK_REPACKAGE_PROGRESS, progress,
- numRemoved, NULL, ts->notifyData));
- progress++;
-
- (void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_REPACKAGE), 0);
-
- /* XXX TR_REMOVED needs CPIO_MAP_{ABSOLUTE,ADDDOT} CPIO_ALL_HARDLINKS */
- fi->mapflags |= CPIO_MAP_ABSOLUTE;
- fi->mapflags |= CPIO_MAP_ADDDOT;
- fi->mapflags |= CPIO_ALL_HARDLINKS;
- psm = rpmpsmNew(ts, p, fi);
-assert(psm != NULL);
- xx = rpmpsmStage(psm, PSM_PKGSAVE);
- psm = rpmpsmFree(psm);
- fi->mapflags &= ~CPIO_MAP_ABSOLUTE;
- fi->mapflags &= ~CPIO_MAP_ADDDOT;
- fi->mapflags &= ~CPIO_ALL_HARDLINKS;
-
- (void) rpmswExit(rpmtsOp(ts, RPMTS_OP_REPACKAGE), 0);
-
- break;
- }
- }
- pi = rpmtsiFree(pi);
- if (progress) {
- NOTIFY(ts, (NULL, RPMCALLBACK_REPACKAGE_STOP, 7, numRemoved,
- NULL, ts->notifyData));
- }
- }
-
- /* ===============================================
* Install and remove packages.
*/
lastFailKey = (rpmalKey)-2; /* erased packages have -1 */