diff options
author | javiplx@gmail.com <javiplx@gmail.com@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2011-04-07 12:07:25 (EDT) |
---|---|---|
committer | javiplx@gmail.com <javiplx@gmail.com@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2011-04-07 12:07:25 (EDT) |
commit | 6474082c529d7dff6790062969d9e1056e66c566 (patch) | |
tree | 5ced7c9cac9a9d2a9225190309c8a7d31eeefe20 | |
parent | 0c51136398083908842f9faeb005cd5a5cc49273 (diff) |
Download all the valid Packages files for dist entries
git-svn-id: http://opkg.googlecode.com/svn/trunk@615 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
-rw-r--r-- | libopkg/opkg_cmd.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/libopkg/opkg_cmd.c b/libopkg/opkg_cmd.c index 8c04418..ce7cf5e 100644 --- a/libopkg/opkg_cmd.c +++ b/libopkg/opkg_cmd.c @@ -27,6 +27,7 @@ #include "opkg_conf.h" #include "opkg_cmd.h" #include "opkg_message.h" +#include "release.h" #include "pkg.h" #include "pkg_dest.h" #include "pkg_parse.h" @@ -113,11 +114,47 @@ opkg_update_cmd(int argc, char **argv) } + for (iter = void_list_first(&conf->dist_src_list); iter; iter = void_list_next(&conf->dist_src_list, iter)) { + char *url, *list_file_name; + + src = (pkg_src_t *)iter->data; + + sprintf_alloc(&url, "%s/dists/%s/Release", src->value, src->name); + + sprintf_alloc(&list_file_name, "%s/%s", lists_dir, src->name); + err = opkg_download(url, list_file_name, NULL, NULL, 0); + if (!err) { + opkg_msg(NOTICE, "Downloaded release files for dist %s.\n", + src->name); + release_t *release = release_new(); + err = release_init_from_file(release, list_file_name); + if (!err) { + if (!release_comps_supported(release, src->extra_data)) + err = -1; + } + if (!err) { + err = release_download(release, src, lists_dir, tmp); + } + release_deinit(release); + if (err) + unlink(list_file_name); + } + + if (err) + failures++; + + free(list_file_name); + free(url); + } + for (iter = void_list_first(&conf->pkg_src_list); iter; iter = void_list_next(&conf->pkg_src_list, iter)) { char *url, *list_file_name; src = (pkg_src_t *)iter->data; + if (src->extra_data && strcmp(src->extra_data, "__dummy__ ")) + continue; + if (src->extra_data) /* debian style? */ sprintf_alloc(&url, "%s/%s/%s", src->value, src->extra_data, src->gzip ? "Packages.gz" : "Packages"); |