Ken Brown [Tue, 19 Dec 2017 00:46:36 +0000 (19:46 -0500)]
Give TOPLEVEL_CATCH an owner window
The fatal message box produced by TOPLEVEL_CATCH had a NULL owner
window. This meant that the box could be hidden by whatever window
was previously being displayed, so that setup appeared to hang. In
addition, the user could interact with the propsheet window while the
message box was displayed.
Fix this by giving TOPLEVEL_CATCH an "owner" parameter. In all uses
but one (TOPLEVEL_CATCH("main")), there is a non-NULL owner available
that we can use.
Jon Turney [Sat, 4 Nov 2017 16:09:01 +0000 (16:09 +0000)]
Simplify LocalDirPage::OnNext()
Never go directly to IDD_CHOOSE from LocalDirPage::OnNext(), go to
IDD_INSTATUS with WM_APP_START_SETUP_INI_DOWNLOAD (if source ==
IDC_SOURCE_LOCALDIR), otherwise IDD_NET (which eventually leads there)
Jon Turney [Sat, 4 Nov 2017 15:37:58 +0000 (15:37 +0000)]
Make do_ini() succeed if found_ini_list is empty
Rather than count the number of .ini files read in do_{local,remote}_ini,
and assume success if greater than zero, actually track if an error occured.
This is a subtle change of behaviour if more than one .ini file is read:
previously all we needed was one to succeed, now we need them all to
succeed.
(Note that site_list should never be empty, and it's still an error if we
don't find an .ini file from a site, so the practical effect is to make
do_local_ini succeed with an empty found_ini_list)
Jon Turney [Fri, 29 Sep 2017 13:18:44 +0000 (14:18 +0100)]
Make removeEmptyCategories() explicit, rather than a side effect of defaultTrust()
It's unclear that this can ever do anything. The list of categories is
built as we see packages in those categories, so I don't know how we can
ever get an empty category.
Jon Turney [Tue, 25 Apr 2017 22:44:08 +0000 (23:44 +0100)]
Hoist uninstall up to Installer::uninstallOne()
This calls packagemeta, which applies to packageversion (which delegates
through packageversion_ to cygpackage) to return lines from the .lst.gz file
(pretending that we know it contains a file list for that specific version)
and to remove the .lst.gz file when done.
Move this all up into Installer::uninstallOne(), where it's all in the same
place as the operation it is reversing, Installer::installOne().
Jon Turney [Wed, 26 Apr 2017 14:20:14 +0000 (15:20 +0100)]
Hoist pick() up to packagemeta
We are always writing packagemeta.desired.pick(bool, packagemeta). This
kind of suggests something not quite right.
The pick flag means install/reinstall, so despite being stored per
packageversion, is only significant to download/install for the desired
version.
There's a slight wrinkle in that we want to also set/clear this flag for the
source packageversion. We can't change this to point to packagemeta rather
than packageversion, as that may not be the same for all versions, so
instead just track this flag separately as srcpicked.
Note that there is still a complicated mapping between the state of desired
and pick and the action represented in the UI:
Jon Turney [Tue, 23 May 2017 21:19:15 +0000 (22:19 +0100)]
Hoist addScript() etc. up from packageversion to packagemeta
We're only interesting in storing scripts and later running them from the
desired version as we install it, so despite being stored per
packageversion, this is only significant for the desired version.
Ken Brown [Tue, 5 Dec 2017 17:21:12 +0000 (12:21 -0500)]
Fix response to enter in the chooser search textbox
Make 'enter' after we've started typing into the search textbox cause the
search filter to immediately take effect.
We don't change the default control immediately on EN_SETFOCUS unless there
is already text in the search textbox, so pressing 'enter' with the focus on
the search textbox (the initial state of the dialog) without typing anything
into the search textbox moves to the next page, as previously.
Also improve a bit of debug output from ChooserPage::OnMessageCmd()
v2:
Explicitly add/remove the defpushbutton style from the "Next" button when
the default button changes
v3:
Refine behaviour so default control is changed on EN_SETFOCUS if some
search text is present.
Ken Brown [Tue, 28 Nov 2017 13:54:37 +0000 (08:54 -0500)]
Remove references to "last-extrakeys"
Extra gpg keys used to be stored in a file /etc/setup/last-extrakeys.
These keys are now saved in the "extrakeys" user setting, but there
were still references to "last-extrakeys" in comments and in a help
string.
Ken Brown [Tue, 28 Nov 2017 13:45:44 +0000 (08:45 -0500)]
Change the interpretation of '#' in setup.rc
'#' was treated as a comment character in all circumstances. Since
saved gpg keys contain '#', this caused the "extrakeys" user setting
to get truncated. Change this so that '#' only indicates a comment if
it's the first non-whitespace character in a line.
Ken Brown [Mon, 27 Nov 2017 18:14:15 +0000 (13:14 -0500)]
Fix the reading and writing of the "extrakeys" user setting
ExtraKeysSetting::keybuffer is terminated by LF rather than NUL. So
we have to replace NUL by LF after calling
UserSettings::get("extrakeys") in the ExtraKeysSetting constructor.
Otherwise the last saved key is discarded. Also, bufsize has to be
set appropriately before the call to count_keys(), or else all saved
keys are discarded.
Similarly, the final LF in keybuffer has to be replaced by NUL in the
ExtraKeysSetting destructor before the call to
UserSettings::set("extrakeys", keybuffer). Otherwise we get garbage
at the end of the "extrakeys" setting in setup.rc.
Ken Brown [Fri, 24 Nov 2017 17:29:27 +0000 (12:29 -0500)]
site.cc, site.h: code cleanup
Remove site_list_type::init(), which was introduced to work around a
problem with gcc-2.95.
Add a bool member 'from_mirrors_lst' to the site_list_type class. Use
it to distinguish mirrors listed in mirrors.lst from user-added sites.
This replaces the (undocumented) use of
site_list_type::servername.size() for this purpose.
When registerSavedSite is called on a URL that's already in
'all_site_list', add the version from 'all_site_list' to 'site_list'
rather than adding a temporary version that contains no information
other than the URL.
Similarly, if the user adds a site that was already in
'all_site_list', don't replace the existent version with the new one
(which contains only the URL).
Ken Brown [Fri, 27 Oct 2017 18:47:23 +0000 (14:47 -0400)]
Remove the ScanFindVisitor class
This class was used for local installs in which the repository contains no
setup.ini file.
This seems of questionable usefulness, since it doesn't know anything about
dependencies
It also doesn't correctly handle filenames with colons.
There are now good instructions at
https://cygwin.com/package-server.html#overlay for creating a valid
repository, so we just remove the class instead of trying to fix it.
Ken Brown [Mon, 13 Nov 2017 17:27:58 +0000 (12:27 -0500)]
Query user after download error in interactive mode
Instead of just giving the user a "Try again?" Yes/No choice that goes
to IDD_SITE on Yes, create a dialog IDD_DOWNLOAD_ERROR with the
following choices: 'Retry' (retry the download), 'Back' (return to
IDD_CHOOSE), 'Continue' (ignore the errors), or 'Cancel' (exit).
The dialog lists the packages that had download errors so that the
user can make an informed choice.
Users who liked the old behavior (IDD_SITE) can select Back twice.
Ken Brown [Fri, 10 Nov 2017 14:43:35 +0000 (09:43 -0500)]
Just retry download after error in unattended mode
After a download error, setup was going back to IDD_SITE. This is
pointless in unattended mode, since no changes in the mirrors or
packages can be made.
Change misleading comment about retries in unattended mode; the Yes/No
dialog is not used in that case.
Jon Turney [Thu, 19 Oct 2017 01:20:55 +0000 (02:20 +0100)]
Fix -Werror=misleading-indentation errors seen with gcc 6
This looks like an actual bug which has been lurking here since forever,
fortunately not exposed since hardly anything uses Option::Optional...
libgetopt++/src/OptionSet.cc: In member function 'void OptionSet::doOption(std::__cxx11::string&, const size_type&)':
libgetopt++/src/OptionSet.cc:125:25: error: this 'if' clause does not guard... [-Werror=misleading-indentation]
if (!isOption(maybepos))
^~
libgetopt++/src/OptionSet.cc:128:8: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
argv.erase(argv.begin() + 1);
^~~~
libgetopt++/src/OptionSet.cc:159:25: error: this 'if' clause does not guard... [-Werror=misleading-indentation]
if (!isOption(maybepos))
^~
libgetopt++/src/OptionSet.cc:161:8: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
argv.erase(argv.begin() + 1);
^~~~
Jon Turney [Tue, 10 Oct 2017 16:10:57 +0000 (17:10 +0100)]
Fix spinning after replace-on-reboot failure or skipped
If:
- extracting a file failed AND --no-replaceonreboot was used
- OR, writing the .new file for replacing on reboot failed
we don't advance to the next file in the archive, so we just sit there,
trying the same operation repeatedly.
Yes, this seems to mean that --no-replaceonreboot never worked usefully.
Also advance to next file in extract_other error case.
See https://cygwin.com/ml/cygwin/2017-10/msg00090.html
Ake Rehnman [Tue, 2 May 2017 18:55:07 +0000 (20:55 +0200)]
Avoid messagebox spam with file:// protocol URLs
When using a file:// protocol URL for package repo, don't spam messageboxes
warning about absence of compressed setup files. We don't do that for
ftp:// or http:// protocol URLs.
A warning is still given we couldn't find a useable setup.ini from the URL
provided
Jon Turney [Fri, 2 Jun 2017 16:46:14 +0000 (17:46 +0100)]
Fix that clicking on any column changes "Keep" to "Uninstall"
A package's status is only changed by clicking on the "New" column, with one
exception: If the status is "Keep", it is changed to "Uninstall" after a
click (even accidental) on any other column.
"Keep" means desired == installed, picked = false. Only run the code which
is supposed to detect both "src?" and "bin?" unchecked when clicking on
those columns.
Jon Turney [Fri, 2 Jun 2017 11:20:36 +0000 (12:20 +0100)]
Add Option::isPresent() method
Add Option::isPresent() method, so we can distinguish between the cases of
an option which is present with the default value, and an option which is
absent.
Jon Turney [Fri, 28 Apr 2017 21:11:47 +0000 (22:11 +0100)]
Fold build(Install|Source)(MD5|SHA512) into buildPackage(Install|Source)
Fold build(Install|Source)(MD5|SHA512) into buildPackage(Install|Source), so
the (pathname, size, hash) information from an install: or source: line is
all processed together.
Jon Turney [Sun, 21 May 2017 18:45:29 +0000 (19:45 +0100)]
Rename category "Misc" to "Orphaned"
Packages which have no category are placed into this category. Since a
category is mandatory for all packages in setup.ini, this effectively means
packages which are "orphaned" in the sense that they are installed, but
don't appear in any setup.ini.
Usually it's safe to uninstall such packages (with --delete-orphans), unless
you are actually using them, or have locally built packages which rely on
them.
Jon Turney [Tue, 23 May 2017 13:40:24 +0000 (14:40 +0100)]
Restore a missing NULL-ness check
Accidentally dropped in 249e9360. This could go away if
packagesource::Canonical() was changed to return std::string and other uses
checked empty() rather than against NULL.
Jon Turney [Thu, 4 May 2017 21:21:45 +0000 (22:21 +0100)]
All, rather than just the first (usually current) version should get dependencies
It seems that dependencies are only recorded against the first version
encountered, which is fortunately usually the current version. If one were
to install a different version than that the first time a package is
installed, it's dependencies wouldn't be installed.
More zany hijinks from the wacky world of setup :)
Jon Turney [Sat, 29 Apr 2017 22:23:31 +0000 (23:23 +0100)]
Simplify class packagesource
packagesource::Filename() is unused
packagesource::Base() was only used in reporting progress in install.
Instead report the package name and package version. (It would be nice to
do so consistently in uninstall well, but we don't really know what version
we are uninstalling)
The default copy constructor is not overriden, which is unsafe, as the class
contains a pointer to new-ed memory. Use std::string instead, retaining the
relied-upon behaviour of returning NULL for an empty string.
Jon Turney [Thu, 18 May 2017 12:01:06 +0000 (13:01 +0100)]
Use INTERNET_FLAG_RESYNCHRONIZE when fetching cacheable URLs with wininet
It seems this is needed for correct cache behaviour when the server doesn't
add an ETags header (i.e. sending an If-Modified-Since: request). Why would
we want sane behaviour by default, eh?
Jon Turney [Thu, 30 Mar 2017 10:48:44 +0000 (11:48 +0100)]
Use wininet for fetching URLs in direct (non-proxy) case
From the discussion in [1], I was somewhat surprised to learn that setup
doesn't support https or ftps.
Switch to using wininet for fetching URLs in the direct (non-proxy) case, as
well. (It's already used in proxy case). This allows https and ftps
protocols to be used.
For the moment, we keep around the existing, hand-built URL fetching as
'Direct (legacy)'.
Arrange for mirrors.lst and setup.ini to be cached by wininet, but not
package archives (as setup maintains it's own cache of those)
Read from wininet in 64K chunks rather than the whole file, so we can report
progress feedback as we download.
Close rather than leak InternetOpenUrl() handles with errors.
Also fix up some bad indentation.
I think the reason we have a handbuilt HTTP client is that back in 2000 or
so, we were concerned about the case where IE5 wasn't installed and so
wininet wasn't available. But who knows...
Jon Turney [Sat, 21 Jan 2017 16:03:02 +0000 (16:03 +0000)]
Don't show source-only packages in package list
external-source: packages which have no binary package will be marked skip:
and so won't show up in setup.ini at all.
If we change to using the Source: line to identify a source package, which
is (by definition) source only, these will appear in setup.ini, but without
any install: lines, so we need to explcitly avoid showing them in the
package list.
Future work: perhaps add another view to show just source packages?
Jon Turney [Tue, 25 Apr 2017 18:15:16 +0000 (19:15 +0100)]
Don't do unneeded work when changing stability level
Since 2c4487b3, we stopped recomputing all the dependencies every time
something was changed in the PickView. Remove all the depsolver code which
was used to do that.
The only remaining use was when we changed stability level, to select all
the package versions at that stability level. That work is already being
done by packagedb::defaultTrust() (called by ChooserPage::changeTrust()).
(Note that this changes behaviour slightly: New dependencies of currently
installed packages used to be shown in the PickView, but now they won't be
reported until the PrereqChecker)
(This still leaves the crude depsolver we actually use in PrereqChecker,
which just selects all the unmet dependencies with the current trust level)
Jon Turney [Fri, 7 Apr 2017 19:11:08 +0000 (20:11 +0100)]
Remove pointless abstract base class IniDBBuilder
There can be no instances of IniDBBuilder (it has pure virtual methods).
There is only one derived class IniDBBuilderPackage.
We can't think of any use for other derived classes.
Jon Turney [Sat, 21 Jan 2017 18:07:02 +0000 (18:07 +0000)]
Add --allow-unsupported-windows option
This patch was suggested in a discussion with Peter Castro.
The concern is that using old versions of setup to install time machine
mirrors is not ideal, as it misses possible fixes in newer versions of
setup.
However, we do want to make it hard for someone to destroy their working XP
installation, so allowing setup to simply run on XP, which will break it by
upgrading it to the latest version (which doesn't work on XP), seems
contraindicated.
When --allow-unsupported-windows is on:
- Don't check the windows version
- Don't read the mirror list from cygwin.com
- Don't use any stored mirror selection in the 'last-mirror' key (as this
may point to a cygwin mirror, which, if we install from will break things)
- Retain the mirror selection (presumably a time machine circa given with
--site or via the GUI) in an alternate key 'last-mirror-unsupported'
Also, for discoverability, rearrange things so --help works even on
unsupported windows versions
Jon Turney [Wed, 14 Dec 2016 00:00:02 +0000 (00:00 +0000)]
Make package size and checksum mandatory in setup.ini
The setup.ini grammar is written such that size and checksum are optional in
install: lines, and checksum is optional in source: lines. Presumably this
had some historical use.
Change to make package size and checksum mandatory.
Future work: We keep the asymmetry between install: and source: where
buildPackageSource() sets both pathname and size, but buildPackageInstall()
only sets pathname, relying on a separate buildInstallSize() to set the size
later for the moment, as fixing that ripples through to other place.
Jon Turney [Wed, 31 Aug 2016 10:31:22 +0000 (11:31 +0100)]
Allow setup to parse more than 3 versions from the setup.ini file
This recognizes any "[foo]" line as introducing the information for another
version, which doesn't have one of the trust levels [curr], [prev] or
[test], and so isn't automatically selected when setup is told to install
all packages at that trust level (by default, [curr]).
Setup already does all the necessary sorting in version order etc. to use
these additional versions.
The value of <foo> carries no meaning, but the setup.ini specification
will be amended to mandate the use of "[ver<digits>]".
* PackageTrust.h (trusts): Add TRUST_OTHER.
* inilex.ll: tokenize any other [version] as the T_OTHER token.
* iniparse.yy: Add T_OTHER token and set package trust
to TRUST_OTHER when it is used.
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Jon Turney [Tue, 22 Nov 2016 16:05:58 +0000 (16:05 +0000)]
Strip symbols to setup.dbg
As noted in https://cygwin.com/ml/cygwin/2016-11/msg00254.html debugging the
distributed setup executable is a lost cause at the moment. Preserve
symbols so it's not quite as hopeless.
Note: to debug the distributed setup executable with gdb, it will be
necessary to decompress the setup executable with 'upx -d', and, if the .dbg
file has been renamed to match the renamed setup executable, explicitly load
it into gdb with the 'symbol-file' command.
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>