[BACK]Return to perform.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc / pkgtools / pkg_install / files / add

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /pkgsrc/pkgtools/pkg_install/files/add/perform.c between version 1.92 and 1.93

version 1.92, 2010/01/22 13:30:41 version 1.93, 2010/01/30 20:09:34
Line 84  struct pkg_task {
Line 84  struct pkg_task {
   
         char *logdir;          char *logdir;
         char *install_logdir;          char *install_logdir;
           char *install_logdir_real;
         char *other_version;          char *other_version;
   
         package_t plist;          package_t plist;
Line 338  check_already_installed(struct pkg_task 
Line 339  check_already_installed(struct pkg_task 
         int fd;          int fd;
   
         if (Force)          if (Force)
                 return -1;                  return 1;
   
         filename = pkgdb_pkg_file(pkg->pkgname, CONTENTS_FNAME);          filename = pkgdb_pkg_file(pkg->pkgname, CONTENTS_FNAME);
         fd = open(filename, O_RDONLY);          fd = open(filename, O_RDONLY);
         free(filename);          free(filename);
         if (fd == -1)          if (fd == -1)
                 return -1;                  return 1;
   
           if (ReplaceSame) {
                   struct stat sb;
   
                   pkg->install_logdir_real = pkg->install_logdir;
                   pkg->install_logdir = xasprintf("%s.xxxxxx", pkg->install_logdir);
                   if (stat(pkg->install_logdir, &sb) == 0) {
                           warnx("package `%s' already has a temporary update "
                               "directory `%s', remove it manually",
                               pkg->pkgname, pkg->install_logdir);
                           return -1;
                   }
                   return 1;
           }
   
         /* We can only arrive here for explicitly requested packages. */          /* We can only arrive here for explicitly requested packages. */
         if (!Automatic && is_automatic_installed(pkg->pkgname)) {          if (!Automatic && is_automatic_installed(pkg->pkgname)) {
Line 372  check_other_installed(struct pkg_task *p
Line 387  check_other_installed(struct pkg_task *p
         plist_t *p;          plist_t *p;
         int status;          int status;
   
           if (pkg->install_logdir_real) {
                   pkg->other_version = xstrdup(pkg->pkgname);
                   return 0;
           }
   
         pkgbase = xstrdup(pkg->pkgname);          pkgbase = xstrdup(pkg->pkgname);
   
         if ((iter = strrchr(pkgbase, '-')) == NULL) {          if ((iter = strrchr(pkgbase, '-')) == NULL) {
Line 1110  preserve_meta_data_file(struct pkg_task 
Line 1130  preserve_meta_data_file(struct pkg_task 
                 return 0;                  return 0;
   
         old_file = pkgdb_pkg_file(pkg->other_version, name);          old_file = pkgdb_pkg_file(pkg->other_version, name);
         new_file = pkgdb_pkg_file(pkg->pkgname, name);          new_file = xasprintf("%s/%s", pkg->install_logdir, name);
         rv = 0;          rv = 0;
         if (rename(old_file, new_file) == -1 && errno != ENOENT) {          if (rename(old_file, new_file) == -1 && errno != ENOENT) {
                 warn("Can't move %s from %s to %s", name, old_file, new_file);                  warn("Can't move %s from %s to %s", name, old_file, new_file);
Line 1353  pkg_do(const char *pkgpath, int mark_aut
Line 1373  pkg_do(const char *pkgpath, int mark_aut
                 }                  }
         }          }
   
         if (check_already_installed(pkg) == 0) {          switch (check_already_installed(pkg)) {
           case 0:
                 status = 0;                  status = 0;
                 goto clean_memory;                  goto clean_memory;
           case 1:
                   break;
           case -1:
                   goto clean_memory;
         }          }
   
         if (check_platform(pkg))          if (check_platform(pkg))
Line 1382  pkg_do(const char *pkgpath, int mark_aut
Line 1407  pkg_do(const char *pkgpath, int mark_aut
                 if (start_replacing(pkg))                  if (start_replacing(pkg))
                         goto nuke_pkgdb;                          goto nuke_pkgdb;
   
                   if (pkg->install_logdir_real) {
                           rename(pkg->install_logdir, pkg->install_logdir_real);
                           free(pkg->install_logdir);
                           pkg->install_logdir = pkg->install_logdir_real;
                           pkg->install_logdir_real = NULL;
                   }
   
                 if (check_dependencies(pkg))                  if (check_dependencies(pkg))
                         goto nuke_pkgdb;                          goto nuke_pkgdb;
         } else {          } else {
Line 1438  nuke_pkgdb:
Line 1470  nuke_pkgdb:
         if (!Fake) {          if (!Fake) {
                 if (recursive_remove(pkg->install_logdir, 1))                  if (recursive_remove(pkg->install_logdir, 1))
                         warn("Couldn't remove %s", pkg->install_logdir);                          warn("Couldn't remove %s", pkg->install_logdir);
                   free(pkg->install_logdir_real);
                 free(pkg->install_logdir);                  free(pkg->install_logdir);
                 free(pkg->logdir);                  free(pkg->logdir);
                   pkg->install_logdir_real = NULL;
                 pkg->install_logdir = NULL;                  pkg->install_logdir = NULL;
                 pkg->logdir = NULL;                  pkg->logdir = NULL;
         }          }
Line 1450  clean_memory:
Line 1484  clean_memory:
                         warn("Couldn't remove %s", pkg->install_logdir);                          warn("Couldn't remove %s", pkg->install_logdir);
         }          }
         free(pkg->install_prefix);          free(pkg->install_prefix);
           free(pkg->install_logdir_real);
         free(pkg->install_logdir);          free(pkg->install_logdir);
         free(pkg->logdir);          free(pkg->logdir);
         free_buildinfo(pkg);          free_buildinfo(pkg);

Legend:
Removed from v.1.92  
changed lines
  Added in v.1.93

CVSweb <webmaster@jp.NetBSD.org>