[PATCH] setup: Add --nowarn-if-older option

Igor Pechtchanski pechtcha@cs.nyu.edu
Thu Sep 8 03:44:00 GMT 2005


One consequence of doing releases from a separate branch, rather than the
trunk, is that self-built setup from the trunk will complain[*] that a
newer version is available (unless there was a check-in since the
release).  The attached patch adds a --nowarn-if-older (-o) option that
prevents this warning.  I'd be happy to have an alternative solution to
this problem (such as removing the warning altogether, or making it
non-modal).

Again, the ChangeLog is below.
	Igor
[*] Rather annoyingly, by popping one message box per mirror, plus an
extra message box in the end.
==============================================================================
2005-09-07  Igor Pechtchanski  <pechtcha@cs.nyu.edu>

	* state.cc (no_warn_if_older): New global variable.
	* state.h (no_warn_if_older): Declare it.
	* main.cc (NoWarnIfOlderOption): New boolean option.
	* ini.cc (do_ini_thread): Don't warn about newer setup if
	no_warn_if_older is true.
	* IniDBBuilderPackage.cc (IniDBBuilderPackage::buildVersion): Ditto.

-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. /DA
-------------- next part --------------
Index: IniDBBuilderPackage.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/IniDBBuilderPackage.cc,v
retrieving revision 2.19
diff -u -p -r2.19 IniDBBuilderPackage.cc
--- IniDBBuilderPackage.cc	14 May 2005 15:57:29 -0000	2.19
+++ IniDBBuilderPackage.cc	8 Sep 2005 03:09:57 -0000
@@ -25,6 +25,7 @@
 #include "package_version.h"
 #include "cygpackage.h"
 #include "filemanip.h"
+#include "state.h"
 // for strtoul
 #include <string.h>
 #include "LogSingleton.h"
@@ -57,7 +58,7 @@ IniDBBuilderPackage::buildVersion (Strin
   version = aVersion;
   if (version.size())
     {
-      if (version_compare(setup_version, version) < 0)
+      if (!no_warn_if_older && version_compare(setup_version, version) < 0)
 	_feedback.warning("The current ini file is from a newer version of setup.exe. If you have any trouble installing, please download a fresh version from http://www.cygwin.com/setup.exe");
     }
 }
Index: ini.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/ini.cc,v
retrieving revision 2.42
diff -u -p -r2.42 ini.cc
--- ini.cc	5 May 2005 22:48:35 -0000	2.42
+++ ini.cc	8 Sep 2005 03:09:57 -0000
@@ -258,7 +258,7 @@ do_ini_thread (HINSTANCE h, HWND owner)
        setup_version);
   if (ini_setup_version.size())
     {
-      if (version_compare(setup_version, ini_setup_version) < 0)
+      if (!no_warn_if_older && version_compare(setup_version, ini_setup_version) < 0)
 	note (owner, IDS_OLD_SETUP_VERSION, setup_version,
               ini_setup_version.c_str());
     }
Index: main.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/main.cc,v
retrieving revision 2.42
diff -u -p -r2.42 main.cc
--- main.cc	21 May 2005 23:04:02 -0000	2.42
+++ main.cc	8 Sep 2005 03:09:57 -0000
@@ -75,6 +75,9 @@ HINSTANCE hinstance;
 static BoolOption UnattendedOption (false, 'q', "quiet-mode", "Unattended setup mode");
 static BoolOption HelpOption (false, 'h', "help", "print help");
 
+static BoolOption NoWarnIfOlderOption (false, 'o', "nowarn-if-older",
+    "Don't warn if a newer version of setup is available");
+
 /* Maximum size of a SID on NT/W2K. */
 #define MAX_SID_LEN	40
 
@@ -476,6 +479,8 @@ main (int argc, char **argv)
 
     unattended_mode = UnattendedOption;
 
+    no_warn_if_older = NoWarnIfOlderOption;
+
     /* Set the default DACL and Group only on NT/W2K. 9x/ME has 
        no idea of access control lists and security at all. */
     if (IsWindowsNT())
@@ -526,3 +531,4 @@ main (int argc, char **argv)
   // Never reached
   return 0;
 }
+// }
Index: state.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/state.cc,v
retrieving revision 2.4
diff -u -p -r2.4 state.cc
--- state.cc	4 May 2005 14:52:34 -0000	2.4
+++ state.cc	8 Sep 2005 03:09:58 -0000
@@ -23,6 +23,7 @@ static const char *cvsid =
 #include "state.h"
 
 bool unattended_mode;
+bool no_warn_if_older;
 
 int source;
 
Index: state.h
===================================================================
RCS file: /cvs/cygwin-apps/setup/state.h,v
retrieving revision 2.10
diff -u -p -r2.10 state.h
--- state.h	4 May 2005 14:52:34 -0000	2.10
+++ state.h	8 Sep 2005 03:09:58 -0000
@@ -32,6 +32,7 @@
 #include "String++.h"
 
 extern bool unattended_mode;
+extern bool no_warn_if_older;
 
 extern int source;
 


More information about the Cygwin-apps mailing list