[PATCH] Incidental setup.exe patches #3: Simplify packagedb task handling

Dave Korn dave.korn.cygwin@googlemail.com
Wed Apr 14 04:35:00 GMT 2010



  I found out why we never see packages being set to "Retrieve" in download
mode any more.  There was a bit of a refactoring accident here:

> 2008-08-12  
> 
> 	Revamp for Cygwin 1.7.

> 	* package_db.cc (chosen_db_task): New global variable.
> 	* package_db.h (chosen_db_task): Declare.

> 	(RootPage::OnNext): Initialize packagedb here the first time, to
> 	avoid fetching wrong data from different previous installation.
> 	* source.cc (save_dialog): Don't initialize packagedb here, rather
> 	just memorize setting in chosen_db_task for the deferred initialization
> 	in RootPage::OnNext.

  The problem with this design is that the root page isn't run in download
mode, so the deferred assignment never happens.  As it happens, the default
setting is PackageDB_Install, which means that download mode is the only mode
in which the deferred assignment would actually change anything - but it's
also the one mode in which the deferred assignment never takes place!

  Fortunately, as far as I can tell, it no longer matters.  I couldn't work
out what the original problem referred to might have been, because subsequent
changes have apparently rendered it moot.  The one and only thing for which
the packagedb's task setting is used any more is in order to decide whether to
return the string "Reinstall" or "Retrieve" when generating the action caption
for the PickPackageLine related to a given packagemeta.

  So, I think we can now safely remove chosen_db_task and the whole deferred
init construct, giving the attached patch.

	* package_db.cc (chosen_db_task): Delete variable.  Relocate
	trailing comment.
	* package_db.h (chosen_db_task): Don't declare extern.
	* package_meta.cc (packagemeta::action_caption): Simplify static
	member access to packagedb task.
	* root.cc (RootPage::OnNext): Don't deferred-init packagedb task.
	* source.cc (save_dialog): Set packagedb task directly instead of
	caching value in chosen_db_task for deferred init.

  In download mode, the strings that until now used to say "Reinstall", now
say "Retrieve" again.  OK?

  Also, a more general question: what does it mean that setup.exe offers an
"Uninstall" option in download mode?  (I'm going to have to fire up a VM and
see whether it actually does anything or not, but what could it be *supposed*
to do?)  My first thought is that it's an accident and shouldn't be there.

    cheers,
      DaveK

-------------- next part --------------
A non-text attachment was scrubbed...
Name: setup-simplify-packagedb-task-handling.diff
Type: text/x-c
Size: 3489 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-apps/attachments/20100414/01b47bc5/attachment.bin>


More information about the Cygwin-apps mailing list