libopkg: support https_proxy
[project/opkg-lede.git] / libopkg / opkg_conf.c
index 08855ebcd3d8a7bfbc2c64d61b8e059ab5b22417..0cbd1ccab73fb1c8051ffd811d8e2c40f010e969 100644 (file)
@@ -58,6 +58,7 @@ opkg_option_t options[] = {
        {"ftp_proxy", OPKG_OPT_TYPE_STRING, &_conf.ftp_proxy},
        {"http_proxy", OPKG_OPT_TYPE_STRING, &_conf.http_proxy},
        {"http_timeout", OPKG_OPT_TYPE_STRING, &_conf.http_timeout},
+       {"https_proxy", OPKG_OPT_TYPE_STRING, &_conf.https_proxy},
        {"no_proxy", OPKG_OPT_TYPE_STRING, &_conf.no_proxy},
        {"test", OPKG_OPT_TYPE_BOOL, &_conf.noaction},
        {"noaction", OPKG_OPT_TYPE_BOOL, &_conf.noaction},
@@ -70,8 +71,10 @@ opkg_option_t options[] = {
        {"proxy_user", OPKG_OPT_TYPE_STRING, &_conf.proxy_user},
        {"query-all", OPKG_OPT_TYPE_BOOL, &_conf.query_all},
        {"size", OPKG_OPT_TYPE_BOOL, &_conf.size},
+       {"strip_abi", OPKG_OPT_TYPE_BOOL, &_conf.strip_abi},
        {"tmp_dir", OPKG_OPT_TYPE_STRING, &_conf.tmp_dir},
        {"verbosity", OPKG_OPT_TYPE_INT, &_conf.verbosity},
+       {"verify_program", OPKG_OPT_TYPE_STRING, &_conf.verify_program},
        {NULL, 0, NULL}
 };
 
@@ -183,8 +186,7 @@ static int opkg_conf_set_option(const char *name, const char *value)
 
 static int
 opkg_conf_parse_file(const char *filename,
-                    pkg_src_list_t * pkg_src_list,
-                    pkg_src_list_t * dist_src_list)
+                    pkg_src_list_t * pkg_src_list)
 {
        int line_num = 0;
        int err = 0;
@@ -218,7 +220,7 @@ opkg_conf_parse_file(const char *filename,
 
        while (1) {
                char *line;
-               char *type, *name, *value, *extra;
+               char *type, *name, *value;
 
                line_num++;
 
@@ -261,20 +263,6 @@ opkg_conf_parse_file(const char *filename,
                                         regmatch[9].rm_eo - regmatch[9].rm_so);
                }
 
-               extra = NULL;
-               if (regmatch[11].rm_so > 0) {
-                       if (regmatch[13].rm_so > 0
-                           && regmatch[13].rm_so != regmatch[13].rm_eo)
-                               extra =
-                                   xstrndup(line + regmatch[11].rm_so,
-                                            regmatch[13].rm_eo -
-                                            regmatch[11].rm_so);
-                       else
-                               extra = xstrndup(line + regmatch[11].rm_so,
-                                                regmatch[11].rm_eo -
-                                                regmatch[11].rm_so);
-               }
-
                if (regmatch[13].rm_so != regmatch[13].rm_eo
                    && strncmp(type, "dist", 4) != 0) {
                        opkg_msg(ERROR,
@@ -290,31 +278,11 @@ opkg_conf_parse_file(const char *filename,
                           tmp_src_nv_pair_list for sake of symmetry.) */
                        if (strcmp(type, "option") == 0) {
                                opkg_conf_set_option(name, value);
-                       } else if (strcmp(type, "dist") == 0) {
-                               if (!nv_pair_list_find
-                                   ((nv_pair_list_t *) dist_src_list, name)) {
-                                       pkg_src_list_append(dist_src_list, name,
-                                                           value, extra, 0);
-                               } else {
-                                       opkg_msg(ERROR,
-                                                "Duplicate dist declaration (%s %s). "
-                                                "Skipping.\n", name, value);
-                               }
-                       } else if (strcmp(type, "dist/gz") == 0) {
-                               if (!nv_pair_list_find
-                                   ((nv_pair_list_t *) dist_src_list, name)) {
-                                       pkg_src_list_append(dist_src_list, name,
-                                                           value, extra, 1);
-                               } else {
-                                       opkg_msg(ERROR,
-                                                "Duplicate dist declaration (%s %s). "
-                                                "Skipping.\n", name, value);
-                               }
                        } else if (strcmp(type, "src") == 0) {
                                if (!nv_pair_list_find
                                    ((nv_pair_list_t *) pkg_src_list, name)) {
                                        pkg_src_list_append(pkg_src_list, name,
-                                                           value, extra, 0);
+                                                           value, 0);
                                } else {
                                        opkg_msg(ERROR,
                                                 "Duplicate src declaration (%s %s). "
@@ -324,7 +292,7 @@ opkg_conf_parse_file(const char *filename,
                                if (!nv_pair_list_find
                                    ((nv_pair_list_t *) pkg_src_list, name)) {
                                        pkg_src_list_append(pkg_src_list, name,
-                                                           value, extra, 1);
+                                                           value, 1);
                                } else {
                                        opkg_msg(ERROR,
                                                 "Duplicate src declaration (%s %s). "
@@ -358,8 +326,6 @@ opkg_conf_parse_file(const char *filename,
                free(type);
                free(name);
                free(value);
-               if (extra)
-                       free(extra);
 
 NEXT_LINE:
                free(line);
@@ -457,7 +423,6 @@ static int glob_errfunc(const char *epath, int eerrno)
 int opkg_conf_init(void)
 {
        pkg_src_list_init(&conf->pkg_src_list);
-       pkg_src_list_init(&conf->dist_src_list);
        pkg_dest_list_init(&conf->pkg_dest_list);
        pkg_dest_list_init(&conf->tmp_dest_list);
        nv_pair_list_init(&conf->arch_list);
@@ -485,8 +450,7 @@ int opkg_conf_load(void)
                        goto err0;
                }
                if (opkg_conf_parse_file(conf->conf_file,
-                                        &conf->pkg_src_list,
-                                        &conf->dist_src_list))
+                                        &conf->pkg_src_list))
                        goto err1;
        }
 
@@ -517,8 +481,7 @@ int opkg_conf_load(void)
                            !strcmp(conf->conf_file, globbuf.gl_pathv[i]))
                                continue;
                if (opkg_conf_parse_file(globbuf.gl_pathv[i],
-                                        &conf->pkg_src_list,
-                                        &conf->dist_src_list) < 0) {
+                                        &conf->pkg_src_list) < 0) {
                        globfree(&globbuf);
                        goto err1;
                }
@@ -572,6 +535,9 @@ int opkg_conf_load(void)
        if (conf->lists_dir == NULL)
                conf->lists_dir = xstrdup(OPKG_CONF_LISTS_DIR);
 
+       if (conf->verify_program == NULL)
+               conf->verify_program = xstrdup(OPKG_CONF_DEFAULT_VERIFY_PROGRAM);
+
        if (conf->offline_root) {
                sprintf_alloc(&tmp, "%s/%s", conf->offline_root,
                              conf->lists_dir);
@@ -625,7 +591,6 @@ err2:
        }
 err1:
        pkg_src_list_deinit(&conf->pkg_src_list);
-       pkg_src_list_deinit(&conf->dist_src_list);
        pkg_dest_list_deinit(&conf->pkg_dest_list);
        nv_pair_list_deinit(&conf->arch_list);
 
@@ -666,7 +631,6 @@ void opkg_conf_deinit(void)
                free(conf->conf_file);
 
        pkg_src_list_deinit(&conf->pkg_src_list);
-       pkg_src_list_deinit(&conf->dist_src_list);
        pkg_dest_list_deinit(&conf->pkg_dest_list);
        nv_pair_list_deinit(&conf->arch_list);