opkg: remove redundant multiple_providers option and also remove redundant familiar_r...
[oweals/opkg-lede.git] / libopkg / pkg_parse.c
index 0bb4433c8d85229fff4a6ab15bea0007359e9d93..9b43754e04a6e51dcb305f4a6dc5a65c6cf91703 100644 (file)
@@ -1,4 +1,4 @@
-/* pkg_parse.c - the itsy package management system
+/* pkg_parse.c - the opkg package management system
 
    Steven M. Ayer
    
@@ -15,7 +15,7 @@
    General Public License for more details.
 */
 
-#include "opkg.h"
+#include "includes.h"
 #include <errno.h>
 #include <ctype.h>
    
@@ -105,9 +105,7 @@ void parseConffiles(pkg_t * pkg, char * raw)
 int parseVersion(pkg_t *pkg, char *raw)
 {
   char *colon, *eepochcolon;
-#ifdef USE_DEBVERSION
   char *hyphen;
-#endif
   unsigned long epoch;
 
   if (!*raw) {
@@ -140,41 +138,24 @@ int parseVersion(pkg_t *pkg, char *raw)
   }
 
   pkg->revision = "";
-  pkg->familiar_revision = "";
 
+  if (!pkg->version)
+  {
   pkg->version= malloc(strlen(raw)+1);
   if ( pkg->version == NULL ) {
      fprintf(stderr, "%s: out of memory \n", __FUNCTION__);
      return ENOMEM;
   }
   strcpy(pkg->version, raw);
+  }
 
-#ifdef USE_DEBVERSION
   hyphen= strrchr(pkg->version,'-');
 
   if (hyphen) {
     *hyphen++= 0;
-    if (strncmp("fam", hyphen, 3) == 0) {
-      pkg->familiar_revision=hyphen+3;
-      hyphen= strrchr(pkg->version,'-');
-      if (hyphen) {
-       *hyphen++= 0;
-       pkg->revision = hyphen;
-      }
-    } else {
       pkg->revision = hyphen;
-    }
   }
-#endif
-
-/*
-  fprintf(stderr,"Parsed version: %lu, %s, %s, %s\n",
-         pkg->epoch,
-         pkg->version,
-         pkg->revision,
-         pkg->familiar_revision);
-*/
-         
+
   return 0;
 }
 
@@ -295,6 +276,11 @@ int pkg_parse_raw(pkg_t *pkg, char ***raw, pkg_src_t *src, pkg_dest_t *dest)
                pkg->suggests_str = parseDependsString(*lines, &pkg->suggests_count);
            break;
 
+       case 'T':
+           if(isGenericFieldType("Tags:", *lines))
+               pkg->tags = parseGenericFieldType("Tags", *lines);
+           break;
+
        case 'M':
            if(isGenericFieldType("MD5sum:", *lines))
                pkg->md5sum = parseGenericFieldType("MD5sum", *lines);
@@ -312,6 +298,7 @@ int pkg_parse_raw(pkg_t *pkg, char ***raw, pkg_src_t *src, pkg_dest_t *dest)
            else if(isGenericFieldType("Installed-Time:", *lines)) {
                char *time_str = parseGenericFieldType("Installed-Time", *lines);
                pkg->installed_time = strtoul(time_str, NULL, 0);
+               free (time_str);
            }       
            break;
 
@@ -384,7 +371,11 @@ out:;
     *raw = lines;
 /* If the ipk has not a Provides line, we insert our false line */ 
     if ( pkg_false_provides==1)
-       pkg->provides_str = parseDependsString ((char *)"Provides: opkg_internal_use_only ", &pkg->provides_count);
+    {
+       pkg->provides_count = 1;
+       pkg->provides_str = malloc (sizeof (char*));
+       pkg->provides_str[0] = strdup ("opkg_internal_use_only");
+    }
 
     if (pkg->name) {
        return 0;