On 1 Apr 2003, Robert Collins wrote:

> On Tue, 2003-04-01 at 09:31, Igor Pechtchanski wrote:
>
> > Rob,
> >
> > The reason I wanted to keep the to_log parameter is that I wanted to keep
> > the code around that directs output to console.  If there are no
> > objections, I'll just make the default value of to_log TRUE, and remove
> > the third parameter from the calls.  I'd like to keep the parameter for
> > now, though.
>
> We're not using that plain code today.
>
> CVS will keep it forever, but I don't want setup kept more complex than
> it needs to be.
>
> Here are some options I'll accept:
> option A) Make output a Strategy of the script object. Allow the output
> strategy to determine window sizing and logging (or not). (This would
> probably be three patchs:
> patch 1)
>  - Extend Script to have more responsibilities from the non OOP script
> code.
> patch 2)
>  - Give it a base strategy class for logging, containing the current if
> (to_log) conditionals, and a boolean in the constructor.
> patch 3)
>  - Create a subclass of the strategy for logging to files.
>  - Create another subclass for logging to console.
>  - Make the base strategy methods pure virtual as appropriate.
>  - Only link in the log to file strategy.
>
> option B) Strip out the unused code.
>
> Leaving the code there, simply so that it's there doesn't make sense.
> I'll accept 'leave it there so we can do X in the future' - in which
> case option A above is an easy path to separate out the two bits of code
> and allow X. But leaving it there for no purpose doesn't make sense to
> me.
>
> Rob

I agree with the sentiment above.  I also think that moving all the static
functionality into the Script class is the way to go.  However, as spare
time is sparse these days, I probably won't get to it for a bit.  In the
meantime, the attached patch provides logging for preremove script in a
minimal way.
        Igor
==============================================================================
ChangeLog:
2003-03-31  Igor Pechtchanski  <[EMAIL PROTECTED]>

        * script.cc (try_run_script): Pass TRUE to run_script.

-- 
                                http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_                [EMAIL PROTECTED]
ZZZzz /,`.-'`'    -.  ;-;;,_            [EMAIL PROTECTED]
     |,4-  ) )-,_. ,\ (  `'-'           Igor Pechtchanski
    '---''(_/--'  `-'\_) fL     a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Knowledge is an unending adventure at the edge of uncertainty.
  -- Leto II
Index: script.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/script.cc,v
retrieving revision 2.8
diff -u -p -r2.8 script.cc
--- script.cc   25 Mar 2003 20:57:13 -0000      2.8
+++ script.cc   1 Apr 2003 01:23:51 -0000
@@ -240,9 +240,9 @@ void
 try_run_script (String const &dir, String const &fname)
 {
   if (io_stream::exists (String ("cygfile://")+ dir + fname + ".sh"))
-    run_script (dir.cstr_oneuse(), (fname + ".sh").cstr_oneuse());
+    run_script (dir.cstr_oneuse(), (fname + ".sh").cstr_oneuse(), TRUE);
   if (io_stream::exists (String ("cygfile://")+ dir + fname + ".bat"))
-    run_script (dir.cstr_oneuse(), (fname + ".bat").cstr_oneuse());
+    run_script (dir.cstr_oneuse(), (fname + ".bat").cstr_oneuse(), TRUE);
 }
 
 char const Script::ETCPostinstall[] = "/etc/postinstall/";

Reply via email to