libopkg: remove "extra_data" option
[project/opkg-lede.git] / libopkg / opkg_conf.c
index 589fc49479dab696bc8f4a973d91a6b0479d00bc..5fe0be9363c4bce6fd1d93c60ccdef99452da33e 100644 (file)
@@ -54,8 +54,10 @@ opkg_option_t options[] = {
        {"force_postinstall", OPKG_OPT_TYPE_BOOL, &_conf.force_postinstall},
        {"force_checksum", OPKG_OPT_TYPE_BOOL, &_conf.force_checksum},
        {"check_signature", OPKG_OPT_TYPE_BOOL, &_conf.check_signature},
+       {"no_check_certificate", OPKG_OPT_TYPE_BOOL, &_conf.no_check_certificate},
        {"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},
        {"no_proxy", OPKG_OPT_TYPE_STRING, &_conf.no_proxy},
        {"test", OPKG_OPT_TYPE_BOOL, &_conf.noaction},
        {"noaction", OPKG_OPT_TYPE_BOOL, &_conf.noaction},
@@ -70,6 +72,7 @@ opkg_option_t options[] = {
        {"size", OPKG_OPT_TYPE_BOOL, &_conf.size},
        {"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}
 };
 
@@ -181,8 +184,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;
@@ -216,7 +218,7 @@ opkg_conf_parse_file(const char *filename,
 
        while (1) {
                char *line;
-               char *type, *name, *value, *extra;
+               char *type, *name, *value;
 
                line_num++;
 
@@ -259,20 +261,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,
@@ -288,31 +276,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). "
@@ -322,7 +290,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). "
@@ -356,8 +324,6 @@ opkg_conf_parse_file(const char *filename,
                free(type);
                free(name);
                free(value);
-               if (extra)
-                       free(extra);
 
 NEXT_LINE:
                free(line);
@@ -455,7 +421,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);
@@ -483,8 +448,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;
        }
 
@@ -515,8 +479,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;
                }
@@ -570,6 +533,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);
@@ -623,7 +589,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);
 
@@ -664,7 +629,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);