projects
/
oweals
/
opkg-lede.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
libopkg: print error messages to stderr
[oweals/opkg-lede.git]
/
libopkg
/
opkg.c
diff --git
a/libopkg/opkg.c
b/libopkg/opkg.c
index b36dc1b0af88779e52e89f8fae8b6351ff72bac0..7c3e18f878e5fe05910cfd255f596268d11fb431 100644
(file)
--- a/
libopkg/opkg.c
+++ b/
libopkg/opkg.c
@@
-112,11
+112,14
@@
curl_progress_cb(struct _curl_cb_data *cb_data, double t, /* dltotal */
}
}
+static struct opkg_conf saved_conf;
/*** Public API ***/
int
opkg_new()
{
/*** Public API ***/
int
opkg_new()
{
+ saved_conf = *conf;
+
if (opkg_conf_init())
goto err0;
if (opkg_conf_init())
goto err0;
@@
-150,20
+153,9
@@
opkg_free(void)
int
opkg_re_read_config_files(void)
{
int
opkg_re_read_config_files(void)
{
- pkg_hash_deinit();
- pkg_hash_init();
-
- if (pkg_hash_load_feeds())
- goto err;
-
- if (pkg_hash_load_status_files())
- goto err;
-
- return 0;
-
-err:
- pkg_hash_deinit();
- return -1;
+ opkg_free();
+ *conf = saved_conf;
+ return opkg_new();
}
void
}
void
@@
-350,7
+342,7
@@
opkg_install_package(const char *package_name,
err = opkg_download(url, pkg->local_filename,
(curl_progress_func) curl_progress_cb,
err = opkg_download(url, pkg->local_filename,
(curl_progress_func) curl_progress_cb,
- &cb_data);
+ &cb_data
, 0
);
free(url);
if (err) {
free(url);
if (err) {
@@
-621,7
+613,7
@@
opkg_update_package_lists(opkg_progress_callback_t progress_callback,
err = opkg_download(url, tmp_file_name,
(curl_progress_func) curl_progress_cb,
err = opkg_download(url, tmp_file_name,
(curl_progress_func) curl_progress_cb,
- &cb_data);
+ &cb_data
, 0
);
if (err == 0) {
opkg_msg(INFO, "Inflating %s...\n",
if (err == 0) {
opkg_msg(INFO, "Inflating %s...\n",
@@
-640,7
+632,7
@@
opkg_update_package_lists(opkg_progress_callback_t progress_callback,
}
free(tmp_file_name);
} else
}
free(tmp_file_name);
} else
- err = opkg_download(url, list_file_name, NULL, NULL);
+ err = opkg_download(url, list_file_name, NULL, NULL
, 0
);
if (err) {
opkg_msg(ERROR, "Couldn't retrieve %s\n", url);
if (err) {
opkg_msg(ERROR, "Couldn't retrieve %s\n", url);
@@
-667,7
+659,7
@@
opkg_update_package_lists(opkg_progress_callback_t progress_callback,
/* make sure there is no existing signature file */
unlink(sig_file_name);
/* make sure there is no existing signature file */
unlink(sig_file_name);
- err = opkg_download(url, sig_file_name, NULL, NULL);
+ err = opkg_download(url, sig_file_name, NULL, NULL
, 0
);
if (err) {
opkg_msg(ERROR, "Couldn't retrieve %s\n", url);
} else {
if (err) {
opkg_msg(ERROR, "Couldn't retrieve %s\n", url);
} else {
@@
-685,7
+677,6
@@
opkg_update_package_lists(opkg_progress_callback_t progress_callback,
}
}
free(sig_file_name);
}
}
free(sig_file_name);
- free(list_file_name);
free(url);
}
#else
free(url);
}
#else
@@
-693,6
+684,7
@@
opkg_update_package_lists(opkg_progress_callback_t progress_callback,
" has not been enabled in this build\n",
list_file_name);
#endif
" has not been enabled in this build\n",
list_file_name);
#endif
+ free(list_file_name);
sources_done++;
progress(pdata, 100 * sources_done / sources_list_count);
sources_done++;
progress(pdata, 100 * sources_done / sources_list_count);
@@
-778,6
+770,7
@@
pkg_t *
opkg_find_package(const char *name, const char *ver, const char *arch,
const char *repo)
{
opkg_find_package(const char *name, const char *ver, const char *arch,
const char *repo)
{
+ int pkg_found = 0;
pkg_t *pkg = NULL;
pkg_vec_t *all;
int i;
pkg_t *pkg = NULL;
pkg_vec_t *all;
int i;
@@
-815,12
+808,13
@@
opkg_find_package(const char *name, const char *ver, const char *arch,
}
/* match found */
}
/* match found */
+ pkg_found = 1;
break;
}
pkg_vec_free(all);
break;
}
pkg_vec_free(all);
- return pkg;
+ return pkg
_found ? pkg : NULL
;
}
/**
}
/**
@@
-870,7
+864,7
@@
opkg_repository_accessibility_check(void)
iter1 = str_list_pop(src);
repositories--;
iter1 = str_list_pop(src);
repositories--;
- if (opkg_download(iter1->data, "/dev/null", NULL, NULL))
+ if (opkg_download(iter1->data, "/dev/null", NULL, NULL
, 0
))
ret++;
str_list_elt_deinit(iter1);
}
ret++;
str_list_elt_deinit(iter1);
}