Revert "opkg: vfork external gzip command to uncompress data"
[lede.git] / package / system / opkg / patches / 220-drop-release-support.patch
1 --- a/libopkg/Makefile.am
2 +++ b/libopkg/Makefile.am
3 @@ -15,7 +15,6 @@ opkg_cmd_sources = opkg_cmd.c opkg_cmd.h
4                    opkg_upgrade.c opkg_upgrade.h \
5                    opkg_remove.c opkg_remove.h
6  opkg_db_sources = opkg_conf.c opkg_conf.h \
7 -                 release.c release.h release_parse.c release_parse.h \
8                   opkg_utils.c opkg_utils.h pkg.c pkg.h hash_table.h \
9                   pkg_depends.c pkg_depends.h pkg_extract.c pkg_extract.h \
10                   hash_table.c pkg_hash.c pkg_hash.h pkg_parse.c pkg_parse.h \
11 @@ -28,7 +27,6 @@ opkg_list_sources = conffile.c conffile.
12                     active_list.c active_list.h list.h 
13  opkg_util_sources = file_util.c file_util.h opkg_message.h opkg_message.c md5.c md5.h \
14                     parse_util.c parse_util.h \
15 -                   cksum_list.c cksum_list.h \
16                     sprintf_alloc.c sprintf_alloc.h \
17                     xregex.c xregex.h xsystem.c xsystem.h
18  if HAVE_PATHFINDER
19 --- a/libopkg/cksum_list.c
20 +++ /dev/null
21 @@ -1,87 +0,0 @@
22 -/* cksum_lis.c - the opkg package management system
23 -
24 -   Copyright (C) 2010,2011 Javier Palacios
25 -
26 -   This program is free software; you can redistribute it and/or
27 -   modify it under the terms of the GNU General Public License as
28 -   published by the Free Software Foundation; either version 2, or (at
29 -   your option) any later version.
30 -
31 -   This program is distributed in the hope that it will be useful, but
32 -   WITHOUT ANY WARRANTY; without even the implied warranty of
33 -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
34 -   General Public License for more details.
35 -*/
36 -
37 -#include "config.h"
38 -
39 -#include <stdio.h>
40 -
41 -#include "cksum_list.h"
42 -#include "libbb/libbb.h"
43 -
44 -
45 -int cksum_init(cksum_t *cksum, char **itemlist)
46 -{
47 -    cksum->value = xstrdup(*itemlist++);
48 -    cksum->size = atoi(*itemlist++);
49 -    cksum->name = xstrdup(*itemlist++);
50 -
51 -    return 0;
52 -}
53 -
54 -void cksum_deinit(cksum_t *cksum)
55 -{
56 -    free (cksum->name);
57 -    cksum->name = NULL;
58 -
59 -    free (cksum->value);
60 -    cksum->value = NULL;
61 -}
62 -
63 -void cksum_list_init(cksum_list_t *list)
64 -{
65 -    void_list_init((void_list_t *) list);
66 -}
67 -
68 -void cksum_list_deinit(cksum_list_t *list)
69 -{
70 -    cksum_list_elt_t *iter, *n;
71 -    cksum_t *cksum;
72 -
73 -    list_for_each_entry_safe(iter, n, &list->head, node) {
74 -      cksum = (cksum_t *)iter->data;
75 -      cksum_deinit(cksum);
76 -
77 -      /* malloced in cksum_list_append */
78 -      free(cksum);
79 -      iter->data = NULL;
80 -    }
81 -    void_list_deinit((void_list_t *) list);
82 -}
83 -
84 -cksum_t *cksum_list_append(cksum_list_t *list, char **itemlist)
85 -{
86 -    /* freed in cksum_list_deinit */
87 -    cksum_t *cksum = xcalloc(1, sizeof(cksum_t));
88 -    cksum_init(cksum, itemlist);
89 -
90 -    void_list_append((void_list_t *) list, cksum);
91 -
92 -    return cksum;
93 -}
94 -
95 -const cksum_t *cksum_list_find(cksum_list_t *list, const char *name)
96 -{
97 -     cksum_list_elt_t *iter;
98 -     cksum_t *cksum;
99 -
100 -     list_for_each_entry(iter, &list->head, node) {
101 -         cksum = (cksum_t *)iter->data;
102 -         if (strcmp(cksum->name, name) == 0) {
103 -              return cksum;
104 -         }
105 -     }    
106 -     return NULL;
107 -}
108 -
109 --- a/libopkg/cksum_list.h
110 +++ /dev/null
111 @@ -1,46 +0,0 @@
112 -/* cksum_list.h - the opkg package management system
113 -
114 -   Copyright (C) 2010,2011 Javier Palacios
115 -
116 -   This program is free software; you can redistribute it and/or
117 -   modify it under the terms of the GNU General Public License as
118 -   published by the Free Software Foundation; either version 2, or (at
119 -   your option) any later version.
120 -
121 -   This program is distributed in the hope that it will be useful, but
122 -   WITHOUT ANY WARRANTY; without even the implied warranty of
123 -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
124 -   General Public License for more details.
125 -*/
126 -
127 -#ifndef CKSUM_LIST_H
128 -#define CKSUM_LIST_H
129 -
130 -typedef struct 
131 -{
132 -  char *name;
133 -  char *value;
134 -  int size;
135 -} cksum_t;
136 -
137 -int cksum_init(cksum_t *cksum, char **itemlist);
138 -void cksum_deinit(cksum_t *cksum);
139 -
140 -#include "void_list.h"
141 -
142 -typedef struct void_list_elt cksum_list_elt_t;
143 -
144 -typedef struct void_list cksum_list_t;
145 -
146 -static inline int cksum_list_empty(cksum_list_t *list)
147 -{
148 -    return void_list_empty ((void_list_t *)list);
149 -}
150 -
151 -void cksum_list_init(cksum_list_t *list);
152 -void cksum_list_deinit(cksum_list_t *list);
153 -
154 -cksum_t *cksum_list_append(cksum_list_t *list, char **itemlist);
155 -const cksum_t *cksum_list_find(cksum_list_t *list, const char *name);
156 -
157 -#endif
158 --- a/libopkg/release.c
159 +++ /dev/null
160 @@ -1,342 +0,0 @@
161 -/* release.c - the opkg package management system
162 -
163 -   Copyright (C) 2010,2011 Javier Palacios
164 -
165 -   This program is free software; you can redistribute it and/or
166 -   modify it under the terms of the GNU General Public License as
167 -   published by the Free Software Foundation; either version 2, or (at
168 -   your option) any later version.
169 -
170 -   This program is distributed in the hope that it will be useful, but
171 -   WITHOUT ANY WARRANTY; without even the implied warranty of
172 -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
173 -   General Public License for more details.
174 -*/
175 -
176 -#include <unistd.h>
177 -#include <ctype.h>
178 -
179 -#include "release.h"
180 -#include "opkg_utils.h"
181 -#include "libbb/libbb.h"
182 -
183 -#include "opkg_download.h"
184 -#include "sprintf_alloc.h"
185 -
186 -#include "release_parse.h"
187 -
188 -#include "parse_util.h"
189 -#include "file_util.h"
190 -
191 -static void
192 -release_init(release_t *release)
193 -{
194 -     release->name = NULL;
195 -     release->datestring = NULL;
196 -     release->architectures = NULL;
197 -     release->architectures_count = 0;
198 -     release->components = NULL;
199 -     release->components_count = 0;
200 -     release->complist = NULL;
201 -     release->complist_count = 0;
202 -}
203 -
204 -release_t *
205 -release_new(void)
206 -{
207 -     release_t *release;
208 -
209 -     release = xcalloc(1, sizeof(release_t));
210 -     release_init(release);
211 -
212 -     return release;
213 -}
214 -
215 -void
216 -release_deinit(release_t *release)
217 -{
218 -    int i;
219 -
220 -    free(release->name);
221 -    free(release->datestring);
222 -
223 -    for(i = 0; i < release->architectures_count; i++){
224 -       free(release->architectures[i]);
225 -    }
226 -    free(release->architectures);
227 -
228 -    for(i = 0; i < release->components_count; i++){
229 -       free(release->components[i]);
230 -    }
231 -    free(release->components);
232 -
233 -    for(i = 0; i < release->complist_count; i++){
234 -       free(release->complist[i]);
235 -    }
236 -    free(release->complist);
237 -
238 -}
239 -
240 -int
241 -release_init_from_file(release_t *release, const char *filename)
242 -{
243 -       int err = 0;
244 -       FILE *release_file;
245 -
246 -       release_file = fopen(filename, "r");
247 -       if (release_file == NULL) {
248 -               opkg_perror(ERROR, "Failed to open %s", filename);
249 -               return -1;
250 -       }
251 -
252 -       err=release_parse_from_stream(release, release_file);
253 -       if (!err) {
254 -               if (!release_arch_supported(release)) {
255 -                       opkg_msg(ERROR, "No valid architecture found on Release file.\n");
256 -                       err = -1;
257 -               }
258 -       }
259 -
260 -       return err;
261 -}
262 -
263 -const char *
264 -item_in_list(const char *comp, char **complist, const unsigned int count)
265 -{
266 -     int i;
267 -
268 -     if (!complist)
269 -         return comp;
270 -
271 -     for(i = 0; i < count; i++){
272 -         if (strcmp(comp, complist[i]) == 0)
273 -                   return complist[i];
274 -     }
275 -
276 -     return NULL;
277 -}
278 -
279 -int
280 -release_arch_supported(release_t *release)
281 -{
282 -     nv_pair_list_elt_t *l;
283 -
284 -     list_for_each_entry(l , &conf->arch_list.head, node) {
285 -         nv_pair_t *nv = (nv_pair_t *)l->data;
286 -         if (item_in_list(nv->name, release->architectures, release->architectures_count)) {
287 -              opkg_msg(DEBUG, "Arch %s (priority %s) supported for dist %s.\n",
288 -                              nv->name, nv->value, release->name);
289 -              return 1;
290 -         }
291 -     }
292 -
293 -     return 0;
294 -}
295 -
296 -int
297 -release_comps_supported(release_t *release, const char *complist)
298 -{
299 -     int ret = 1;
300 -     int i;
301 -
302 -     if (complist) {
303 -         release->complist = parse_list(complist, &release->complist_count, ' ', 1);
304 -         for(i = 0; i < release->complist_count; i++){
305 -              if (!item_in_list(release->complist[i], release->components, release->components_count)) {
306 -                   opkg_msg(ERROR, "Component %s not supported for dist %s.\n",
307 -                                   release->complist[i], release->name);
308 -                   ret = 0;
309 -              }
310 -         }
311 -     }
312 -
313 -     return ret;
314 -}
315 -
316 -const char **
317 -release_comps(release_t *release, unsigned int *count)
318 -{
319 -     char **comps = release->complist;
320 -
321 -     if (!comps) {
322 -         comps = release->components;
323 -         *count = release->components_count;
324 -     } else {
325 -         *count = release->complist_count;
326 -     }
327 -
328 -     return (const char **)comps;
329 -}
330 -
331 -int
332 -release_download(release_t *release, pkg_src_t *dist, char *lists_dir, char *tmpdir)
333 -{
334 -     int ret = 0;
335 -     unsigned int ncomp;
336 -     const char **comps = release_comps(release, &ncomp);
337 -     nv_pair_list_elt_t *l;
338 -     int i;
339 -
340 -     for(i = 0; i < ncomp; i++){
341 -         int err = 0;
342 -         char *prefix;
343 -
344 -         sprintf_alloc(&prefix, "%s/dists/%s/%s/binary", dist->value, dist->name,
345 -                       comps[i]);
346 -
347 -         list_for_each_entry(l , &conf->arch_list.head, node) {
348 -              char *url;
349 -              char *tmp_file_name, *list_file_name;
350 -              char *subpath = NULL;
351 -
352 -              nv_pair_t *nv = (nv_pair_t *)l->data;
353 -
354 -              sprintf_alloc(&list_file_name, "%s/%s-%s-%s", lists_dir, dist->name, comps[i], nv->name);
355 -
356 -              sprintf_alloc(&tmp_file_name, "%s/%s-%s-%s%s", tmpdir, dist->name, comps[i], nv->name, ".gz");
357 -
358 -              sprintf_alloc(&subpath, "%s/binary-%s/%s", comps[i], nv->name, dist->gzip ? "Packages.gz" : "Packages");
359 -
360 -              if (dist->gzip) {
361 -              sprintf_alloc(&url, "%s-%s/Packages.gz", prefix, nv->name);
362 -              err = opkg_download(url, tmp_file_name, NULL, NULL, 1);
363 -              if (!err) {
364 -                   err = release_verify_file(release, tmp_file_name, subpath);
365 -                   if (err) {
366 -                        unlink (tmp_file_name);
367 -                        unlink (list_file_name);
368 -                   }
369 -              }
370 -              if (!err) {
371 -                   FILE *in, *out;
372 -                   opkg_msg(NOTICE, "Inflating %s.\n", url);
373 -                   in = fopen (tmp_file_name, "r");
374 -                   out = fopen (list_file_name, "w");
375 -                   if (in && out) {
376 -                        err = unzip (in, out);
377 -                        if (err)
378 -                             opkg_msg(INFO, "Corrumpt file at %s.\n", url);
379 -                   } else
380 -                        err = 1;
381 -                   if (in)
382 -                        fclose (in);
383 -                   if (out)
384 -                        fclose (out);
385 -                   unlink (tmp_file_name);
386 -              }
387 -              free(url);
388 -              }
389 -
390 -              if (err) {
391 -                   sprintf_alloc(&url, "%s-%s/Packages", prefix, nv->name);
392 -                   err = opkg_download(url, list_file_name, NULL, NULL, 1);
393 -                   if (!err) {
394 -                        err = release_verify_file(release, tmp_file_name, subpath);
395 -                        if (err)
396 -                             unlink (list_file_name);
397 -                   }
398 -                   free(url);
399 -              }
400 -
401 -              free(tmp_file_name);
402 -              free(list_file_name);
403 -         }
404 -
405 -         if(err)
406 -              ret = 1;
407 -
408 -         free(prefix);
409 -     }
410 -
411 -     return ret;
412 -}
413 -
414 -int
415 -release_get_size(release_t *release, const char *pathname)
416 -{
417 -     const cksum_t *cksum;
418 -
419 -     if (release->md5sums) {
420 -         cksum = cksum_list_find(release->md5sums, pathname);
421 -         return cksum->size;
422 -     }
423 -
424 -#ifdef HAVE_SHA256
425 -     if (release->sha256sums) {
426 -         cksum = cksum_list_find(release->sha256sums, pathname);
427 -         return cksum->size;
428 -     }
429 -#endif
430 -
431 -     return -1;
432 -}
433 -
434 -const char *
435 -release_get_md5(release_t *release, const char *pathname)
436 -{
437 -     const cksum_t *cksum;
438 -
439 -     if (release->md5sums) {
440 -         cksum = cksum_list_find(release->md5sums, pathname);
441 -         return cksum->value;
442 -     }
443 -
444 -     return '\0';
445 -}
446 -
447 -#ifdef HAVE_SHA256
448 -const char *
449 -release_get_sha256(release_t *release, const char *pathname)
450 -{
451 -     const cksum_t *cksum;
452 -
453 -     if (release->sha256sums) {
454 -         cksum = cksum_list_find(release->sha256sums, pathname);
455 -         return cksum->value;
456 -     }
457 -
458 -     return '\0';
459 -}
460 -#endif
461 -
462 -int
463 -release_verify_file(release_t *release, const char* file_name, const char *pathname)
464 -{
465 -     struct stat f_info;
466 -     char *f_md5 = NULL;
467 -     const char *md5 = release_get_md5(release, pathname);
468 -#ifdef HAVE_SHA256
469 -     char *f_sha256 = NULL;
470 -     const char *sha256 = release_get_sha256(release, pathname);
471 -#endif
472 -     int ret = 0;
473 -
474 -     if (stat(file_name, &f_info) || (f_info.st_size!=release_get_size(release, pathname))) {
475 -         opkg_msg(ERROR, "Size verification failed for %s - %s.\n", release->name, pathname);
476 -         ret = 1;
477 -     } else {
478 -
479 -     f_md5 = file_md5sum_alloc(file_name);
480 -#ifdef HAVE_SHA256
481 -     f_sha256 = file_sha256sum_alloc(file_name);
482 -#endif
483 -
484 -     if (md5 && strcmp(md5, f_md5)) {
485 -         opkg_msg(ERROR, "MD5 verification failed for %s - %s.\n", release->name, pathname);
486 -         ret = 1;
487 -#ifdef HAVE_SHA256
488 -     } else if (sha256 && strcmp(sha256, f_sha256)) {
489 -         opkg_msg(ERROR, "SHA256 verification failed for %s - %s.\n", release->name, pathname);
490 -         ret = 1;
491 -#endif
492 -     }
493 -
494 -     }
495 -
496 -     free(f_md5);
497 -#ifdef HAVE_SHA256
498 -     free(f_sha256);
499 -#endif
500 -
501 -     return ret;
502 -}
503 --- a/libopkg/release.h
504 +++ /dev/null
505 @@ -1,53 +0,0 @@
506 -/* release.h - the opkg package management system
507 -
508 -   Copyright (C) 2010,2011 Javier Palacios
509 -
510 -   This program is free software; you can redistribute it and/or
511 -   modify it under the terms of the GNU General Public License as
512 -   published by the Free Software Foundation; either version 2, or (at
513 -   your option) any later version.
514 -
515 -   This program is distributed in the hope that it will be useful, but
516 -   WITHOUT ANY WARRANTY; without even the implied warranty of
517 -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
518 -   General Public License for more details.
519 -*/
520 -
521 -#ifndef RELEASE_H
522 -#define RELEASE_H
523 -
524 -#include <stdio.h>
525 -#include "pkg.h"
526 -#include "cksum_list.h"
527 -
528 -struct release
529 -{
530 -     char *name;
531 -     char *datestring;
532 -     char **architectures;
533 -     unsigned int architectures_count;
534 -     char **components;
535 -     unsigned int components_count;
536 -     cksum_list_t *md5sums;
537 -#ifdef HAVE_SHA256
538 -     cksum_list_t *sha256sums;
539 -#endif
540 -     char **complist;
541 -     unsigned int complist_count;
542 -};
543 -
544 -typedef struct release release_t;
545 -
546 -release_t *release_new(void);
547 -void release_deinit(release_t *release);
548 -int release_init_from_file(release_t *release, const char *filename);
549 -
550 -int release_arch_supported(release_t *release);
551 -int release_comps_supported(release_t *release, const char *complist);
552 -int release_download(release_t *release, pkg_src_t *dist, char *lists_dir, char *tmpdir);
553 -
554 -const char **release_comps(release_t *release, unsigned int *count);
555 -
556 -int release_verify_file(release_t *release, const char *filename, const char *pathname);
557 -
558 -#endif
559 --- a/libopkg/release_parse.c
560 +++ /dev/null
561 @@ -1,126 +0,0 @@
562 -/* release_parse.c - the opkg package management system
563 -
564 -   Copyright (C) 2010,2011 Javier Palacios
565 -
566 -   This program is free software; you can redistribute it and/or
567 -   modify it under the terms of the GNU General Public License as
568 -   published by the Free Software Foundation; either version 2, or (at
569 -   your option) any later version.
570 -
571 -   This program is distributed in the hope that it will be useful, but
572 -   WITHOUT ANY WARRANTY; without even the implied warranty of
573 -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
574 -   General Public License for more details.
575 -*/
576 -
577 -#include "config.h"
578 -
579 -#include <stdio.h>
580 -
581 -#include "release.h"
582 -#include "release_parse.h"
583 -#include "libbb/libbb.h"
584 -#include "parse_util.h"
585 -
586 -static int
587 -release_parse_line(void *ptr, const char *line, uint mask)
588 -{
589 -       release_t *release = (release_t *) ptr;
590 -
591 -       int ret = 0;
592 -       unsigned int count = 0;
593 -       char **list = 0;
594 -       static int reading_md5sums = 0;
595 -#ifdef HAVE_SHA256
596 -       static int reading_sha256sums = 0;
597 -#endif
598 -
599 -       switch (*line) {
600 -       case 'A':
601 -               if (is_field("Architectures", line)) {
602 -                       release->architectures = parse_list(line, &release->architectures_count, ' ', 0);
603 -               }
604 -               break;
605 -
606 -       case 'C':
607 -               if (is_field("Codename", line)) {
608 -                       release->name = parse_simple("Codename", line);
609 -               }
610 -               else if (is_field("Components", line)) {
611 -                       release->components = parse_list(line, &release->components_count, ' ', 0);
612 -               }
613 -               break;
614 -
615 -       case 'D':
616 -               if (is_field("Date", line)) {
617 -                       release->datestring = parse_simple("Date", line);
618 -               }
619 -               break;
620 -
621 -       case 'M':
622 -               if (is_field("MD5sum", line)) {
623 -                       reading_md5sums = 1;
624 -                       if (release->md5sums == NULL) {
625 -                            release->md5sums = xcalloc(1, sizeof(cksum_list_t));
626 -                            cksum_list_init(release->md5sums);
627 -                       }
628 -                       goto dont_reset_flags;
629 -               }
630 -               break;
631 -
632 -#ifdef HAVE_SHA256
633 -       case 'S':
634 -               if (is_field("SHA256", line)) {
635 -                       reading_sha256sums = 1;
636 -                       if (release->sha256sums == NULL) {
637 -                            release->sha256sums = xcalloc(1, sizeof(cksum_list_t));
638 -                            cksum_list_init(release->sha256sums);
639 -                       }
640 -                       goto dont_reset_flags;
641 -               }
642 -               break;
643 -#endif
644 -
645 -       case ' ':
646 -               if (reading_md5sums) {
647 -                       list = parse_list(line, &count, ' ', 1);
648 -                       cksum_list_append(release->md5sums, list);
649 -                       goto dont_reset_flags;
650 -               }
651 -#ifdef HAVE_SHA256
652 -               else if (reading_sha256sums) {
653 -                       list = parse_list(line, &count, ' ', 1);
654 -                       cksum_list_append(release->sha256sums, list);
655 -                       goto dont_reset_flags;
656 -               }
657 -#endif
658 -               break;
659 -
660 -       default:
661 -               ret = 1;
662 -       }
663 -
664 -       reading_md5sums = 0;
665 -#ifdef HAVE_SHA256
666 -       reading_sha256sums = 0;
667 -#endif
668 -
669 -dont_reset_flags:
670 -
671 -       return ret;
672 -}
673 -
674 -int
675 -release_parse_from_stream(release_t *release, FILE *fp)
676 -{
677 -       int ret;
678 -       char *buf;
679 -       const size_t len = 4096;
680 -
681 -       buf = xmalloc(len);
682 -       ret = parse_from_stream_nomalloc(release_parse_line, release, fp, 0, &buf, len);
683 -       free(buf);
684 -
685 -       return ret;
686 -}
687 -
688 --- a/libopkg/release_parse.h
689 +++ /dev/null
690 @@ -1,21 +0,0 @@
691 -/* release_parse.h - the opkg package management system
692 -
693 -   Copyright (C) 2010,2011 Javier Palacios
694 -
695 -   This program is free software; you can redistribute it and/or
696 -   modify it under the terms of the GNU General Public License as
697 -   published by the Free Software Foundation; either version 2, or (at
698 -   your option) any later version.
699 -
700 -   This program is distributed in the hope that it will be useful, but
701 -   WITHOUT ANY WARRANTY; without even the implied warranty of
702 -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
703 -   General Public License for more details.
704 -*/
705 -
706 -#ifndef RELEASE_PARSE_H
707 -#define RELEASE_PARSE_H
708 -
709 -int release_parse_from_stream(release_t *release, FILE *fp);
710 -
711 -#endif
712 --- a/libopkg/opkg_cmd.c
713 +++ b/libopkg/opkg_cmd.c
714 @@ -27,7 +27,6 @@
715  #include "opkg_conf.h"
716  #include "opkg_cmd.h"
717  #include "opkg_message.h"
718 -#include "release.h"
719  #include "pkg.h"
720  #include "pkg_dest.h"
721  #include "pkg_parse.h"
722 @@ -114,39 +113,6 @@ opkg_update_cmd(int argc, char **argv)
723       }
724  
725  
726 -     for (iter = void_list_first(&conf->dist_src_list); iter; iter = void_list_next(&conf->dist_src_list, iter)) {
727 -         char *url, *list_file_name;
728 -
729 -         src = (pkg_src_t *)iter->data;
730 -
731 -         sprintf_alloc(&url, "%s/dists/%s/Release", src->value, src->name);
732 -
733 -         sprintf_alloc(&list_file_name, "%s/%s", lists_dir, src->name);
734 -         err = opkg_download(url, list_file_name, NULL, NULL, 0);
735 -         if (!err) {
736 -              opkg_msg(NOTICE, "Downloaded release files for dist %s.\n",
737 -                           src->name);
738 -              release_t *release = release_new(); 
739 -              err = release_init_from_file(release, list_file_name);
740 -              if (!err) {
741 -                   if (!release_comps_supported(release, src->extra_data))
742 -                        err = -1;
743 -              }
744 -              if (!err) {
745 -                   err = release_download(release, src, lists_dir, tmp);
746 -              }
747 -              release_deinit(release); 
748 -              if (err)
749 -                   unlink(list_file_name);
750 -         }
751 -
752 -         if (err)
753 -              failures++;
754 -
755 -         free(list_file_name);
756 -         free(url);
757 -     }
758 -
759       for (iter = void_list_first(&conf->pkg_src_list); iter; iter = void_list_next(&conf->pkg_src_list, iter)) {
760           char *url, *list_file_name;
761  
762 --- a/libopkg/pkg_hash.c
763 +++ b/libopkg/pkg_hash.c
764 @@ -18,7 +18,6 @@
765  #include <stdio.h>
766  
767  #include "hash_table.h"
768 -#include "release.h"
769  #include "pkg.h"
770  #include "opkg_message.h"
771  #include "pkg_vec.h"
772 @@ -183,40 +182,6 @@ pkg_hash_load_feeds(void)
773         lists_dir = conf->restrict_to_default_dest ?
774                 conf->default_dest->lists_dir : conf->lists_dir;
775  
776 -       for (iter = void_list_first(&conf->dist_src_list); iter;
777 -                       iter = void_list_next(&conf->dist_src_list, iter)) {
778 -
779 -               src = (pkg_src_t *)iter->data;
780 -
781 -               sprintf_alloc(&list_file, "%s/%s", lists_dir, src->name);
782 -
783 -               if (file_exists(list_file)) {
784 -                       int i;
785 -                       release_t *release = release_new();
786 -                       if(release_init_from_file(release, list_file)) {
787 -                               free(list_file);
788 -                               return -1;
789 -                       }
790 -
791 -                       unsigned int ncomp;
792 -                       const char **comps = release_comps(release, &ncomp);
793 -                       subdist = (pkg_src_t *) xmalloc(sizeof(pkg_src_t));
794 -                       memcpy(subdist, src, sizeof(pkg_src_t));
795 -
796 -                       for(i = 0; i < ncomp; i++){
797 -                               subdist->name = NULL;
798 -                               sprintf_alloc(&subdist->name, "%s-%s", src->name, comps[i]);
799 -                               if (dist_hash_add_from_file(lists_dir, subdist)) {
800 -                                       free(subdist->name); free(subdist);
801 -                                       free(list_file);
802 -                                       return -1;
803 -                               }
804 -                       }
805 -                       free(subdist->name); free(subdist);
806 -               }
807 -               free(list_file);
808 -       }
809 -
810         for (iter = void_list_first(&conf->pkg_src_list); iter;
811                         iter = void_list_next(&conf->pkg_src_list, iter)) {
812