set_flags_from_control: remove function
[oweals/opkg-lede.git] / libopkg / pkg.c
index a76e152d4420c49153eac0eaff2316cc055a3ad6..c0de884bfe8916cd9048e1d035a359b560732c21 100644 (file)
@@ -15,8 +15,6 @@
    General Public License for more details.
 */
 
-#include "config.h"
-
 #include <stdio.h>
 #include <string.h>
 #include <ctype.h>
@@ -483,6 +481,9 @@ int pkg_merge(pkg_t * oldpkg, pkg_t * newpkg)
        if (!oldpkg->essential)
                oldpkg->essential = newpkg->essential;
 
+       if (!oldpkg->provided_by_hand)
+               oldpkg->provided_by_hand = newpkg->provided_by_hand;
+
        return 0;
 }
 
@@ -503,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;
@@ -849,13 +822,11 @@ void pkg_formatted_field(FILE * fp, pkg_t * pkg, const char *field)
                        if (p) {
                                fprintf(fp, "Section: %s\n", p);
                        }
-#if defined HAVE_SHA256
                } else if (strcasecmp(field, "SHA256sum") == 0) {
                        p = pkg_get_string(pkg, PKG_SHA256SUM);
                        if (p) {
                                fprintf(fp, "SHA256sum: %s\n", p);
                        }
-#endif
                } else if (strcasecmp(field, "Size") == 0) {
                        i = pkg_get_int(pkg, PKG_SIZE);
                        if (i) {
@@ -1402,7 +1373,7 @@ int pkg_run_script(pkg_t * pkg, const char *script, const char *args)
        sprintf_alloc(&cmd, "%s %s", path, args);
        free(path);
        {
-               const char *argv[] = { "sh", "-c", cmd, NULL };
+               const char *argv[] = { "/bin/sh", "-c", cmd, NULL };
                err = xsystem(argv);
        }
        free(cmd);