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
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");
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");
27 - if (waitpid(gunzip_pid, NULL, 0) == -1) {
28 - printf("Couldnt wait ?");
29 + if (waitpid(gunzip_pid, NULL, 0) == -1) {
30 + printf("Couldnt wait ?");
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
43 #include "ipkg_conf.h"
46 typedef struct enum_map enum_map_t;
50 strncat(buff ,line, strlen(line));
53 + line = pkg_formatted_field(pkg, "Installed-Size");
54 + strncat(buff ,line, strlen(line));
70 if (strcasecmp(field, "Installed-Size") == 0) {
72 - temp = (char *)realloc(temp,strlen(pkg->installed_size)+17);
73 - if ( temp == NULL ){
74 - fprintf(stderr, "%s: out of memory\n", __FUNCTION__);
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__);
86 + snprintf(temp, (strlen(pkg->installed_size)+18), "Installed-Size: %s\n", pkg->installed_size);
88 + /* Caculate installed files size */
89 + str_list_elt_t *iter;
91 + int installed_files_length = 0;
92 + if (pkg->installed_files == NULL)
95 + if (pkg->is_processing!=1)
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__);
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);
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) {
130 snprintf(temp, (strlen(pkg->size)+8), "Size: %s\n", pkg->size);
132 + if ( pkg->local_filename ) {
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__);
145 + snprintf(temp, (strlen(pkg->size)+8), "Size: %s\n", pkg->size);
150 } else if (strcasecmp(field, "Source") == 0) {
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");
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
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 */
178 pkg_t *pkg_new(void);