[PATCH 2/2] libopkg: remove "extra_data" option
Paul Spooren
mail at aparcar.org
Thu Sep 24 16:54:33 EDT 2020
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 at aparcar.org>
---
libopkg/opkg.c | 17 ++++-------------
libopkg/opkg_cmd.c | 20 ++++----------------
libopkg/opkg_conf.c | 22 +++-------------------
libopkg/pkg_src.c | 8 +-------
libopkg/pkg_src.h | 3 +--
libopkg/pkg_src_list.c | 4 ++--
libopkg/pkg_src_list.h | 3 +--
7 files changed, 16 insertions(+), 61 deletions(-)
diff --git a/libopkg/opkg.c b/libopkg/opkg.c
index 3583488..191e028 100644
--- a/libopkg/opkg.c
+++ b/libopkg/opkg.c
@@ -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,
diff --git a/libopkg/opkg_cmd.c b/libopkg/opkg_cmd.c
index a329558..83e345e 100644
--- a/libopkg/opkg_cmd.c
+++ b/libopkg/opkg_cmd.c
@@ -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;
diff --git a/libopkg/opkg_conf.c b/libopkg/opkg_conf.c
index ee151f5..5fe0be9 100644
--- a/libopkg/opkg_conf.c
+++ b/libopkg/opkg_conf.c
@@ -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);
diff --git a/libopkg/pkg_src.c b/libopkg/pkg_src.c
index fae3ce3..83ede16 100644
--- a/libopkg/pkg_src.c
+++ b/libopkg/pkg_src.c
@@ -19,15 +19,11 @@
#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);
}
diff --git a/libopkg/pkg_src.h b/libopkg/pkg_src.h
index 1320f1f..e5e7a42 100644
--- a/libopkg/pkg_src.h
+++ b/libopkg/pkg_src.h
@@ -23,12 +23,11 @@
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
diff --git a/libopkg/pkg_src_list.c b/libopkg/pkg_src_list.c
index cc24438..5259423 100644
--- a/libopkg/pkg_src_list.c
+++ b/libopkg/pkg_src_list.c
@@ -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);
diff --git a/libopkg/pkg_src_list.h b/libopkg/pkg_src_list.h
index 71a10f6..0852614 100644
--- a/libopkg/pkg_src_list.h
+++ b/libopkg/pkg_src_list.h
@@ -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
--
2.25.1
More information about the openwrt-devel
mailing list