This is the mail archive of the cygwin-apps@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Run postinstall scripts in a thread with progress bars - take 3


On 21 Mar 2003, Robert Collins wrote:

> On Fri, 2003-03-21 at 08:49, Igor Pechtchanski wrote:
> > On 21 Mar 2003, Robert Collins wrote:
> >
> > > On Fri, 2003-03-21 at 04:49, Igor Pechtchanski wrote:
> > >
> > > > Same as above, but regenerated against HEAD.  ChangeLog is the same.
> > > > The only thing about this patch that really makes me uncomfortable is
> > > > having to run through iterators/FindVisitors twice.  Any suggestions for
> > > > improvement are welcome.
> > >
> > > Sight unseen - instead of counting in the visitor and iterators, push
> > > all the script details (and package references if appropriate) onto a
> > > list or vector first time through.
> > >
> > > Then, simply walk the list.
> > > Rob
>
> I've give a fuller review later. However:
>
> This code can be simplified:
> 1) iterate over the dependency ordered packages and push all their
> scripts into the 'to be run' collection. Save the current count of
> scripts.
> 2) iterate over the files in the directory.
> 3) subtract the count in 1) from the now total to get the total scripts
> to be run.
> 3a) optional: iterate forward through the scripts vector and remove any
> duplicates. There may even be an stl order preserving call to do this
> (removing the duplicates from pos->end()).
> 4) iterate through the scripts and run them.
>
> 3a) is optional because we don't error on missing scripts IIRC.

Rob,

I wanted (and still want) to keep the two bar progress on this.  The
second bar would show progress through packages, and the first - progress
through the scripts *in the current package*.

> Alteratively/also you could extract the script running and screen
> updating code to a new method.
> Rob

Done.  I've also done some restructuring of the Script class and enabled
the "#if 0"'d code from the previous patch, now that the progress bars
exist.

I've attached the next iteration.  Should apply cleanly to HEAD.
	Igor
==============================================================================
ChangeLog:
2003-03-24  Igor Pechtchanski <pechtcha at cs dot nyu dot edu>

	* threebar.h (WM_APP_START_POSTINSTALL): New message.
	(WM_APP_POSTINSTALL_THREAD_COMPLETE): New message.
	* threebar.cc (ThreeBarProgressPage::OnMessageApp):
	Add handling for WM_APP_START_POSTINSTALL and
	WM_APP_POSTINSTALL_THREAD_COMPLETE.
	* install.cc (do_install_thread): Set next_dialog to
	IDD_S_POSTINSTALL.
	* desktop.cc (DesktopSetupPage::OnFinish): Move the
	do_postinstall call to ThreeBarProgressPage::OnMessageApp.
	* script.h (Script::fullName): New member function.
	(Script::run): New member function.
	* script.cc (Script::fullName): Implement.
	(Script::run): Implement.
	(run): Enable "#if 0"'d code.
	* postinstall.cc (Progress): New extern variable.
	(RunFindVisitor::visitFile): Add script to vector
	instead of running.
	(RunFindVisitor::_scripts): New member variable.
	(run_package_scripts): New static function.
	(do_postinstall_thread): Rename do_postinstall to.  Add
	Progress bar and text setting.  Add package count.
	(do_postinstall_reflector): New static function.
	(do_postinstall): Rename to do_postinstall_thread.
	Create a thread instead.

-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha at cs dot nyu dot edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor at watson dot ibm dot com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Oh, boy, virtual memory! Now I'm gonna make myself a really *big* RAMdisk!
  -- /usr/games/fortune

Attachment: setup-postinstall-thread.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]