svn commit: r184238 - releng/6.4/usr.sbin/sysinstall

Ken Smith kensmith at FreeBSD.org
Sat Oct 25 01:25:30 UTC 2008


Author: kensmith
Date: Sat Oct 25 01:25:29 2008
New Revision: 184238
URL: http://svn.freebsd.org/changeset/base/184238

Log:
  MFS r184237 (which was MFS of r184232):
  
  > MFC r183921 and r184180
  > When we notice the INDEX had volume numbers (so the media the packages
  > are coming from has multiple volumes) walk through the dependency tree
  > for the packages selected by the user once for each volume, only
  > installing packages on the current volume.  If we can't install the
  > package because its on a higher volume just note that we have looked
  > at it during the pass for this volume to cut down on time spent checking
  > dependencies.  This stops the excessive disc swapping that users have
  > complained (a lot...) about.
  
  Approved by:    re (kib)

Modified:
  releng/6.4/usr.sbin/sysinstall/   (props changed)
  releng/6.4/usr.sbin/sysinstall/config.c
  releng/6.4/usr.sbin/sysinstall/globals.c
  releng/6.4/usr.sbin/sysinstall/index.c
  releng/6.4/usr.sbin/sysinstall/package.c
  releng/6.4/usr.sbin/sysinstall/sysinstall.h

Modified: releng/6.4/usr.sbin/sysinstall/config.c
==============================================================================
--- releng/6.4/usr.sbin/sysinstall/config.c	Sat Oct 25 01:21:28 2008	(r184237)
+++ releng/6.4/usr.sbin/sysinstall/config.c	Sat Oct 25 01:25:29 2008	(r184238)
@@ -785,6 +785,7 @@ configPackages(dialogMenuItem *self)
 
     while (1) {
 	int ret, pos, scroll;
+	int current, low, high;
 
 	/* Bring up the packages menu */
 	pos = scroll = 0;
@@ -799,8 +800,14 @@ configPackages(dialogMenuItem *self)
 	    else if (DITEM_STATUS(ret) != DITEM_FAILURE) {
 		dialog_clear();
 		restoreflag = 1;
-		for (tmp = Plist.kids; tmp && tmp->name; tmp = tmp->next)
-		    (void)index_extract(mediaDevice, &Top, tmp, FALSE);
+		if (have_volumes) {
+		    low = low_volume;
+		    high = high_volume;
+		} else
+		    low = high = 0;
+		for (current = low; current <= high; current++)
+		    for (tmp = Plist.kids; tmp && tmp->name; tmp = tmp->next)
+		        (void)index_extract(mediaDevice, &Top, tmp, FALSE, current);
 		break;
 	    }
 	}

Modified: releng/6.4/usr.sbin/sysinstall/globals.c
==============================================================================
--- releng/6.4/usr.sbin/sysinstall/globals.c	Sat Oct 25 01:21:28 2008	(r184237)
+++ releng/6.4/usr.sbin/sysinstall/globals.c	Sat Oct 25 01:25:29 2008	(r184238)
@@ -48,10 +48,13 @@ Boolean		DialogActive;	/* Is libdialog i
 Boolean		ColorDisplay;	/* Are we on a color display? */
 Boolean		OnVTY;		/* Are we on a VTY? */
 Boolean		Restarting;	/* Are we restarting sysinstall? */
+Boolean		have_volumes;	/* Media has more than one volume. */
 Variable	*VarHead;	/* The head of the variable chain */
 Device		*mediaDevice;	/* Where we're installing from */
 int		BootMgr;	/* Which boot manager we're using */
 int		StatusLine;	/* Where to stick our status messages */
+int		low_volume;	/* Lowest volume number */
+int		high_volume;	/* Highest volume number */
 jmp_buf		BailOut;	/* Beam me up, scotty! The natives are pissed! */
 
 Chunk		*HomeChunk;

Modified: releng/6.4/usr.sbin/sysinstall/index.c
==============================================================================
--- releng/6.4/usr.sbin/sysinstall/index.c	Sat Oct 25 01:21:28 2008	(r184237)
+++ releng/6.4/usr.sbin/sysinstall/index.c	Sat Oct 25 01:25:29 2008	(r184238)
@@ -225,7 +225,17 @@ new_index(char *name, char *pathto, char
     tmp->deps =		_strdup(deps);
     tmp->depc =		0;
     tmp->installed =	package_installed(name);
+    tmp->vol_checked =	0;
     tmp->volume =	volume;
+    if (volume != 0) {
+	have_volumes = TRUE;
+	if (low_volume == 0)
+	    low_volume = volume;
+	else if (low_volume > volume)
+	    low_volume = volume;
+	if (high_volume < volume)
+	    high_volume = volume;
+    }
     return tmp;
 }
 
@@ -681,9 +691,11 @@ recycle:
 }
 
 int
-index_extract(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended)
+index_extract(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended,
+    int current_volume)
 {
     int status = DITEM_SUCCESS;
+    Boolean notyet = FALSE;
     PkgNodePtr tmp2;
     IndexEntryPtr id = who->data;
     WINDOW *w;
@@ -698,7 +710,7 @@ index_extract(Device *dev, PkgNodePtr to
      * a certain faulty INDEX file. 
      */
 
-    if (id->installed == 1)
+    if (id->installed == 1 || (have_volumes && id->vol_checked == current_volume))
 	return DITEM_SUCCESS;
 
     w = savescr();
@@ -711,9 +723,13 @@ index_extract(Device *dev, PkgNodePtr to
 	    if ((cp2 = index(cp, ' ')) != NULL)
 		*cp2 = '\0';
 	    if ((tmp2 = index_search(top, cp, NULL)) != NULL) {
-		status = index_extract(dev, top, tmp2, TRUE);
+		status = index_extract(dev, top, tmp2, TRUE, current_volume);
 		if (DITEM_STATUS(status) != DITEM_SUCCESS) {
-		    if (variable_get(VAR_NO_CONFIRM))
+		    /* package probably on a future disc volume */
+		    if (status & DITEM_CONTINUE) {
+			status = DITEM_SUCCESS;
+			notyet = TRUE;
+		    } else if (variable_get(VAR_NO_CONFIRM))
 			msgNotify("Loading of dependent package %s failed", cp);
 		    else
 			msgConfirm("Loading of dependent package %s failed", cp);
@@ -731,10 +747,38 @@ index_extract(Device *dev, PkgNodePtr to
 		cp = NULL;
 	}
     }
-    /* Done with the deps?  Load the real m'coy */
+
+    /*
+     * If iterating through disc volumes one at a time indicate failure if
+     * dependency install failed due to package being on a higher volume
+     * numbered disc, but that we should continue anyway.  Note that this
+     * package has already been processed for this disc volume so we don't
+     * need to do it again.
+     */
+
+    if (notyet) {
+    	restorescr(w);
+	id->vol_checked = current_volume;
+	return DITEM_FAILURE | DITEM_CONTINUE;
+    }
+
+    /*
+     * Done with the deps?  Try to load the real m'coy.  If iterating
+     * through a multi-volume disc set fail the install if the package
+     * is on a higher numbered volume to cut down on disc switches the
+     * user needs to do, but indicate caller should continue processing
+     * despite error return.  Note this package was processed for the
+     * current disc being checked.
+     */
+
     if (DITEM_STATUS(status) == DITEM_SUCCESS) {
 	/* Prompt user if the package is not available on the current volume. */
 	if(mediaDevice->type == DEVICE_TYPE_CDROM) {
+	    if (current_volume != 0 && id->volume > current_volume) {
+		restorescr(w);
+		id->vol_checked = current_volume;
+		return DITEM_FAILURE | DITEM_CONTINUE;
+	    }
 	    while (id->volume != dev->volume) {
 		if (!msgYesNo("This is disc #%d.  Package %s is on disc #%d\n"
 			  "Would you like to switch discs now?\n", dev->volume,
@@ -800,6 +844,8 @@ index_initialize(char *path)
     if (!index_initted) {
 	w = savescr();
 	dialog_clear_norefresh();
+	have_volumes = FALSE;
+	low_volume = high_volume = 0;
 
 	/* Got any media? */
 	if (!mediaVerify()) {

Modified: releng/6.4/usr.sbin/sysinstall/package.c
==============================================================================
--- releng/6.4/usr.sbin/sysinstall/package.c	Sat Oct 25 01:21:28 2008	(r184237)
+++ releng/6.4/usr.sbin/sysinstall/package.c	Sat Oct 25 01:25:29 2008	(r184238)
@@ -55,7 +55,7 @@ int
 package_add(char *name)
 {
     PkgNodePtr tmp;
-    int i;
+    int i, current, low, high;
 
     if (!mediaVerify())
 	return DITEM_FAILURE;
@@ -68,9 +68,16 @@ package_add(char *name)
 	return i;
 
     tmp = index_search(&Top, name, &tmp);
-    if (tmp)
-	return index_extract(mediaDevice, &Top, tmp, FALSE);
-    else {
+    if (tmp) {
+	if (have_volumes) {
+	    low = low_volume;
+	    high = high_volume;
+	} else
+	    low = high = 0;
+	for (current = low; current <= high; current++)
+	    i = index_extract(mediaDevice, &Top, tmp, FALSE, current);
+	return i;
+    } else {
 	msgConfirm("Sorry, package %s was not found in the INDEX.", name);
 	return DITEM_FAILURE;
     }

Modified: releng/6.4/usr.sbin/sysinstall/sysinstall.h
==============================================================================
--- releng/6.4/usr.sbin/sysinstall/sysinstall.h	Sat Oct 25 01:21:28 2008	(r184237)
+++ releng/6.4/usr.sbin/sysinstall/sysinstall.h	Sat Oct 25 01:25:29 2008	(r184238)
@@ -383,6 +383,7 @@ typedef struct _indexEntry {	/* A single
     char *deps;			/* packages this depends on	*/
     int  depc;			/* how many depend on me	*/
     int  installed;		/* indicates if it is installed */
+    int  vol_checked;		/* disc volume last checked for */
     char *maintainer;		/* maintainer			*/
     unsigned int volume;	/* Volume of package            */
 } IndexEntry;
@@ -415,6 +416,7 @@ extern Boolean		RunningAsInit;		/* Are w
 extern Boolean		DialogActive;		/* Is the dialog() stuff up?			*/
 extern Boolean		ColorDisplay;		/* Are we on a color display?			*/
 extern Boolean		OnVTY;			/* On a syscons VTY?				*/
+extern Boolean		have_volumes;		/* Media has multiple volumes                   */
 extern Variable		*VarHead;		/* The head of the variable chain		*/
 extern Device		*mediaDevice;		/* Where we're getting our distribution from	*/
 extern unsigned int	Dists;			/* Which distributions we want			*/
@@ -477,6 +479,8 @@ extern DMenu		MenuFixit;		/* Fixit flopp
 extern int              FixItMode;              /* FixItMode starts shell onc urrent device (ie Serial port) */
 extern const char *	StartName;		/* Which name we were started as */
 extern int		NCpus;			/* # cpus on machine */
+extern int		low_volume;		/* Lowest volume number */
+extern int		high_volume;		/* Highest volume number */
 
 /* Important chunks. */
 extern Chunk *HomeChunk;
@@ -668,7 +672,7 @@ void		index_init(PkgNodePtr top, PkgNode
 void		index_node_free(PkgNodePtr top, PkgNodePtr plist);
 void		index_sort(PkgNodePtr top);
 void		index_print(PkgNodePtr top, int level);
-int		index_extract(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended);
+int		index_extract(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended, int current_volume);
 int		index_initialize(char *path);
 PkgNodePtr	index_search(PkgNodePtr top, char *str, PkgNodePtr *tp);
 


More information about the svn-src-all mailing list