EGCS cruft.
authorjbj <devnull@localhost>
Fri, 8 Jan 1999 16:44:30 +0000 (16:44 +0000)
committerjbj <devnull@localhost>
Fri, 8 Jan 1999 16:44:30 +0000 (16:44 +0000)
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

install.c
lib/cpio.c
lib/dbindex.c
lib/dbindex.h
lib/depends.c
lib/package.c
lib/rpmdb.c
lib/rpmlib.h
popt/po/popt.pot
tests/hello-test/i
tests/hello-test/initdb

index 6eb2ad8..1581056 100644 (file)
--- 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;
 }
index 13500fb..5c80797 100644 (file)
@@ -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;
        }
 
index 87a5cd4..eac06ef 100644 (file)
@@ -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) {
index 0fca910..b6b7581 100644 (file)
@@ -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);
index 9a58728..e61a839 100644 (file)
@@ -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;
index b72bc05..2559c38 100644 (file)
@@ -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,
index 8b8c1b9..ec7f2a6 100644 (file)
@@ -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");
 
index 828b81b..96d36fa 100644 (file)
@@ -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);
 
index 2b1571a..40d81e4 100644 (file)
@@ -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 <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
index cd810ce..943c221 100755 (executable)
@@ -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
 
index 88a7a2c..bea5405 100755 (executable)
@@ -6,4 +6,5 @@ rpm=${rpm:=rpm}
 destdir="`pwd`"
 destdir="`dirname $destdir`"
 
+rm -rf $destdir/var/lib/rpm/*
 ${DBGX} $rpm --initdb