summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2000-02-15 16:40:28 +0000
committerjbj <devnull@localhost>2000-02-15 16:40:28 +0000
commit38e3c32e92f90cc3c62245b72c2ea287ab07f3d9 (patch)
treea6e1638793e669e3405a686c7a7e56de73a4a85c /lib
parent6b70a982bc5ea599d32650a6b8ed45dac23cf8f8 (diff)
downloadlibrpm-tizen-38e3c32e92f90cc3c62245b72c2ea287ab07f3d9.tar.gz
librpm-tizen-38e3c32e92f90cc3c62245b72c2ea287ab07f3d9.tar.bz2
librpm-tizen-38e3c32e92f90cc3c62245b72c2ea287ab07f3d9.zip
new rpm-build package to isolate rpm dependencies on perl/bash2.
always remove duplicate identical package entries on --rebuilddb. CVS patchset: 3558 CVS date: 2000/02/15 16:40:28
Diffstat (limited to 'lib')
-rw-r--r--lib/install.c2
-rw-r--r--lib/rebuilddb.c22
2 files changed, 20 insertions, 4 deletions
diff --git a/lib/install.c b/lib/install.c
index 51cc4e4c4..ea79493af 100644
--- a/lib/install.c
+++ b/lib/install.c
@@ -820,7 +820,7 @@ int installBinaryPackage(const char * rootdir, rpmdb db, FD_t fd, Header h,
break;
}
- if (ext) {
+ if (ext && access(files[i].relativePath, F_OK) == 0) {
newpath = alloca(strlen(files[i].relativePath) + 20);
strcpy(newpath, files[i].relativePath);
strcat(newpath, ext);
diff --git a/lib/rebuilddb.c b/lib/rebuilddb.c
index 573f80e67..82a740d9e 100644
--- a/lib/rebuilddb.c
+++ b/lib/rebuilddb.c
@@ -19,6 +19,7 @@ int rpmdbRebuild(const char * rootdir)
int nocleanup = 1;
int failed = 0;
int rc = 0;
+ int unique = 1; /* XXX always eliminate duplicate entries */
tfn = rpmGetPath("%{_dbpath}", NULL);
if (!(tfn && tfn[0] != '%')) {
@@ -90,9 +91,24 @@ int rpmdbRebuild(const char * rootdir)
if (headerIsEntry(h, RPMTAG_NAME) &&
headerIsEntry(h, RPMTAG_VERSION) &&
headerIsEntry(h, RPMTAG_RELEASE) &&
- headerIsEntry(h, RPMTAG_RELEASE) &&
headerIsEntry(h, RPMTAG_BUILDTIME)) {
- if (rpmdbAdd(newdb, h)) {
+ dbiIndexSet matches;
+ int skip;
+
+ /* XXX always eliminate duplicate entries */
+ if (unique && !rpmdbFindByHeader(newdb, h, &matches)) {
+ const char * name, * version, * release;
+ headerNVR(h, &name, &version, &release);
+
+ rpmError(RPMERR_INTERNAL,
+ _("duplicated database entry: %s-%s-%s -- skipping."),
+ name, version, release);
+ skip = 1;
+ dbiFreeIndexRecord(matches);
+ } else
+ skip = 0;
+
+ if (skip == 0 && rpmdbAdd(newdb, h)) {
rpmError(RPMERR_INTERNAL,
_("cannot add record originally at %d"), recnum);
failed = 1;
@@ -100,7 +116,7 @@ int rpmdbRebuild(const char * rootdir)
}
} else {
rpmError(RPMERR_INTERNAL,
- _("record number %d in database is bad -- skipping it"),
+ _("record number %d in database is bad -- skipping."),
recnum);
}