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 #define sstrdup(x) (x) ? strdup (x) : NULL;
65 new->name = sstrdup (old->name);
66 new->version = pkg_version_str_alloc (old);
67 new->architecture = sstrdup (old->architecture);
69 new->repository = sstrdup (old->src->name);
70 new->description = sstrdup (old->description);
71 new->tags = sstrdup (old->tags);
72 new->url = sstrdup (old->url);
76 new->size = (old->size) ? atoi (old->size) : 0;
77 new->installed = (old->state_status == SS_INSTALLED);
83 opkg_configure_packages(opkg_conf_t *conf, char *pkg_name)
90 all = pkg_vec_alloc ();
91 pkg_hash_fetch_available (&conf->pkg_hash, all);
93 for (i = 0; i < all->len; i++)
97 if (pkg_name && fnmatch (pkg_name, pkg->name, 0))
100 if (pkg->state_status == SS_UNPACKED)
102 r = opkg_configure (conf, pkg);
105 pkg->state_status = SS_INSTALLED;
106 pkg->parent->state_status = SS_INSTALLED;
107 pkg->state_flag &= ~SF_PREFER;
123 opkg_progress_callback_t cb;
124 opkg_progress_data_t *progress_data;
132 curl_progress_cb (struct _curl_cb_data *cb_data,
133 double t, /* dltotal */
134 double d, /* dlnow */
138 int p = (t) ? d * 100 / t : 0;
139 static int prev = -1;
142 /* prevent the same value being sent twice (can occur due to rounding) */
150 progress = cb_data->start_range + (d / t * ((cb_data->finish_range - cb_data->start_range)));
151 cb_data->progress_data->percentage = progress;
153 (cb_data->cb)(cb_data->opkg,
154 cb_data->progress_data,
169 p = calloc (1, sizeof (opkg_package_t));
175 opkg_package_free (opkg_package_t *p)
179 free (p->architecture);
180 free (p->description);
183 free (p->repository);
194 opkg = calloc (1, sizeof (opkg_t));
196 opkg->args = calloc (1, sizeof (args_t));
197 err = args_init (opkg->args);
205 opkg->conf = calloc (1, sizeof (opkg_conf_t));
206 err = opkg_conf_init (opkg->conf, opkg->args);
215 opkg_init_options_array (opkg->conf, &opkg->options);
220 opkg_free (opkg_t *opkg)
222 opkg_assert (opkg != NULL);
224 opkg_conf_deinit (opkg->conf);
225 args_deinit (opkg->args);
226 free (opkg->options);
233 opkg_re_read_config_files (opkg_t *opkg)
238 opkg_assert (opkg != NULL);
243 /* Unfortunatly, the easiest way to re-read the config files right now is to
244 * throw away opkg->conf and start again */
246 /* copy the settings we need to keep */
247 a->autoremove = c->autoremove;
248 a->force_depends = c->force_depends;
249 a->force_defaults = c->force_defaults;
250 a->force_maintainer = c->force_maintainer;
251 a->force_overwrite = c->force_overwrite;
252 a->force_downgrade = c->force_downgrade;
253 a->force_reinstall = c->force_reinstall;
254 a->force_removal_of_dependent_packages = c->force_removal_of_dependent_packages;
255 a->force_removal_of_essential_packages = c->force_removal_of_essential_packages;
256 a->nodeps = c->nodeps;
257 a->noaction = c->noaction;
258 a->query_all = c->query_all;
259 a->verbosity = c->verbosity;
263 if (a->offline_root) free (a->offline_root);
264 a->offline_root = strdup (c->offline_root);
267 if (c->offline_root_pre_script_cmd)
269 if (a->offline_root_pre_script_cmd) free (a->offline_root_pre_script_cmd);
270 a->offline_root_pre_script_cmd = strdup (c->offline_root_pre_script_cmd);
273 if (c->offline_root_post_script_cmd)
275 if (a->offline_root_post_script_cmd) free (a->offline_root_post_script_cmd);
276 a->offline_root_post_script_cmd = strdup (c->offline_root_post_script_cmd);
282 a->cache = strdup(c->cache);
285 /* throw away old opkg_conf and start again */
286 opkg_conf_deinit (opkg->conf);
287 opkg_conf_init (opkg->conf, opkg->args);
289 free (opkg->options);
290 opkg_init_options_array (opkg->conf, &opkg->options);
296 opkg_get_option (opkg_t *opkg, char *option, void **value)
299 opkg_option_t *options;
301 opkg_assert (opkg != NULL);
302 opkg_assert (option != NULL);
303 opkg_assert (value != NULL);
305 options = opkg->options;
307 /* look up the option
308 * TODO: this would be much better as a hash table
310 while (options[i].name)
312 if (strcmp (options[i].name, option) != 0)
320 switch (options[i].type)
322 case OPKG_OPT_TYPE_BOOL:
323 *((int *) value) = *((int *) options[i].value);
326 case OPKG_OPT_TYPE_INT:
327 *((int *) value) = *((int *) options[i].value);
330 case OPKG_OPT_TYPE_STRING:
331 *((char **)value) = strdup (options[i].value);
338 opkg_set_option (opkg_t *opkg, char *option, void *value)
340 int i = 0, found = 0;
341 opkg_option_t *options;
343 opkg_assert (opkg != NULL);
344 opkg_assert (option != NULL);
345 opkg_assert (value != NULL);
347 options = opkg->options;
349 /* look up the option
350 * TODO: this would be much better as a hash table
352 while (options[i].name)
354 if (strcmp (options[i].name, option) == 0)
364 /* XXX: Warning: Option not found */
369 switch (options[i].type)
371 case OPKG_OPT_TYPE_BOOL:
372 if (*((int *) value) == 0)
373 *((int *)options[i].value) = 0;
375 *((int *)options[i].value) = 1;
378 case OPKG_OPT_TYPE_INT:
379 *((int *) options[i].value) = *((int *) value);
382 case OPKG_OPT_TYPE_STRING:
383 *((char **)options[i].value) = strdup (value);
390 * @brief libopkg API: Install package
391 * @param opkg Then opkg handler
392 * @param package_name The name of package in which is going to install
393 * @param progress_callback The callback function that report the status to caller.
396 opkg_install_package (opkg_t *opkg, const char *package_name, opkg_progress_callback_t progress_callback, void *user_data)
399 char *stripped_filename;
400 opkg_progress_data_t pdata;
402 pkg_vec_t *deps, *all;
404 char **unresolved = NULL;
406 opkg_assert (opkg != NULL);
407 opkg_assert (package_name != NULL);
410 pkg_info_preinstall_check (opkg->conf);
413 /* check to ensure package is not already installed */
414 old = pkg_hash_fetch_installed_by_name(&opkg->conf->pkg_hash, package_name);
417 /* XXX: Error: Package is already installed. */
418 return OPKG_PACKAGE_ALREADY_INSTALLED;
421 new = pkg_hash_fetch_best_installation_candidate_by_name(opkg->conf, package_name, NULL);
424 /* XXX: Error: Could not find package to install */
425 return OPKG_PACKAGE_NOT_FOUND;
428 new->state_flag |= SF_USER;
430 pdata.action = OPKG_INSTALL;
431 pdata.package = pkg_t_to_opkg_package_t (new);
435 /* find dependancies and download them */
436 deps = pkg_vec_alloc ();
437 /* this function does not return the original package, so we insert it later */
438 ndepends = pkg_hash_fetch_unsatisfied_dependencies (opkg->conf, new, deps, &unresolved);
441 /* XXX: Error: Could not satisfy dependencies */
443 return OPKG_DEPENDENCIES_FAILED;
446 /* insert the package we are installing so that we download it */
447 pkg_vec_insert (deps, new);
449 /* download package and dependancies */
450 for (i = 0; i < deps->len; i++)
453 struct _curl_cb_data cb_data;
457 if (pkg->local_filename)
460 opkg_package_free (pdata.package);
461 pdata.package = pkg_t_to_opkg_package_t (pkg);
462 pdata.action = OPKG_DOWNLOAD;
464 if (pkg->src == NULL)
466 /* XXX: Error: Package not available from any configured src */
467 return OPKG_PACKAGE_NOT_AVAILABLE;
470 sprintf_alloc(&url, "%s/%s", pkg->src->value, pkg->filename);
472 /* Get the filename part, without any directory */
473 stripped_filename = strrchr(pkg->filename, '/');
474 if ( ! stripped_filename )
475 stripped_filename = pkg->filename;
477 sprintf_alloc(&pkg->local_filename, "%s/%s", opkg->conf->tmp_dir, stripped_filename);
479 cb_data.cb = progress_callback;
480 cb_data.progress_data = &pdata;
482 cb_data.user_data = user_data;
483 /* 75% of "install" progress is for downloading */
484 cb_data.start_range = 75 * i / deps->len;
485 cb_data.finish_range = 75 * (i + 1) / deps->len;
487 err = opkg_download(opkg->conf, url, pkg->local_filename,
488 (curl_progress_func) curl_progress_cb, &cb_data);
494 opkg_package_free (pdata.package);
495 return OPKG_DOWNLOAD_FAILED;
501 /* clear depenacy checked marks, left by pkg_hash_fetch_unsatisfied_dependencies */
502 all = pkg_vec_alloc ();
503 pkg_hash_fetch_available (&opkg->conf->pkg_hash, all);
504 for (i = 0; i < all->len; i++)
506 all->pkgs[i]->parent->dependencies_checked = 0;
511 /* 75% of "install" progress is for downloading */
512 opkg_package_free (pdata.package);
513 pdata.package = pkg_t_to_opkg_package_t (new);
514 pdata.action = OPKG_INSTALL;
515 progress (pdata, 75);
517 /* unpack the package */
518 err = opkg_install_pkg(opkg->conf, new, 0);
522 opkg_package_free (pdata.package);
525 case OPKG_INSTALL_ERR_NOT_TRUSTED: return OPKG_GPG_ERROR;
526 case OPKG_INSTALL_ERR_DOWNLOAD: return OPKG_DOWNLOAD_FAILED;
527 case OPKG_INSTALL_ERR_DEPENDENCIES:
528 case OPKG_INSTALL_ERR_CONFLICTS: return OPKG_DEPENDENCIES_FAILED;
529 case OPKG_INSTALL_ERR_ALREADY_INSTALLED: return OPKG_PACKAGE_ALREADY_INSTALLED;
530 case OPKG_INSTALL_ERR_SIGNATURE: return OPKG_GPG_ERROR;
531 case OPKG_INSTALL_ERR_MD5: return OPKG_MD5_ERROR;
532 case OPKG_INSTALL_ERR_SHA256: return OPKG_SHA256_ERROR;
533 default: return OPKG_UNKNOWN_ERROR;
537 progress (pdata, 75);
539 /* run configure scripts, etc. */
540 err = opkg_configure_packages (opkg->conf, NULL);
543 opkg_package_free (pdata.package);
544 return OPKG_UNKNOWN_ERROR;
547 /* write out status files and file lists */
548 opkg_conf_write_status_files (opkg->conf);
549 pkg_write_changed_filelists (opkg->conf);
551 progress (pdata, 100);
552 opkg_package_free (pdata.package);
557 opkg_remove_package (opkg_t *opkg, const char *package_name, opkg_progress_callback_t progress_callback, void *user_data)
561 pkg_t *pkg_to_remove;
562 opkg_progress_data_t pdata;
564 opkg_assert (opkg != NULL);
565 opkg_assert (package_name != NULL);
567 pkg_info_preinstall_check (opkg->conf);
569 pkg = pkg_hash_fetch_installed_by_name (&opkg->conf->pkg_hash, package_name);
573 /* XXX: Error: Package not installed. */
574 return OPKG_PACKAGE_NOT_INSTALLED;
577 pdata.action = OPKG_REMOVE;
578 pdata.package = pkg_t_to_opkg_package_t (pkg);
582 if (pkg->state_status == SS_NOT_INSTALLED)
584 /* XXX: Error: Package seems to be not installed (STATUS = NOT_INSTALLED). */
585 opkg_package_free (pdata.package);
586 return OPKG_PACKAGE_NOT_INSTALLED;
588 progress (pdata, 25);
590 if (opkg->conf->restrict_to_default_dest)
592 pkg_to_remove = pkg_hash_fetch_installed_by_name_dest (&opkg->conf->pkg_hash,
594 opkg->conf->default_dest);
598 pkg_to_remove = pkg_hash_fetch_installed_by_name (&opkg->conf->pkg_hash, pkg->name );
602 progress (pdata, 75);
604 err = opkg_remove_pkg (opkg->conf, pkg_to_remove, 0);
606 /* write out status files and file lists */
607 opkg_conf_write_status_files (opkg->conf);
608 pkg_write_changed_filelists (opkg->conf);
611 progress (pdata, 100);
612 opkg_package_free (pdata.package);
613 return (err) ? OPKG_UNKNOWN_ERROR : OPKG_NO_ERROR;
617 opkg_upgrade_package (opkg_t *opkg, const char *package_name, opkg_progress_callback_t progress_callback, void *user_data)
621 opkg_progress_data_t pdata;
625 opkg_assert (opkg != NULL);
626 opkg_assert (package_name != NULL);
628 pkg_info_preinstall_check (opkg->conf);
630 if (opkg->conf->restrict_to_default_dest)
632 pkg = pkg_hash_fetch_installed_by_name_dest (&opkg->conf->pkg_hash,
634 opkg->conf->default_dest);
637 /* XXX: Error: Package not installed in default_dest */
638 return OPKG_PACKAGE_NOT_INSTALLED;
643 pkg = pkg_hash_fetch_installed_by_name (&opkg->conf->pkg_hash,
649 /* XXX: Error: Package not installed */
650 return OPKG_PACKAGE_NOT_INSTALLED;
653 pdata.action = OPKG_INSTALL;
654 pdata.package = pkg_t_to_opkg_package_t (pkg);
657 err = opkg_upgrade_pkg (opkg->conf, pkg);
658 /* opkg_upgrade_pkg returns the error codes of opkg_install_pkg */
662 opkg_package_free (pdata.package);
665 case OPKG_INSTALL_ERR_NOT_TRUSTED: return OPKG_GPG_ERROR;
666 case OPKG_INSTALL_ERR_DOWNLOAD: return OPKG_DOWNLOAD_FAILED;
667 case OPKG_INSTALL_ERR_DEPENDENCIES:
668 case OPKG_INSTALL_ERR_CONFLICTS: return OPKG_DEPENDENCIES_FAILED;
669 case OPKG_INSTALL_ERR_ALREADY_INSTALLED: return OPKG_PACKAGE_ALREADY_INSTALLED;
670 case OPKG_INSTALL_ERR_SIGNATURE: return OPKG_GPG_ERROR;
671 case OPKG_INSTALL_ERR_MD5: return OPKG_MD5_ERROR;
672 case OPKG_INSTALL_ERR_SHA256: return OPKG_SHA256_ERROR;
673 default: return OPKG_UNKNOWN_ERROR;
676 progress (pdata, 75);
678 err = opkg_configure_packages (opkg->conf, NULL);
680 opkg_package_free (pdata.package);
681 return OPKG_UNKNOWN_ERROR;
684 /* write out status files and file lists */
685 opkg_conf_write_status_files (opkg->conf);
686 pkg_write_changed_filelists (opkg->conf);
688 progress (pdata, 100);
689 opkg_package_free (pdata.package);
694 opkg_upgrade_all (opkg_t *opkg, opkg_progress_callback_t progress_callback, void *user_data)
696 pkg_vec_t *installed;
700 opkg_progress_data_t pdata;
702 pdata.action = OPKG_INSTALL;
703 pdata.package = NULL;
705 opkg_assert (opkg != NULL);
708 installed = pkg_vec_alloc ();
709 pkg_info_preinstall_check (opkg->conf);
711 pkg_hash_fetch_all_installed (&opkg->conf->pkg_hash, installed);
712 for (i = 0; i < installed->len; i++)
714 pkg = installed->pkgs[i];
716 pdata.package = pkg_t_to_opkg_package_t (pkg);
717 progress (pdata, 99 * i / installed->len);
718 opkg_package_free (pdata.package);
720 err += opkg_upgrade_pkg (opkg->conf, pkg);
722 pkg_vec_free (installed);
727 err = opkg_configure_packages (opkg->conf, NULL);
731 pdata.package = NULL;
732 progress (pdata, 100);
737 opkg_update_package_lists (opkg_t *opkg, opkg_progress_callback_t progress_callback, void *user_data)
742 pkg_src_list_elt_t *iter;
744 int sources_list_count, sources_done;
745 opkg_progress_data_t pdata;
747 opkg_assert (opkg != NULL);
749 pdata.action = OPKG_DOWNLOAD;
750 pdata.package = NULL;
753 sprintf_alloc (&lists_dir, "%s",
754 (opkg->conf->restrict_to_default_dest)
755 ? opkg->conf->default_dest->lists_dir
756 : opkg->conf->lists_dir);
758 if (!file_is_dir (lists_dir))
760 if (file_exists (lists_dir))
762 /* XXX: Error: file exists but is not a directory */
767 err = file_mkdir_hier (lists_dir, 0755);
770 /* XXX: Error: failed to create directory */
776 tmp = strdup ("/tmp/opkg.XXXXXX");
778 if (mkdtemp (tmp) == NULL)
780 /* XXX: Error: could not create temporary file name */
786 /* count the number of sources so we can give some progress updates */
787 sources_list_count = 0;
789 list_for_each_entry(iter, &opkg->conf->pkg_src_list.head, node)
791 sources_list_count++;
794 list_for_each_entry(iter, &opkg->conf->pkg_src_list.head, node)
796 char *url, *list_file_name = NULL;
798 src = (pkg_src_t *)iter->data;
800 if (src->extra_data) /* debian style? */
801 sprintf_alloc (&url, "%s/%s/%s", src->value, src->extra_data,
802 src->gzip ? "Packages.gz" : "Packages");
804 sprintf_alloc (&url, "%s/%s", src->value, src->gzip ? "Packages.gz" : "Packages");
806 sprintf_alloc (&list_file_name, "%s/%s", lists_dir, src->name);
810 struct _curl_cb_data cb_data;
811 char *tmp_file_name = NULL;
813 sprintf_alloc (&tmp_file_name, "%s/%s.gz", tmp, src->name);
815 /* XXX: Note: downloading url */
817 cb_data.cb = progress_callback;
818 cb_data.progress_data = &pdata;
820 cb_data.user_data = user_data;
821 cb_data.start_range = 100 * sources_done / sources_list_count;
822 cb_data.finish_range = 100 * (sources_done + 1) / sources_list_count;
824 err = opkg_download (opkg->conf, url, tmp_file_name, (curl_progress_func) curl_progress_cb, &cb_data);
828 /* XXX: Note: Inflating downloaded file */
829 in = fopen (tmp_file_name, "r");
830 out = fopen (list_file_name, "w");
839 unlink (tmp_file_name);
841 free (tmp_file_name);
844 err = opkg_download (opkg->conf, url, list_file_name, NULL, NULL);
848 /* XXX: Error: download error */
849 result = OPKG_DOWNLOAD_FAILED;
853 #if defined(HAVE_GPGME) || defined(HAVE_OPENSSL)
854 if ( opkg->conf->check_signature ) {
856 /* download detached signitures to verify the package lists */
857 /* get the url for the sig file */
858 if (src->extra_data) /* debian style? */
859 sprintf_alloc (&url, "%s/%s/%s", src->value, src->extra_data,
862 sprintf_alloc (&url, "%s/%s", src->value, "Packages.sig");
864 /* create filename for signature */
865 sprintf_alloc (&sig_file_name, "%s/%s.sig", lists_dir, src->name);
867 /* make sure there is no existing signature file */
868 unlink (sig_file_name);
870 err = opkg_download (opkg->conf, url, sig_file_name, NULL, NULL);
873 /* XXX: Warning: Download failed */
878 err = opkg_verify_file (opkg->conf, list_file_name, sig_file_name);
881 /* XXX: Notice: Signature check passed */
885 /* XXX: Warning: Signature check failed */
888 free (sig_file_name);
889 free (list_file_name);
893 /* XXX: Note: Signature check for %s skipped because GPG support was not
894 * enabled in this build
899 progress (pdata, 100 * sources_done / sources_list_count);
906 /* Now re-read the package lists to update package hash tables. */
907 opkg_re_read_config_files (opkg);
914 opkg_list_packages (opkg_t *opkg, opkg_package_callback_t callback, void *user_data)
920 opkg_assert (callback);
922 all = pkg_vec_alloc ();
923 pkg_hash_fetch_available (&opkg->conf->pkg_hash, all);
924 for (i = 0; i < all->len; i++)
927 opkg_package_t *package;
931 package = pkg_t_to_opkg_package_t (pkg);
932 callback (opkg, package, user_data);
933 opkg_package_free (package);
942 opkg_list_upgradable_packages (opkg_t *opkg, opkg_package_callback_t callback, void *user_data)
944 struct active_list *head;
945 struct active_list *node;
946 pkg_t *old=NULL, *new = NULL;
947 static opkg_package_t* package=NULL;
951 opkg_assert (callback);
953 /* ensure all data is valid */
954 pkg_info_preinstall_check (opkg->conf);
956 head = prepare_upgrade_list(opkg->conf);
957 for (node=active_list_next(head, head); node; active_list_next(head,node)) {
958 old = list_entry(node, pkg_t, list);
959 new = pkg_hash_fetch_best_installation_candidate_by_name(opkg->conf, old->name, NULL);
960 package = pkg_t_to_opkg_package_t (new);
961 callback (opkg, package, user_data);
962 opkg_package_free (package);
964 active_list_head_delete(head);
969 opkg_find_package (opkg_t *opkg, const char *name, const char *ver, const char *arch, const char *repo)
972 opkg_package_t *package = NULL;
974 #define sstrcmp(x,y) (x && y) ? strcmp (x, y) : 0
978 all = pkg_vec_alloc ();
979 pkg_hash_fetch_available (&opkg->conf->pkg_hash, all);
980 for (i = 0; i < all->len; i++)
988 if (sstrcmp (pkg->name, name))
992 pkgv = pkg_version_str_alloc (pkg);
993 if (sstrcmp (pkgv, ver))
1000 /* check architecture */
1003 if (sstrcmp (pkg->architecture, arch))
1007 /* check repository */
1010 if (sstrcmp (pkg->src->name, repo))
1015 package = pkg_t_to_opkg_package_t (pkg);
1025 #include <curl/curl.h>
1028 * @brief Check the accessibility of repositories. It will try to access the repository to check if the respository is accessible throught current network status.
1029 * @param opkg The opkg_t
1030 * @return return how many repositories cannot access. 0 means all okay.
1032 int opkg_repository_accessibility_check(opkg_t *opkg)
1034 pkg_src_list_elt_t *iter;
1035 str_list_elt_t *iter1;
1042 opkg_assert(opkg != NULL);
1044 src = str_list_alloc();
1046 list_for_each_entry(iter, &opkg->conf->pkg_src_list.head, node)
1048 if (strstr(((pkg_src_t *)iter->data)->value, "://") &&
1049 index(strstr(((pkg_src_t *)iter->data)->value, "://") + 3, '/'))
1050 stmp = strndup(((pkg_src_t *)iter->data)->value,
1051 (index(strstr(((pkg_src_t *)iter->data)->value, "://") + 3, '/') - ((pkg_src_t *)iter->data)->value)*sizeof(char));
1054 stmp = strdup(((pkg_src_t *)iter->data)->value);
1056 for (iter1 = str_list_first(src); iter1; iter1 = str_list_next(src, iter1))
1058 if (strstr(iter1->data, stmp))
1064 sprintf_alloc(&repo_ptr, "%s/index.html",stmp);
1067 str_list_append(src, repo_ptr);
1071 while (repositories > 0)
1073 iter1 = str_list_pop(src);
1076 err = opkg_download(opkg->conf, iter1->data, "/dev/null", NULL, NULL);
1078 if (!(err == CURLE_OK ||
1079 err == CURLE_HTTP_RETURNED_ERROR ||
1080 err == CURLE_FILE_COULDNT_READ_FILE ||
1081 err == CURLE_REMOTE_FILE_NOT_FOUND ||
1082 err == CURLE_TFTP_NOTFOUND
1089 str_list_elt_deinit(iter1);