3bc2e5d71f5d435ef12292edaba2466985f05d28
[vuplus_openvuplus_3.0] / meta-openvuplus / recipes-enigma2 / opkg / opkg / 0010-opkg_remove-auto-delete-.pyo-files.patch
1 From 719cc4ab765c008bd7e4f2d085692657c33d171e Mon Sep 17 00:00:00 2001
2 From: Andreas Oberritter <obi@opendreambox.org>
3 Date: Mon, 21 May 2012 14:05:37 +0200
4 Subject: [PATCH 10/10] opkg_remove: auto-delete .pyo files
5
6 Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
7 ---
8  libopkg/opkg_remove.c |    7 +++++++
9  1 file changed, 7 insertions(+)
10
11 diff --git a/libopkg/opkg_remove.c b/libopkg/opkg_remove.c
12 index 5f4219b..4320dc3 100644
13 --- a/libopkg/opkg_remove.c
14 +++ b/libopkg/opkg_remove.c
15 @@ -375,8 +375,15 @@ remove_data_files_and_list(pkg_t *pkg)
16           }
17  
18           if (!conf->noaction) {
19 +               size_t l = strlen(file_name);
20                 opkg_msg(INFO, "Deleting %s.\n", file_name);
21                unlink(file_name);
22 +               if (l >= 3 && !strcmp(&file_name[l - 3], ".py")) {
23 +                       char pyo_file_name[l + 2];
24 +                       strcpy(pyo_file_name, file_name);
25 +                       strcat(pyo_file_name, "o");
26 +                       unlink(pyo_file_name);
27 +               }
28           } else
29                 opkg_msg(INFO, "Not deleting %s. (noaction)\n",
30                                 file_name);
31 -- 
32 1.7.9.5
33