set_flags_from_control: remove function
authorAlejandro del Castillo <alejandro.delcastillo@ni.com>
Wed, 22 Feb 2017 23:32:08 +0000 (17:32 -0600)
committerJo-Philipp Wich <jo@mein.io>
Wed, 15 Mar 2017 01:16:39 +0000 (02:16 +0100)
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 <alejandro.delcastillo@ni.com>
[Jo-Philipp Wich: remove function prototype as well]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
libopkg/opkg_install.c
libopkg/pkg.c
libopkg/pkg.h

index e18c7c6bc19b8285dd65180e1f58195666e1c681..ccf6f455377674a922768270a049d2f162fdf6fc 100644 (file)
@@ -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)
index 313e691d5159aa2201d137ceb341a3485ad9ed0f..c0de884bfe8916cd9048e1d035a359b560732c21 100644 (file)
@@ -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;
index 04ca85e5c0761b50bea437c8797ffc3bf07062c4..cf405b15e8148d281f6e75438f1ee800a671d978 100644 (file)
@@ -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);