Rev 5728 | Rev 5731 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5728 | Rev 5729 | ||
---|---|---|---|
Line 63... | Line 63... | ||
63 | { |
63 | { |
64 | if(http_receive_with_retry(http, 500) == 0) |
64 | if(http_receive_with_retry(http, 500) == 0) |
65 | { |
65 | { |
66 | int count; |
66 | int count; |
Line 67... | Line 67... | ||
67 | 67 | ||
68 | if(http->flags & 0xffff0000) |
68 | // if(http->flags & 0xffff0000) |
Line 69... | Line 69... | ||
69 | break; |
69 | // break; |
70 | 70 | ||
71 | count = http->content_received - received; |
71 | count = http->content_received - received; |
72 | if(count+offset <= BUFFSIZE) |
72 | if(count+offset <= BUFFSIZE) |
73 | { |
73 | { |
74 | memcpy(buf+offset, http->content_ptr, count); |
- | |
75 | offset+= count; |
74 | memcpy(buf+offset, http->content_ptr, count); |
76 | } |
75 | offset+= count; |
77 | else |
76 | } else |
78 | { |
77 | { |
79 | tail = count+offset-BUFFSIZE; |
78 | tail = count+offset-BUFFSIZE; |
80 | count = BUFFSIZE - offset; |
79 | count = BUFFSIZE - offset; |
Line 146... | Line 145... | ||
146 | { |
145 | { |
147 | if(build_download_list(&download_list, &install_list)) |
146 | if(build_download_list(&download_list, &install_list)) |
148 | do_download(&download_list); |
147 | do_download(&download_list); |
Line 149... | Line 148... | ||
149 | 148 | ||
150 | if(!list_empty(&download_list)) |
149 | if(!list_empty(&download_list)) |
Line 151... | Line 150... | ||
151 | remove_packages(&install_list, &download_list); |
150 | remove_missing_packages(&install_list, &download_list); |
152 | 151 | ||
- | 152 | list_for_each_entry(pkg, &install_list, list) |
|
- | 153 | printf("install package %s-%s\n", pkg->name, pkg->version); |
|
- | 154 | ||
- | 155 | set_cwd("/tmp0/1"); |
|
153 | list_for_each_entry(pkg, &install_list, list) |
156 | |
154 | printf("install package %s-%s\n", pkg->name, pkg->version); |
157 | do_install(&install_list); |
Line 155... | Line 158... | ||
155 | }; |
158 | }; |
Line 227... | Line 230... | ||
227 | cache_path = make_cache_path(pkg->filename); |
230 | cache_path = make_cache_path(pkg->filename); |
228 | count = http_load_file(cache_path, make_url(pkg->filename)); |
231 | count = http_load_file(cache_path, make_url(pkg->filename)); |
229 | printf("%s loaded %d bytes\n",cache_path, count); |
232 | printf("%s loaded %d bytes\n",cache_path, count); |
230 | if( !test_archive(cache_path)) |
233 | if( !test_archive(cache_path)) |
231 | list_del_pkg(pkg); |
234 | list_del_pkg(pkg); |
- | 235 | else |
|
232 | else /*delete file*/; |
236 | unlink(cache_path); |
233 | }; |
237 | }; |
234 | } |
238 | } |
Line 235... | Line 239... | ||
235 | 239 | ||
236 | void remove_packages(list_t *install, list_t *missed) |
240 | void remove_missing_packages(list_t *install, list_t *missed) |
237 | { |
241 | { |
Line 238... | Line 242... | ||
238 | package_t *mpkg, *mtmp, *ipkg, *itmp; |
242 | package_t *mpkg, *mtmp, *ipkg, *itmp; |
239 | 243 | ||
240 | list_for_each_entry_safe(mpkg, mtmp, missed, list) |
244 | list_for_each_entry_safe(mpkg, mtmp, missed, list) |
241 | { |
245 | { |
242 | list_for_each_entry_safe(ipkg, itmp, install, list) |
246 | list_for_each_entry_safe(ipkg, itmp, install, list) |
243 | { |
247 | { |
244 | if(ipkg->id == mpkg->id) |
248 | if(ipkg->id == mpkg->id) |
245 | { |
249 | { |
246 | printf("skip missed package %s-%s\n", ipkg->name, ipkg->version); |
250 | printf("skip missing package %s-%s\n", ipkg->name, ipkg->version); |
247 | list_del_pkg(ipkg); |
251 | list_del_pkg(ipkg); |
248 | }; |
252 | }; |
249 | } |
253 | } |
250 | list_del_pkg(mpkg); |
254 | list_del_pkg(mpkg); |
- | 255 | }; |
|
- | 256 | };=>> |