[PATCH] inform user if any postinstall script failed to run
Christopher Faylor
cgf-use-the-mailinglist-please@cygwin.com
Fri Aug 27 18:33:00 GMT 2010
On Fri, Aug 27, 2010 at 06:15:38PM +0100, Jon TURNEY wrote:
>On 29/07/2010 17:28, Jon TURNEY wrote:
>> On 28/07/2010 15:58, Christopher Faylor wrote:
>>> On Wed, Jul 28, 2010 at 03:25:17PM +0100, Jon TURNEY wrote:
>>>> Anyhow, here's another attempt, which unfortunately changes rather more than I
>>>> wanted to. It adds a new page, which is displayed if any script failed, and
>>>> reports which packages and scripts failed.
>>>
>>> That is great. Please check in (with a ChangeLog of course).
>
>Due to the way I tested this change, I'd failed to notice that when a package
>is installed with a failing postinstall script, this will list the failing
>script twice, once with the package name and once as 'no package'.
>
>Attached is a patch to remedy that.
Do we realy need a separate for loop for this? Couldn't we just piggy
back on the previous for loop?
cgf
>Index: postinstall.cc
>===================================================================
>RCS file: /cvs/cygwin-apps/setup/postinstall.cc,v
>retrieving revision 2.25
>diff -u -r2.25 postinstall.cc
>--- postinstall.cc 30 Jul 2010 20:53:42 -0000 2.25
>+++ postinstall.cc 27 Aug 2010 17:06:39 -0000
>@@ -161,13 +161,29 @@
> Progress.SetBar2 (k, numpkg);
> }
>
>- // Look for any scripts in /etc/postinstall which haven't been renamed .done,
>- // and try to run them...
>+ // Look for any scripts in /etc/postinstall which haven't been renamed .done
> std::string postinst = cygpath ("/etc/postinstall");
> vector<Script> scripts;
> RunFindVisitor myVisitor (&scripts);
> Find (postinst).accept (myVisitor);
>
>+ // Remove anything which we just tried to run (so we don't try twice)
>+ for (i = packages.begin (); i != packages.end (); ++i)
>+ {
>+ packagemeta & pkg = **i;
>+ for (std::vector<Script>::const_iterator j = pkg.installed.scripts().begin();
>+ j != pkg.installed.scripts().end();
>+ j++)
>+ {
>+ std::vector<Script>::iterator p = find(scripts.begin(), scripts.end(), *j);
>+ if (p != scripts.end())
>+ {
>+ scripts.erase(p);
>+ }
>+ }
>+ }
>+
>+ // and try to run what's left...
> {
> RunScript scriptRunner("No package", scripts);
> scriptRunner.run_all(s);
>Index: script.h
>===================================================================
>RCS file: /cvs/cygwin-apps/setup/script.h,v
>retrieving revision 2.13
>diff -u -r2.13 script.h
>--- script.h 16 Apr 2006 15:37:49 -0000 2.13
>+++ script.h 27 Aug 2010 17:06:39 -0000
>@@ -35,6 +35,7 @@
> or command.com (9x). Returns the exit status of the process, or
> negative error if any. */
> int run() const;
>+ bool operator == (const Script s) { return s.scriptName == scriptName; } ;
> private:
> std::string scriptName;
> static char const ETCPostinstall[];
More information about the Cygwin-apps
mailing list