]> git.pld-linux.org Git - packages/rpm.git/blob - fast_python_deps.patch
- don't install and package some useless scripts
[packages/rpm.git] / fast_python_deps.patch
1 --- rpm-5.4.17/lib/rpmfc.c.orig 2018-06-10 09:52:43.111996936 +0200
2 +++ rpm-5.4.17/lib/rpmfc.c      2018-06-10 09:54:23.968662453 +0200
3 @@ -606,8 +606,6 @@
4    /* XXX "a /usr/bin/python -t script text executable" */
5    /* XXX "python 2.3 byte-compiled" */
6    { " /usr/bin/python",                RPMFC_PYTHON|RPMFC_INCLUDE },
7 -  { "python ",                 RPMFC_PYTHON|RPMFC_INCLUDE },
8 -  { "Python script",           RPMFC_PYTHON|RPMFC_INCLUDE },
9  
10    { "libtool library ",                RPMFC_LIBTOOL|RPMFC_INCLUDE },
11    { "pkgconfig ",              RPMFC_PKGCONFIG|RPMFC_INCLUDE },
12 @@ -1118,6 +1116,9 @@
13      int i;
14      int xx;
15      int skipping;
16 +    int l;
17 +    const char * lastPycDir = NULL;
18 +    const char * p;
19  
20      miRE mire;
21      int skipProv = fc->skipProv;
22 @@ -1160,8 +1161,29 @@
23                 if ((fn[0] == '3' && fn[1] == '2') || 
24                         (fn[0] == '6' && fn[1] == '4'))
25                     fn += 2;
26 -               if (!strncmp(fn, "/python", sizeof("/python")-1))
27 -                   fc->fcolor->vals[fc->ix] |= RPMFC_PYTHON;
28 +               if (!strncmp(fn, "/python", sizeof("/python")-1)) {
29 +                   l = strlen(fn);
30 +                   if (fn[l-4] == '.' && fn[l-3] == 'p' && fn[l-2] == 'y'
31 +                           && (fn[l-1] == 'c' || fn[l-1] == 'o')) {
32 +                       p = strchr(fn, '/');
33 +                       if (p) {
34 +                           l = p - fc->fn[fc->ix];
35 +                           if (!lastPycDir || strncmp(lastPycDir, fc->fn[fc->ix], l)) {
36 +                               /* one pyc/pyo file per python library directory should be enough to get the dependency */
37 +                               fc->fcolor->vals[fc->ix] |= RPMFC_PYTHON;
38 +                               lastPycDir = fc->fn[fc->ix];
39 +                           }
40 +                       }
41 +                   }
42 +                   else if (l > 17 && !strcmp(fn + l - 17, "egg-info/PKG-INFO")) {
43 +                       /* get all PKG-INFO files for egg-info data */
44 +                       fc->fcolor->vals[fc->ix] |= RPMFC_PYTHON;
45 +                   }
46 +                   else if (l > 8 && !strcmp(fn + l - 8, "egg-info")) {
47 +                       /* get all .egg-info files too */
48 +                       fc->fcolor->vals[fc->ix] |= RPMFC_PYTHON;
49 +                   }
50 +               }
51                 else if (!strncmp(fn, "/ruby", sizeof("/ruby")-1)) {
52                     fc->fcolor->vals[fc->ix] |= RPMFC_RUBY;
53                     if ((strstr(fn, ".gemspec") || strstr(fn, "rbconfig.rb"))) {
54 @@ -1190,8 +1212,29 @@
55             fn = strstr(fc->fn[fc->ix], "/usr/share");
56             if (fn) {
57                 fn += sizeof("/usr/share")-1;
58 -               if (!strncmp(fn, "/python", sizeof("/python")-1))
59 -                   fc->fcolor->vals[fc->ix] |= RPMFC_PYTHON;
60 +               if (!strncmp(fn, "/python", sizeof("/python")-1)) {
61 +                   l = strlen(fn);
62 +                   if (fn[l-4] == '.' && fn[l-3] == 'p' && fn[l-2] == 'y'
63 +                           && (fn[l-1] == 'c' || fn[l-1] == 'o')) {
64 +                       p = strchr(fn, '/');
65 +                       if (p) {
66 +                           l = p - fc->fn[fc->ix];
67 +                           if (!lastPycDir || strncmp(lastPycDir, fc->fn[fc->ix], l)) {
68 +                               /* one pyc/pyo file per python library directory should be enough to get the dependency */
69 +                               fc->fcolor->vals[fc->ix] |= RPMFC_PYTHON;
70 +                               lastPycDir = fc->fn[fc->ix];
71 +                           }
72 +                       }
73 +                   }
74 +                   else if (l > 17 && !strcmp(fn + l - 17, "egg-info/PKG-INFO")) {
75 +                       /* get all PKG-INFO files for egg-info data */
76 +                       fc->fcolor->vals[fc->ix] |= RPMFC_PYTHON;
77 +                   }
78 +                   else if (l > 8 && !strcmp(fn + l - 8, "egg-info")) {
79 +                       /* get all .egg-info files too */
80 +                       fc->fcolor->vals[fc->ix] |= RPMFC_PYTHON;
81 +                   }
82 +               }
83                 else if (!strncmp(fn, "/ruby", sizeof("/ruby")-1) || !strncmp(fn, "/gems/specifications", sizeof("/gems/specifications")-1)) {
84                     fc->fcolor->vals[fc->ix] |= RPMFC_RUBY;
85  /* XXX specification/{*.gemspec,rpmconfig.rb} should use rpmGlob/fnmatch. */
This page took 0.026999 seconds and 3 git commands to generate.