1 /* opkg.c - the opkg package management system
3 Thomas Wood <thomas@openedhand.com>
5 Copyright (C) 2008 OpenMoko Inc
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2, or (at
10 your option) any later version.
12 This program is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
22 #include "opkg_conf.h"
25 #include "opkg_install.h"
26 #include "opkg_configure.h"
27 #include "opkg_download.h"
28 #include "opkg_remove.h"
29 #include "opkg_upgrade.h"
30 #include "opkg_error.h"
32 #include "sprintf_alloc.h"
33 #include "file_util.h"
35 #include <libbb/libbb.h>
41 opkg_option_t *options;
44 #define opkg_assert(expr) if (!(expr)) { \
45 printf ("opkg: file %s: line %d (%s): Assertation '%s' failed",\
46 __FILE__, __LINE__, __PRETTY_FUNCTION__, # expr); abort (); }
48 #define progress(d, p) d.percentage = p; if (progress_callback) progress_callback (opkg, &d, user_data);
49 #define SSTRCMP(x,y) (x && y) ? strcmp (x, y) : 0
51 /** Private Functions ***/
56 static opkg_package_t*
57 pkg_t_to_opkg_package_t (pkg_t *old)
61 new = opkg_package_new ();
63 new->name = xstrdup(old->name);
64 new->version = pkg_version_str_alloc (old);
65 new->architecture = xstrdup(old->architecture);
67 new->repository = xstrdup(old->src->name);
68 new->description = xstrdup(old->description);
69 new->tags = xstrdup(old->tags);
70 new->url = xstrdup(old->url);
72 new->size = (old->size) ? atoi (old->size) : 0;
73 new->installed = (old->state_status == SS_INSTALLED);
79 opkg_configure_packages(opkg_conf_t *conf, char *pkg_name)
86 all = pkg_vec_alloc ();
87 pkg_hash_fetch_available (&conf->pkg_hash, all);
89 for (i = 0; i < all->len; i++)
93 if (pkg_name && fnmatch (pkg_name, pkg->name, 0))
96 if (pkg->state_status == SS_UNPACKED)
98 r = opkg_configure (conf, pkg);
101 pkg->state_status = SS_INSTALLED;
102 pkg->parent->state_status = SS_INSTALLED;
103 pkg->state_flag &= ~SF_PREFER;
119 opkg_progress_callback_t cb;
120 opkg_progress_data_t *progress_data;
128 curl_progress_cb (struct _curl_cb_data *cb_data,
129 double t, /* dltotal */
130 double d, /* dlnow */
134 int p = (t) ? d * 100 / t : 0;
135 static int prev = -1;
138 /* prevent the same value being sent twice (can occur due to rounding) */
146 progress = cb_data->start_range + (d / t * ((cb_data->finish_range - cb_data->start_range)));
147 cb_data->progress_data->percentage = progress;
149 (cb_data->cb)(cb_data->opkg,
150 cb_data->progress_data,
165 p = xcalloc(1, sizeof (opkg_package_t));
171 opkg_package_free (opkg_package_t *p)
175 free (p->architecture);
176 free (p->description);
179 free (p->repository);
190 opkg = xcalloc(1, sizeof (opkg_t));
192 opkg->args = xcalloc(1, sizeof (args_t));
193 args_init (opkg->args);
195 opkg->conf = xcalloc(1, sizeof (opkg_conf_t));
196 err = opkg_conf_init (opkg->conf, opkg->args);
205 opkg_init_options_array (opkg->conf, &opkg->options);
210 opkg_free (opkg_t *opkg)
212 opkg_assert (opkg != NULL);
214 opkg_conf_deinit (opkg->conf);
215 args_deinit (opkg->args);
216 free (opkg->options);
223 opkg_re_read_config_files (opkg_t *opkg)
228 opkg_assert (opkg != NULL);
233 /* Unfortunatly, the easiest way to re-read the config files right now is to
234 * throw away opkg->conf and start again */
236 /* copy the settings we need to keep */
237 a->autoremove = c->autoremove;
238 a->force_depends = c->force_depends;
239 a->force_defaults = c->force_defaults;
240 a->force_maintainer = c->force_maintainer;
241 a->force_overwrite = c->force_overwrite;
242 a->force_downgrade = c->force_downgrade;
243 a->force_reinstall = c->force_reinstall;
244 a->force_removal_of_dependent_packages = c->force_removal_of_dependent_packages;
245 a->force_removal_of_essential_packages = c->force_removal_of_essential_packages;
246 a->nodeps = c->nodeps;
247 a->noaction = c->noaction;
248 a->query_all = c->query_all;
249 a->verbosity = c->verbosity;
253 if (a->offline_root) free (a->offline_root);
254 a->offline_root = xstrdup(c->offline_root);
257 if (c->offline_root_pre_script_cmd)
259 if (a->offline_root_pre_script_cmd) free (a->offline_root_pre_script_cmd);
260 a->offline_root_pre_script_cmd = xstrdup(c->offline_root_pre_script_cmd);
263 if (c->offline_root_post_script_cmd)
265 if (a->offline_root_post_script_cmd) free (a->offline_root_post_script_cmd);
266 a->offline_root_post_script_cmd = xstrdup(c->offline_root_post_script_cmd);
272 a->cache = xstrdup(c->cache);
275 /* throw away old opkg_conf and start again */
276 opkg_conf_deinit (opkg->conf);
277 opkg_conf_init (opkg->conf, opkg->args);
279 free (opkg->options);
280 opkg_init_options_array (opkg->conf, &opkg->options);
286 opkg_get_option (opkg_t *opkg, char *option, void **value)
289 opkg_option_t *options;
291 opkg_assert (opkg != NULL);
292 opkg_assert (option != NULL);
293 opkg_assert (value != NULL);
295 options = opkg->options;
297 /* look up the option
298 * TODO: this would be much better as a hash table
300 while (options[i].name)
302 if (strcmp (options[i].name, option) != 0)
310 switch (options[i].type)
312 case OPKG_OPT_TYPE_BOOL:
313 *((int *) value) = *((int *) options[i].value);
316 case OPKG_OPT_TYPE_INT:
317 *((int *) value) = *((int *) options[i].value);
320 case OPKG_OPT_TYPE_STRING:
321 *((char **)value) = xstrdup(options[i].value);
328 opkg_set_option (opkg_t *opkg, char *option, void *value)
330 int i = 0, found = 0;
331 opkg_option_t *options;
333 opkg_assert (opkg != NULL);
334 opkg_assert (option != NULL);
335 opkg_assert (value != NULL);
337 options = opkg->options;
339 /* look up the option
340 * TODO: this would be much better as a hash table
342 while (options[i].name)
344 if (strcmp (options[i].name, option) == 0)
354 /* XXX: Warning: Option not found */
359 switch (options[i].type)
361 case OPKG_OPT_TYPE_BOOL:
362 if (*((int *) value) == 0)
363 *((int *)options[i].value) = 0;
365 *((int *)options[i].value) = 1;
368 case OPKG_OPT_TYPE_INT:
369 *((int *) options[i].value) = *((int *) value);
372 case OPKG_OPT_TYPE_STRING:
373 *((char **)options[i].value) = xstrdup(value);
380 * @brief libopkg API: Install package
381 * @param opkg Then opkg handler
382 * @param package_name The name of package in which is going to install
383 * @param progress_callback The callback function that report the status to caller.
386 opkg_install_package (opkg_t *opkg, const char *package_name, opkg_progress_callback_t progress_callback, void *user_data)
389 char *stripped_filename;
390 opkg_progress_data_t pdata;
392 pkg_vec_t *deps, *all;
394 char **unresolved = NULL;
396 opkg_assert (opkg != NULL);
397 opkg_assert (package_name != NULL);
400 pkg_info_preinstall_check (opkg->conf);
403 /* check to ensure package is not already installed */
404 old = pkg_hash_fetch_installed_by_name(&opkg->conf->pkg_hash, package_name);
407 /* XXX: Error: Package is already installed. */
408 return OPKG_PACKAGE_ALREADY_INSTALLED;
411 new = pkg_hash_fetch_best_installation_candidate_by_name(opkg->conf, package_name, NULL);
414 /* XXX: Error: Could not find package to install */
415 return OPKG_PACKAGE_NOT_FOUND;
418 new->state_flag |= SF_USER;
420 pdata.action = OPKG_INSTALL;
421 pdata.package = pkg_t_to_opkg_package_t (new);
425 /* find dependancies and download them */
426 deps = pkg_vec_alloc ();
427 /* this function does not return the original package, so we insert it later */
428 ndepends = pkg_hash_fetch_unsatisfied_dependencies (opkg->conf, new, deps, &unresolved);
431 /* XXX: Error: Could not satisfy dependencies */
433 return OPKG_DEPENDENCIES_FAILED;
436 /* insert the package we are installing so that we download it */
437 pkg_vec_insert (deps, new);
439 /* download package and dependancies */
440 for (i = 0; i < deps->len; i++)
443 struct _curl_cb_data cb_data;
447 if (pkg->local_filename)
450 opkg_package_free (pdata.package);
451 pdata.package = pkg_t_to_opkg_package_t (pkg);
452 pdata.action = OPKG_DOWNLOAD;
454 if (pkg->src == NULL)
456 /* XXX: Error: Package not available from any configured src */
457 return OPKG_PACKAGE_NOT_AVAILABLE;
460 sprintf_alloc(&url, "%s/%s", pkg->src->value, pkg->filename);
462 /* Get the filename part, without any directory */
463 stripped_filename = strrchr(pkg->filename, '/');
464 if ( ! stripped_filename )
465 stripped_filename = pkg->filename;
467 sprintf_alloc(&pkg->local_filename, "%s/%s", opkg->conf->tmp_dir, stripped_filename);
469 cb_data.cb = progress_callback;
470 cb_data.progress_data = &pdata;
472 cb_data.user_data = user_data;
473 /* 75% of "install" progress is for downloading */
474 cb_data.start_range = 75 * i / deps->len;
475 cb_data.finish_range = 75 * (i + 1) / deps->len;
477 err = opkg_download(opkg->conf, url, pkg->local_filename,
478 (curl_progress_func) curl_progress_cb, &cb_data);
484 opkg_package_free (pdata.package);
485 return OPKG_DOWNLOAD_FAILED;
491 /* clear depenacy checked marks, left by pkg_hash_fetch_unsatisfied_dependencies */
492 all = pkg_vec_alloc ();
493 pkg_hash_fetch_available (&opkg->conf->pkg_hash, all);
494 for (i = 0; i < all->len; i++)
496 all->pkgs[i]->parent->dependencies_checked = 0;
501 /* 75% of "install" progress is for downloading */
502 opkg_package_free (pdata.package);
503 pdata.package = pkg_t_to_opkg_package_t (new);
504 pdata.action = OPKG_INSTALL;
505 progress (pdata, 75);
507 /* unpack the package */
508 err = opkg_install_pkg(opkg->conf, new, 0);
512 opkg_package_free (pdata.package);
515 case OPKG_INSTALL_ERR_NOT_TRUSTED: return OPKG_GPG_ERROR;
516 case OPKG_INSTALL_ERR_DOWNLOAD: return OPKG_DOWNLOAD_FAILED;
517 case OPKG_INSTALL_ERR_DEPENDENCIES:
518 case OPKG_INSTALL_ERR_CONFLICTS: return OPKG_DEPENDENCIES_FAILED;
519 case OPKG_INSTALL_ERR_ALREADY_INSTALLED: return OPKG_PACKAGE_ALREADY_INSTALLED;
520 case OPKG_INSTALL_ERR_SIGNATURE: return OPKG_GPG_ERROR;
521 case OPKG_INSTALL_ERR_MD5: return OPKG_MD5_ERROR;
522 case OPKG_INSTALL_ERR_SHA256: return OPKG_SHA256_ERROR;
523 default: return OPKG_UNKNOWN_ERROR;
527 progress (pdata, 75);
529 /* run configure scripts, etc. */
530 err = opkg_configure_packages (opkg->conf, NULL);
533 opkg_package_free (pdata.package);
534 return OPKG_UNKNOWN_ERROR;
537 /* write out status files and file lists */
538 opkg_conf_write_status_files (opkg->conf);
539 pkg_write_changed_filelists (opkg->conf);
541 progress (pdata, 100);
542 opkg_package_free (pdata.package);
547 opkg_remove_package (opkg_t *opkg, const char *package_name, opkg_progress_callback_t progress_callback, void *user_data)
551 pkg_t *pkg_to_remove;
552 opkg_progress_data_t pdata;
554 opkg_assert (opkg != NULL);
555 opkg_assert (package_name != NULL);
557 pkg_info_preinstall_check (opkg->conf);
559 pkg = pkg_hash_fetch_installed_by_name (&opkg->conf->pkg_hash, package_name);
563 /* XXX: Error: Package not installed. */
564 return OPKG_PACKAGE_NOT_INSTALLED;
567 pdata.action = OPKG_REMOVE;
568 pdata.package = pkg_t_to_opkg_package_t (pkg);
572 if (pkg->state_status == SS_NOT_INSTALLED)
574 /* XXX: Error: Package seems to be not installed (STATUS = NOT_INSTALLED). */
575 opkg_package_free (pdata.package);
576 return OPKG_PACKAGE_NOT_INSTALLED;
578 progress (pdata, 25);
580 if (opkg->conf->restrict_to_default_dest)
582 pkg_to_remove = pkg_hash_fetch_installed_by_name_dest (&opkg->conf->pkg_hash,
584 opkg->conf->default_dest);
588 pkg_to_remove = pkg_hash_fetch_installed_by_name (&opkg->conf->pkg_hash, pkg->name );
592 progress (pdata, 75);
594 err = opkg_remove_pkg (opkg->conf, pkg_to_remove, 0);
596 /* write out status files and file lists */
597 opkg_conf_write_status_files (opkg->conf);
598 pkg_write_changed_filelists (opkg->conf);
601 progress (pdata, 100);
602 opkg_package_free (pdata.package);
603 return (err) ? OPKG_UNKNOWN_ERROR : OPKG_NO_ERROR;
607 opkg_upgrade_package (opkg_t *opkg, const char *package_name, opkg_progress_callback_t progress_callback, void *user_data)
611 opkg_progress_data_t pdata;
615 opkg_assert (opkg != NULL);
616 opkg_assert (package_name != NULL);
618 pkg_info_preinstall_check (opkg->conf);
620 if (opkg->conf->restrict_to_default_dest)
622 pkg = pkg_hash_fetch_installed_by_name_dest (&opkg->conf->pkg_hash,
624 opkg->conf->default_dest);
627 /* XXX: Error: Package not installed in default_dest */
628 return OPKG_PACKAGE_NOT_INSTALLED;
633 pkg = pkg_hash_fetch_installed_by_name (&opkg->conf->pkg_hash,
639 /* XXX: Error: Package not installed */
640 return OPKG_PACKAGE_NOT_INSTALLED;
643 pdata.action = OPKG_INSTALL;
644 pdata.package = pkg_t_to_opkg_package_t (pkg);
647 err = opkg_upgrade_pkg (opkg->conf, pkg);
648 /* opkg_upgrade_pkg returns the error codes of opkg_install_pkg */
652 opkg_package_free (pdata.package);
655 case OPKG_INSTALL_ERR_NOT_TRUSTED: return OPKG_GPG_ERROR;
656 case OPKG_INSTALL_ERR_DOWNLOAD: return OPKG_DOWNLOAD_FAILED;
657 case OPKG_INSTALL_ERR_DEPENDENCIES:
658 case OPKG_INSTALL_ERR_CONFLICTS: return OPKG_DEPENDENCIES_FAILED;
659 case OPKG_INSTALL_ERR_ALREADY_INSTALLED: return OPKG_PACKAGE_ALREADY_INSTALLED;
660 case OPKG_INSTALL_ERR_SIGNATURE: return OPKG_GPG_ERROR;
661 case OPKG_INSTALL_ERR_MD5: return OPKG_MD5_ERROR;
662 case OPKG_INSTALL_ERR_SHA256: return OPKG_SHA256_ERROR;
663 default: return OPKG_UNKNOWN_ERROR;
666 progress (pdata, 75);
668 err = opkg_configure_packages (opkg->conf, NULL);
670 opkg_package_free (pdata.package);
671 return OPKG_UNKNOWN_ERROR;
674 /* write out status files and file lists */
675 opkg_conf_write_status_files (opkg->conf);
676 pkg_write_changed_filelists (opkg->conf);
678 progress (pdata, 100);
679 opkg_package_free (pdata.package);
684 opkg_upgrade_all (opkg_t *opkg, opkg_progress_callback_t progress_callback, void *user_data)
686 pkg_vec_t *installed;
690 opkg_progress_data_t pdata;
692 pdata.action = OPKG_INSTALL;
693 pdata.package = NULL;
695 opkg_assert (opkg != NULL);
698 installed = pkg_vec_alloc ();
699 pkg_info_preinstall_check (opkg->conf);
701 pkg_hash_fetch_all_installed (&opkg->conf->pkg_hash, installed);
702 for (i = 0; i < installed->len; i++)
704 pkg = installed->pkgs[i];
706 pdata.package = pkg_t_to_opkg_package_t (pkg);
707 progress (pdata, 99 * i / installed->len);
708 opkg_package_free (pdata.package);
710 err += opkg_upgrade_pkg (opkg->conf, pkg);
712 pkg_vec_free (installed);
717 err = opkg_configure_packages (opkg->conf, NULL);
721 pdata.package = NULL;
722 progress (pdata, 100);
727 opkg_update_package_lists (opkg_t *opkg, opkg_progress_callback_t progress_callback, void *user_data)
732 pkg_src_list_elt_t *iter;
734 int sources_list_count, sources_done;
735 opkg_progress_data_t pdata;
737 opkg_assert (opkg != NULL);
739 pdata.action = OPKG_DOWNLOAD;
740 pdata.package = NULL;
743 sprintf_alloc (&lists_dir, "%s",
744 (opkg->conf->restrict_to_default_dest)
745 ? opkg->conf->default_dest->lists_dir
746 : opkg->conf->lists_dir);
748 if (!file_is_dir (lists_dir))
750 if (file_exists (lists_dir))
752 /* XXX: Error: file exists but is not a directory */
757 err = file_mkdir_hier (lists_dir, 0755);
760 /* XXX: Error: failed to create directory */
766 tmp = xstrdup("/tmp/opkg.XXXXXX");
768 if (mkdtemp (tmp) == NULL)
770 /* XXX: Error: could not create temporary file name */
776 /* count the number of sources so we can give some progress updates */
777 sources_list_count = 0;
779 list_for_each_entry(iter, &opkg->conf->pkg_src_list.head, node)
781 sources_list_count++;
784 list_for_each_entry(iter, &opkg->conf->pkg_src_list.head, node)
786 char *url, *list_file_name = NULL;
788 src = (pkg_src_t *)iter->data;
790 if (src->extra_data) /* debian style? */
791 sprintf_alloc (&url, "%s/%s/%s", src->value, src->extra_data,
792 src->gzip ? "Packages.gz" : "Packages");
794 sprintf_alloc (&url, "%s/%s", src->value, src->gzip ? "Packages.gz" : "Packages");
796 sprintf_alloc (&list_file_name, "%s/%s", lists_dir, src->name);
800 struct _curl_cb_data cb_data;
801 char *tmp_file_name = NULL;
803 sprintf_alloc (&tmp_file_name, "%s/%s.gz", tmp, src->name);
805 /* XXX: Note: downloading url */
807 cb_data.cb = progress_callback;
808 cb_data.progress_data = &pdata;
810 cb_data.user_data = user_data;
811 cb_data.start_range = 100 * sources_done / sources_list_count;
812 cb_data.finish_range = 100 * (sources_done + 1) / sources_list_count;
814 err = opkg_download (opkg->conf, url, tmp_file_name, (curl_progress_func) curl_progress_cb, &cb_data);
818 /* XXX: Note: Inflating downloaded file */
819 in = fopen (tmp_file_name, "r");
820 out = fopen (list_file_name, "w");
829 unlink (tmp_file_name);
831 free (tmp_file_name);
834 err = opkg_download (opkg->conf, url, list_file_name, NULL, NULL);
838 /* XXX: Error: download error */
839 result = OPKG_DOWNLOAD_FAILED;
843 #if defined(HAVE_GPGME) || defined(HAVE_OPENSSL)
844 if ( opkg->conf->check_signature ) {
846 /* download detached signitures to verify the package lists */
847 /* get the url for the sig file */
848 if (src->extra_data) /* debian style? */
849 sprintf_alloc (&url, "%s/%s/%s", src->value, src->extra_data,
852 sprintf_alloc (&url, "%s/%s", src->value, "Packages.sig");
854 /* create filename for signature */
855 sprintf_alloc (&sig_file_name, "%s/%s.sig", lists_dir, src->name);
857 /* make sure there is no existing signature file */
858 unlink (sig_file_name);
860 err = opkg_download (opkg->conf, url, sig_file_name, NULL, NULL);
863 /* XXX: Warning: Download failed */
868 err = opkg_verify_file (opkg->conf, list_file_name, sig_file_name);
871 /* XXX: Notice: Signature check passed */
875 /* XXX: Warning: Signature check failed */
878 free (sig_file_name);
879 free (list_file_name);
883 /* XXX: Note: Signature check for %s skipped because GPG support was not
884 * enabled in this build
889 progress (pdata, 100 * sources_done / sources_list_count);
896 /* Now re-read the package lists to update package hash tables. */
897 opkg_re_read_config_files (opkg);
904 opkg_list_packages (opkg_t *opkg, opkg_package_callback_t callback, void *user_data)
910 opkg_assert (callback);
912 all = pkg_vec_alloc ();
913 pkg_hash_fetch_available (&opkg->conf->pkg_hash, all);
914 for (i = 0; i < all->len; i++)
917 opkg_package_t *package;
921 package = pkg_t_to_opkg_package_t (pkg);
922 callback (opkg, package, user_data);
923 opkg_package_free (package);
932 opkg_list_upgradable_packages (opkg_t *opkg, opkg_package_callback_t callback, void *user_data)
934 struct active_list *head;
935 struct active_list *node;
936 pkg_t *old=NULL, *new = NULL;
937 static opkg_package_t* package=NULL;
941 opkg_assert (callback);
943 /* ensure all data is valid */
944 pkg_info_preinstall_check (opkg->conf);
946 head = prepare_upgrade_list(opkg->conf);
947 for (node=active_list_next(head, head); node; active_list_next(head,node)) {
948 old = list_entry(node, pkg_t, list);
949 new = pkg_hash_fetch_best_installation_candidate_by_name(opkg->conf, old->name, NULL);
950 package = pkg_t_to_opkg_package_t (new);
951 callback (opkg, package, user_data);
952 opkg_package_free (package);
954 active_list_head_delete(head);
959 opkg_find_package (opkg_t *opkg, const char *name, const char *ver, const char *arch, const char *repo)
962 opkg_package_t *package = NULL;
964 #define sstrcmp(x,y) (x && y) ? strcmp (x, y) : 0
968 all = pkg_vec_alloc ();
969 pkg_hash_fetch_available (&opkg->conf->pkg_hash, all);
970 for (i = 0; i < all->len; i++)
978 if (sstrcmp (pkg->name, name))
982 pkgv = pkg_version_str_alloc (pkg);
983 if (sstrcmp (pkgv, ver))
990 /* check architecture */
993 if (sstrcmp (pkg->architecture, arch))
997 /* check repository */
1000 if (sstrcmp (pkg->src->name, repo))
1005 package = pkg_t_to_opkg_package_t (pkg);
1015 #include <curl/curl.h>
1018 * @brief Check the accessibility of repositories. It will try to access the repository to check if the respository is accessible throught current network status.
1019 * @param opkg The opkg_t
1020 * @return return how many repositories cannot access. 0 means all okay.
1022 int opkg_repository_accessibility_check(opkg_t *opkg)
1024 pkg_src_list_elt_t *iter;
1025 str_list_elt_t *iter1;
1032 opkg_assert(opkg != NULL);
1034 src = str_list_alloc();
1036 list_for_each_entry(iter, &opkg->conf->pkg_src_list.head, node)
1038 if (strstr(((pkg_src_t *)iter->data)->value, "://") &&
1039 index(strstr(((pkg_src_t *)iter->data)->value, "://") + 3, '/'))
1040 stmp = xstrndup(((pkg_src_t *)iter->data)->value,
1041 (index(strstr(((pkg_src_t *)iter->data)->value, "://") + 3, '/') - ((pkg_src_t *)iter->data)->value)*sizeof(char));
1044 stmp = xstrdup(((pkg_src_t *)iter->data)->value);
1046 for (iter1 = str_list_first(src); iter1; iter1 = str_list_next(src, iter1))
1048 if (strstr(iter1->data, stmp))
1054 sprintf_alloc(&repo_ptr, "%s/index.html",stmp);
1057 str_list_append(src, repo_ptr);
1061 while (repositories > 0)
1063 iter1 = str_list_pop(src);
1066 err = opkg_download(opkg->conf, iter1->data, "/dev/null", NULL, NULL);
1068 if (!(err == CURLE_OK ||
1069 err == CURLE_HTTP_RETURNED_ERROR ||
1070 err == CURLE_FILE_COULDNT_READ_FILE ||
1071 err == CURLE_REMOTE_FILE_NOT_FOUND ||
1072 err == CURLE_TFTP_NOTFOUND
1079 str_list_elt_deinit(iter1);