1 diff -dur -x '*~' -x '*.orig' rpm-5.4.15.orig/lib/rpmfc.c rpm-5.4.15/lib/rpmfc.c
2 --- rpm-5.4.15.orig/lib/rpmfc.c 2015-11-29 09:57:16.945204643 +0100
3 +++ rpm-5.4.15/lib/rpmfc.c 2015-11-29 09:59:24.804768239 +0100
5 /* XXX "a /usr/bin/python -t script text executable" */
6 /* XXX "python 2.3 byte-compiled" */
7 { " /usr/bin/python", RPMFC_PYTHON|RPMFC_INCLUDE },
8 - { "python ", RPMFC_PYTHON|RPMFC_INCLUDE },
9 - { "Python script", RPMFC_PYTHON|RPMFC_INCLUDE },
11 { "libtool library ", RPMFC_LIBTOOL|RPMFC_INCLUDE },
12 { "pkgconfig ", RPMFC_PKGCONFIG|RPMFC_INCLUDE },
18 + const char * lastPycDir = NULL;
22 int skipProv = fc->skipProv;
23 @@ -1156,8 +1157,29 @@
24 if ((fn[0] == '3' && fn[1] == '2') ||
25 (fn[0] == '6' && fn[1] == '4'))
27 - if (!strncmp(fn, "/python", sizeof("/python")-1))
28 - fc->fcolor->vals[fc->ix] |= RPMFC_PYTHON;
29 + if (!strncmp(fn, "/python", sizeof("/python")-1)) {
31 + if (fn[l-4] == '.' && fn[l-3] == 'p' && fn[l-2] == 'y'
32 + && (fn[l-1] == 'c' || fn[l-1] == 'o')) {
33 + p = strchr(fn, '/');
35 + l = p - fc->fn[fc->ix];
36 + if (!lastPycDir || strncmp(lastPycDir, fc->fn[fc->ix], l)) {
37 + /* one pyc/pyo file per python library directory should be enough to get the dependency */
38 + fc->fcolor->vals[fc->ix] |= RPMFC_PYTHON;
39 + lastPycDir = fc->fn[fc->ix];
43 + else if (l > 17 && !strcmp(fn + l - 17, "egg-info/PKG-INFO")) {
44 + /* get all PKG-INFO files for egg-info data */
45 + fc->fcolor->vals[fc->ix] |= RPMFC_PYTHON;
47 + else if (l > 8 && !strcmp(fn + l - 8, "egg-info")) {
48 + /* get all .egg-info files too */
49 + fc->fcolor->vals[fc->ix] |= RPMFC_PYTHON;
52 else if (!strncmp(fn, "/ruby", sizeof("/ruby")-1)) {
53 fc->fcolor->vals[fc->ix] |= RPMFC_RUBY;
54 if ((strstr(fn, ".gemspec") || strstr(fn, "rbconfig.rb"))) {
55 @@ -1184,8 +1206,29 @@
56 fn = strstr(fc->fn[fc->ix], "/usr/share");
58 fn += sizeof("/usr/share")-1;
59 - if (!strncmp(fn, "/python", sizeof("/python")-1))
60 - fc->fcolor->vals[fc->ix] |= RPMFC_PYTHON;
61 + if (!strncmp(fn, "/python", sizeof("/python")-1)) {
63 + if (fn[l-4] == '.' && fn[l-3] == 'p' && fn[l-2] == 'y'
64 + && (fn[l-1] == 'c' || fn[l-1] == 'o')) {
65 + p = strchr(fn, '/');
67 + l = p - fc->fn[fc->ix];
68 + if (!lastPycDir || strncmp(lastPycDir, fc->fn[fc->ix], l)) {
69 + /* one pyc/pyo file per python library directory should be enough to get the dependency */
70 + fc->fcolor->vals[fc->ix] |= RPMFC_PYTHON;
71 + lastPycDir = fc->fn[fc->ix];
75 + else if (l > 17 && !strcmp(fn + l - 17, "egg-info/PKG-INFO")) {
76 + /* get all PKG-INFO files for egg-info data */
77 + fc->fcolor->vals[fc->ix] |= RPMFC_PYTHON;
79 + else if (l > 8 && !strcmp(fn + l - 8, "egg-info")) {
80 + /* get all .egg-info files too */
81 + fc->fcolor->vals[fc->ix] |= RPMFC_PYTHON;
84 else if (!strncmp(fn, "/ruby", sizeof("/ruby")-1) || !strncmp(fn, "/gems/specifications", sizeof("/gems/specifications")-1)) {
85 fc->fcolor->vals[fc->ix] |= RPMFC_RUBY;
86 if ((strstr(fn, ".gemspec") || strstr(fn, "rbconfig.rb"))) {