summaryrefslogtreecommitdiff
path: root/rpmdb
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2001-10-25 01:36:32 +0000
committerjbj <devnull@localhost>2001-10-25 01:36:32 +0000
commitf03b462b1ef0ad128b7732c0492eefeff9c2248e (patch)
tree712adf7fee56f1b6510c3bf170d35e43d37d48f5 /rpmdb
parentcdeb78fb1a97bee2778e873725fe452ba5d79786 (diff)
downloadrpm-f03b462b1ef0ad128b7732c0492eefeff9c2248e.tar.gz
rpm-f03b462b1ef0ad128b7732c0492eefeff9c2248e.tar.bz2
rpm-f03b462b1ef0ad128b7732c0492eefeff9c2248e.zip
- legacy signatures always checked on -qp and -Vp.
CVS patchset: 5133 CVS date: 2001/10/25 01:36:32
Diffstat (limited to 'rpmdb')
-rw-r--r--rpmdb/legacy.c53
-rw-r--r--rpmdb/legacy.h7
2 files changed, 60 insertions, 0 deletions
diff --git a/rpmdb/legacy.c b/rpmdb/legacy.c
index 61b4d5218..bcacc42f1 100644
--- a/rpmdb/legacy.c
+++ b/rpmdb/legacy.c
@@ -5,9 +5,12 @@
#include "system.h"
#include "rpmio_internal.h"
#include <rpmlib.h>
+#include "misc.h"
#include "legacy.h"
#include "debug.h"
+#define alloca_strdup(_s) strcpy(alloca(strlen(_s)+1), (_s))
+
int domd5(const char * fn, unsigned char * digest, int asAscii)
{
int rc;
@@ -318,3 +321,53 @@ exit:
&pEVR, 1);
}
}
+
+void legacyRetrofit(Header h, const struct rpmlead * lead)
+{
+ const char * prefix;
+
+ /*
+ * We don't use these entries (and rpm >= 2 never has) and they are
+ * pretty misleading. Let's just get rid of them so they don't confuse
+ * anyone.
+ */
+ if (headerIsEntry(h, RPMTAG_FILEUSERNAME))
+ (void) headerRemoveEntry(h, RPMTAG_FILEUIDS);
+ if (headerIsEntry(h, RPMTAG_FILEGROUPNAME))
+ (void) headerRemoveEntry(h, RPMTAG_FILEGIDS);
+
+ /*
+ * We switched the way we do relocateable packages. We fix some of
+ * it up here, though the install code still has to be a bit
+ * careful. This fixup makes queries give the new values though,
+ * which is quite handy.
+ */
+ /*@=branchstate@*/
+ if (headerGetEntry(h, RPMTAG_DEFAULTPREFIX, NULL, (void **) &prefix, NULL))
+ {
+ const char * nprefix = stripTrailingChar(alloca_strdup(prefix), '/');
+ (void) headerAddEntry(h, RPMTAG_PREFIXES, RPM_STRING_ARRAY_TYPE,
+ &nprefix, 1);
+ }
+ /*@=branchstate@*/
+
+ /*
+ * The file list was moved to a more compressed format which not
+ * only saves memory (nice), but gives fingerprinting a nice, fat
+ * speed boost (very nice). Go ahead and convert old headers to
+ * the new style (this is a noop for new headers).
+ */
+ if (lead->major < 4)
+ compressFilelist(h);
+
+ /* XXX binary rpms always have RPMTAG_SOURCERPM, source rpms do not */
+ if (lead->type == RPMLEAD_SOURCE) {
+ int_32 one = 1;
+ if (!headerIsEntry(h, RPMTAG_SOURCEPACKAGE))
+ (void) headerAddEntry(h, RPMTAG_SOURCEPACKAGE, RPM_INT32_TYPE,
+ &one, 1);
+ } else if (lead->major < 4) {
+ /* Retrofit "Provide: name = EVR" for binary packages. */
+ providePackageNVR(h);
+ }
+}
diff --git a/rpmdb/legacy.h b/rpmdb/legacy.h
index 74ec565d6..8648b9831 100644
--- a/rpmdb/legacy.h
+++ b/rpmdb/legacy.h
@@ -90,6 +90,13 @@ void buildOrigFileList(Header h, /*@out@*/ const char *** fileListPtr,
void providePackageNVR(Header h)
/*@modifies h @*/;
+/**
+ * Do all necessary retorfits for a package header.
+ * @param h header
+ */
+void legacyRetrofit(Header h, const struct rpmlead * lead)
+ /*@modifies h@*/;
+
#ifdef __cplusplus
}
#endif