r4140 - trunk/src/target/opkg/libopkg

thomas at sita.openmoko.org thomas at sita.openmoko.org
Fri Feb 29 18:51:27 CET 2008


Author: thomas
Date: 2008-02-29 18:51:25 +0100 (Fri, 29 Feb 2008)
New Revision: 4140

Modified:
   trunk/src/target/opkg/libopkg/pkg.c
   trunk/src/target/opkg/libopkg/pkg.h
   trunk/src/target/opkg/libopkg/pkg_parse.c
Log:
opkg: add support for Tags attribute


Modified: trunk/src/target/opkg/libopkg/pkg.c
===================================================================
--- trunk/src/target/opkg/libopkg/pkg.c	2008-02-29 14:31:27 UTC (rev 4139)
+++ trunk/src/target/opkg/libopkg/pkg.c	2008-02-29 17:51:25 UTC (rev 4140)
@@ -206,6 +206,8 @@
      pkg->installed_files_ref_cnt = 1;
      pkg_free_installed_files(pkg);
      pkg->essential = 0;
+     free (pkg->tags);
+     pkg->tags = NULL;
 }
 
 int pkg_init_from_file(pkg_t *pkg, const char *filename)
@@ -522,6 +524,10 @@
      strncat(buff ,line, strlen(line));
      free(line);
 
+     line = pkg_formatted_field(pkg, "Tags");
+     strncat(buff ,line, strlen(line));
+     free(line);
+
      return buff;
 }
 
@@ -937,6 +943,21 @@
 	  }
      }
 	  break;
+     case 't':
+     case 'T':
+	  if (strcasecmp(field, "Tags") == 0) {
+	       /* Tags */
+	       if (pkg->tags) {
+                   temp = (char *)realloc(temp,strlen(pkg->tags)+8);
+                   if ( temp == NULL ){
+	              fprintf(stderr, "%s: out of memory\n", __FUNCTION__);
+	              return NULL;
+                   }
+                   temp[0]='\0';
+                   snprintf(temp, (strlen(pkg->tags)+8), "Tags: %s\n", pkg->tags);
+	       }
+	  }
+	  break;
      case 'v':
      case 'V': {
 	  /* Version */

Modified: trunk/src/target/opkg/libopkg/pkg.h
===================================================================
--- trunk/src/target/opkg/libopkg/pkg.h	2008-02-29 14:31:27 UTC (rev 4139)
+++ trunk/src/target/opkg/libopkg/pkg.h	2008-02-29 17:51:25 UTC (rev 4140)
@@ -124,6 +124,7 @@
      char *section;
      char *maintainer;
      char *description;
+     char *tags;
      pkg_state_want_t state_want;
      pkg_state_flag_t state_flag;
      pkg_state_status_t state_status;

Modified: trunk/src/target/opkg/libopkg/pkg_parse.c
===================================================================
--- trunk/src/target/opkg/libopkg/pkg_parse.c	2008-02-29 14:31:27 UTC (rev 4139)
+++ trunk/src/target/opkg/libopkg/pkg_parse.c	2008-02-29 17:51:25 UTC (rev 4140)
@@ -282,6 +282,11 @@
 		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);





More information about the commitlog mailing list