]> git.pld-linux.org Git - packages/rpm.git/blob - rpm-mimetype.patch
- automatically generate mimetype(...) provides for packages at build time
[packages/rpm.git] / rpm-mimetype.patch
1 diff -urN rpm-4.4.9/lib/rpmfc.c rpm-4.4.9.new/lib/rpmfc.c
2 --- rpm-4.4.9/lib/rpmfc.c       2008-05-06 16:27:09.000000000 +0200
3 +++ rpm-4.4.9.new/lib/rpmfc.c   2008-05-06 16:33:48.000000000 +0200
4 @@ -531,6 +531,8 @@
5    { "troff or preprocessor input",     RPMFC_MANPAGE|RPMFC_INCLUDE },
6    { "GNU Info",                        RPMFC_MANPAGE|RPMFC_INCLUDE },
7  
8 +  { "Desktop E",               RPMFC_DESKTOP_FILE|RPMFC_INCLUDE },
9 +
10    { "perl script text",                RPMFC_PERL|RPMFC_INCLUDE },
11    { "Perl5 module source text", RPMFC_PERL|RPMFC_MODULE|RPMFC_INCLUDE },
12  
13 @@ -872,6 +874,10 @@
14             xx = rpmfcHelper(fc, 'P', "java", fc->noautoprov, fc->noautoprov_c);
15         if (fc->findreq)
16             xx = rpmfcHelper(fc, 'R', "java", fc->noautoreq, fc->noautoreq_c);
17 +    } else
18 +    if (fc->fcolor->vals[fc->ix] & RPMFC_DESKTOP_FILE) {
19 +       if (fc->findprov)
20 +           xx = rpmfcHelper(fc, 'P', "mimetype", fc->noautoprov, fc->noautoprov_c);
21      }
22  
23      return 0;
24 @@ -984,7 +990,7 @@
25  /*@unchecked@*/
26  static struct rpmfcApplyTbl_s rpmfcApplyTable[] = {
27      { rpmfcELF,                RPMFC_ELF },
28 -    { rpmfcSCRIPT,     (RPMFC_SCRIPT|RPMFC_PERL|RPMFC_PYTHON|RPMFC_LIBTOOL|RPMFC_PKGCONFIG|RPMFC_BOURNE|RPMFC_JAVA|RPMFC_PHP) },
29 +    { rpmfcSCRIPT,     (RPMFC_SCRIPT|RPMFC_PERL|RPMFC_PYTHON|RPMFC_LIBTOOL|RPMFC_PKGCONFIG|RPMFC_BOURNE|RPMFC_JAVA|RPMFC_PHP|RPMFC_DESKTOP_FILE) },
30      { rpmfcMONO,       RPMFC_MONO },
31      { NULL, 0 }
32  };
33 @@ -1350,6 +1356,10 @@
34             else if (_suffix(s, ".php"))
35                 ftype = "PHP script text";
36  
37 +           /* XXX all files with extension ".desktop" are desktop files for now. */
38 +           else if (_suffix(s, ".desktop"))
39 +               ftype = "Desktop Entry";
40 +
41             /* XXX skip all files in /dev/ which are (or should be) %dev dummies. */
42             else if (slen >= fc->brlen+sizeof("/dev/") && !strncmp(s+fc->brlen, "/dev/", sizeof("/dev/")-1))
43                 ftype = "";
44 diff -urN rpm-4.4.9/lib/rpmfc.h rpm-4.4.9.new/lib/rpmfc.h
45 --- rpm-4.4.9/lib/rpmfc.h       2008-05-06 16:27:09.000000000 +0200
46 +++ rpm-4.4.9.new/lib/rpmfc.h   2008-05-06 16:28:44.000000000 +0200
47 @@ -53,6 +53,7 @@
48      RPMFC_FONT                 = (1 << 21),
49      RPMFC_IMAGE                        = (1 << 22),
50      RPMFC_MANPAGE              = (1 << 23),
51 +    RPMFC_DESKTOP_FILE         = (1 << 11),
52  
53      RPMFC_PERL                 = (1 << 24),
54      RPMFC_JAVA                 = (1 << 25),
55 diff -urN rpm-4.4.9/macros.in rpm-4.4.9.new/macros.in
56 --- rpm-4.4.9/macros.in 2008-05-06 16:27:09.000000000 +0200
57 +++ rpm-4.4.9.new/macros.in     2008-05-06 16:24:15.000000000 +0200
58 @@ -1461,6 +1461,16 @@
59  #%__executable_requires        %{_usrlibrpm}/executabledeps.sh --requires
60  #%__scriptlet_requires /bin/bash --rpm-requires
61  
62 +#------------------------------------------------------------------------
63 +# mimetype(...) configuration.
64 +#
65 +# Path to script to autogenerate mimetype(foo) provides, based on MimeType
66 +# key from desktop files.
67 +#
68 +# Note: Used if _use_internal_dependency_generator is non-zero. The
69 +# helper is also used by %{_uselibrpm}/rpmdeps --provides
70 +%__mimetype_provides %{_usrlibrpm}/mimetypedeps.sh --provides
71 +
72  # PLD rpm macros
73  %_enable_debug_packages 1
74  
This page took 0.034021 seconds and 4 git commands to generate.