From: Alejandro del Castillo Date: Wed, 22 Feb 2017 23:32:08 +0000 (-0600) Subject: set_flags_from_control: remove function X-Git-Url: https://git.librecmc.org/?p=oweals%2Fopkg-lede.git;a=commitdiff_plain;h=07f3b022c1cf6bcafe87f083ef2482eb7a8ec701 set_flags_from_control: remove function During installs, install_data_files calls set_flags_from_control to capture the case where fields, such as "Essential", are present in the package control file but are missing on the Packages file. This operation is expensive (re-parses the control file) and is catering to a case that should not be supported on the first place. Signed-off-by: Alejandro del Castillo [Jo-Philipp Wich: remove function prototype as well] Signed-off-by: Jo-Philipp Wich --- diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c index e18c7c6..ccf6f45 100644 --- a/libopkg/opkg_install.c +++ b/libopkg/opkg_install.c @@ -1090,13 +1090,6 @@ static int install_data_files(pkg_t * pkg) return err; } - /* The "Essential" control field may only be present in the control - * file and not in the Packages list. Ensure we capture it regardless. - * - * XXX: This should be fixed outside of opkg, in the Package list. - */ - set_flags_from_control(pkg); - opkg_msg(DEBUG, "Calling pkg_write_filelist.\n"); err = pkg_write_filelist(pkg); if (err) diff --git a/libopkg/pkg.c b/libopkg/pkg.c index 313e691..c0de884 100644 --- a/libopkg/pkg.c +++ b/libopkg/pkg.c @@ -504,34 +504,6 @@ abstract_pkg_t *abstract_pkg_new(void) return ab_pkg; } -void set_flags_from_control(pkg_t * pkg) -{ - char *file_name; - FILE *fp; - - sprintf_alloc(&file_name, "%s/%s.control", pkg->dest->info_dir, - pkg->name); - - fp = fopen(file_name, "r"); - if (fp == NULL) { - opkg_perror(ERROR, "Failed to open %s", file_name); - free(file_name); - return; - } - - free(file_name); - - if (pkg_parse_from_stream(pkg, fp, PFM_ALL ^ PFM_ESSENTIAL)) { - opkg_msg(DEBUG, - "Unable to read control file for %s. May be empty.\n", - pkg->name); - } - - fclose(fp); - - return; -} - static const char *pkg_state_want_to_str(pkg_state_want_t sw) { int i; diff --git a/libopkg/pkg.h b/libopkg/pkg.h index 04ca85e..cf405b1 100644 --- a/libopkg/pkg.h +++ b/libopkg/pkg.h @@ -235,8 +235,6 @@ int abstract_pkg_name_compare(const void *a, const void *b); void pkg_formatted_info(FILE * fp, pkg_t * pkg); void pkg_formatted_field(FILE * fp, pkg_t * pkg, const char *field); -void set_flags_from_control(pkg_t * pkg); - void pkg_print_status(pkg_t * pkg, FILE * file); str_list_t *pkg_get_installed_files(pkg_t * pkg); void pkg_free_installed_files(pkg_t * pkg);