Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/pkg_install Rename "upgrade" variable to "Replace" ...



details:   https://anonhg.NetBSD.org/src/rev/1323a91d4c1d
branches:  trunk
changeset: 546179:1323a91d4c1d
user:      hubertf <hubertf%NetBSD.org@localhost>
date:      Tue Apr 22 01:17:03 2003 +0000

description:
Rename "upgrade" variable to "Replace" (etc.) as that is what it's really
for. Assorted text updates.

diffstat:

 usr.sbin/pkg_install/add/main.c    |   8 ++--
 usr.sbin/pkg_install/add/perform.c |  54 +++++++++++++++++++-------------------
 usr.sbin/pkg_install/add/pkg_add.1 |  10 +++---
 usr.sbin/pkg_install/lib/lib.h     |   4 +-
 4 files changed, 38 insertions(+), 38 deletions(-)

diffs (227 lines):

diff -r 278a3e219c12 -r 1323a91d4c1d usr.sbin/pkg_install/add/main.c
--- a/usr.sbin/pkg_install/add/main.c   Tue Apr 22 00:24:48 2003 +0000
+++ b/usr.sbin/pkg_install/add/main.c   Tue Apr 22 01:17:03 2003 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: main.c,v 1.27 2003/01/10 10:55:25 agc Exp $    */
+/*     $NetBSD: main.c,v 1.28 2003/04/22 01:17:03 hubertf Exp $        */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char *rcsid = "from FreeBSD Id: main.c,v 1.16 1997/10/08 07:45:43 charnier Exp";
 #else
-__RCSID("$NetBSD: main.c,v 1.27 2003/01/10 10:55:25 agc Exp $");
+__RCSID("$NetBSD: main.c,v 1.28 2003/04/22 01:17:03 hubertf Exp $");
 #endif
 #endif
 
@@ -50,7 +50,7 @@
 char   *Directory = NULL;
 char    FirstPen[FILENAME_MAX];
 add_mode_t AddMode = NORMAL;
-int    upgrade = 0;
+Boolean        Replace = FALSE;
 
 static void
 usage(void)
@@ -117,7 +117,7 @@
                        /* NOTREACHED */
 
                case 'u':
-                       upgrade = 1;
+                       Replace = 1;
                        break;
                case 'h':
                case '?':
diff -r 278a3e219c12 -r 1323a91d4c1d usr.sbin/pkg_install/add/perform.c
--- a/usr.sbin/pkg_install/add/perform.c        Tue Apr 22 00:24:48 2003 +0000
+++ b/usr.sbin/pkg_install/add/perform.c        Tue Apr 22 01:17:03 2003 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: perform.c,v 1.80 2003/04/10 16:12:38 grant Exp $       */
+/*     $NetBSD: perform.c,v 1.81 2003/04/22 01:17:03 hubertf Exp $     */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.44 1997/10/13 15:03:46 jkh Exp";
 #else
-__RCSID("$NetBSD: perform.c,v 1.80 2003/04/10 16:12:38 grant Exp $");
+__RCSID("$NetBSD: perform.c,v 1.81 2003/04/22 01:17:03 hubertf Exp $");
 #endif
 #endif
 
@@ -101,10 +101,10 @@
 {
        char    playpen[FILENAME_MAX];
        char    extract_contents[FILENAME_MAX];
-       char    upgrade_from[FILENAME_MAX];
-       char    upgrade_via[FILENAME_MAX];
-       char    upgrade_to[FILENAME_MAX];
-       int     upgrading = 0;
+       char    replace_from[FILENAME_MAX];
+       char    replace_via[FILENAME_MAX];
+       char    replace_to[FILENAME_MAX];
+       int     replacing = 0;
        char   *where_to, *tmp, *extract;
        char   *dbdir;
        const char *exact;
@@ -302,23 +302,23 @@
 
                        /*
                         * See if the pkg is already installed. If so, we might
-                        * want to upgrade it. 
+                        * want to upgrade/replace it. 
                         */
                        (void) snprintf(buf, sizeof(buf), "%.*s[0-9]*",
                                (int)(s - PkgName) + 1, PkgName);
                        if (findmatchingname(dbdir, buf, note_whats_installed, installed) > 0) {
-                               if (upgrade) {
-                                       snprintf(upgrade_from, sizeof(upgrade_from), "%s/%s/" REQUIRED_BY_FNAME,
+                               if (Replace) {
+                                       snprintf(replace_from, sizeof(replace_from), "%s/%s/" REQUIRED_BY_FNAME,
                                                 dbdir, installed);
-                                       snprintf(upgrade_via, sizeof(upgrade_via), "%s/.%s." REQUIRED_BY_FNAME,
+                                       snprintf(replace_via, sizeof(replace_via), "%s/.%s." REQUIRED_BY_FNAME,
                                                 dbdir, installed);
-                                       snprintf(upgrade_to, sizeof(upgrade_to), "%s/%s/" REQUIRED_BY_FNAME,
+                                       snprintf(replace_to, sizeof(replace_to), "%s/%s/" REQUIRED_BY_FNAME,
                                                 dbdir, PkgName);
 
                                        if (Verbose)
                                                printf("Upgrading %s to %s.\n", installed, PkgName);
 
-                                       if (fexists(upgrade_from)) {  /* Are there any dependencies? */
+                                       if (fexists(replace_from)) {  /* Are there any dependencies? */
                                                /*
                                                 * Upgrade step 1/4: Check if the new version is ok with all pkgs
                                                 * (from +REQUIRED_BY) that require this pkg
@@ -326,12 +326,12 @@
                                                FILE *rb;                     /* +REQUIRED_BY file */
                                                char pkg2chk[FILENAME_MAX];
 
-                                               rb = fopen(upgrade_from, "r");
+                                               rb = fopen(replace_from, "r");
                                                if (! rb) {
-                                                       warnx("Cannot open '%s' for reading%s", upgrade_from,
+                                                       warnx("Cannot open '%s' for reading%s", replace_from,
                                                              Force ? " (proceeding anyways)" : "");
                                                        if (Force)
-                                                               goto ignore_upgrade_depends_check;
+                                                               goto ignore_replace_depends_check;
                                                        else
                                                                goto bomb;
                                                }
@@ -355,7 +355,7 @@
                                                                warnx("Cannot check depends in '%s'%s", depC, 
                                                                      Force ? " (proceeding anyways)" : "!" );
                                                                if (Force)
-                                                                       goto ignore_upgrade_depends_check;
+                                                                       goto ignore_replace_depends_check;
                                                                else
                                                                        goto bomb;
                                                        }
@@ -399,7 +399,7 @@
                                                                                        printf("@pkgdep check: %s is ok for %s (in %s pkg)\n",
                                                                                               PkgName, depp->name, pkg2chk);
                                                                        } else {
-                                                                               printf("Package %s requires %s, \n\tCannot perform upgrade to %s%s\n",
+                                                                               printf("Package %s requires %s, \n\tCannot replace with %s%s\n",
                                                                                       pkg2chk, depp->name, PkgName,
                                                                                       Force? " (proceeding anyways)" : "!");
                                                                                if (! Force)
@@ -410,7 +410,7 @@
                                                }
                                                fclose(rb);
                                                
-ignore_upgrade_depends_check:
+ignore_replace_depends_check:
                                                /*
                                                 * Upgrade step 2/4: Do the actual update by moving aside
                                                 * the +REQUIRED_BY file, deinstalling the old pkg, adding
@@ -418,11 +418,11 @@
                                                 * into place (finished in step 3/4)
                                                 */
                                                if (Verbose)
-                                                       printf("mv %s %s\n", upgrade_from, upgrade_via);                                                
-                                               rc = rename(upgrade_from, upgrade_via);
+                                                       printf("mv %s %s\n", replace_from, replace_via);                                                
+                                               rc = rename(replace_from, replace_via);
                                                assert(rc == 0);
                                                
-                                               upgrading = 1;
+                                               replacing = 1;
                                        }
 
                                        if (Verbose)
@@ -499,11 +499,11 @@
                                        warnx("pkg `%s' required, but `%s' found installed.",
                                              p->name, installed);
 
-                                       if (upgrading) {
-                                               printf("HF: upgrade note -- could 'pkg_delete %s', and let the normal\n"
-                                                      "dependency handling reinstall the updated package, assuming one IS\n"
+                                       if (replacing) {
+                                               printf("HF: replace note -- could 'pkg_delete %s', and let the normal\n"
+                                                      "dependency handling reinstall the replaced package, assuming one IS\n"
                                                       "available. But then I'd expect proper binary pkgs being available for\n"
-                                                      "the upgrade case.\n", installed);
+                                                      "the replace case.\n", installed);
                                        }
 
                                        if (Force) {
@@ -752,12 +752,12 @@
        free_plist(&Plist);
        leave_playpen(Home);
 
-       if (upgrading) {
+       if (replacing) {
                /*
                 * Upgrade step 3/4: move back +REQUIRED_BY file
                 * (see also step 2/4)
                 */
-               rc = rename(upgrade_via, upgrade_to);
+               rc = rename(replace_via, replace_to);
                assert(rc == 0);
                
                /*
diff -r 278a3e219c12 -r 1323a91d4c1d usr.sbin/pkg_install/add/pkg_add.1
--- a/usr.sbin/pkg_install/add/pkg_add.1        Tue Apr 22 00:24:48 2003 +0000
+++ b/usr.sbin/pkg_install/add/pkg_add.1        Tue Apr 22 01:17:03 2003 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_add.1,v 1.40 2003/03/24 13:47:13 hubertf Exp $
+.\" $NetBSD: pkg_add.1,v 1.41 2003/04/22 01:17:04 hubertf Exp $
 .\"
 .\" FreeBSD install - a package for the installation and maintenance
 .\" of non-core utilities.
@@ -270,10 +270,10 @@
 .Pp
 If the
 .Fl u
-option is given, it's assumed the package should be upgraded instead.
-Before doing so, all packages that depend on the pkg being upgraded
-are checked if they also work with the new version. If that test is
-successful, the upgrade is prepared by moving an existing
+option is given, it's assumed the package should be replaced by the
+new version instead.  Before doing so, all packages that depend on the
+pkg being upgraded are checked if they also work with the new version.
+If that test is successful, replacing is prepared by moving an existing
 .Pa +REQUIRED_BY
 file aside (if it exists), and running
 .Xr pkg_delete 1
diff -r 278a3e219c12 -r 1323a91d4c1d usr.sbin/pkg_install/lib/lib.h
--- a/usr.sbin/pkg_install/lib/lib.h    Tue Apr 22 00:24:48 2003 +0000
+++ b/usr.sbin/pkg_install/lib/lib.h    Tue Apr 22 01:17:03 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lib.h,v 1.51 2003/04/10 23:31:26 grant Exp $ */
+/* $NetBSD: lib.h,v 1.52 2003/04/22 01:17:05 hubertf Exp $ */
 
 /* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */
 
@@ -303,6 +303,6 @@
 extern Boolean Verbose;
 extern Boolean Fake;
 extern Boolean Force;
-extern int upgrade;
+extern Boolean Replace;
 
 #endif                         /* _INST_LIB_LIB_H_ */



Home | Main Index | Thread Index | Old Index