aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-02-26 15:53:32 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-02-26 15:53:32 +0000
commitbe00e4455844b5b83e07c97e041b205ad62186c9 (patch)
tree37aafa24075fb68aa8cdbe58241528132c4d5f27
parentce88114faa0e19ddeda43d9deb3a325c3951697b (diff)
downloadrpmtools-be00e4455844b5b83e07c97e041b205ad62186c9.tar
rpmtools-be00e4455844b5b83e07c97e041b205ad62186c9.tar.gz
rpmtools-be00e4455844b5b83e07c97e041b205ad62186c9.tar.bz2
rpmtools-be00e4455844b5b83e07c97e041b205ad62186c9.tar.xz
rpmtools-be00e4455844b5b83e07c97e041b205ad62186c9.zip
- parsehdlist, rpm2header:
o do not add/use FILENAME_TAG and FILESIZE_TAG to/in hdlist anymore
-rw-r--r--NEWS3
-rw-r--r--parsehdlist.c29
-rw-r--r--rpm2header.c5
3 files changed, 14 insertions, 23 deletions
diff --git a/NEWS b/NEWS
index 84b8a76..7c4cef3 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+- parsehdlist, rpm2header:
+ o do not add/use FILENAME_TAG and FILESIZE_TAG to/in hdlist anymore
+
Version 5.3.6 - 5 February 2007, by Pascal "Pixel" Rigaux
- genhdlist2:
diff --git a/parsehdlist.c b/parsehdlist.c
index ea263ce..eb618d8 100644
--- a/parsehdlist.c
+++ b/parsehdlist.c
@@ -17,9 +17,6 @@
#define VERSION_STRING "0.0"
#endif
-/* see rpm2header.c */
-#define FILENAME_TAG 1000000
-
/* static data for very simple list */
static struct {
char *name;
@@ -177,12 +174,9 @@ void print_list_name(Header header, char *format, char print_sep, int extension)
char *version = get_name(header, RPMTAG_VERSION);
char *release = get_name(header, RPMTAG_RELEASE);
char *arch = headerIsEntry(header, RPMTAG_SOURCERPM) ? get_name(header, RPMTAG_ARCH) : "src";
- char *buff = alloca(strlen(name) + strlen(version) + strlen(release) + strlen(arch) + 1+1+1 + 5);
printf(format, name, "");
- sprintf(buff, "%s-%s-%s.%s.rpm", name, version, release, arch);
- if (!strcmp(buff, get_name(header, FILENAME_TAG))) {
if (extension)
printf("%s-%s-%s.%s%c%u%c%u%c%s\n", name, version, release, arch,
print_sep ? print_sep : ':', get_int(header, RPMTAG_EPOCH),
@@ -190,17 +184,16 @@ void print_list_name(Header header, char *format, char print_sep, int extension)
print_sep ? print_sep : ':', get_name(header, RPMTAG_GROUP));
else
printf("%s-%s-%s.%s\n", name, version, release, arch);
- } else {
- if (extension)
- printf("%s-%s-%s.%s%c%u%c%u%c%s%c%s\n", name, version, release, arch,
- print_sep ? print_sep : ':', get_int(header, RPMTAG_EPOCH),
- print_sep ? print_sep : ':', get_int(header, RPMTAG_SIZE),
- print_sep ? print_sep : ':', get_name(header, RPMTAG_GROUP),
- print_sep ? print_sep : ':', get_name(header, FILENAME_TAG));
- else
- printf("%s-%s-%s.%s%c%s\n", name, version, release, arch,
- print_sep ? print_sep : ':', get_name(header, FILENAME_TAG));
- }
+}
+
+static
+void print_filename(Header header) {
+ char *name = get_name(header, RPMTAG_NAME);
+ char *version = get_name(header, RPMTAG_VERSION);
+ char *release = get_name(header, RPMTAG_RELEASE);
+ char *arch = headerIsEntry(header, RPMTAG_SOURCERPM) ? get_name(header, RPMTAG_ARCH) : "src";
+
+ printf("%s-%s-%s.%s.rpm\n", name, version, release, arch);
}
static
@@ -537,7 +530,7 @@ int main(int argc, char **argv)
if (print_info) print_list_name(header, printable_header(print_quiet, "info", print_sep, 0), print_sep, 1);
if ((print_name | print_info | print_group | print_size | print_epoch | print_summary | print_description |
print_provides | print_requires | print_files | print_conflicts | print_obsoletes | print_prereqs | print_files_more_info) == 0) {
- printf("%s\n", get_name(header, FILENAME_TAG));
+ print_filename(header);
}
headerFree(header);
}
diff --git a/rpm2header.c b/rpm2header.c
index cec2200..d8831f6 100644
--- a/rpm2header.c
+++ b/rpm2header.c
@@ -8,9 +8,6 @@
#include <rpmlib.h>
#include <rpm/rpmts.h>
-#define FILENAME_TAG 1000000
-#define FILESIZE_TAG 1000001
-
const char *basename(const char *f) {
char *p = strrchr(f, '/');
return p ? p + 1 : f;
@@ -76,8 +73,6 @@ int main(int argc, char **argv) {
headerRemoveEntry(h, RPMTAG_EXCLUSIVE);
headerRemoveEntry(h, RPMTAG_DISTRIBUTION);
headerRemoveEntry(h, RPMTAG_VERIFYSCRIPT);
- headerAddEntry(h, FILENAME_TAG, RPM_STRING_TYPE, name, 1);
- headerAddEntry(h, FILESIZE_TAG, RPM_INT32_TYPE, &size, 1);
headerWrite(fout, h, HEADER_MAGIC_YES);
headerFree(h);
}