PERFORCE change 148544 for review

Anders Nore andenore at FreeBSD.org
Tue Aug 26 19:51:56 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=148544

Change 148544 by andenore at andenore_laptop on 2008/08/26 19:51:46

	Fixed problem with large packages download status in url.c

Affected files ...

.. //depot/projects/soc2008/andenore_pkginstall/src/usr.sbin/pkg_install/CHANGES#13 edit
.. //depot/projects/soc2008/andenore_pkginstall/src/usr.sbin/pkg_install/delete/perform.c#7 edit
.. //depot/projects/soc2008/andenore_pkginstall/src/usr.sbin/pkg_install/info/show.c#10 edit
.. //depot/projects/soc2008/andenore_pkginstall/src/usr.sbin/pkg_install/lib/plist.c#12 edit
.. //depot/projects/soc2008/andenore_pkginstall/src/usr.sbin/pkg_install/lib/url.c#7 edit

Differences ...

==== //depot/projects/soc2008/andenore_pkginstall/src/usr.sbin/pkg_install/CHANGES#13 (text+ko) ====

@@ -52,7 +52,7 @@
   - A @comment DATE:YYYY-MM-DD hh:mm:ss has been added (affects add/create/info/lib)
 
 
-Fixed bugs in -CURRENT:
+Fixed bugs which exists in -CURRENT and possibly earlier versions:
   - Fixed a bug with the oldstyle -W handling of empty @cwd's, which leads to a
     number of files installed by packages not beeing recognized.
   - pkg_add -r of two packages (or more I assume) where the first depends on

==== //depot/projects/soc2008/andenore_pkginstall/src/usr.sbin/pkg_install/delete/perform.c#7 (text+ko) ====

@@ -41,7 +41,7 @@
     struct reqr_by_head *rb_list;
 
     if (MatchType != MATCH_EXACT) {
-	matched = matchinstalled(MatchType, pkgs, &errcode);
+	matched = matchinstalled(MatchType * (DateMatch ? 10 : 1), pkgs, &errcode);
 	if (errcode != 0)
 	    return 1;
 

==== //depot/projects/soc2008/andenore_pkginstall/src/usr.sbin/pkg_install/info/show.c#10 (text+ko) ====

@@ -198,6 +198,10 @@
 		"\tPackage origin: %s\n", p->name); 
 	    break;
 
+	case PLIST_DATE:
+	    printf(Quiet ? "$comment DATE:%s\n" : "\tInstalldate: %s", p->name);
+	    break;
+
 	default:
 	    cleanup(0);
 	    errx(2, "%s: unknown command type %d (%s)",

==== //depot/projects/soc2008/andenore_pkginstall/src/usr.sbin/pkg_install/lib/plist.c#12 (text+ko) ====

@@ -271,7 +271,7 @@
 void
 read_plist(Package *pkg, FILE *fp)
 {
-    char *cp, date[20], time[20], pline[FILENAME_MAX];
+    char *cp, pline[FILENAME_MAX];
     int cmd, major, minor;
 
     pkg->fmtver_maj = 1;

==== //depot/projects/soc2008/andenore_pkginstall/src/usr.sbin/pkg_install/lib/url.c#7 (text+ko) ====

@@ -37,7 +37,7 @@
 char *
 fileGetURL(const char *base, const char *spec, int keep_package)
 {
-    char *cp, *rp, *tmp;
+    char *cp, *rp, *tmp, *strippedName;
     char fname[FILENAME_MAX];
     char pen[FILENAME_MAX];
     char pkg[FILENAME_MAX];
@@ -51,9 +51,10 @@
     Boolean gotStat = FALSE;
     struct timeval oldtime, newtime;
     struct ttysize ws;
-    int cols = 80, dspeed = 0, acc = 0, fileSize, count=0;
+    int cols = 80, dspeed = 0, acc = 0;
+    off_t count = 0, fileSize = 0;
     double time = 0;
-    char tmpString[512];
+    char tmpString[512], sFileSize[10];
 
     bzero(&oldtime, sizeof(oldtime));
 
@@ -121,7 +122,8 @@
 	    warn("Error: Could not get filestat for url: %s", fname);
     } else {
 	gotStat = TRUE;
-	fileSize = (int)ustat.size;
+	fileSize = ustat.size;
+	snprintf(sFileSize, sizeof(sFileSize), "%s", (char *)getHumanReadable(fileSize));
     }
 
     if ((ftp = fetchGetURL(fname, Verbose ? "v" : NULL)) == NULL) {
@@ -132,7 +134,7 @@
 
     if (isatty(0) || Verbose) {
 	printf("Fetching %s from %s...\n",
-		gotStat ? (char *)getHumanReadable(fileSize) : "", fname);
+		gotStat ? sFileSize : "", fname);
 	fflush(stdout);
     }
     pen[0] = '\0';
@@ -197,16 +199,14 @@
 	count += r;
 	acc += r;
 	
-	char *strippedName = strrchr(fname, '/');
-	char progress[64];
-
+	strippedName = strrchr(fname, '/');
 	if (strippedName)
 	    strippedName++;
-	snprintf(progress, sizeof(progress), "%s", (char *)getHumanReadable(count));
-	int perc = (int)count*100 / fileSize;
+	
+	int perc = (count*100) / fileSize;
 	snprintf(tmpString, sizeof(tmpString), 
 		 "%3i%% of %*s %*sps",
-		 gotStat ? perc : 100, 9, progress, 9,
+		 gotStat ? perc : 100, 9, sFileSize, 9,
 		 (char *)getHumanReadable(dspeed ? dspeed : acc));
 	
 	if (isatty(0) || Verbose)


More information about the p4-projects mailing list