From owner-svn-src-stable-7@FreeBSD.ORG Fri Oct 24 20:10:23 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 32A491065673; Fri, 24 Oct 2008 20:10:23 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1ED718FC1E; Fri, 24 Oct 2008 20:10:23 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9OKANt1098125; Fri, 24 Oct 2008 20:10:23 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9OKAMYC098120; Fri, 24 Oct 2008 20:10:22 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200810242010.m9OKAMYC098120@svn.freebsd.org> From: Ken Smith Date: Fri, 24 Oct 2008 20:10:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184232 - stable/7/usr.sbin/sysinstall X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2008 20:10:23 -0000 Author: kensmith Date: Fri Oct 24 20:10:22 2008 New Revision: 184232 URL: http://svn.freebsd.org/changeset/base/184232 Log: 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: stable/7/usr.sbin/sysinstall/ (props changed) stable/7/usr.sbin/sysinstall/config.c stable/7/usr.sbin/sysinstall/globals.c stable/7/usr.sbin/sysinstall/index.c stable/7/usr.sbin/sysinstall/package.c stable/7/usr.sbin/sysinstall/sysinstall.h Modified: stable/7/usr.sbin/sysinstall/config.c ============================================================================== --- stable/7/usr.sbin/sysinstall/config.c Fri Oct 24 19:36:28 2008 (r184231) +++ stable/7/usr.sbin/sysinstall/config.c Fri Oct 24 20:10:22 2008 (r184232) @@ -737,6 +737,7 @@ configPackages(dialogMenuItem *self) while (1) { int ret, pos, scroll; + int current, low, high; /* Bring up the packages menu */ pos = scroll = 0; @@ -751,8 +752,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: stable/7/usr.sbin/sysinstall/globals.c ============================================================================== --- stable/7/usr.sbin/sysinstall/globals.c Fri Oct 24 19:36:28 2008 (r184231) +++ stable/7/usr.sbin/sysinstall/globals.c Fri Oct 24 20:10:22 2008 (r184232) @@ -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: stable/7/usr.sbin/sysinstall/index.c ============================================================================== --- stable/7/usr.sbin/sysinstall/index.c Fri Oct 24 19:36:28 2008 (r184231) +++ stable/7/usr.sbin/sysinstall/index.c Fri Oct 24 20:10:22 2008 (r184232) @@ -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; } @@ -682,9 +692,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; @@ -699,7 +711,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(); @@ -712,9 +724,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); @@ -732,10 +748,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, @@ -801,6 +845,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: stable/7/usr.sbin/sysinstall/package.c ============================================================================== --- stable/7/usr.sbin/sysinstall/package.c Fri Oct 24 19:36:28 2008 (r184231) +++ stable/7/usr.sbin/sysinstall/package.c Fri Oct 24 20:10:22 2008 (r184232) @@ -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: stable/7/usr.sbin/sysinstall/sysinstall.h ============================================================================== --- stable/7/usr.sbin/sysinstall/sysinstall.h Fri Oct 24 19:36:28 2008 (r184231) +++ stable/7/usr.sbin/sysinstall/sysinstall.h Fri Oct 24 20:10:22 2008 (r184232) @@ -386,6 +386,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; @@ -418,6 +419,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 */ @@ -481,6 +483,8 @@ extern int FixItMode; extern const char * StartName; /* Which name we were started as */ extern const char * ProgName; /* Program's proper name */ 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; @@ -672,7 +676,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);