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 Mon, 24 Mar 2003, Igor Pechtchanski wrote:

> On 25 Mar 2003, Robert Collins wrote:
>
> > On Tue, 2003-03-25 at 11:00, Igor Pechtchanski wrote:
> > > > run_package_scripts cries our for a helper class IMO.
> > > >
> > > > i.e. ScriptRunner with
> > > > a) constructor
> > > > b) destructor
> > > > c) run(std::vector<Script> const &) method.
> > > > d) operator () (Script const &aScript) method.
> > >
> > > I don't see the benefit of run(); it'll be subsumed by operator(), IMO.
> > > Otherwise, I'll give it a shot.
> >
> > well, you'll have one instance of ScriptRunner for both the dependency
> > order package scripts, and the found-by-filename scripts. If you have
> > pre-running-a-vector or post-running-a-vector code, then that belongs in
> > run(). If that code goes into the constructor, then sure, eliminate
> > run().
>
> Yep, I think the pre-post vector code could go into the
> constructor/destructor.
>
> > > > this:
> > > > for (std::vector<Script>::iterator script = scripts.begin();
> > > > +       script != scripts.end();
> > > > +       ++script)
> > > >
> > > > then becomes
> > > > *this = for_each (scripts.begin(), scripts.end(), *this);
> > >
> > > We could probably just lose the return value...
> >
> > Check the template, IIRC it takes a copy of the object, calls the copy's
> > operator (), then returns a copy of the copy.
> > i.e. if we want failure stats, script run counts etc, we need the return
> > value.
> > Rob
>
> Yes, but we don't keep failure stats.  If we ever decide to, we can easily
> capture the return value later.  I'm pretty sure we can ignore it for now.
>
> Thanks for the feedback.  I'll send the next iteration soon.
>         Igor

...and here it is.  Attached.
	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::ETCPostinstall): New static member constant.
	* script.cc (Script::fullName): Implement.
	(Script::run): Implement.
	(Script::ETCPostinstall): Define.
	(Script::isAScript): Use ETCPostinstall instead of a
	hardcoded string constant.
	(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.
	(RunScript): New helper class for use in for_each.
	(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]