aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-09-28 09:54:36 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-09-28 09:54:36 +0000
commitdee5a0fbc3b052e20b3646b02d85c2678c483387 (patch)
treeb01bf2466aaadbaafddd96ad00d980a7ba3ae58d
parent77c467255c766a1bcc99e7f75a89fad1bde3c835 (diff)
downloadrpmtools-dee5a0fbc3b052e20b3646b02d85c2678c483387.tar
rpmtools-dee5a0fbc3b052e20b3646b02d85c2678c483387.tar.gz
rpmtools-dee5a0fbc3b052e20b3646b02d85c2678c483387.tar.bz2
rpmtools-dee5a0fbc3b052e20b3646b02d85c2678c483387.tar.xz
rpmtools-dee5a0fbc3b052e20b3646b02d85c2678c483387.zip
Remove obsolete code
-rw-r--r--Makefile.PL9
-rw-r--r--rpm2header.c140
2 files changed, 62 insertions, 87 deletions
diff --git a/Makefile.PL b/Makefile.PL
index ec5190d..8e7cb7f 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,13 +1,11 @@
# $Id$
-# use 5.008;
use ExtUtils::MakeMaker;
use MDK::Common qw(cat_);
(my $rpmtools_version) = cat_('rpmtools.spec') =~ /define\s+version\s+(\d+\.\d+\.\d+)/
or die "no version found\n";
-
my $tag_version = "v$rpmtools_version";
$tag_version =~ s/\./_/g;
@@ -16,10 +14,10 @@ sub MY::postamble {
.PHONY: ChangeLog
\$(FROMCC): %: %.cc
- \$(CXX) \$(CCFLAGS) \$(OPTIMIZE) -DVERSION_STRING=\\"\$(RPMTOOLSVERSION)\\" \$< \$(LIBRPM) \$(INCRPM) \$(DEFRPM) -o \$@
+ \$(CXX) \$(CCFLAGS) \$(OPTIMIZE) -DVERSION_STRING=\\"\$(RPMTOOLSVERSION)\\" \$< \$(LIBRPM) \$(INCRPM) -o \$@
\$(FROMC): %: %.c
- \$(CC) \$(CCFLAGS) \$(OPTIMIZE) -DVERSION_STRING=\\"\$(RPMTOOLSVERSION)\\" \$< \$(LIBRPM) \$(INCRPM) \$(DEFRPM) -o \$@
+ \$(CC) \$(CCFLAGS) \$(OPTIMIZE) -DVERSION_STRING=\\"\$(RPMTOOLSVERSION)\\" \$< \$(LIBRPM) \$(INCRPM) -o \$@
buildc: \$(FROMC) \$(FROMCC)
@@ -37,9 +35,7 @@ rpm: dist
tag:
cvs tag $tag_version
-
MAKEMAKEFILE
-
}
WriteMakefile(
@@ -51,7 +47,6 @@ WriteMakefile(
FROMCC => '#gendepslist2 hdlist2names hdlist2files hdlist2prereq hdlist2groups',
LIBRPM => '-lrpm -lrpmio -lrpmdb -lrpmbuild -lz -lbz2 -lpopt',
INCRPM => '-I/usr/include/rpm',
- DEFRPM => '-DRPM_42',
},
depend => {
clean_subdirs => 'cleanc',
diff --git a/rpm2header.c b/rpm2header.c
index 1dd3ab9..cec2200 100644
--- a/rpm2header.c
+++ b/rpm2header.c
@@ -6,102 +6,82 @@
#include <fcntl.h>
#include <unistd.h>
#include <rpmlib.h>
-
-#ifdef RPM_42
#include <rpm/rpmts.h>
-#endif
#define FILENAME_TAG 1000000
#define FILESIZE_TAG 1000001
const char *basename(const char *f) {
- char *p = strrchr(f, '/');
- return p ? p + 1 : f;
+ char *p = strrchr(f, '/');
+ return p ? p + 1 : f;
}
int_32 FD_size(FD_t fd) {
- struct stat sb;
- fstat(fdFileno(fd), &sb);
- return sb.st_size;
+ struct stat sb;
+ fstat(fdFileno(fd), &sb);
+ return sb.st_size;
}
int main(int argc, char **argv) {
- int i;
- FD_t fout;
-
- if (argc < 2) {
- fprintf(stderr, "usage: rpm2header <rpms>\n");
- exit(1);
- }
+ int i;
+ FD_t fout;
- fout = fdDup(1 /*stdout*/);
-
- for (i = 1; i < argc; i++) {
- FD_t fd;
- Header h;
- int_32 size;
- const char *name = basename(argv[i]);
-#ifdef RPM_42
- rpmts ts;
- /* rpmVSFlags vsflags, ovsflags; */
-#else
- int isSource;
-#endif
-
- fprintf(stderr, "%s\n", argv[i]);
-
- if (!(fd = fdOpen(argv[i], O_RDONLY, 0666))) {
- perror("open");
- exit(1);
+ if (argc < 2) {
+ fprintf(stderr, "usage: rpm2header <rpms>\n");
+ exit(1);
}
- size = FD_size(fd);
-#ifdef RPM_42
- ts = rpmtsCreate();
- rpmtsSetVSFlags(ts, _RPMVSF_NOSIGNATURES);
- if (rpmReadPackageFile(ts, fd, argv[1], &h) == 0) {
-#else
- if (rpmReadPackageHeader(fd, &h, &isSource, NULL, NULL) == 0) {
-#endif
- headerRemoveEntry(h, RPMTAG_POSTIN);
- headerRemoveEntry(h, RPMTAG_POSTUN);
- headerRemoveEntry(h, RPMTAG_PREIN);
- headerRemoveEntry(h, RPMTAG_PREUN);
- headerRemoveEntry(h, RPMTAG_FILEUSERNAME);
- headerRemoveEntry(h, RPMTAG_FILEGROUPNAME);
- headerRemoveEntry(h, RPMTAG_FILEVERIFYFLAGS);
- headerRemoveEntry(h, RPMTAG_FILERDEVS);
- headerRemoveEntry(h, RPMTAG_FILEMTIMES);
- headerRemoveEntry(h, RPMTAG_FILEDEVICES);
- headerRemoveEntry(h, RPMTAG_FILEINODES);
- headerRemoveEntry(h, RPMTAG_TRIGGERSCRIPTS);
- headerRemoveEntry(h, RPMTAG_TRIGGERVERSION);
- headerRemoveEntry(h, RPMTAG_TRIGGERFLAGS);
- headerRemoveEntry(h, RPMTAG_TRIGGERNAME);
- headerRemoveEntry(h, RPMTAG_CHANGELOGTIME);
- headerRemoveEntry(h, RPMTAG_CHANGELOGNAME);
- headerRemoveEntry(h, RPMTAG_CHANGELOGTEXT);
- headerRemoveEntry(h, RPMTAG_ICON);
- headerRemoveEntry(h, RPMTAG_GIF);
- headerRemoveEntry(h, RPMTAG_VENDOR);
- headerRemoveEntry(h, RPMTAG_EXCLUDE);
- headerRemoveEntry(h, RPMTAG_EXCLUSIVE);
- headerRemoveEntry(h, RPMTAG_DISTRIBUTION);
- headerRemoveEntry(h, RPMTAG_VERIFYSCRIPT);
+ fout = fdDup(1 /*stdout*/);
+
+ for (i = 1; i < argc; i++) {
+ FD_t fd;
+ Header h;
+ int_32 size;
+ const char *name = basename(argv[i]);
+ rpmts ts;
+
+ fprintf(stderr, "%s\n", argv[i]);
- /* removing that break updates.
- headerRemoveEntry(h, RPMTAG_OLDFILENAMES);
- headerRemoveEntry(h, RPMTAG_BASENAMES);
- headerRemoveEntry(h, RPMTAG_DIRINDEXES);
- headerRemoveEntry(h, RPMTAG_DIRNAMES);
- */
+ if (!(fd = fdOpen(argv[i], O_RDONLY, 0666))) {
+ perror("open");
+ exit(1);
+ }
+ size = FD_size(fd);
- 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);
+ ts = rpmtsCreate();
+ rpmtsSetVSFlags(ts, _RPMVSF_NOSIGNATURES);
+ if (rpmReadPackageFile(ts, fd, argv[1], &h) == 0) {
+ headerRemoveEntry(h, RPMTAG_POSTIN);
+ headerRemoveEntry(h, RPMTAG_POSTUN);
+ headerRemoveEntry(h, RPMTAG_PREIN);
+ headerRemoveEntry(h, RPMTAG_PREUN);
+ headerRemoveEntry(h, RPMTAG_FILEUSERNAME);
+ headerRemoveEntry(h, RPMTAG_FILEGROUPNAME);
+ headerRemoveEntry(h, RPMTAG_FILEVERIFYFLAGS);
+ headerRemoveEntry(h, RPMTAG_FILERDEVS);
+ headerRemoveEntry(h, RPMTAG_FILEMTIMES);
+ headerRemoveEntry(h, RPMTAG_FILEDEVICES);
+ headerRemoveEntry(h, RPMTAG_FILEINODES);
+ headerRemoveEntry(h, RPMTAG_TRIGGERSCRIPTS);
+ headerRemoveEntry(h, RPMTAG_TRIGGERVERSION);
+ headerRemoveEntry(h, RPMTAG_TRIGGERFLAGS);
+ headerRemoveEntry(h, RPMTAG_TRIGGERNAME);
+ headerRemoveEntry(h, RPMTAG_CHANGELOGTIME);
+ headerRemoveEntry(h, RPMTAG_CHANGELOGNAME);
+ headerRemoveEntry(h, RPMTAG_CHANGELOGTEXT);
+ headerRemoveEntry(h, RPMTAG_ICON);
+ headerRemoveEntry(h, RPMTAG_GIF);
+ headerRemoveEntry(h, RPMTAG_VENDOR);
+ headerRemoveEntry(h, RPMTAG_EXCLUDE);
+ 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);
+ }
+ fdClose(fd);
}
- fdClose(fd);
- }
- return 0;
+ return 0;
}