From: jbj Date: Fri, 8 Jan 1999 16:44:30 +0000 (+0000) Subject: EGCS cruft. X-Git-Tag: rpm-4.4-release~3215 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=303fa780d31fb4b408515e89e5bee43a7fc12632;p=platform%2Fupstream%2Frpm.git EGCS cruft. Use cpioStrerror when getNextHeader fails. More const warnings removed. binary rpms always have RPMTAG_SOURCERPM, source rpms do not. CVS patchset: 2682 CVS date: 1999/01/08 16:44:30 --- diff --git a/install.c b/install.c index 6eb2ad8..1581056 100644 --- a/install.c +++ b/install.c @@ -83,7 +83,7 @@ int doInstall(const char * rootdir, const char ** argv, int installFlags, Header h; int isSource; int tmpnum = 0; - rpmTransactionSet rpmdep; + rpmTransactionSet rpmdep = NULL; struct rpmDependencyConflict * conflicts; int numConflicts; int stopInstall = 0; @@ -192,8 +192,6 @@ int doInstall(const char * rootdir, const char ** argv, int installFlags, fdClose(fd); } else { if (!dbIsOpen) { - rpmMessage(RPMMESS_DEBUG, _("opening database " - "mode: 0%o\n"), mode); if (rpmdbOpen(rootdir, &db, mode, 0644)) { const char *dn; dn = rpmGetPath( (rootdir ? rootdir : ""), @@ -271,8 +269,7 @@ int doInstall(const char * rootdir, const char ** argv, int installFlags, if (numBinaryPackages) rpmtransFree(rpmdep); - - if (!stopInstall) { + if (numSourcePackages && !stopInstall) { for (i = 0; i < numSourcePackages; i++) { fd = fdOpen(sourcePackages[i], O_RDONLY, 0); if (fdFileno(fd) < 0) { @@ -295,7 +292,7 @@ int doInstall(const char * rootdir, const char ** argv, int installFlags, /* FIXME how do we close our various fd's? */ - if (db != NULL) rpmdbClose(db); + if (dbIsOpen) rpmdbClose(db); return numFailed; } diff --git a/lib/cpio.c b/lib/cpio.c index 13500fb..5c80797 100644 --- a/lib/cpio.c +++ b/lib/cpio.c @@ -528,8 +528,7 @@ int cpioInstallArchive(CFD_t *cfd, struct cpioFileMapping * mappings, ch.path = NULL; do { if ((rc = getNextHeader(cfd, &ch))) { - fprintf(stderr, _("error %d reading header: %s\n"), - rc, strerror(errno)); + fprintf(stderr, _("getNextHeader: %s\n"), cpioStrerror(rc)); return CPIOERR_BAD_HEADER; } diff --git a/lib/dbindex.c b/lib/dbindex.c index 87a5cd4..eac06ef 100644 --- a/lib/dbindex.c +++ b/lib/dbindex.c @@ -22,21 +22,19 @@ unsigned int dbiIndexRecordFileNumber(dbiIndexSet set, int recno) { return set.recs[recno].fileNumber; } -dbiIndex * dbiOpenIndex(char * filename, int flags, int perms, DBTYPE type) { - dbiIndex * db; +dbiIndex * dbiOpenIndex(const char * filename, int flags, int perms, DBTYPE type) { + dbiIndex * dbi; - db = malloc(sizeof(*db)); - db->indexname = strdup(filename); - db->db = dbopen(filename, flags, perms, type, NULL); - if (!db->db) { - free(db->indexname); - free(db); - rpmError(RPMERR_DBOPEN, _("cannot open file %s: "), filename, + dbi = malloc(sizeof(*dbi)); + dbi->db = dbopen(filename, flags, perms, type, NULL); + if (!dbi->db) { + free(dbi); + rpmError(RPMERR_DBOPEN, _("cannot open file %s: %s"), filename, strerror(errno)); return NULL; } - - return db; + dbi->indexname = strdup(filename); + return dbi; } void dbiCloseIndex(dbiIndex * dbi) { diff --git a/lib/dbindex.h b/lib/dbindex.h index 0fca910..b6b7581 100644 --- a/lib/dbindex.h +++ b/lib/dbindex.h @@ -32,7 +32,7 @@ typedef /*@abstract@*/ struct { extern "C" { #endif -dbiIndex * dbiOpenIndex(char * filename, int flags, int perms, DBTYPE type); +dbiIndex * dbiOpenIndex(const char * filename, int flags, int perms, DBTYPE type); void dbiCloseIndex(dbiIndex * dbi); void dbiSyncIndex(dbiIndex * dbi); int dbiSearchIndex(dbiIndex * dbi, const char * str, dbiIndexSet * set); diff --git a/lib/depends.c b/lib/depends.c index 9a58728..e61a839 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -32,7 +32,7 @@ static int checkPackageSet(rpmTransactionSet rpmdep, struct problemsSet * psp, char * package, dbiIndexSet * matches); static int addOrderedPack(rpmTransactionSet rpmdep, struct availablePackage * package, - void ** ordering, int * orderNumPtr, + const void ** ordering, int * orderNumPtr, int * selected, int selectionClass, int satisfyDepends, char ** errorStack); @@ -235,9 +235,9 @@ int rpmtransAddPackage(rpmTransactionSet rpmdep, Header h, FD_t fd, int count, i, j; char ** obsoletes; - if (headerIsEntry(h, RPMTAG_SOURCEPACKAGE)) { + /* XXX binary rpms always have RPMTAG_SOURCERPM, source rpms do not */ + if (!headerIsEntry(h, RPMTAG_SOURCERPM)) return 1; - } /* FIXME: handling upgrades like this is *almost* okay. It doesn't check to make sure we're upgrading to a newer version, and it @@ -785,7 +785,7 @@ static int dbrecMatchesDepFlags(rpmTransactionSet rpmdep, int recOffset, static int addOrderedPack(rpmTransactionSet rpmdep, struct availablePackage * package, - void ** ordering, int * orderNumPtr, + const void ** ordering, int * orderNumPtr, int * selected, int selectionClass, int satisfyDepends, char ** errorStack) { char ** requires, ** requiresVersion; diff --git a/lib/package.c b/lib/package.c index b72bc05..2559c38 100644 --- a/lib/package.c +++ b/lib/package.c @@ -95,6 +95,7 @@ static int readPackageHeaders(FD_t fd, struct rpmlead * leadPtr, &defaultPrefix, 1); } + /* XXX binary rpms always have RPMTAG_SOURCERPM, source rpms do not */ if (lead->type == RPMLEAD_SOURCE) { if (!headerIsEntry(*hdr, RPMTAG_SOURCEPACKAGE)) headerAddEntry(*hdr, RPMTAG_SOURCEPACKAGE, RPM_INT32_TYPE, diff --git a/lib/rpmdb.c b/lib/rpmdb.c index 8b8c1b9..ec7f2a6 100644 --- a/lib/rpmdb.c +++ b/lib/rpmdb.c @@ -118,6 +118,9 @@ int openDatabase(const char * prefix, const char * dbpath, rpmdb *rpmdbp, int mo int minimal = flags & RPMDB_FLAG_MINIMAL; const char * akey; + if (mode & O_WRONLY) + return 1; + /* we should accept NULL as a valid prefix */ if (!prefix) prefix=""; @@ -132,13 +135,11 @@ int openDatabase(const char * prefix, const char * dbpath, rpmdb *rpmdbp, int mo filename = alloca(strlen(prefix) + strlen(dbpath) + 40); - if (mode & O_WRONLY) - return 1; - strcpy(filename, prefix); strcat(filename, dbpath); - rpmMessage(RPMMESS_DEBUG, _("opening database in %s\n"), filename); + rpmMessage(RPMMESS_DEBUG, _("opening database mode 0x%x in %s\n"), + mode, filename); strcat(filename, "packages.rpm"); diff --git a/lib/rpmlib.h b/lib/rpmlib.h index 828b81b..96d36fa 100644 --- a/lib/rpmlib.h +++ b/lib/rpmlib.h @@ -466,6 +466,7 @@ typedef void (*rpmErrorCallBackType)(void); void rpmError(int code, char * format, ...); int rpmErrorCode(void); +char *rpmErrorCodeString(void); char *rpmErrorString(void); rpmErrorCallBackType rpmErrorSetCallback(rpmErrorCallBackType); diff --git a/popt/po/popt.pot b/popt/po/popt.pot index 2b1571a..40d81e4 100644 --- a/popt/po/popt.pot +++ b/popt/po/popt.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 1999-01-06 15:53-0500\n" +"POT-Creation-Date: 1999-01-08 09:54-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/tests/hello-test/i b/tests/hello-test/i index cd810ce..943c221 100755 --- a/tests/hello-test/i +++ b/tests/hello-test/i @@ -4,7 +4,6 @@ rpm=${rpm:=rpm} destdir="`pwd`" destdir="`dirname $destdir`" -rm -rf $destdir/var/lib/rpm/* $rpm -i -vv --nodeps --prefix="`pwd`/../usr" $myrpm | \ sed -e "s,$destdir,,g" > $0.out diff --git a/tests/hello-test/initdb b/tests/hello-test/initdb index 88a7a2c..bea5405 100755 --- a/tests/hello-test/initdb +++ b/tests/hello-test/initdb @@ -6,4 +6,5 @@ rpm=${rpm:=rpm} destdir="`pwd`" destdir="`dirname $destdir`" +rm -rf $destdir/var/lib/rpm/* ${DBGX} $rpm --initdb