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-23 20:38:44.516459734 +0100
3 +++ rpm-5.4.15/lib/rpmfc.c 2015-11-23 20:39:56.267070624 +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,25 @@
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;
48 else if (!strncmp(fn, "/ruby", sizeof("/ruby")-1)) {
49 fc->fcolor->vals[fc->ix] |= RPMFC_RUBY;
50 if ((strstr(fn, ".gemspec") || strstr(fn, "rbconfig.rb"))) {
51 @@ -1184,8 +1202,25 @@
52 fn = strstr(fc->fn[fc->ix], "/usr/share");
54 fn += sizeof("/usr/share")-1;
55 - if (!strncmp(fn, "/python", sizeof("/python")-1))
56 - fc->fcolor->vals[fc->ix] |= RPMFC_PYTHON;
57 + if (!strncmp(fn, "/python", sizeof("/python")-1)) {
59 + if (fn[l-4] == '.' && fn[l-3] == 'p' && fn[l-2] == 'y'
60 + && (fn[l-1] == 'c' || fn[l-1] == 'o')) {
61 + p = strchr(fn, '/');
63 + l = p - fc->fn[fc->ix];
64 + if (!lastPycDir || strncmp(lastPycDir, fc->fn[fc->ix], l)) {
65 + /* one pyc/pyo file per python library directory should be enough to get the dependency */
66 + fc->fcolor->vals[fc->ix] |= RPMFC_PYTHON;
67 + lastPycDir = fc->fn[fc->ix];
71 + else if (l > 17 && !strcmp(fn + l - 17, "egg-info/PKG-INFO")) {
72 + /* get all PKG-INFO files for egg-info data */
73 + fc->fcolor->vals[fc->ix] |= RPMFC_PYTHON;
76 else if (!strncmp(fn, "/ruby", sizeof("/ruby")-1) || !strncmp(fn, "/gems/specifications", sizeof("/gems/specifications")-1)) {
77 fc->fcolor->vals[fc->ix] |= RPMFC_RUBY;
78 if ((strstr(fn, ".gemspec") || strstr(fn, "rbconfig.rb"))) {