[PATCH] Run postinstall scripts in a thread with progress bars - take 2

Robert Collins rbcollins@cygwin.com
Thu Mar 20 22:11:00 GMT 2003


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.

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

Rob

-- 
GPG key available at: <http://users.bigpond.net.au/robertc/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://cygwin.com/pipermail/cygwin-apps/attachments/20030320/07596fec/attachment.sig>


More information about the Cygwin-apps mailing list