00001
00005 #include "system.h"
00006 #include "lib/rpmlib.h"
00007 #include "debug.h"
00008
00009 int headerNVR(Header h, const char **np, const char **vp, const char **rp)
00010 {
00011 int type;
00012 int count;
00013
00014
00015 if (np) {
00016 if (!(headerGetEntry(h, RPMTAG_NAME, &type, (void **) np, &count)
00017 && type == RPM_STRING_TYPE && count == 1))
00018 *np = NULL;
00019 }
00020 if (vp) {
00021 if (!(headerGetEntry(h, RPMTAG_VERSION, &type, (void **) vp, &count)
00022 && type == RPM_STRING_TYPE && count == 1))
00023 *vp = NULL;
00024 }
00025 if (rp) {
00026 if (!(headerGetEntry(h, RPMTAG_RELEASE, &type, (void **) rp, &count)
00027 && type == RPM_STRING_TYPE && count == 1))
00028 *rp = NULL;
00029 }
00030
00031 return 0;
00032 }
00033
00034 int headerNEVRA(Header h, const char **np,
00035 const char **ep, const char **vp, const char **rp,
00036 const char **ap)
00037 {
00038 int type;
00039 int count;
00040
00041
00042 if (np) {
00043 if (!(headerGetEntry(h, RPMTAG_NAME, &type, (void **) np, &count)
00044 && type == RPM_STRING_TYPE && count == 1))
00045 *np = NULL;
00046 }
00047 if (vp) {
00048 if (!(headerGetEntry(h, RPMTAG_VERSION, &type, (void **) vp, &count)
00049 && type == RPM_STRING_TYPE && count == 1))
00050 *vp = NULL;
00051 }
00052 if (rp) {
00053 if (!(headerGetEntry(h, RPMTAG_RELEASE, &type, (void **) rp, &count)
00054 && type == RPM_STRING_TYPE && count == 1))
00055 *rp = NULL;
00056 }
00057 if (ap) {
00058 if (!(headerGetEntry(h, RPMTAG_ARCH, &type, (void **) ap, &count)
00059 && type == RPM_STRING_TYPE && count == 1))
00060 *ap = NULL;
00061 }
00062
00063 return 0;
00064 }