opkg: trivial, clean up obsolete code, and some typo
authorticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 15 Dec 2008 05:29:30 +0000 (05:29 +0000)
committerticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 15 Dec 2008 05:29:30 +0000 (05:29 +0000)
git-svn-id: http://opkg.googlecode.com/svn/trunk@157 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

libbb/unzip.c
libopkg/opkg_install.c
libopkg/pkg.c
libopkg/pkg_depends.c
libopkg/pkg_vec.c

index fb2429b..954ee61 100644 (file)
  * 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>
index e503d0a..dc014d3 100644 (file)
@@ -312,60 +312,6 @@ int pkg_mark_dependencies_for_installation(opkg_conf_t *conf, pkg_t *pkg, pkg_ve
 
      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)
 {
index 4bbecb9..6c07b84 100644 (file)
@@ -1313,7 +1313,7 @@ str_list_t *pkg_get_installed_files(pkg_t *pkg)
          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) {
index b0aacb3..49962ba 100644 (file)
@@ -45,18 +45,6 @@ static int pkg_installed_and_constraint_satisfied(pkg_t *pkg, void *cdata)
 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 @@ int buildConflicts(hash_table_t * hash, abstract_pkg_t * ab_pkg, pkg_t * pkg)
         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 @@ int buildReplaces(hash_table_t * hash, abstract_pkg_t * ab_pkg, pkg_t * pkg)
         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]);
 
index 7d42a29..2c1bcf9 100644 (file)
@@ -108,17 +108,6 @@ void pkg_vec_insert(pkg_vec_t *vec, const pkg_t *pkg)
 {
      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_free(abstract_pkg_vec_t *vec)
 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)