RFC: setup package in Base

Ken Brown kbrown@cornell.edu
Thu Jul 5 18:34:00 GMT 2018


On 4/11/2018 12:56 PM, Jon Turney wrote:
> On 11/04/2018 00:14, Ken Brown wrote:
>> On 4/10/2018 2:12 PM, Yaakov Selkowitz wrote:
>>> In order to speed up the adoption of the latest setup.exe, would it make
>>> sense to ship it as a package?  Here is an initial draft of what this
>>> might look like:
>>>
>>> https://github.com/cygwinports/setup/blob/master/setup.cygport
> 
> I'm not sure upx packing setup here is a good idea, since it interferes 
> with debuggability, and we will be compressing the package archive anyhow.
> 
>>> Note that the executable itself is version/release-numbered so that we
>>> never have to deal with replacing a running executable (setup itself).
> 
> True.
> 
> Not sure that when the setup package is upgraded, setup will be able to 
> remove itself, though.

I've just tested this, and in fact the running setup doesn't remove itself.

> (Old setup-${VERSION}-${RELEASE}.exe lingering may be a price worth 
> paying, though)

I think some users would find it confusing and annoying.  Maybe the 
setup package could provide a perpetual postinstall script that tries to 
remove old versions.

>> I like the idea.  One thing to think about is how to deal with the 
>> situation in which a buggy version of setup fails to update itself. 
>> Maybe we should modify the existing warning that's issued when a newer 
>> version of setup is available.  It could say that setup should update 
>> itself, but it could also give a link to a script that does this 
>> manually in case something goes wrong.
> 
> The instruction that setup currently emits telling you to update setup 
> won't make a lot of sense if setup is then going to update itself

I'm attaching a patch to setup that adds a new option, 
--no-version-warning, to suppress that warning.  (The patch also 
slightly rewords the warning.)  Two further patches, to setup.cygport 
and cygsetup.in, make the setup shortcuts and the cygsetup script use 
that option.

One other comment about the shortcuts and script: I don't think they 
should use the --local-package-dir option.  By the time the shortcuts or 
script are first run, the user will have already run setup at least once 
and will have provided a local package directory.  It could only cause 
confusion for us to change this.

> Also, I guess ideally setup should update itself first, rather than at 
> the same time as all other packages...

This would be a nice feature (possibly with an option to disable it, as 
Achim requested).  But unless it can be done easily, I think we should 
go ahead with the setup package and save this for the future.

Ken

-------------- next part --------------
From 50575f3bef73e37e86662b4f1a975dca074effaf Mon Sep 17 00:00:00 2001
From: Ken Brown <kbrown@cornell.edu>
Date: Thu, 5 Jul 2018 11:22:20 -0400
Subject: [PATCH] Add --no-version-warning option

This suppresses the warning that a newer version of setup is
available.  It is intended to be used by shortcuts and scripts that
run /usr/bin/setup-<version>.exe (from the 'setup' package).

Also reword the warning so that it mentions
/usr/bin/setup-<version>.exe.
---
 IniDBBuilderPackage.cc | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/IniDBBuilderPackage.cc b/IniDBBuilderPackage.cc
index 48a5d4a..1cdae08 100644
--- a/IniDBBuilderPackage.cc
+++ b/IniDBBuilderPackage.cc
@@ -29,8 +29,12 @@
 #include "PackageSpecification.h"
 #include <algorithm>
 
+#include "getopt++/BoolOption.h"
+
 using namespace std;
 
+static BoolOption NoVersionWarningOption (false, '\0', "no-version-warning", "Suppress warning that a newer version of setup is available");
+
 IniDBBuilderPackage::IniDBBuilderPackage (IniParseFeedback const &aFeedback) :
 currentSpec (0), _feedback (aFeedback){}
 
@@ -51,13 +55,15 @@ IniDBBuilderPackage::buildVersion (const std::string& aVersion)
   version = aVersion;
   if (version.size())
     {
-      if (version_compare(setup_version, version) < 0)
+      if (version_compare(setup_version, version) < 0
+	  && !NoVersionWarningOption)
 	{
 	  char old_vers[256];
 	  snprintf (old_vers, sizeof old_vers,
 	    "The current ini file is from a newer version of setup-%s.exe. "
 	    "If you have any trouble installing, please download a fresh "
-	    "version from https://cygwin.com/setup-%s.exe",
+	    "version from https://cygwin.com/setup-%s.exe, or use "
+	    "/usr/bin/setup-<version>.exe, provided by the 'setup' package.",
 	    is_64bit ? "x86_64" : "x86",
 	    is_64bit ? "x86_64" : "x86");
 	  _feedback.warning(old_vers);
-- 
2.17.0

-------------- next part --------------
From 5a1b1c62ae1ae82604b0e64a510cbe1c9c8f1d79 Mon Sep 17 00:00:00 2001
From: Ken Brown <kbrown@cornell.edu>
Date: Thu, 5 Jul 2018 12:47:21 -0400
Subject: [PATCH] Use --no-version-warning in cygsetup script

---
 cygsetup.in | 1 +
 1 file changed, 1 insertion(+)
 mode change 100755 => 100644 cygsetup.in

diff --git a/cygsetup.in b/cygsetup.in
old mode 100755
new mode 100644
index c4b0adc..6bf271a
--- a/cygsetup.in
+++ b/cygsetup.in
@@ -92,6 +92,7 @@ cygsetup ()
     cygstart -- /bin/setup-@VER@.exe \
 	--arch ${arch/i6/x} \
 	--no-shortcuts \
+	--no-version-warning \
 	--root $(cygpath -w /) \
 	--local-package-dir $(cygpath -w /var/cache/setup) \
 	$args
-- 
2.17.0

-------------- next part --------------
From a1529ce5f71e7b9cafcb82f13fb6c6fcdb1a0d68 Mon Sep 17 00:00:00 2001
From: Ken Brown <kbrown@cornell.edu>
Date: Thu, 5 Jul 2018 12:39:37 -0400
Subject: [PATCH] Use --no-version-warning in shortcuts

---
 setup.cygport | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/setup.cygport b/setup.cygport
index c0f312b..ad2790b 100644
--- a/setup.cygport
+++ b/setup.cygport
@@ -35,11 +35,11 @@ src_install() {
 /usr/bin/mkdir -p "\$(/usr/bin/cygpath \$CYGWINFORALL -P)/Cygwin"
 /usr/bin/mkshortcut \$CYGWINFORALL -P -w /var/log \
   -n "Cygwin/Cygwin${ARCH_x86_64+64} Setup" \
-  -a "--local-package-dir \$(cygpath -w /var/cache/setup)" \
+  -a "--no-version-warning --local-package-dir \$(cygpath -w /var/cache/setup)" \
   /usr/bin/setup-${VERSION}-${RELEASE}.exe
 /usr/bin/mkshortcut \$CYGWINFORALL -P -w /var/log \
   -n "Cygwin/Update Cygwin${ARCH_x86_64+64}" \
-  -a "--no-shortcuts --package-manager --upgrade-also --local-package-dir \$(cygpath -w /var/cache/setup)" \
+  -a "--no-shortcuts --package-manager --upgrade-also --no-version-warning --local-package-dir \$(cygpath -w /var/cache/setup)" \
   /usr/bin/setup-${VERSION}-${RELEASE}.exe
 _EOF
 	cat > ${D}/etc/preremove/setup.sh <<_EOF
-- 
2.17.0



More information about the Cygwin-apps mailing list