This is the mail archive of the 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 2

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
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. 


GPG key available at: <>.

Attachment: signature.asc
Description: This is a digitally signed message part

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