diff options
-rw-r--r-- | build/rpmfc.c | 29 | ||||
-rw-r--r-- | file/magic/Localstuff | 31 | ||||
-rw-r--r-- | file/src/Makefile.am | 4 | ||||
-rw-r--r-- | rpm.spec.in | 8 | ||||
-rw-r--r-- | tools/Makefile.am | 4 |
5 files changed, 58 insertions, 18 deletions
diff --git a/build/rpmfc.c b/build/rpmfc.c index 660215c76..bac69ec6a 100644 --- a/build/rpmfc.c +++ b/build/rpmfc.c @@ -446,7 +446,8 @@ static struct rpmfcTokens_s rpmfcTokens[] = { { " compressed", RPMFC_COMPRESSED }, - { "troff or preprocessor input", RPMFC_MANPAGE }, + { "troff or preprocessor input", RPMFC_MANPAGE|RPMFC_INCLUDE }, + { "GNU Info", RPMFC_MANPAGE|RPMFC_INCLUDE }, { "perl script text", RPMFC_PERL|RPMFC_INCLUDE }, { "Perl5 module source text", RPMFC_PERL|RPMFC_MODULE|RPMFC_INCLUDE }, @@ -1150,7 +1151,8 @@ int rpmfcClassify(rpmfc fc, ARGV_t argv) size_t slen; int fcolor; int xx; - int msflags = 0; /* XXX what MAGIC_FOO flags? */ + static const char * magicfile = "/usr/lib/rpm/magic"; + int msflags = MAGIC_COMPRESS|MAGIC_CHECK; /* XXX what MAGIC_FOO flags? */ magic_t ms = NULL; if (fc == NULL || argv == NULL) @@ -1167,10 +1169,20 @@ int rpmfcClassify(rpmfc fc, ARGV_t argv) xx = argvAdd(&fc->cdict, "directory"); ms = magic_open(msflags); - /* XXX check errors. */ + if (ms == NULL) { + xx = RPMERR_EXEC; + rpmError(xx, _("magic_open(0x%x) failed: %s\n"), + msflags, strerror(errno)); +assert(ms != NULL); /* XXX figger a proper return path. */ + } - xx = magic_load(ms, "/usr/lib/rpm/magic"); - /* XXX check errors. */ + xx = magic_load(ms, magicfile); + if (xx == -1) { + xx = RPMERR_EXEC; + rpmError(xx, _("magic_load(ms, \"%s\") failed: %s\n"), + magicfile, magic_error(ms)); +assert(xx != -1); /* XXX figger a proper return path. */ + } for (fc->ix = 0; fc->ix < fc->nfiles; fc->ix++) { const char * ftype; @@ -1185,7 +1197,12 @@ assert(s != NULL); ftype = "Perl5 module source text"; else { ftype = magic_file(ms, s); -assert(ftype != NULL); + if (ftype == NULL) { + xx = RPMERR_EXEC; + rpmError(xx, _("magic_file(ms, \"%s\") faileds: %s\n"), + s, magic_error(ms)); +assert(ftype != NULL); /* XXX figger a proper return path. */ + } } /*@=branchstate@*/ diff --git a/file/magic/Localstuff b/file/magic/Localstuff index 914d449c0..8aa48646c 100644 --- a/file/magic/Localstuff +++ b/file/magic/Localstuff @@ -5,3 +5,34 @@ # $Id: Localstuff,v 1.4 2003/03/23 04:17:27 christos Exp $ # Add any locally observed files here. Remember: # text if readable, executable if runnable binary, data if unreadable. + +# +# RPM: file(1) magic for RPM packages and headers +# +0 beshort 0xedab +>2 beshort 0xeedb RPM +>>4 byte x v%d package +>>6 beshort 0 bin +>>6 beshort 1 src +>>8 beshort 1 i386 +>>8 beshort 2 Alpha +>>8 beshort 3 Sparc +>>8 beshort 4 MIPS +>>8 beshort 5 PPC +>>8 beshort 6 68000 +>>8 beshort 7 SGI +>>8 beshort 8 RS6000 +>>8 beshort 10 Sparc64 +>>8 beshort 11 MIPSEL +>>8 beshort 12 ARM +>>8 beshort 13 m68kmint +>>8 beshort 14 s390 +>>8 beshort 15 s390x +>>8 beshort 16 PPC64 +>>8 beshort 17 SH +>>8 beshort 18 Xtensa +>>10 string x %s + +0 beshort 0x8ead +>2 beshort 0xe801 RPM header + diff --git a/file/src/Makefile.am b/file/src/Makefile.am index 0f875b55e..2a957b2bb 100644 --- a/file/src/Makefile.am +++ b/file/src/Makefile.am @@ -20,10 +20,6 @@ libmagic_la_SOURCES = magic.c apprentice.c softmagic.c ascmagic.c \ funcs.c apptype.c libmagic_la_LDFLAGS = -version-info 1:0:0 -pkglib_PROGRAMS = rpmfile -rpmfile: file - -cp $< $@ - noinst_PROGRAMS = file file_SOURCES = file.c file_LDFLAGS = -all-static diff --git a/rpm.spec.in b/rpm.spec.in index 281f577d6..023b7c80c 100644 --- a/rpm.spec.in +++ b/rpm.spec.in @@ -330,13 +330,7 @@ exit 0 %endif %attr(-, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/noarch* -%rpmattr %{__prefix}/lib/rpm/rpmdb_deadlock -%rpmattr %{__prefix}/lib/rpm/rpmdb_dump -%rpmattr %{__prefix}/lib/rpm/rpmdb_load -%rpmattr %{__prefix}/lib/rpm/rpmdb_loadcvt -%rpmattr %{__prefix}/lib/rpm/rpmdb_svc -%rpmattr %{__prefix}/lib/rpm/rpmdb_stat -%rpmattr %{__prefix}/lib/rpm/rpmdb_verify +%rpmattr %{__prefix}/lib/rpm/rpmdb_* %rpmattr %{__prefix}/lib/rpm/rpmfile %lang(cs) %{__prefix}/*/locale/cs/LC_MESSAGES/rpm.mo diff --git a/tools/Makefile.am b/tools/Makefile.am index 2f19956cc..f0ab8adfe 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -31,6 +31,7 @@ noinst_PROGRAMS = dumpdb pkgbindir = @RPMCONFIGDIR@ pkgbin_PROGRAMS = debugedit javadeps rpmcache rpmdeps rpmfile +MAGIC = $(pkgbindir)/magic bin_PROGRAMS = rpmgraph @@ -49,11 +50,12 @@ rpmdeps_SOURCES = rpmdeps.c rpmdeps_LDADD = $(top_builddir)/build/librpmbuild.la #rpmdeps_LDFLAGS = $(staticLDFLAGS) -rpmfile.c: $(top_builddir)/file/src/file.c +rpmfile.c: $(top_srcdir)/file/src/file.c rm -f $@ ln -s $< $@ rpmfile_SOURCES = rpmfile.c +rpmfile_CFLAGS = -DMAGIC='"$(MAGIC)"' rpmfile_LDADD = $(top_builddir)/rpmio/librpmio.la #rpmfile_LDFLAGS = $(staticLDFLAGS) |