From 2f9fa168c803e4ddbb20021a128f759da553bd06 Mon Sep 17 00:00:00 2001 From: jbj Date: Thu, 8 Feb 2001 23:05:05 +0000 Subject: [PATCH] Remove DEAD code. CVS patchset: 4531 CVS date: 2001/02/08 23:05:05 --- build/pack.c | 4 -- lib/cpio.c | 157 ++++---------------------------------------------------- lib/cpio.h | 59 +++++++++++++-------- lib/install.c | 23 --------- lib/rollback.h | 10 ++-- lib/uninstall.c | 3 -- po/rpm.pot | 111 +++++++++++++++++++-------------------- 7 files changed, 106 insertions(+), 261 deletions(-) diff --git a/build/pack.c b/build/pack.c index a61064d..1dec9b2 100644 --- a/build/pack.c +++ b/build/pack.c @@ -54,10 +54,6 @@ static int cpio_doio(FD_t fdo, Header h, CSA_t * csa, const char * fmodeMacro) rc = fsmSetup(fi->fsm, FSM_PKGBUILD, ts, fi, cfd, &csa->cpioArchiveSize, &failedFile); -#ifdef DYING - rc = cpioBuildArchive(fi->fsm); -#endif - Fclose(cfd); (void) fsmTeardown(fi->fsm); diff --git a/lib/cpio.c b/lib/cpio.c index 2d44d4c..243615b 100644 --- a/lib/cpio.c +++ b/lib/cpio.c @@ -506,29 +506,6 @@ static int strntoul(const char *str, /*@out@*/char **endptr, int base, int num) return ret; } -/** \ingroup payload - * Cpio archive header information. - * @todo Add support for tar (soon) and ar (eventually) archive formats. - */ -struct cpioCrcPhysicalHeader { - char magic[6]; - char inode[8]; - char mode[8]; - char uid[8]; - char gid[8]; - char nlink[8]; - char mtime[8]; - char filesize[8]; - char devMajor[8]; - char devMinor[8]; - char rdevMajor[8]; - char rdevMinor[8]; - char namesize[8]; - char checksum[8]; /* ignored !! */ -}; - -#define PHYS_HDR_SIZE 110 /*!< Don't depend on sizeof(struct) */ - #define GET_NUM_FIELD(phys, log) \ log = strntoul(phys, &end, 16, sizeof(phys)); \ if (*end) return CPIOERR_BAD_HEADER; @@ -536,7 +513,7 @@ struct cpioCrcPhysicalHeader { sprintf(space, "%8.8lx", (unsigned long) (val)); \ memcpy(phys, space, 8); -static int cpioTrailerWrite(FSM_t fsm) +int cpioTrailerWrite(FSM_t fsm) { struct cpioCrcPhysicalHeader * hdr = (struct cpioCrcPhysicalHeader *)fsm->rdbuf; @@ -562,12 +539,7 @@ static int cpioTrailerWrite(FSM_t fsm) return rc; } -/** - * Write cpio header. - * @retval fsm file path and stat info - * @return 0 on success - */ -static int cpioHeaderWrite(FSM_t fsm, struct stat * st) +int cpioHeaderWrite(FSM_t fsm, struct stat * st) { struct cpioCrcPhysicalHeader * hdr = (struct cpioCrcPhysicalHeader *)fsm->rdbuf; char field[64]; @@ -603,12 +575,7 @@ static int cpioHeaderWrite(FSM_t fsm, struct stat * st) return rc; } -/** - * Read cpio heasder. - * @retval fsm file path and stat info - * @return 0 on success - */ -static int cpioHeaderRead(FSM_t fsm, struct stat * st) +int cpioHeaderRead(FSM_t fsm, struct stat * st) /*@modifies fsm, *st @*/ { struct cpioCrcPhysicalHeader hdr; @@ -755,8 +722,6 @@ int fsmMapPath(FSM_t fsm) switch (fsm->action) { case FA_SKIP: -if (_fsm_debug && !(fsm->goal == FSM_PKGERASE || fsm->goal == FSM_PKGCOMMIT)) -fprintf(stderr, "*** %s:%s %s\n", fiTypeString(fi), fileActionString(fsm->action), (fsm->path ? fsm->path : "")); break; case FA_SKIPMULTILIB: /* XXX RPMFILE_STATE_MULTILIB? */ fprintf(stderr, "*** %s:%s %s\n", fiTypeString(fi), fileActionString(fsm->action), (fsm->path ? fsm->path : "")); @@ -778,8 +743,6 @@ fprintf(stderr, "*** %s:%s %s\n", fiTypeString(fi), fileActionString(fsm->action break; case FA_SKIPNETSHARED: -if (_fsm_debug) -fprintf(stderr, "*** %s:%s %s\n", fiTypeString(fi), fileActionString(fsm->action), (fsm->path ? fsm->path : "")); if (fi->type == TR_ADDED) fi->fstates[i] = RPMFILE_STATE_NETSHARED; break; @@ -797,8 +760,6 @@ fprintf(stderr, "*** %s:%s %s\n", fiTypeString(fi), fileActionString(fsm->action break; case FA_ALTNAME: -if (_fsm_debug) -fprintf(stderr, "*** %s:%s %s\n", fiTypeString(fi), fileActionString(fsm->action), (fsm->path ? fsm->path : "")); assert(fi->type == TR_ADDED); fsm->nsuffix = SUFFIX_RPMNEW; break; @@ -809,7 +770,6 @@ fprintf(stderr, "*** %s:%s %s\n", fiTypeString(fi), fileActionString(fsm->action fsm->osuffix = SUFFIX_RPMSAVE; break; case FA_ERASE: -fprintf(stderr, "*** %s:%s %s\n", fiTypeString(fi), fileActionString(fsm->action), (fsm->path ? fsm->path : "")); assert(fi->type == TR_REMOVED); break; default: @@ -870,11 +830,11 @@ static int expandRegular(FSM_t fsm) int left = st->st_size; int rc = 0; -if (st->st_size == 0) fprintf(stderr, "*** zero %s\n", fsm->path); rc = fsmStage(fsm, FSM_WOPEN); if (rc) goto exit; + /* XXX md5sum's will break on repackaging that includes modified files. */ fmd5sum = fsm->fmd5sum; /* XXX This doesn't support brokenEndian checks. */ @@ -1299,10 +1259,11 @@ int fsmStage(FSM_t fsm, fileStage stage) fsm->li = NULL; errno = 0; /* XXX get rid of EBADF */ -#ifdef NOTYET /* Detect and create directories not explicitly in package. */ - rc = fsmStage(fsm, FSM_MKDIRS); -#endif + if (fsm->goal == FSM_PKGINSTALL) { + rc = fsmStage(fsm, FSM_MKDIRS); + if (!rc) fsm->mkdirsdone = 1; + } break; case FSM_INIT: @@ -1316,11 +1277,13 @@ int fsmStage(FSM_t fsm, fileStage stage) fsm->nsuffix = NULL; if (fsm->goal == FSM_PKGINSTALL) { +#ifdef DYING /* Detect and create directories not explicitly in package. */ if (!fsm->mkdirsdone) { rc = fsmStage(fsm, FSM_MKDIRS); fsm->mkdirsdone = 1; } +#endif /* Read next header from payload, checking for end-of-payload. */ rc = fsmStage(fsm, FSM_NEXT); @@ -2096,106 +2059,6 @@ if (fsm->rdnb != fsm->wrnb) fprintf(stderr, "*** short write: had %d, got %d\n", return rc; } -#ifdef DYING -/** @todo Verify payload MD5 sum. */ -int cpioInstallArchive(FSM_t fsm) -{ - int rc = 0; - -#ifdef NOTYET - char * md5sum = NULL; - - fdInitMD5(cfd, 0); -#endif - - while (1) { - - /* Clean fsm, free'ing memory. Read next archive header. */ - rc = fsmStage(fsm, FSM_INIT); - - /* Exit on end-of-payload. */ - if (rc == CPIOERR_HDR_TRAILER) { - rc = 0; - break; - } - if (fsm->goal == FSM_PKGINSTALL) { - if (rc) { - fsm->postpone = 1; - (void) fsmStage(fsm, FSM_UNDO); - goto exit; - } - - /* Extract file from archive. */ - rc = fsmStage(fsm, FSM_PROCESS); - if (rc) { - (void) fsmStage(fsm, FSM_UNDO); - goto exit; - } - - /* Notify on success. */ - (void) fsmStage(fsm, FSM_NOTIFY); - } - - if (fsmStage(fsm, FSM_FINI)) - break; - - } - -#ifdef NOTYET - fdFiniMD5(fsm->cfd, (void **)&md5sum, NULL, 1); - - if (md5sum) - free(md5sum); -#endif - - rc = fsmStage(fsm, FSM_DESTROY); - -exit: - return rc; -} -#endif - -#ifdef DYING -int cpioBuildArchive(FSM_t fsm) -{ - size_t pos = fdGetCpioPos(fsm->cfd); - int rc = 0; - - while (1) { - - rc = fsmStage(fsm, FSM_INIT); - - if (rc == CPIOERR_HDR_TRAILER) { - rc = 0; - break; - } - if (rc) { - fsm->postpone = 1; - (void) fsmStage(fsm, FSM_UNDO); - goto exit; - } - - rc = fsmStage(fsm, FSM_PROCESS); - if (rc) { - (void) fsmStage(fsm, FSM_UNDO); - goto exit; - } - (void) fsmStage(fsm, FSM_FINI); - } - - if (!rc) - rc = fsmStage(fsm, FSM_TRAILER); - - if (!rc && fsm->archiveSize) - *fsm->archiveSize = (fdGetCpioPos(fsm->cfd) - pos); - - rc = fsmStage(fsm, FSM_DESTROY); - -exit: - return rc; -} -#endif - const char *const cpioStrerror(int rc) { static char msg[256]; diff --git a/lib/cpio.h b/lib/cpio.h index 878d937..a60ddcd 100644 --- a/lib/cpio.h +++ b/lib/cpio.h @@ -65,36 +65,53 @@ typedef enum cpioMapFlags_e { CPIO_MULTILIB = (1 << 31) /* internal, only for building. */ } cpioMapFlags; +/** \ingroup payload + * Cpio archive header information. + */ +struct cpioCrcPhysicalHeader { + char magic[6]; + char inode[8]; + char mode[8]; + char uid[8]; + char gid[8]; + char nlink[8]; + char mtime[8]; + char filesize[8]; + char devMajor[8]; + char devMinor[8]; + char rdevMajor[8]; + char rdevMinor[8]; + char namesize[8]; + char checksum[8]; /* ignored !! */ +}; + +#define PHYS_HDR_SIZE 110 /*!< Don't depend on sizeof(struct) */ + #ifdef __cplusplus extern "C" { #endif -#ifdef DYING -/** \ingroup payload - * The RPM internal equivalent of the command line "cpio -i". - * - * If no mappings are passed, this installs everything! If one is passed - * it should be sorted, and only files included in the map are installed. - * Files are installed relative to the current directory unless a mapping - * is given which specifies an absolute directory. The mode mapping is only - * used for the permission bits, not for the file type. The owner/group - * mappings are ignored for the non-root user. - * - * @param fsm file state machine data +/** + * Write cpio trailer. + * @retval fsm file path and stat info * @return 0 on success */ -int cpioInstallArchive(FSM_t fsm) - /*@modifies fileSystem, fsm @*/; +int cpioTrailerWrite(FSM_t fsm); -/** \ingroup payload - * The RPM internal equivalent of the command line "cpio -o". - * - * @param fsm file state machine data +/** + * Write cpio header. + * @retval fsm file path and stat info * @return 0 on success */ -int cpioBuildArchive(FSM_t fsm) - /*@modifies fileSystem, fsm @*/; -#endif +int cpioHeaderWrite(FSM_t fsm, struct stat * st); + +/** + * Read cpio header. + * @retval fsm file path and stat info + * @return 0 on success + */ +int cpioHeaderRead(FSM_t fsm, struct stat * st) + /*@modifies fsm, *st @*/; /** \ingroup payload * Return formatted error message on payload handling failure. diff --git a/lib/install.c b/lib/install.c index 4933a86..8f8f7c8 100644 --- a/lib/install.c +++ b/lib/install.c @@ -442,18 +442,12 @@ static int installArchive(const rpmTransactionSet ts, TFI_t fi, int allFiles) cfd = fdLink(cfd, "persist (installArchive"); rc = fsmSetup(fi->fsm, FSM_PKGINSTALL, ts, fi, cfd, NULL, &failedFile); -#ifdef DYING - rc = cpioInstallArchive(fi->fsm); -#endif saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */ Fclose(cfd); (void) fsmTeardown(fi->fsm); if (!rc && ts->transFlags & RPMTRANS_FLAG_PKGCOMMIT) { rc = fsmSetup(fi->fsm, FSM_PKGCOMMIT, ts, fi, NULL, NULL, &failedFile); -#ifdef DYING - rc = cpioInstallArchive(fi->fsm); -#endif (void) fsmTeardown(fi->fsm); } } @@ -834,23 +828,6 @@ int installBinaryPackage(const rpmTransactionSet ts, TFI_t fi) setFileOwners(fi); -#ifdef DYING - rc = pkgActions(ts, fi, FSM_COMMIT); - if (rc) - goto exit; -#else - { int i; - - for (i = 0; i < fi->fc; i++) { - if (fi->actions && fi->actions[i] == FA_CREATE) - continue; - rpmMessage(RPMMESS_DEBUG, _(" file: %s%s action: %s\n"), - fi->dnl[fi->dil[i]], fi->bnl[i], - fileActionString((fi->actions ? fi->actions[i] : FA_UNKNOWN)) ); - } - } -#endif - rc = installArchive(ts, fi, 0); if (rc) diff --git a/lib/rollback.h b/lib/rollback.h index fee35ea..a772c9a 100644 --- a/lib/rollback.h +++ b/lib/rollback.h @@ -32,11 +32,11 @@ typedef enum fileStage_e { FSM_UNDO = 5, FSM_FINI = 6, - FSM_PKGINSTALL = 7, - FSM_PKGERASE = 8, - FSM_PKGBUILD = 9, - FSM_PKGCOMMIT = 10, - FSM_PKGUNDO = 11, + FSM_PKGINSTALL = _fd(7), + FSM_PKGERASE = _fd(8), + FSM_PKGBUILD = _fd(9), + FSM_PKGCOMMIT = _fd(10), + FSM_PKGUNDO = _fd(11), FSM_CREATE = _fd(17), FSM_MAP = _fd(18), diff --git a/lib/uninstall.c b/lib/uninstall.c index 62f1c4e..8b7ea8a 100644 --- a/lib/uninstall.c +++ b/lib/uninstall.c @@ -82,9 +82,6 @@ int removeBinaryPackage(const rpmTransactionSet ts, TFI_t fi) pkgKey, ts->notifyData); rc = fsmSetup(fi->fsm, FSM_PKGERASE, ts, fi, NULL, NULL, &failedFile); -#ifdef DYING - rc = cpioInstallArchive(fi->fsm); -#endif (void) fsmTeardown(fi->fsm); if (ts->notify) diff --git a/po/rpm.pot b/po/rpm.pot index b2b2358..345c832 100644 --- a/po/rpm.pot +++ b/po/rpm.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2001-02-08 16:37-0500\n" +"POT-Creation-Date: 2001-02-08 17:41-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1472,7 +1472,7 @@ msgstr "" msgid "no tar files given for build" msgstr "" -#: build/build.c:114 build/pack.c:385 +#: build/build.c:114 build/pack.c:381 msgid "Unable to open temp file.\n" msgstr "" @@ -1662,7 +1662,7 @@ msgstr "" msgid "Could not open %%files file %s: %s\n" msgstr "" -#: build/files.c:1464 build/pack.c:121 +#: build/files.c:1464 build/pack.c:117 #, c-format msgid "line: %s\n" msgstr "" @@ -1729,126 +1729,126 @@ msgstr "" msgid "Could not canonicalize hostname: %s\n" msgstr "" -#: build/pack.c:65 +#: build/pack.c:61 #, c-format msgid "create archive failed on file %s: %s\n" msgstr "" -#: build/pack.c:87 +#: build/pack.c:83 #, c-format msgid "cpio_copy write failed: %s\n" msgstr "" -#: build/pack.c:94 +#: build/pack.c:90 #, c-format msgid "cpio_copy read failed: %s\n" msgstr "" -#: build/pack.c:178 +#: build/pack.c:174 #, c-format msgid "Could not open PreIn file: %s\n" msgstr "" -#: build/pack.c:185 +#: build/pack.c:181 #, c-format msgid "Could not open PreUn file: %s\n" msgstr "" -#: build/pack.c:192 +#: build/pack.c:188 #, c-format msgid "Could not open PostIn file: %s\n" msgstr "" -#: build/pack.c:199 +#: build/pack.c:195 #, c-format msgid "Could not open PostUn file: %s\n" msgstr "" -#: build/pack.c:207 +#: build/pack.c:203 #, c-format msgid "Could not open VerifyScript file: %s\n" msgstr "" -#: build/pack.c:222 +#: build/pack.c:218 #, c-format msgid "Could not open Trigger script file: %s\n" msgstr "" -#: build/pack.c:248 +#: build/pack.c:244 #, c-format msgid "readRPM: open %s: %s\n" msgstr "" -#: build/pack.c:258 +#: build/pack.c:254 #, c-format msgid "readRPM: read %s: %s\n" msgstr "" -#: build/pack.c:279 +#: build/pack.c:275 #, c-format msgid "readRPM: %s is not an RPM package\n" msgstr "" -#: build/pack.c:285 +#: build/pack.c:281 #, c-format msgid "readRPM: reading header from %s\n" msgstr "" -#: build/pack.c:397 +#: build/pack.c:393 msgid "Bad CSA data\n" msgstr "" -#: build/pack.c:438 +#: build/pack.c:434 #, c-format msgid "Generating signature: %d\n" msgstr "" -#: build/pack.c:448 +#: build/pack.c:444 #, c-format msgid "Could not open %s: %s\n" msgstr "" -#: build/pack.c:485 +#: build/pack.c:481 #, c-format msgid "Unable to write package: %s\n" msgstr "" -#: build/pack.c:500 +#: build/pack.c:496 #, c-format msgid "Unable to open sigtarget %s: %s\n" msgstr "" -#: build/pack.c:510 +#: build/pack.c:506 #, c-format msgid "Unable to read header from %s: %s\n" msgstr "" -#: build/pack.c:524 +#: build/pack.c:520 #, c-format msgid "Unable to write header to %s: %s\n" msgstr "" -#: build/pack.c:534 +#: build/pack.c:530 #, c-format msgid "Unable to read payload from %s: %s\n" msgstr "" -#: build/pack.c:540 +#: build/pack.c:536 #, c-format msgid "Unable to write payload to %s: %s\n" msgstr "" -#: build/pack.c:567 +#: build/pack.c:563 #, c-format msgid "Wrote: %s\n" msgstr "" -#: build/pack.c:632 +#: build/pack.c:628 #, c-format msgid "Could not generate output filename for package %s: %s\n" msgstr "" -#: build/pack.c:649 +#: build/pack.c:645 #, c-format msgid "cannot create %s: %s\n" msgstr "" @@ -2194,70 +2194,70 @@ msgstr "" msgid "%9d %s\n" msgstr "" -#: lib/cpio.c:1445 +#: lib/cpio.c:1408 #, c-format msgid "%s directory created with perms %04o.\n" msgstr "" -#: lib/cpio.c:1545 lib/cpio.c:1657 +#: lib/cpio.c:1508 lib/cpio.c:1620 #, c-format msgid "%s saved as %s\n" msgstr "" -#: lib/cpio.c:1682 +#: lib/cpio.c:1645 #, c-format msgid "%s rmdir of %s failed: Directory not empty\n" msgstr "" -#: lib/cpio.c:1687 +#: lib/cpio.c:1650 #, c-format msgid "%s rmdir of %s failed: %s\n" msgstr "" -#: lib/cpio.c:1696 +#: lib/cpio.c:1659 #, c-format msgid "%s unlink of %s failed: %s\n" msgstr "" -#: lib/cpio.c:1713 +#: lib/cpio.c:1676 #, c-format msgid "%s created as %s\n" msgstr "" -#: lib/cpio.c:2209 +#: lib/cpio.c:2072 #, c-format msgid "(error 0x%x)" msgstr "" -#: lib/cpio.c:2212 +#: lib/cpio.c:2075 msgid "Bad magic" msgstr "" -#: lib/cpio.c:2213 +#: lib/cpio.c:2076 msgid "Bad/unreadable header" msgstr "" -#: lib/cpio.c:2234 +#: lib/cpio.c:2097 msgid "Header size too big" msgstr "" -#: lib/cpio.c:2235 +#: lib/cpio.c:2098 msgid "Unknown file type" msgstr "" -#: lib/cpio.c:2236 +#: lib/cpio.c:2099 msgid "Missing hard link" msgstr "" -#: lib/cpio.c:2237 +#: lib/cpio.c:2100 msgid "MD5 sum mismatch" msgstr "" -#: lib/cpio.c:2238 +#: lib/cpio.c:2101 msgid "Internal error" msgstr "" -#: lib/cpio.c:2247 +#: lib/cpio.c:2110 msgid " failed - " msgstr "" @@ -2636,56 +2636,51 @@ msgstr "" #. * was used up - if so, we should return a different error. #. #. XXX FIXME: Fclose with libio destroys errno -#: lib/install.c:467 +#: lib/install.c:461 #, c-format msgid "unpacking of archive failed%s%s: %s\n" msgstr "" -#: lib/install.c:468 +#: lib/install.c:462 msgid " on file " msgstr "" -#: lib/install.c:509 +#: lib/install.c:503 #, c-format msgid "cannot create %s %s\n" msgstr "" -#: lib/install.c:515 +#: lib/install.c:509 #, c-format msgid "cannot write to %s\n" msgstr "" -#: lib/install.c:536 +#: lib/install.c:530 msgid "installing a source package\n" msgstr "" -#: lib/install.c:588 +#: lib/install.c:582 msgid "source package contains no .spec file\n" msgstr "" -#: lib/install.c:668 +#: lib/install.c:662 msgid "source package expected, binary found\n" msgstr "" -#: lib/install.c:739 lib/uninstall.c:26 +#: lib/install.c:733 lib/uninstall.c:26 #, c-format msgid "%s: %s-%s-%s has %d files, test = %d\n" msgstr "" -#: lib/install.c:803 lib/install.c:902 lib/uninstall.c:70 lib/uninstall.c:95 +#: lib/install.c:797 lib/install.c:879 lib/uninstall.c:70 lib/uninstall.c:92 #, c-format msgid "%s: running %s script(s) (if any)\n" msgstr "" -#: lib/install.c:810 +#: lib/install.c:804 msgid "skipping %s-%s-%s install, %%pre scriptlet failed rc %d\n" msgstr "" -#: lib/install.c:847 -#, c-format -msgid " file: %s%s action: %s\n" -msgstr "" - #: lib/misc.c:328 lib/misc.c:333 lib/misc.c:339 #, c-format msgid "error creating temporary file %s\n" -- 2.7.4