libopkg: remove "extra_data" option
authorPaul Spooren <mail@aparcar.org>
Thu, 24 Sep 2020 20:54:33 +0000 (10:54 -1000)
committerPaul Spooren <mail@aparcar.org>
Sun, 6 Dec 2020 08:10:32 +0000 (22:10 -1000)
The "extra_data" allowed to add an extra option behind a repository
definition. This was only ever used to either ignore a specific feed by
setting it to "__dummy__" or adding a sub-folder in the repository path,
as done for Debian repositories.

Instead of using "__dummy__" it is cleaner to "comment out" the specific
repository and Debian repository structure is nowhere used in the
OpenWrt ecosystem, therefore it seem save to remove "extra_data".

Signed-off-by: Paul Spooren <mail@aparcar.org>
libopkg/opkg.c
libopkg/opkg_cmd.c
libopkg/opkg_conf.c
libopkg/pkg_src.c
libopkg/pkg_src.h
libopkg/pkg_src_list.c
libopkg/pkg_src_list.h

index 85ab5a05347d284586755473839d1c581cfc6315..510b9c883b2dc58d55b5606548c96f84d82ed5c4 100644 (file)
@@ -529,13 +529,8 @@ opkg_update_package_lists(opkg_progress_callback_t progress_callback,
 
                src = (pkg_src_t *) iter->data;
 
-               if (src->extra_data)    /* debian style? */
-                       sprintf_alloc(&url, "%s/%s/%s", src->value,
-                                     src->extra_data,
-                                     src->gzip ? "Packages.gz" : "Packages");
-               else
-                       sprintf_alloc(&url, "%s/%s", src->value,
-                                     src->gzip ? "Packages.gz" : "Packages");
+               sprintf_alloc(&url, "%s/%s", src->value,
+                             src->gzip ? "Packages.gz" : "Packages");
 
                sprintf_alloc(&list_file_name, "%s/%s", lists_dir, src->name);
 
@@ -550,12 +545,8 @@ opkg_update_package_lists(opkg_progress_callback_t progress_callback,
                        char *sig_file_name;
                        /* download detached signitures to verify the package lists */
                        /* get the url for the sig file */
-                       if (src->extra_data)    /* debian style? */
-                               sprintf_alloc(&url, "%s/%s/%s", src->value,
-                                             src->extra_data, "Packages.sig");
-                       else
-                               sprintf_alloc(&url, "%s/%s", src->value,
-                                             "Packages.sig");
+                       sprintf_alloc(&url, "%s/%s", src->value,
+                                     "Packages.sig");
 
                        /* create filename for signature */
                        sprintf_alloc(&sig_file_name, "%s/%s.sig", lists_dir,
index a32955811e3244939ae7cd1a24ba6a722c2909e7..83e345e527856ec5eebdcd4fb76284f8154839e3 100644 (file)
@@ -117,16 +117,8 @@ static int opkg_update_cmd(int argc, char **argv)
 
                src = (pkg_src_t *) iter->data;
 
-               if (src->extra_data && strcmp(src->extra_data, "__dummy__ "))
-                       continue;
-
-               if (src->extra_data)    /* debian style? */
-                       sprintf_alloc(&url, "%s/%s/%s", src->value,
-                                     src->extra_data,
-                                     src->gzip ? "Packages.gz" : "Packages");
-               else
-                       sprintf_alloc(&url, "%s/%s", src->value,
-                                     src->gzip ? "Packages.gz" : "Packages");
+               sprintf_alloc(&url, "%s/%s", src->value,
+                             src->gzip ? "Packages.gz" : "Packages");
 
                sprintf_alloc(&list_file_name, "%s/%s", lists_dir, src->name);
                pkglist_dl_error = 0;
@@ -146,12 +138,8 @@ static int opkg_update_cmd(int argc, char **argv)
                if (pkglist_dl_error == 0 && conf->check_signature) {
                        /* download detached signitures to verify the package lists */
                        /* get the url for the sig file */
-                       if (src->extra_data)    /* debian style? */
-                               sprintf_alloc(&url, "%s/%s/%s", src->value,
-                                             src->extra_data, "Packages.sig");
-                       else
-                               sprintf_alloc(&url, "%s/%s", src->value,
-                                             "Packages.sig");
+                       sprintf_alloc(&url, "%s/%s", src->value,
+                                     "Packages.sig");
 
                        /* create temporary file for it */
                        char *tmp_file_name;
index ee151f574f3f09dc68fb705c8b1fb6564a130985..5fe0be9363c4bce6fd1d93c60ccdef99452da33e 100644 (file)
@@ -218,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++;
 
@@ -261,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,
@@ -294,7 +280,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, 0);
+                                                           value, 0);
                                } else {
                                        opkg_msg(ERROR,
                                                 "Duplicate src declaration (%s %s). "
@@ -304,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). "
@@ -338,8 +324,6 @@ opkg_conf_parse_file(const char *filename,
                free(type);
                free(name);
                free(value);
-               if (extra)
-                       free(extra);
 
 NEXT_LINE:
                free(line);
index fae3ce37722ab9279f6baf9f1b68d265ffcce07f..83ede168b896d5db9568b70f2cbc40360139ca8f 100644 (file)
 #include "libbb/libbb.h"
 
 int pkg_src_init(pkg_src_t * src, const char *name, const char *base_url,
-                const char *extra_data, int gzip)
+                int gzip)
 {
        src->gzip = gzip;
        src->name = xstrdup(name);
        src->value = xstrdup(base_url);
-       if (extra_data)
-               src->extra_data = xstrdup(extra_data);
-       else
-               src->extra_data = NULL;
        return 0;
 }
 
@@ -35,6 +31,4 @@ void pkg_src_deinit(pkg_src_t * src)
 {
        free(src->name);
        free(src->value);
-       if (src->extra_data)
-               free(src->extra_data);
 }
index 1320f1fb104c39fb30dee0734dc20f3d2068172c..e5e7a427895f89d48111319032abe39df5f29c70 100644 (file)
 typedef struct {
        char *name;
        char *value;
-       char *extra_data;
        int gzip;
 } pkg_src_t;
 
 int pkg_src_init(pkg_src_t * src, const char *name, const char *base_url,
-                const char *extra_data, int gzip);
+                int gzip);
 void pkg_src_deinit(pkg_src_t * src);
 
 #endif
index cc24438116ba796f1e2ff906e09cf239646dcc22..525942346b57ddb34713b24d19bb8c0f9d01f1fe 100644 (file)
@@ -42,11 +42,11 @@ void pkg_src_list_deinit(pkg_src_list_t * list)
 
 pkg_src_t *pkg_src_list_append(pkg_src_list_t * list,
                               const char *name, const char *base_url,
-                              const char *extra_data, int gzip)
+                              int gzip)
 {
        /* freed in pkg_src_list_deinit */
        pkg_src_t *pkg_src = xcalloc(1, sizeof(pkg_src_t));
-       pkg_src_init(pkg_src, name, base_url, extra_data, gzip);
+       pkg_src_init(pkg_src, name, base_url, gzip);
 
        void_list_append((void_list_t *) list, pkg_src);
 
index 71a10f6321f423b29c781a06b1c0cb9a58461fc2..0852614c64096040de2e78aa71a14c489f40d06d 100644 (file)
@@ -37,7 +37,6 @@ void pkg_src_list_init(pkg_src_list_t * list);
 void pkg_src_list_deinit(pkg_src_list_t * list);
 
 pkg_src_t *pkg_src_list_append(pkg_src_list_t * list, const char *name,
-                              const char *root_dir, const char *extra_data,
-                              int gzip);
+                              const char *root_dir, int gzip);
 
 #endif