mesa-7.9: bump PR after talloc changes
[openembedded.git] / recipes / ipkg / files / is-processing.patch
blob45ede41668a5b6f7ba5b184a4f8f1a81cca1bc08
1 diff -Nur ipkg-0.99.163.orig/ipkg_install.c ipkg-0.99.163/ipkg_install.c
2 --- ipkg-0.99.163.orig/ipkg_install.c 2006-03-30 21:50:24.000000000 +0800
3 +++ ipkg-0.99.163/ipkg_install.c 2007-03-15 08:01:20.000000000 +0800
4 @@ -211,6 +211,7 @@
5 anyone ever wants to make a nice libipkg. */
7 ipkg_message(conf, IPKG_DEBUG2,"Function: %s calling ipkg_install_pkg \n",__FUNCTION__);
8 + new->is_processing = 1;
9 return ipkg_install_pkg(conf, new,0);
12 diff -Nur ipkg-0.99.163.orig/libbb/unzip.c ipkg-0.99.163/libbb/unzip.c
13 --- ipkg-0.99.163.orig/libbb/unzip.c 2006-02-06 16:13:02.000000000 +0800
14 +++ ipkg-0.99.163/libbb/unzip.c 2007-03-15 08:03:45.000000000 +0800
15 @@ -1028,13 +1028,15 @@
17 extern void gz_close(int gunzip_pid)
19 - if (kill(gunzip_pid, SIGTERM) == -1) {
20 - error_msg_and_die("*** Couldnt kill old gunzip process *** aborting");
21 - }
22 + if (kill(gunzip_pid, 0) == 0) {
23 + if (kill(gunzip_pid, SIGTERM) == -1) {
24 + error_msg_and_die("*** Couldnt kill old gunzip process *** aborting");
25 + }
27 - if (waitpid(gunzip_pid, NULL, 0) == -1) {
28 - printf("Couldnt wait ?");
29 + if (waitpid(gunzip_pid, NULL, 0) == -1) {
30 + printf("Couldnt wait ?");
31 + }
33 - free(window);
34 - free(crc_table);
35 + free(window);
36 + free(crc_table);
38 diff -Nur ipkg-0.99.163.orig/pkg.c ipkg-0.99.163/pkg.c
39 --- ipkg-0.99.163.orig/pkg.c 2006-04-21 04:29:28.000000000 +0800
40 +++ ipkg-0.99.163/pkg.c 2007-03-20 15:11:32.845064480 +0800
41 @@ -33,6 +33,7 @@
42 #include "xsystem.h"
43 #include "ipkg_conf.h"
46 typedef struct enum_map enum_map_t;
47 struct enum_map
49 @@ -522,6 +523,10 @@
50 strncat(buff ,line, strlen(line));
51 free(line);
53 + line = pkg_formatted_field(pkg, "Installed-Size");
54 + strncat(buff ,line, strlen(line));
55 + free(line);
57 return buff;
60 @@ -542,7 +547,6 @@
63 temp[0]='\0';
65 switch (field[0])
67 case 'a':
68 @@ -690,13 +694,42 @@
69 case 'I': {
70 if (strcasecmp(field, "Installed-Size") == 0) {
71 /* Installed-Size */
72 - temp = (char *)realloc(temp,strlen(pkg->installed_size)+17);
73 - if ( temp == NULL ){
74 - fprintf(stderr, "%s: out of memory\n", __FUNCTION__);
75 - return NULL;
76 - }
77 - temp[0]='\0';
78 - snprintf(temp, (strlen(pkg->installed_size)+17), "Installed-Size: %s\n", pkg->installed_size);
79 + if (pkg->installed_size) {
80 + temp = (char *)realloc(temp,strlen(pkg->installed_size)+18);
81 + if ( temp == NULL ){
82 + fprintf(stderr, "%s: out of memory\n", __FUNCTION__);
83 + return NULL;
84 + }
85 + temp[0]='\0';
86 + snprintf(temp, (strlen(pkg->installed_size)+18), "Installed-Size: %s\n", pkg->installed_size);
87 + } else {
88 + /* Caculate installed files size */
89 + str_list_elt_t *iter;
90 + struct stat buf;
91 + int installed_files_length = 0;
92 + if (pkg->installed_files == NULL)
93 + break;
95 + if (pkg->is_processing!=1)
96 + break;
98 + for (iter = pkg->installed_files->head; iter; iter = iter->next) {
99 + memset(&buf, 0, sizeof(struct stat));
100 + stat(iter->data, &buf);
101 + if (S_ISREG(buf.st_mode))
102 + installed_files_length += buf.st_size;
104 + /*printf("installed_files_length:%d\n", installed_files_length);*/
106 + sprintf_alloc(&pkg->installed_size, "%d", installed_files_length);
107 + temp = (char *)realloc(temp,strlen(pkg->installed_size)+18);
108 + if ( temp == NULL ){
109 + fprintf(stderr, "%s: out of memory\n", __FUNCTION__);
110 + return NULL;
112 + temp[0]='\0';
113 + snprintf(temp, (strlen(pkg->installed_size)+18), "Installed-Size: %s\n", pkg->installed_size);
115 } else if (strcasecmp(field, "Installed-Time") == 0 && pkg->installed_time) {
116 temp = (char *)realloc(temp,29);
117 if ( temp == NULL ){
118 @@ -720,7 +753,7 @@
119 return NULL;
121 temp[0]='\0';
122 - snprintf(temp, (strlen(pkg->maintainer)+14), "maintainer: %s\n", pkg->maintainer);
123 + snprintf(temp, (strlen(pkg->maintainer)+14), "Maintainer: %s\n", pkg->maintainer);
125 } else if (strcasecmp(field, "MD5sum") == 0) {
126 /* MD5sum */
127 @@ -871,6 +904,24 @@
129 temp[0]='\0';
130 snprintf(temp, (strlen(pkg->size)+8), "Size: %s\n", pkg->size);
131 + } else {
132 + if ( pkg->local_filename ) {
133 + struct stat buf;
134 + memset(&buf, 0, sizeof(struct stat));
136 + if ( stat(pkg->local_filename, &buf) == 0 ) {
138 + sprintf_alloc(&pkg->size, "%d", buf.st_size);
139 + temp = (char *)realloc(temp, strlen(pkg->size)+8);
140 + if ( temp == NULL ){
141 + fprintf(stderr, "%s: out of memory\n", __FUNCTION__);
142 + return NULL;
144 + temp[0]='\0';
145 + snprintf(temp, (strlen(pkg->size)+8), "Size: %s\n", pkg->size);
150 } else if (strcasecmp(field, "Source") == 0) {
151 /* Source */
152 @@ -1016,6 +1067,12 @@
153 pkg_print_field(pkg, file, "Essential"); /* @@@@ should be removed in future release. */
154 pkg_print_field(pkg, file, "Architecture");
155 pkg_print_field(pkg, file, "Conffiles");
156 + pkg_print_field(pkg, file, "Description");
157 + pkg_print_field(pkg, file, "Maintainer");
158 + pkg_print_field(pkg, file, "Section");
159 + pkg_print_field(pkg, file, "Size");
160 + pkg_print_field(pkg, file, "Filename");
161 + pkg_print_field(pkg, file, "Installed-Size");
162 pkg_print_field(pkg, file, "Installed-Time");
163 fputs("\n", file);
165 diff -Nur ipkg-0.99.163.orig/pkg.h ipkg-0.99.163/pkg.h
166 --- ipkg-0.99.163.orig/pkg.h 2006-05-30 16:31:08.000000000 +0800
167 +++ ipkg-0.99.163/pkg.h 2007-03-15 08:01:20.000000000 +0800
168 @@ -176,6 +176,10 @@
169 int arch_priority;
170 /* Adding this flag, to "force" ipkg to choose a "provided_by_hand" package, if there are multiple choice */
171 int provided_by_hand;
173 + /* Check whether this pkg is being removed or installed */
174 + int is_processing;
178 pkg_t *pkg_new(void);