]>
Commit | Line | Data |
---|---|---|
8029452c JK |
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 | |
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; | |
23 | @@ -1156,8 +1157,25 @@ | |
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 | + } | |
47 | + } | |
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"); | |
53 | if (fn) { | |
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)) { | |
58 | + l = strlen(fn); | |
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, '/'); | |
62 | + if (p) { | |
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]; | |
68 | + } | |
69 | + } | |
70 | + } | |
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; | |
74 | + } | |
75 | + } | |
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"))) { |