]> TLD Linux GIT Repositories - packages/rpm.git/blob - rpm-rubyprov.patch
- package /usr/lib/rpm/macros.d dir
[packages/rpm.git] / rpm-rubyprov.patch
1 diff -urpa rpm-4.5.orig/configure.ac rpm-4.5/configure.ac
2 --- rpm-4.5.orig/configure.ac   2011-10-03 01:50:17.000000000 +0000
3 +++ rpm-4.5/configure.ac        2018-02-23 13:52:54.438364538 +0000
4 @@ -291,6 +291,7 @@ AC_PATH_PROG(__PHP, php, %{_bindir}/php,
5  AC_PATH_PROG(__PYTHON, python, %{_bindir}/python, $MYPATH)
6  AC_PATH_PROG(__RM, rm, /bin/rm, $MYPATH)
7  AC_PATH_PROG(__RSH, rsh, %{_bindir}/rsh, $MYPATH)
8 +AC_PATH_PROG(__RUBY, ruby, %{_bindir}/ruby, $MYPATH)
9  AC_PATH_PROG(__SED, sed, /bin/sed, $MYPATH)
10  AC_PATH_PROG(__SH, sh, /bin/sh, $MYPATH)
11  AC_PATH_PROG(__SSH, ssh, %{_bindir}/ssh, $MYPATH)
12 diff -urpa rpm-4.5.orig/lib/rpmfc.c rpm-4.5/lib/rpmfc.c
13 --- rpm-4.5.orig/lib/rpmfc.c    2008-06-10 22:13:27.000000000 +0000
14 +++ rpm-4.5/lib/rpmfc.c 2018-02-23 14:04:42.056356571 +0000
15 @@ -478,6 +478,9 @@ static struct rpmfcTokens_s rpmfcTokens[
16  
17    { "Java ",                   RPMFC_JAVA|RPMFC_INCLUDE },
18  
19 +  { "ruby script text",                RPMFC_RUBY|RPMFC_INCLUDE },
20 +  { "Ruby script text",                RPMFC_RUBY|RPMFC_INCLUDE },
21 +
22    /* .NET executables and libraries. file(1) cannot differ it from native win32 executables unfortunatelly */
23    { "PE executable",           RPMFC_MONO|RPMFC_INCLUDE },
24    { "executable PE",           RPMFC_MONO|RPMFC_INCLUDE },
25 @@ -740,6 +743,8 @@ static int rpmfcSCRIPT(rpmfc fc)
26             fc->fcolor->vals[fc->ix] |= RPMFC_PYTHON;
27         else if (!strncmp(bn, "php", sizeof("php")-1))
28             fc->fcolor->vals[fc->ix] |= RPMFC_PHP;
29 +       else if (!strncmp(bn, "ruby", sizeof("ruby")-1))
30 +           fc->fcolor->vals[fc->ix] |= RPMFC_RUBY;
31  
32         break;
33      }
34 @@ -788,6 +793,13 @@ static int rpmfcSCRIPT(rpmfc fc)
35         if (is_executable)
36             xx = rpmfcHelper(fc, 'R', "php");
37      } else
38 +    if (fc->fcolor->vals[fc->ix] & RPMFC_RUBY) {
39 +       xx = rpmfcHelper(fc, 'P', "ruby");
40 +#ifdef  NOTYET
41 +       if (is_executable)
42 +#endif
43 +           xx = rpmfcHelper(fc, 'R', "ruby");
44 +    } else
45      if (fc->fcolor->vals[fc->ix] & RPMFC_JAVA) {
46         xx = rpmfcHelper(fc, 'P', "java");
47         xx = rpmfcHelper(fc, 'R', "java");
48 @@ -898,7 +910,7 @@ typedef struct rpmfcApplyTbl_s {
49  /*@unchecked@*/
50  static struct rpmfcApplyTbl_s rpmfcApplyTable[] = {
51      { rpmfcELF,                RPMFC_ELF },
52 -    { rpmfcSCRIPT,     (RPMFC_SCRIPT|RPMFC_PERL|RPMFC_PYTHON|RPMFC_LIBTOOL|RPMFC_PKGCONFIG|RPMFC_BOURNE|RPMFC_JAVA|RPMFC_PHP|RPMFC_DESKTOP_FILE) },
53 +    { rpmfcSCRIPT,     (RPMFC_SCRIPT|RPMFC_PERL|RPMFC_PYTHON|RPMFC_LIBTOOL|RPMFC_PKGCONFIG|RPMFC_BOURNE|RPMFC_JAVA|RPMFC_PHP|RPMFC_RUBY|RPMFC_DESKTOP_FILE) },
54      { rpmfcMONO,       RPMFC_MONO },
55      { NULL, 0 }
56  };
57 @@ -925,7 +937,7 @@ int rpmfcApply(rpmfc fc)
58      /* Generate package and per-file dependencies. */
59      for (fc->ix = 0; fc->fn[fc->ix] != NULL; fc->ix++) {
60  
61 -       /* XXX Insure that /usr/lib{,64}/python files are marked RPMFC_PYTHON */
62 +       /* XXX Insure that /usr/{share,lib{,64}}/python files are marked RPMFC_PYTHON */
63         /* XXX HACK: classification by path is intrinsically stupid. */
64         {   const char *fn = strstr(fc->fn[fc->ix], "/usr/lib");
65             if (fn) {
66 @@ -934,6 +946,36 @@ int rpmfcApply(rpmfc fc)
67                     fn += 2;
68                 if (!strncmp(fn, "/python", sizeof("/python")-1))
69                     fc->fcolor->vals[fc->ix] |= RPMFC_PYTHON;
70 +               else if (!strncmp(fn, "/ruby", sizeof("/ruby")-1)) {
71 +                   fc->fcolor->vals[fc->ix] |= RPMFC_RUBY;
72 +                   if ((strstr(fn, ".gemspec") || strstr(fn, "rbconfig.rb"))) {
73 +                       miRE mire = mireNew(RPMMIRE_REGEX, RPMTAG_FILEPATHS);
74 +                       if (!mireRegcomp(mire, ".*/(specifications/.*\\.gemspec|rbconfig\\.rb)$"))
75 +                           if (mireRegexec(mire, fc->fn[fc->ix]))
76 +                               fc->fcolor->vals[fc->ix] |= RPMFC_MODULE;
77 +                       mire = mireFree(mire);
78 +                   }
79 +               }
80 +               /* XXX: lacking better, more generic classifier... */
81 +               else if (!strncmp(fn, "/gstreamer", sizeof("/gstreamer")-1) &&
82 +                       fc->fcolor->vals[fc->ix] & RPMFC_LIBRARY)
83 +                   fc->fcolor->vals[fc->ix] |= (RPMFC_MODULE|RPMFC_SCRIPT);
84 +           }
85 +           fn = strstr(fc->fn[fc->ix], "/usr/share");
86 +           if (fn) {
87 +               fn += sizeof("/usr/share")-1;
88 +               if (!strncmp(fn, "/python", sizeof("/python")-1))
89 +                   fc->fcolor->vals[fc->ix] |= RPMFC_PYTHON;
90 +               else if (!strncmp(fn, "/ruby", sizeof("/ruby")-1) || !strncmp(fn, "/gems/specifications", sizeof("/gems/specifications")-1)) {
91 +                   fc->fcolor->vals[fc->ix] |= RPMFC_RUBY;
92 +                   if ((strstr(fn, ".gemspec") || strstr(fn, "rbconfig.rb"))) {
93 +                       miRE mire = mireNew(RPMMIRE_REGEX, RPMTAG_FILEPATHS);
94 +                       if (!mireRegcomp(mire, ".*/(specifications/.*\\.gemspec|rbconfig\\.rb)$"))
95 +                           if (mireRegexec(mire, fc->fn[fc->ix]))
96 +                               fc->fcolor->vals[fc->ix] |= RPMFC_MODULE;
97 +                       mire = mireFree(mire);
98 +                   }
99 +               }
100             }
101         }
102  
103 diff -urpa rpm-4.5.orig/lib/rpmfc.h rpm-4.5/lib/rpmfc.h
104 --- rpm-4.5.orig/lib/rpmfc.h    2008-06-10 21:21:57.000000000 +0000
105 +++ rpm-4.5/lib/rpmfc.h 2018-02-23 13:52:54.438364538 +0000
106 @@ -31,8 +31,9 @@ enum FCOLOR_e {
107  #define        RPMFC_ELF       (RPMFC_ELF32|RPMFC_ELF64|RPMFC_ELFMIPSN32)
108  
109         /* bits 4-7 unused */
110 -    RPMFC_DESKTOP_FILE         = (1 << 7),     /* XXX */
111 +    RPMFC_DESKTOP_FILE         = (1 << 6),     /* XXX */
112  
113 +    RPMFC_RUBY                 = (1 << 7),
114      RPMFC_PKGCONFIG            = (1 <<  8),
115      RPMFC_LIBTOOL              = (1 <<  9),
116      RPMFC_BOURNE               = (1 << 10),
117 diff -urpa rpm-4.5.orig/macros.in rpm-4.5/macros.in
118 --- rpm-4.5.orig/macros.in      2008-06-10 22:00:43.000000000 +0000
119 +++ rpm-4.5/macros.in   2018-02-23 13:52:54.439364538 +0000
120 @@ -78,6 +78,7 @@
121  %__python              @__PYTHON@
122  %__rm                  @__RM@
123  %__rsh                 @__RSH@
124 +%__ruby                        @__RUBY@
125  %__sed                 @__SED@
126  %__sh                  @__SH@
127  %__ssh                 @__SSH@
128 @@ -1421,6 +1422,44 @@ PreReq: python >= %{python_version}, pyt
129  #%__java_requires      %{_rpmhome}/javadeps.sh --requires
130  
131  #------------------------------------------------------------------------
132 +# ruby(...) configuration.
133 +#
134 +# Path to scripts to autogenerate ruby package dependencies,
135 +
136 +# Note: Used if _use_internal_dependency_generator is non-zero. The
137 +# helpers are also used by %{_rpmhome}/rpmdeps {--provides|--requires}.
138 +%__ruby_provides       %{_rpmhome}/rubygems.rb --provides
139 +%__ruby_requires       %{_rpmhome}/rubygems.rb --requires
140 +
141 +%ruby_version          %(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["ruby_version"]')
142 +
143 +%ruby_archdir          %(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["archdir"]')
144 +%ruby_libdir           %(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["rubylibdir"]')
145 +%ruby_sitedir          %(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["sitedir"]')
146 +%ruby_sitearchdir      %(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["sitearchdir"]')
147 +%ruby_sitelibdir       %(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["sitelibdir"]')
148 +%ruby_vendordir                %(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["vendordir"]')
149 +%ruby_vendorarchdir    %(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["vendorarchdir"]')
150 +%ruby_vendorlibdir     %(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["vendorlibdir"]')
151 +%ruby_gemdir           %(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["rubylibdir"].sub(RbConfig::CONFIG["ruby_version"], "gems/#{RbConfig::CONFIG["ruby_version"]}")')
152 +%ruby_ridir            %(%{__ruby} -rrbconfig -e 'print File.join(RbConfig::CONFIG["datadir"], "ri", RbConfig::CONFIG["ruby_version"])')
153 +
154 +%__gem_helper %{_usrlibrpm}/gem_helper.rb
155 +
156 +%gem_build(f:j:) \
157 +       %__gem_helper build \\\
158 +       %{-f:-f%{-f*}} \\\
159 +       %{!-j:%{_smp_mflags}}%{-j:-j%{-j*}}
160 +
161 +%gem_install(i:n:C) \
162 +       DESTDIR=${DESTDIR:-%{buildroot}} \\\
163 +       %__gem_helper install \\\
164 +       --env-shebang --rdoc --ri --force --ignore-dependencies \\\
165 +       %{!-i:--install-dir %{buildroot}%{ruby_gemdir}}%{-i:--install-dir %{-i*}} \\\
166 +       %{!-n:--bindir %{buildroot}%{_bindir}}%{-n:--bindir%{-n*}} \\\
167 +       %{!-C:--fix-permissions}
168 +
169 +#------------------------------------------------------------------------
170  # libtool(...) configuration.
171  #
172  # Path to scripts to autogenerate libtool package dependencies,