X-Git-Url: https://git.librecmc.org/?p=oweals%2Fopkg-lede.git;a=blobdiff_plain;f=libopkg%2Fopkg.c;h=87c3244f2652849ba0041bdb4284cd38fcb24472;hp=a8f85a95fb21f86e4c1518091737b68fc6d446da;hb=0066c1ac6151d99b95453eeab3307e99f5884a45;hpb=d9150d59a75023bc996a101208e4eb28fbe4ec56 diff --git a/libopkg/opkg.c b/libopkg/opkg.c index a8f85a9..87c3244 100644 --- a/libopkg/opkg.c +++ b/libopkg/opkg.c @@ -15,7 +15,10 @@ General Public License for more details. */ -#include +#include "config.h" + +#include +#include #include #include "opkg.h" @@ -241,7 +244,7 @@ opkg_set_option(char *option, void *value) /** * @brief libopkg API: Install package * @param package_name The name of package in which is going to install - * @param progress_callback The callback function that report the status to caller. + * @param progress_callback The callback function that report the status to caller. */ int opkg_install_package(const char *package_name, @@ -520,6 +523,10 @@ opkg_upgrade_all(opkg_progress_callback_t progress_callback, void *user_data) if (err) return 1; + /* write out status files and file lists */ + opkg_conf_write_status_files(); + pkg_write_changed_filelists(); + pdata.pkg = NULL; progress(pdata, 100); return 0; @@ -753,7 +760,7 @@ opkg_list_upgradable_packages(opkg_package_callback_t callback, void *user_data) head = prepare_upgrade_list(); for (node = active_list_next(head, head); node; - active_list_next(head, node)) { + node = active_list_next(head, node)) { old = list_entry(node, pkg_t, list); new = pkg_hash_fetch_best_installation_candidate_by_name(old->name); if (new == NULL) @@ -813,12 +820,9 @@ opkg_find_package(const char *name, const char *ver, const char *arch, return pkg; } -#ifdef HAVE_CURL -#include -#endif /** - * @brief Check the accessibility of repositories. It will try to access the repository to check if the respository is accessible throught current network status. - * @return return how many repositories cannot access. 0 means all okay. + * @brief Check the accessibility of repositories. + * @return return how many repositories cannot access. 0 means all okay. */ int opkg_repository_accessibility_check(void) @@ -828,7 +832,6 @@ opkg_repository_accessibility_check(void) str_list_t *src; int repositories = 0; int ret = 0; - int err; char *repo_ptr; char *stmp; char *host, *end; @@ -859,24 +862,17 @@ opkg_repository_accessibility_check(void) free(repo_ptr); repositories++; } + while (repositories > 0) { iter1 = str_list_pop(src); repositories--; - err = opkg_download(iter1->data, "/dev/null", NULL, NULL); -#ifdef HAVE_CURL - if (!(err == CURLE_OK || - err == CURLE_HTTP_RETURNED_ERROR || - err == CURLE_FILE_COULDNT_READ_FILE || - err == CURLE_REMOTE_FILE_NOT_FOUND || - err == CURLE_TFTP_NOTFOUND)) { -#else - if (!(err == 0)) { -#endif + if (opkg_download(iter1->data, "/dev/null", NULL, NULL)) ret++; - } str_list_elt_deinit(iter1); } + free(src); + return ret; }