libopkg: drop custom md5 implementation, unconditionally enable sha256 support
[oweals/opkg-lede.git] / libopkg / pkg.c
index 3633a3c932d9e3260517924a3a0528a8371fd85e..114cf05705666ab43c57903faafe6ba29e257eeb 100644 (file)
@@ -15,8 +15,6 @@
    General Public License for more details.
 */
 
-#include "config.h"
-
 #include <stdio.h>
 #include <string.h>
 #include <ctype.h>
@@ -346,6 +344,11 @@ int pkg_init_from_file(pkg_t * pkg, const char *filename)
 
        pkg_init(pkg);
 
+       if (!(pkg->state_flag & SF_NEED_DETAIL)) {
+               opkg_msg(DEBUG, "applying abpkg flag to %s\n", filename);
+               pkg->state_flag |= SF_NEED_DETAIL;
+       }
+
        pkg_set_string(pkg, PKG_LOCAL_FILENAME, filename);
 
        tmp = xstrdup(filename);
@@ -796,10 +799,9 @@ void pkg_formatted_field(FILE * fp, pkg_t * pkg, const char *field)
                        ab_pkg = pkg_get_ptr(pkg, PKG_PROVIDES);
                        if (ab_pkg && ab_pkg[0] && ab_pkg[1]) {
                                fprintf(fp, "Provides:");
-                               for (i = 0, ab_pkg++; *ab_pkg; i++, ab_pkg++) {
-                                       fprintf(fp, "%s %s", i == 0 ? "" : ",",
-                                               (*ab_pkg)->name);
-                                       ab_pkg++;
+                               for (i = 1; ab_pkg[i]; i++) {
+                                       fprintf(fp, "%s %s", i == 1 ? "" : ",",
+                                               ab_pkg[i]->name);
                                }
                                fprintf(fp, "\n");
                        }
@@ -845,13 +847,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) {