r4825 - in trunk/src/target/opkg: libbb libopkg

tick at docs.openmoko.org tick at docs.openmoko.org
Wed Nov 26 11:01:32 CET 2008


Author: tick
Date: 2008-11-26 11:01:31 +0100 (Wed, 26 Nov 2008)
New Revision: 4825

Modified:
   trunk/src/target/opkg/libbb/unzip.c
   trunk/src/target/opkg/libopkg/opkg_install.c
   trunk/src/target/opkg/libopkg/pkg.c
   trunk/src/target/opkg/libopkg/pkg_depends.c
   trunk/src/target/opkg/libopkg/pkg_vec.c
Log:
opkg: trivial, clean up obsolete code, and some typo


Modified: trunk/src/target/opkg/libbb/unzip.c
===================================================================
--- trunk/src/target/opkg/libbb/unzip.c	2008-11-26 06:10:56 UTC (rev 4824)
+++ trunk/src/target/opkg/libbb/unzip.c	2008-11-26 10:01:31 UTC (rev 4825)
@@ -40,26 +40,6 @@
  * See the file algorithm.doc for the compression algorithms and file formats.
  */
 
-#if 0
-static char *license_msg[] = {
-	"   Copyright (C) 1992-1993 Jean-loup Gailly",
-	"   This program is free software; you can redistribute it and/or modify",
-	"   it under the terms of the GNU General Public License as published by",
-	"   the Free Software Foundation; either version 2, or (at your option)",
-	"   any later version.",
-	"",
-	"   This program is distributed in the hope that it will be useful,",
-	"   but WITHOUT ANY WARRANTY; without even the implied warranty of",
-	"   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the",
-	"   GNU General Public License for more details.",
-	"",
-	"   You should have received a copy of the GNU General Public License",
-	"   along with this program; if not, write to the Free Software",
-	"   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.",
-	0
-};
-#endif
-
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <signal.h>

Modified: trunk/src/target/opkg/libopkg/opkg_install.c
===================================================================
--- trunk/src/target/opkg/libopkg/opkg_install.c	2008-11-26 06:10:56 UTC (rev 4824)
+++ trunk/src/target/opkg/libopkg/opkg_install.c	2008-11-26 10:01:31 UTC (rev 4825)
@@ -312,61 +312,7 @@
 
      return 0;
 }
-#if 0
-int name_mark_dependencies_for_installation(opkg_conf_t *conf, const char *pkg_name, pkg_vec_t *pkgs_needed)
-{
-     int cmp;
-     pkg_t *old, *new;
-     char *old_version, *new_version;
 
-     old = pkg_hash_fetch_installed_by_name(&conf->pkg_hash, pkg_name);
-    
-     new = pkg_hash_fetch_best_installation_candidate_by_name(conf, pkg_name);
-     if (new == NULL) {
-	  return OPKG_PKG_HAS_NO_CANDIDATE;
-     }
-     if (old) {
-	  old_version = pkg_version_str_alloc(old);
-	  new_version = pkg_version_str_alloc(new);
-
-	  cmp = pkg_compare_versions(old, new);
-          if ( (conf->force_downgrade==1) && (cmp > 0) ){     /* We've been asked to allow downgrade  and version is precedent */
-	    opkg_message(conf, OPKG_DEBUG, " Forcing downgrade ");
-             cmp = -1 ;                                       /* then we force opkg to downgrade */ 
-                                                              /* We need to use a value < 0 because in the 0 case we are asking to */
-                                                              /* reinstall, and some check could fail asking the "force-reinstall" option */
-          } 
-	  opkg_message(conf, OPKG_DEBUG, 
-		       "comparing visible versions of pkg %s:"
-		       "\n\t%s is installed "
-		       "\n\t%s is available "
-		       "\n\t%d was comparison result\n",
-		       pkg_name, old_version, new_version, cmp);
-	  if (cmp == 0 && !conf->force_reinstall) {
-	       opkg_message(conf, OPKG_NOTICE,
-			    "Package %s (%s) installed in %s is up to date.\n",
-			    old->name, old_version, old->dest->name);
-	       free(old_version);
-	       free(new_version);
-	       return 0;
-	  } else if (cmp > 0) {
-	       opkg_message(conf, OPKG_NOTICE,
-			    "Not downgrading package %s on %s from %s to %s.\n",
-			    old->name, old->dest->name, old_version, new_version);
-	       free(old_version);
-	       free(new_version);
-	       return 0;
-	  } else if (cmp < 0) {
-	       new->dest = old->dest;
-	       old->state_want = SW_DEINSTALL;
-	       old->state_flag |= SF_OBSOLETE;
-	  }
-     }
-     return pkg_mark_dependencies_for_installation(conf, new, pkgs_needed);
-}
-
-#endif
-
 int satisfy_dependencies_for(opkg_conf_t *conf, pkg_t *pkg)
 {
      int i, err;

Modified: trunk/src/target/opkg/libopkg/pkg.c
===================================================================
--- trunk/src/target/opkg/libopkg/pkg.c	2008-11-26 06:10:56 UTC (rev 4824)
+++ trunk/src/target/opkg/libopkg/pkg.c	2008-11-26 10:01:31 UTC (rev 4825)
@@ -1313,7 +1313,7 @@
 	  return NULL;
      }
 
-     /* For uninstalled packages, get the file list firectly from the package.
+     /* For uninstalled packages, get the file list directly from the package.
 	For installed packages, look at the package.list file in the database.
      */
      if (pkg->state_status == SS_NOT_INSTALLED || pkg->dest == NULL) {

Modified: trunk/src/target/opkg/libopkg/pkg_depends.c
===================================================================
--- trunk/src/target/opkg/libopkg/pkg_depends.c	2008-11-26 06:10:56 UTC (rev 4824)
+++ trunk/src/target/opkg/libopkg/pkg_depends.c	2008-11-26 10:01:31 UTC (rev 4825)
@@ -45,18 +45,6 @@
 static int pkg_constraint_satisfied(pkg_t *pkg, void *cdata)
 {
      depend_t *depend = (depend_t *)cdata;
-#if 0
-     pkg_t * temp = pkg_new();
-     int comparison;
-     parseVersion(temp, depend->version);
-     comparison = pkg_compare_versions(pkg, temp);
-     free(temp);
-
-     fprintf(stderr, "%s: pkg=%s pkg->version=%s constraint=%p type=%d version=%s comparison=%d satisfied=%d\n", 
-	     __FUNCTION__, pkg->name, pkg->version, 
-	     depend, depend->constraint, depend->version,
-	     comparison, version_constraints_satisfied(depend, pkg));
-#endif
      if (version_constraints_satisfied(depend, pkg))
 	  return 1;
      else
@@ -705,13 +693,6 @@
 	 conflicts->type = CONFLICTS;
 	 parseDepends(conflicts, hash,
 		      pkg->conflicts_str[i]);
-#if 0
-	 for (j = 0; j < conflicts->possibility_count; j++) {
-	      depend_t *possibility = conflicts->possibilities[j];
-	      abstract_pkg_t *conflicting_apkg = possibility->pkg;
-	      pkg_add_conflict_pair(ab_pkg, conflicting_apkg);
-	 }
-#endif
 	 conflicts++;
     }
     return 0;
@@ -730,9 +711,6 @@
         return  -1;
      }
 
-     // if (strcmp(ab_pkg->name, pkg->name))
-     //     fprintf(stderr, __FUNCTION__ ": ab_pkg=%s pkg=%s\n", ab_pkg->name, pkg->name);
-
      for(i = 0; i < pkg->replaces_count; i++){
 	  abstract_pkg_t *old_abpkg = ensure_abstract_pkg_by_name(hash, pkg->replaces_str[i]);
 

Modified: trunk/src/target/opkg/libopkg/pkg_vec.c
===================================================================
--- trunk/src/target/opkg/libopkg/pkg_vec.c	2008-11-26 06:10:56 UTC (rev 4824)
+++ trunk/src/target/opkg/libopkg/pkg_vec.c	2008-11-26 10:01:31 UTC (rev 4825)
@@ -108,17 +108,6 @@
 {
      int found = 0;
 
-#if 0
-     /* look for a duplicate pkg by name, version, and architecture */
-     for (i = 0; i < vec->len; i++)
-	  if ((strcmp(pkg->name, vec->pkgs[i]->name) == 0)
-	      && (pkg_compare_versions(pkg, vec->pkgs[i]) == 0)
-	      && (strcmp(pkg->architecture, vec->pkgs[i]->name) == 0)) {
-	       found = 1;
-	       break;
-	  }
-#endif
-
      /* we didn't find one, add it */
      if(!found){   
 	  vec->pkgs = (pkg_t **)realloc(vec->pkgs, (vec->len + 1) * sizeof(pkg_t *));
@@ -197,23 +186,11 @@
 void abstract_pkg_vec_insert(abstract_pkg_vec_t *vec, abstract_pkg_t *pkg)
 {
 
-#if 0
-    /* look for a duplicate pkg by name */
-    for(i = 0; i < vec->len; i++)
-	if (strcmp(pkg->name, vec->pkgs[i]->name) == 0)
-	    break;
-
-    /* we didn't find one, add it */
-    if(i == vec->len){   
-#endif
 	vec->pkgs = 
 	  (abstract_pkg_t **)
 	    realloc(vec->pkgs, (vec->len + 1) * sizeof(abstract_pkg_t *));
 	vec->pkgs[vec->len] = pkg;
 	vec->len++;
-#if 0
-    }
-#endif
 }
 
 abstract_pkg_t * abstract_pkg_vec_get(abstract_pkg_vec_t *vec, int i)




More information about the commitlog mailing list