r3985 - trunk/src/target/opkg

thomas at sita.openmoko.org thomas at sita.openmoko.org
Wed Jan 30 17:40:27 CET 2008


Author: thomas
Date: 2008-01-30 17:40:24 +0100 (Wed, 30 Jan 2008)
New Revision: 3985

Modified:
   trunk/src/target/opkg/opkg_install.c
   trunk/src/target/opkg/pkg.c
   trunk/src/target/opkg/pkg.h
   trunk/src/target/opkg/pkg_parse.c
Log:
opkg: add a status flag to record if the package was automatically installed to
      satisfy a dependency


Modified: trunk/src/target/opkg/opkg_install.c
===================================================================
--- trunk/src/target/opkg/opkg_install.c	2008-01-30 11:34:15 UTC (rev 3984)
+++ trunk/src/target/opkg/opkg_install.c	2008-01-30 16:40:24 UTC (rev 3985)
@@ -413,6 +413,9 @@
 	      && (dep->state_status != SS_UNPACKED)) {
                opkg_message(conf, OPKG_DEBUG2,"Function: %s calling opkg_install_pkg \n",__FUNCTION__);
 	       err = opkg_install_pkg(conf, dep,0);
+	       /* mark this package as having been automatically installed to
+	        * satisfy a dependancy */
+	       dep->auto_installed = 1;
 	       if (err) {
 		    pkg_vec_free(depends);
 		    return err;

Modified: trunk/src/target/opkg/pkg.c
===================================================================
--- trunk/src/target/opkg/pkg.c	2008-01-30 11:34:15 UTC (rev 3984)
+++ trunk/src/target/opkg/pkg.c	2008-01-30 16:40:24 UTC (rev 3985)
@@ -558,6 +558,13 @@
                    temp[0]='\0';
                    snprintf(temp, (strlen(pkg->architecture)+17), "Architecture: %s\n", pkg->architecture);
 	       }
+	  } else if (strcasecmp(field, "Auto-Installed") == 0) {
+		/* Auto-Installed flag */
+		if (pkg->auto_installed) {
+		    char * s = "Auto-Installed: yes\n";
+		    temp = (char *)realloc(temp, strlen(s) + 1);
+		    strcpy (temp, s);
+		}
 	  } else {
 	       goto UNKNOWN_FMT_FIELD;
 	  }
@@ -1017,6 +1024,7 @@
      pkg_print_field(pkg, file, "Architecture");
      pkg_print_field(pkg, file, "Conffiles");
      pkg_print_field(pkg, file, "Installed-Time");
+     pkg_print_field(pkg, file, "Auto-Installed");
      fputs("\n", file);
 }
 

Modified: trunk/src/target/opkg/pkg.h
===================================================================
--- trunk/src/target/opkg/pkg.h	2008-01-30 11:34:15 UTC (rev 3984)
+++ trunk/src/target/opkg/pkg.h	2008-01-30 16:40:24 UTC (rev 3985)
@@ -176,6 +176,10 @@
      int arch_priority;
 /* Adding this flag, to "force" opkg to choose a "provided_by_hand" package, if there are multiple choice */
      int provided_by_hand;
+
+     /* this flag specifies whether the package was installed to satisfy another
+      * package's dependancies */
+     int auto_installed;
 };
 
 pkg_t *pkg_new(void);

Modified: trunk/src/target/opkg/pkg_parse.c
===================================================================
--- trunk/src/target/opkg/pkg_parse.c	2008-01-30 11:34:15 UTC (rev 3984)
+++ trunk/src/target/opkg/pkg_parse.c	2008-01-30 16:40:24 UTC (rev 3985)
@@ -267,6 +267,15 @@
 	case 'A':
 	    if(isGenericFieldType("Architecture:", *lines))
 		pkg->architecture = parseGenericFieldType("Architecture", *lines);
+	    else if(isGenericFieldType("Auto-Installed:", *lines)) {
+		char *auto_installed_value;
+		auto_installed_value = parseGenericFieldType("Auto-Installed:", *lines);
+		if (strcmp(auto_installed_value, "yes") == 0) {
+		    pkg->auto_installed = 1;
+		}
+		free(auto_installed_value);
+		pkg->architecture = parseGenericFieldType("Auto-Installed", *lines);
+	    }
 	    break;
 
 	case 'F':





More information about the commitlog mailing list