public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* [PATCH setup] Add setup-minimum-version: to setup.ini
@ 2018-02-26 14:02 Jon Turney
  2018-02-26 17:10 ` cyg Simple
  0 siblings, 1 reply; 8+ messages in thread
From: Jon Turney @ 2018-02-26 14:02 UTC (permalink / raw)
  To: cygwin-apps; +Cc: Jon Turney

This allows setup.ini to require a certain setup version, rather than advise
a newer version when one is available.

Unfortunately, versions of setup prior to this one don't implement this, but
at least we have this going forward.

When we want to start using this, we can break backwards compatibility with
even older setup in a less clean way, simply by using setup.ini grammar that
they can't parse.
---
 IniDBBuilderPackage.cc | 16 ++++++++++++++++
 IniDBBuilderPackage.h  |  1 +
 inilex.ll              |  2 ++
 iniparse.yy            | 16 ++++++++++++----
 4 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/IniDBBuilderPackage.cc b/IniDBBuilderPackage.cc
index 8fa6ad9..ed861a5 100644
--- a/IniDBBuilderPackage.cc
+++ b/IniDBBuilderPackage.cc
@@ -65,6 +65,22 @@ IniDBBuilderPackage::buildVersion (const std::string& aVersion)
     }
 }
 
+const std::string
+IniDBBuilderPackage::buildMinimumVersion (const std::string& minimum)
+{
+  if (version_compare(setup_version, minimum) < 0)
+    {
+      char min_vers[256];
+      snprintf (min_vers, sizeof(min_vers),
+                "The current ini file requires at least version %s of setup.\n"
+                "Please download a newer version from http://www.cygwin.com/setup-%s.exe",
+                minimum.c_str(),
+                is_64bit ? "x86_64" : "x86");
+      return min_vers;
+    }
+  return "";
+}
+
 void
 IniDBBuilderPackage::buildPackage (const std::string& _name)
 {
diff --git a/IniDBBuilderPackage.h b/IniDBBuilderPackage.h
index da2d97d..1fed420 100644
--- a/IniDBBuilderPackage.h
+++ b/IniDBBuilderPackage.h
@@ -37,6 +37,7 @@ public:
 
   void buildTimestamp (const std::string& );
   void buildVersion (const std::string& );
+  const std::string buildMinimumVersion(const std::string &);
   void buildPackage (const std::string& );
   void buildPackageVersion (const std::string& );
   void buildPackageSDesc (const std::string& );
diff --git a/inilex.ll b/inilex.ll
index 95888cf..41bf6a2 100644
--- a/inilex.ll
+++ b/inilex.ll
@@ -107,7 +107,9 @@ B64	[a-zA-Z0-9_-]
 
 "setup-timestamp:"	return SETUP_TIMESTAMP;
 "setup-version:"	return SETUP_VERSION;
+"setup-minimum-version:"	return SETUP_MINIMUM_VERSION;
 "arch:"			return ARCH;
+
 "release:"		return RELEASE;
 "Package:"		return PACKAGENAME;
 [vV]"ersion:"		return PACKAGEVERSION;
diff --git a/iniparse.yy b/iniparse.yy
index 1999536..991e788 100644
--- a/iniparse.yy
+++ b/iniparse.yy
@@ -35,8 +35,15 @@ IniDBBuilderPackage *iniBuilder;
 extern int yylineno;
 %}
 
-%token STRING 
-%token SETUP_TIMESTAMP SETUP_VERSION PACKAGEVERSION INSTALL SOURCE SDESC LDESC
+%token STRING
+%token SETUP_TIMESTAMP
+%token SETUP_VERSION
+%token SETUP_MINIMUM_VERSION
+%token PACKAGEVERSION
+%token INSTALL
+%token SOURCE
+%token SDESC
+%token LDESC
 %token REPLACE_VERSIONS
 %token CATEGORY DEPENDS REQUIRES
 %token T_PREV T_CURR T_TEST T_OTHER
@@ -59,12 +66,13 @@ whole_file
 setup_headers: /* empty */
  | setup_headers header
  ;
- 
+
 header /* non-empty */
  : SETUP_TIMESTAMP STRING	{ iniBuilder->buildTimestamp ($2); } NL
  | SETUP_VERSION STRING		{ iniBuilder->buildVersion ($2); } NL
  | RELEASE STRING		{ iniBuilder->set_release ($2); } NL
- | ARCH STRING 			{ iniBuilder->set_arch ($2); } NL
+ | ARCH STRING			{ iniBuilder->set_arch ($2); } NL
+ | SETUP_MINIMUM_VERSION STRING { std::string e = iniBuilder->buildMinimumVersion ($2); if (!e.empty()) { yyerror(e); } } NL
  ;
 
 packages: /* empty */
-- 
2.16.2

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH setup] Add setup-minimum-version: to setup.ini
  2018-02-26 14:02 [PATCH setup] Add setup-minimum-version: to setup.ini Jon Turney
@ 2018-02-26 17:10 ` cyg Simple
  2018-02-26 17:45   ` Jon Turney
  0 siblings, 1 reply; 8+ messages in thread
From: cyg Simple @ 2018-02-26 17:10 UTC (permalink / raw)
  To: cygwin-apps

On 2/26/2018 9:02 AM, Jon Turney wrote:
> This allows setup.ini to require a certain setup version, rather than advise
> a newer version when one is available.
> 
> Unfortunately, versions of setup prior to this one don't implement this, but
> at least we have this going forward.
> 
> When we want to start using this, we can break backwards compatibility with
> even older setup in a less clean way, simply by using setup.ini grammar that
> they can't parse.
While you're breaking backward compatibility may I be so bold as to
suggest a change in the name of setup EXE to include the version of
setup?  And then with that change a query to the user to download and
use the newest version of setup?

The change stems from a long standing desire to do just what I've
described.  Since setup knows that it is out of date why force the user
to exit it, go to cygwin.com to download the current version and then
restart that version of setup?  The name change would allow for an easy
method to apply a change to do the download of the newer version from
the older version as it removes the name conflict.

-- 
cyg Simple

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH setup] Add setup-minimum-version: to setup.ini
  2018-02-26 17:10 ` cyg Simple
@ 2018-02-26 17:45   ` Jon Turney
  2018-02-27 14:32     ` cyg Simple
  2018-03-02 16:09     ` cyg Simple
  0 siblings, 2 replies; 8+ messages in thread
From: Jon Turney @ 2018-02-26 17:45 UTC (permalink / raw)
  To: cygwin-apps

On 26/02/2018 17:10, cyg Simple wrote:
> On 2/26/2018 9:02 AM, Jon Turney wrote:
>> This allows setup.ini to require a certain setup version, rather than advise
>> a newer version when one is available.
>>
>> Unfortunately, versions of setup prior to this one don't implement this, but
>> at least we have this going forward.
>>
>> When we want to start using this, we can break backwards compatibility with
>> even older setup in a less clean way, simply by using setup.ini grammar that
>> they can't parse.
> While you're breaking backward compatibility may I be so bold as to

Um, what?  This doesn't do anything of the sort.

> suggest a change in the name of setup EXE to include the version of
> setup?  And then with that change a query to the user to download and
> use the newest version of setup?

This will break more than backwards compatibility with old versions of 
setup, but also any scripts that do 'wget -N 
https://cygwin.com/setup-x86_64.exe', or equivalent.

It also invalidates a lot of written references to this executable, so 
we should probably only make this change with good reason.

> The change stems from a long standing desire to do just what I've
> described.  Since setup knows that it is out of date why force the user
> to exit it, go to cygwin.com to download the current version and then
> restart that version of setup?  The name change would allow for an easy
> method to apply a change to do the download of the newer version from
> the older version as it removes the name conflict.

You might find the code in [1] a good starting point for an alternate 
implementation, which doesn't require renaming the executable.

[1] https://cygwin.com/ml/cygwin-apps/2011-04/msg00054.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH setup] Add setup-minimum-version: to setup.ini
  2018-02-26 17:45   ` Jon Turney
@ 2018-02-27 14:32     ` cyg Simple
  2018-02-27 15:32       ` Marco Atzeri
  2018-03-02 16:09     ` cyg Simple
  1 sibling, 1 reply; 8+ messages in thread
From: cyg Simple @ 2018-02-27 14:32 UTC (permalink / raw)
  To: cygwin-apps

On 2/26/2018 12:45 PM, Jon Turney wrote:
> On 26/02/2018 17:10, cyg Simple wrote:
>> On 2/26/2018 9:02 AM, Jon Turney wrote:
>>> This allows setup.ini to require a certain setup version, rather than
>>> advise
>>> a newer version when one is available.
>>>
>>> Unfortunately, versions of setup prior to this one don't implement
>>> this, but
>>> at least we have this going forward.
>>>
>>> When we want to start using this, we can break backwards
>>> compatibility with
>>> even older setup in a less clean way, simply by using setup.ini
>>> grammar that
>>> they can't parse.
>> While you're breaking backward compatibility may I be so bold as to
> 
> Um, what?  This doesn't do anything of the sort.
> 
>> suggest a change in the name of setup EXE to include the version of
>> setup?  And then with that change a query to the user to download and
>> use the newest version of setup?
> 
> This will break more than backwards compatibility with old versions of
> setup, but also any scripts that do 'wget -N
> https://cygwin.com/setup-x86_64.exe', or equivalent.
> 

Easily remedied by a symlink to the current version.  Many packages have
such a link as an aid to such scripts.

> It also invalidates a lot of written references to this executable, so
> we should probably only make this change with good reason.
> 

Versioning the executable to the version setup.ini expects can add
visual documentation for problems that someone might have based on a
private setup.ini file.  If someone downloads a current version of the
setup executable and points it to his older private setup.ini then
things break.

Versioning the executable also prevents the user from having to guess
which version of setup-x86[_64].exe is sitting in his downloads folder
when he has more than one.  Windows adds its own versioning indicators
which is simply nothing more than trying to avoid file name collision
which makes it difficult to determine which version of the file it
actually is.

Versioning the executable is more in line with other open source
projects that version the files it delivers to the version being
released.  I am aware that this anomaly with the setup executable has
been in play for many years but that doesn't mean that it is correct to
continue it.

>> The change stems from a long standing desire to do just what I've
>> described.  Since setup knows that it is out of date why force the user
>> to exit it, go to cygwin.com to download the current version and then
>> restart that version of setup?  The name change would allow for an easy
>> method to apply a change to do the download of the newer version from
>> the older version as it removes the name conflict.
> 
> You might find the code in [1] a good starting point for an alternate
> implementation, which doesn't require renaming the executable.
> 
> [1] https://cygwin.com/ml/cygwin-apps/2011-04/msg00054.html

I'll take a look at your reference and provide comment under a different
response.  However, not versioning the file isn't something I am
promoting as I am of the belief that the delivered executable should
have a version attached to its name.

-- 
cyg Simple

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH setup] Add setup-minimum-version: to setup.ini
  2018-02-27 14:32     ` cyg Simple
@ 2018-02-27 15:32       ` Marco Atzeri
  2018-02-27 20:17         ` cyg Simple
  0 siblings, 1 reply; 8+ messages in thread
From: Marco Atzeri @ 2018-02-27 15:32 UTC (permalink / raw)
  To: cygwin-apps

On 27/02/2018 15:32, cyg Simple wrote:
> On 2/26/2018 12:45 PM, Jon Turney wrote:

> I'll take a look at your reference and provide comment under a different
> response.  However, not versioning the file isn't something I am
> promoting as I am of the belief that the delivered executable should
> have a version attached to its name.
> 

please not add version to the setup executable name.

Some of us are using the setup through link or batch
to automatically select some preferred configuration.

Adjusting them every time we update the setup program
has no added value.

Regards
Marco


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH setup] Add setup-minimum-version: to setup.ini
  2018-02-27 15:32       ` Marco Atzeri
@ 2018-02-27 20:17         ` cyg Simple
  2018-02-28 18:54           ` Achim Gratz
  0 siblings, 1 reply; 8+ messages in thread
From: cyg Simple @ 2018-02-27 20:17 UTC (permalink / raw)
  To: cygwin-apps

On 2/27/2018 10:32 AM, Marco Atzeri wrote:
> On 27/02/2018 15:32, cyg Simple wrote:
>> On 2/26/2018 12:45 PM, Jon Turney wrote:
> 
>> I'll take a look at your reference and provide comment under a different
>> response.  However, not versioning the file isn't something I am
>> promoting as I am of the belief that the delivered executable should
>> have a version attached to its name.
>>
> 
> please not add version to the setup executable name.
> 
> Some of us are using the setup through link or batch
> to automatically select some preferred configuration.
> 
> Adjusting them every time we update the setup program
> has no added value.

That point was already addressed by Jon and my retort was that the issue
could be resolved by supplying a symlink for the name without the version.

>>
>> This will break more than backwards compatibility with old versions
>> of setup, but also any scripts that do 'wget -N
>> https://cygwin.com/setup-x86_64.exe', or equivalent.
>>

> Easily remedied by a symlink to the current version.  Many packages
> have such a link as an aid to such scripts.

-- 
cyg Simple

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH setup] Add setup-minimum-version: to setup.ini
  2018-02-27 20:17         ` cyg Simple
@ 2018-02-28 18:54           ` Achim Gratz
  0 siblings, 0 replies; 8+ messages in thread
From: Achim Gratz @ 2018-02-28 18:54 UTC (permalink / raw)
  To: cygwin-apps

cyg Simple writes:
> That point was already addressed by Jon and my retort was that the issue
> could be resolved by supplying a symlink for the name without the version.

You still failed to provide an evidence of the benefits outweighing the
drawbacks.  Also, I'm neither buying your argument that the practise you
advocate is widespread (simply because there aren't many programs that
work like setup.exe) nor that it is clearly better than the
alternatives.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Samples for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldSamplesExtra

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH setup] Add setup-minimum-version: to setup.ini
  2018-02-26 17:45   ` Jon Turney
  2018-02-27 14:32     ` cyg Simple
@ 2018-03-02 16:09     ` cyg Simple
  1 sibling, 0 replies; 8+ messages in thread
From: cyg Simple @ 2018-03-02 16:09 UTC (permalink / raw)
  To: cygwin-apps

On 2/26/2018 12:45 PM, Jon Turney wrote:
> 
> You might find the code in [1] a good starting point for an alternate
> implementation, which doesn't require renaming the executable.
> 
> [1] https://cygwin.com/ml/cygwin-apps/2011-04/msg00054.html

Chris Faylor:
>>
>> Sounds wonderful but couldn't you just rename the original setup.exe
>> out of the way, copy a new version over it in place, and then
>> re-execute?

Jon Turney:
> I'm just following a sequence of actions which a bit of google
> research found other people had successfully used.

> what you suggest seems like it should work, although I'd perhaps be a
> bit wary of assuming that MoveFile() on the running executable works
> always.

But my suggestion removes the need to MoveFile() of the open executable
as the name of the new version file would be different.  The other
possibility I suppose would be to give the file being downloaded a name
with the version or date of download appended.  But I still think a
version number on the setup executable file name could potentially be
beneficial.

Benefits:
* A person could check cygwin.com and know that the version of setup he
has is different just by visually checking the name.
* The name of the executable represents the version expected by setup.ini.
* Historical preview of someone doing research for previous versions.
* Better serves convention with other projects delivering installers for
Windows executables; Firefox, Thunderbird, MySQL, Postgres, PHP, Apache,
etc. all have a version number for the Windows executable.

Drawbacks:
* Scripts using the name of the executable without the version.  This is
easily remedied by a symlink to the current executable.

-- 
cyg Simple

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-03-02 16:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-26 14:02 [PATCH setup] Add setup-minimum-version: to setup.ini Jon Turney
2018-02-26 17:10 ` cyg Simple
2018-02-26 17:45   ` Jon Turney
2018-02-27 14:32     ` cyg Simple
2018-02-27 15:32       ` Marco Atzeri
2018-02-27 20:17         ` cyg Simple
2018-02-28 18:54           ` Achim Gratz
2018-03-02 16:09     ` cyg Simple

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).