]>
Commit | Line | Data |
---|---|---|
8029452c | 1 | diff -dur -x '*~' -x '*.orig' rpm-5.4.15.orig/lib/rpmfc.c rpm-5.4.15/lib/rpmfc.c |
296155b5 JK |
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 | |
8029452c JK |
4 | @@ -604,8 +604,6 @@ |
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 }, | |
10 | ||
11 | { "libtool library ", RPMFC_LIBTOOL|RPMFC_INCLUDE }, | |
12 | { "pkgconfig ", RPMFC_PKGCONFIG|RPMFC_INCLUDE }, | |
13 | @@ -1114,6 +1112,9 @@ | |
14 | int i; | |
15 | int xx; | |
16 | int skipping; | |
17 | + int l; | |
18 | + const char * lastPycDir = NULL; | |
19 | + const char * p; | |
20 | ||
21 | miRE mire; | |
22 | int skipProv = fc->skipProv; | |
296155b5 | 23 | @@ -1156,8 +1157,29 @@ |
8029452c JK |
24 | if ((fn[0] == '3' && fn[1] == '2') || |
25 | (fn[0] == '6' && fn[1] == '4')) | |
26 | fn += 2; | |
27 | - if (!strncmp(fn, "/python", sizeof("/python")-1)) | |
28 | - fc->fcolor->vals[fc->ix] |= RPMFC_PYTHON; | |
29 | + if (!strncmp(fn, "/python", sizeof("/python")-1)) { | |
30 | + l = strlen(fn); | |
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, '/'); | |
34 | + if (p) { | |
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]; | |
40 | + } | |
41 | + } | |
42 | + } | |
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; | |
46 | + } | |
296155b5 JK |
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; | |
50 | + } | |
8029452c JK |
51 | + } |
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"))) { | |
296155b5 | 55 | @@ -1184,8 +1206,29 @@ |
8029452c JK |
56 | fn = strstr(fc->fn[fc->ix], "/usr/share"); |
57 | if (fn) { | |
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)) { | |
62 | + l = strlen(fn); | |
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, '/'); | |
66 | + if (p) { | |
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]; | |
72 | + } | |
73 | + } | |
74 | + } | |
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; | |
78 | + } | |
296155b5 JK |
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; | |
82 | + } | |
8029452c JK |
83 | + } |
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"))) { |