Jon Turney [Wed, 23 Sep 2020 21:43:30 +0000 (22:43 +0100)]
Fix error with gcc 10.2 and -Werror=format
archive_tar.cc: In member function ‘virtual const string archive_tar::next_file_name()’:
archive_tar.cc:161:37: error: 'I' flag used with ‘%o’ gnu_scanf format [-Werror=format=]
archive_tar.cc:161:37: error: format ‘%o’ expects argument of type ‘unsigned int*’, but argument 3 has type ‘size_t*’ {aka ‘long long unsigned int*’} [-Werror=format=]
archive_tar.cc:181:38: error: 'I' flag used with ‘%o’ gnu_scanf format [-Werror=format=]
archive_tar.cc:181:38: error: format ‘%o’ expects argument of type ‘unsigned int*’, but argument 3 has type ‘size_t*’ {aka ‘long long unsigned int*’} [-Werror=format=]
Jon Turney [Mon, 20 Jul 2020 14:30:44 +0000 (15:30 +0100)]
Migrate selected sites from http:// to https://
If a selected site URL saved from the last run starts with "http://",
and an identical URL except starting with "https://" is in the current
mirror list, migrate it from "http://" to "https://".
Jon Turney [Tue, 21 Jul 2020 13:52:58 +0000 (14:52 +0100)]
Factor out site_list_insert in site.cc
Factor out site_list_insert in site.cc, and add comments to descibe what
what nutty thing this wacky code is doing, after we've expended the
mental effort to figure it out.
Jon Turney [Tue, 17 Mar 2020 13:54:16 +0000 (13:54 +0000)]
Rename Start Menu folder for 32-bit installs on WoW64
This is not totally straightforward: Since setup can install Cygwin with
either bitness (using the '--arch 32|64' option), we must do the right
thing if this is a 64-bit installer being used to install 32-bit Cygwin,
which will run under WoW, even if the installer isn't...
(Naming things like this makes things consistent with Cygwin-X, which
already names it's Start Menu folder 'Cygwin-X (32-bit)' on WoW64. It
also ensures that there aren't collisions between any setup created
shortcuts for 32-bit and 64-bits.)
The desktop icon is already named 'Cygwin Terminal' or 'Cygwin64
Terminal' so doesn't need attention.
Start menu links made in the 'Cygwin' folder by cygwin-doc, and possibly
other packages will also need adjusting.
Jon Turney [Sun, 1 Mar 2020 13:40:21 +0000 (13:40 +0000)]
Produce detatched signature for setup executable using new and old keys
This is slightly fraught: If we don't specify a digest preference, sha1
will be used with both keys, which we don't want. Even if we do specify
a digest preference, sha1 is still used for DSA, and gpg won't verify
all the signatures, if they don't use the same hash algorithm (See [1]).
So specify dsa2 as well, to allow sha256 to be used in both signatures.
Jon Turney [Tue, 25 Feb 2020 13:49:31 +0000 (13:49 +0000)]
Handle multiple signature packets in .sig file
Rather than stopping after the first signature packet, handle multiple
signature packets appearing in a .sig file. If any of them is a valid
signature from a known key, then the signature is good.
Jon Turney [Mon, 24 Feb 2020 14:47:41 +0000 (14:47 +0000)]
Provide hash to DSA as an opaque block
Provide the hash to DSA as an opaque data block, rather than an MPI.
This allows libgcrypt to truncate the hash correctly when a hash alg is
specified which produces more than the 160 bits DSA accepts.
Jon Turney [Mon, 24 Feb 2020 19:25:43 +0000 (19:25 +0000)]
Also AttachConsole() when not elevating
Arrange to call AttachConsole() when not elevating (e.g. 'setup -B').
This seems to be needed for output to stdout to work via a Windows
pseudo-console ('conpty'), as is used with cygwin >=3.0.0.
Note that setup is a GUI application. I have no idea what it means to
write to stdout without calling AttachConsole(), but that doesn't seem
to work anymore...
Jon Turney [Mon, 3 Feb 2020 19:54:12 +0000 (19:54 +0000)]
Fix 'make check'
Add <string.h> where needed to fix compilation of libgetopt++ tests
UserSetting was removed in f26f525f, so remove that test.
UserSettings also got rewritten in that commit, so rewrite test.
Rework UserSettings constructor so it can be initialized without needing
to attempt loading from a file (which requires all the io_stream URL
providers we might try to be registered).
Jon Turney [Mon, 27 Jan 2020 15:35:05 +0000 (15:35 +0000)]
Don't always be silent about failing to fetch mirrors.lst
Currently, if there is no cached mirrors list (e.g. this is the first
run), and we're behind some kind of proxy which doesn't let us through,
we'll try to fetch mirrors.lst, silently fail, and present the user with
an empty mirror list.
Instead, report failure to fetch mirror.lst if we don't have a cached
mirrored list (and a mirror isn't being explicitly specified with
'--only-site --site <someurl>').
Jon Turney [Thu, 2 Jan 2020 16:26:46 +0000 (16:26 +0000)]
Ignore reinstall action when the package isn't installed
'--packages X --remove-packages X' is interpreted by
applyCommandLinePackageSelection() as a request to reinstall X (and
similarly with --category X --remove-categories X). If X isn't actually
already installed, this leads to bogus 'erase/install no-package' tasks
appearing in the task list.
Jon Turney [Thu, 2 Jan 2020 14:56:07 +0000 (14:56 +0000)]
Ignore install action when no current package exists
This isn't ideal as a command line to install a package which only has a
test version will do nothing. But I think we don't want installing by
category to install packages in that category which only have a test
version. Unfortunately, both cases are currently identical by the time
we get to applyCommandLinePackageSelection().
I'd forgotten that action = Install_action, desired = empty version is
how we represent 'install any version of this package'. Converting that
to NoChange_action leaves us back mishandling obsolete packges specified
on the command line, fixing which was the whole point of this change. So
let's try to fix this a different way...
Jon Turney [Wed, 1 Jan 2020 14:38:45 +0000 (14:38 +0000)]
Fix cases where incorrect action is stored by set_action()
set_action() with action = Install_action and desired = empty version
when curr = empty version is equivalent to action = NoChange_Action.
(This can occur if we are selecting a category for install on the
command line, and that category happens to include a package which only
has a test version, but no current version)
(For completeness, also address the case of action = Install_action,
desired = empty_version, where curr = some version is equivalent to
action = Uninstall_action)
Jon Turney [Tue, 9 Jul 2019 15:53:57 +0000 (16:53 +0100)]
Allow better handling of an obsolete package specified on command line
Now we have the flexibilty to record a package as explicitly required to
be installed, rather than merely installed because the desired version
is different to the installed version, we can record packages selected
for installation on the command line as distinct from choosing a
specific version of that package via the picker.
Use this to allow the solver to make a better choice of what provides a
package name specified on the command line.
(Note that we need to use SOLVER_SOLVABLE_PROVIDES rather than
SOLVER_SOLVABLE_NAME to allow the solver to take packages which provide
and obsolete the named package into account.)
Only turn this behaviour on when --upgrade-also is specified.
e.g. setup -q -g -P python3-lxml currently gets you an (empty)
python3-lxml package, which is replaced by python36-lxml (which
obsoletes it) on the next setup run. After this change, python36-lxml
is installed instead.
See also the dicusssion at
https://cygwin.com/ml/cygwin-apps/2017-10/msg00092.html et seq.
Jon Turney [Tue, 9 Jul 2019 18:22:37 +0000 (19:22 +0100)]
Use packagemeta::set_action() to update action
Use packagemeta::set_action() to update the action for packagemeta
object in more (hopefully all) the places it gets changed.
(Future work: ideally we'd opaque packagemeta internals more by making
installed/curr/desired/etc. object private, rather than letting users
grovel around in those details)
Jon Turney [Tue, 9 Jul 2019 14:40:04 +0000 (15:40 +0100)]
Store the requested action in packagemeta::set_action()
Store the action requested with set_action() in the packagemeta object,
rather than just encoding it in _picked/installed/desired (see
discussion in commit 4209699d)
Try to avoid meaningless states occuring, i.e. action=Install with
desired=installed is converted to action=Keep.
Future work: There's still some odd stuff left in set_action() which we
need to do some hard thinking about: action=NoChange treats Base
category packages specially, action=Install will switch to installing
the source if binary isn't accessible.
Jon Turney [Fri, 12 Jul 2019 11:38:54 +0000 (12:38 +0100)]
Remove 'Bin?' column
The only use this column appears to have now is that unticking it is the
same as selecting 'uninstall'.
Future work: Make 'Src?' column more independent, rather than
interacting with the 'New' (action) column in non-obvious ways. We
should be able to choose to install source irrespective of the state of
the binary package. (That should also take into account the
'--include-source' option)
Jon Turney [Wed, 20 Mar 2019 19:56:44 +0000 (19:56 +0000)]
Add double-click for a 'default action' to ListView
Add support for a double-click in the ListView to invoke a 'default
action'.
Because we receive both NM_CLICK and then NM_DBCLK, reduce the area of a
pop-up column which is sensitive to a click to the drop-down button
(which opens a focus-stealing pop-up menu), so the rest of the area can
receive a click (which does nothing) or a double-click (which does the
default action).
For a package, this default action is to toggle between the currently
installed version (or uninstalled, if not installed), and the highest
non-test version.
There is no keyboard acceleration for this action currently.
Jon Turney [Wed, 20 Mar 2019 18:08:23 +0000 (18:08 +0000)]
Don't propagate actions down category tree into obsolete categories
Choosing the 'Install' action on the 'All' category shouldn't propagate
down into the '_obsolete' category, because that will just result in
dependency conflicts due to trying to install both obsolete packages and
their replacements.
Jon Turney [Wed, 20 Mar 2019 17:12:08 +0000 (17:12 +0000)]
Don't show FTP 550 'file not found' errors in a MessageBox
Don't show FTP 550 'file not found' errors in a MessageBox. Also log
InternetGetLastResponseInfo() when fetching a URL.
WinInet documentation seems to indicate this kind of extended error
information only exists when WinInet has an FTP error code to report.
Log this error (and the associated URL) rather than just showing a
MessageBox. Don't bother showing a MessageBox for 550, since we can
tolerate certain missing files (e.g. setup.zst), and we'll go on to
report that couldn't fetch needed files in a more generic way.
Jon Turney [Sat, 21 Jul 2018 21:19:51 +0000 (22:19 +0100)]
Simple keyboard accelerators for Listview
Wire-up certain actions to keyboard accelerators.
To permit selecting a subitem apparently needs us to custom-draw everything,
so for simplicity, just make the accelerators per row.
Getting the enter keypress to be delivered to the listview is tricky (the
propsheet really want to hold onto it), so for the moment we just use the
Windows menu key and space bar as accelerators.
Ken Brown [Mon, 6 Aug 2018 14:05:12 +0000 (10:05 -0400)]
Ensure that an installed packageversion has an ldesc if possible
In packagedb::read(), copy the ldesc from setup.ini to the
packageversion read from installed.db. Otherwise, an installed
package with only one version will not have an ldesc to use as a
tooltip.
v2: If the installed version is no longer available, copy the ldesc
from the current version of the package.
Jon Turney [Tue, 17 Jul 2018 10:09:32 +0000 (11:09 +0100)]
Use indents in category view
We keep around an empty imagelist for 1x1 images, to reset the indent when
not in tree view mode
(This isn't quite right as the listview will allocate a 1-pixel space before
column 0 for those images, but this seems the best we can do as 0x0
imagelists aren't allowed...)
Jon Turney [Tue, 17 Jul 2018 18:26:23 +0000 (19:26 +0100)]
Use an icon to represent expanded/collapsed state
Use a listview icon to represent expanded/collapsed state, rather than
puttting '[+]'/'[-]' in front of the category name
Just use the item icon directly to represent expanded/collapsed state,
rather than using a state icon as otherwise we have empty space where the
item icon would be, when it's size is being used for indenting.
The icons were made by tracing the previously used .bmp in Inkscape to
produce a .svg, then converting that to an icon with ImageMagick using
'convert -filter point -background transparent -define icon:auto-resize'
Jon Turney [Wed, 7 Dec 2016 19:52:58 +0000 (19:52 +0000)]
Custom draw popup menus in ListView control
Construct a menu containing the actions from the action list for the package
or category, and if one is selected, apply it.
This lets us remove packagemeta::set_action() which implements the strange
UX of cycling around actions without showing what the possibilities are.
This somewhat emulates a BS_SPLITBUTTON style control. The 'popup' cell has
a visual hint that clicking on it opens a menu (a 'combox scrollbar'), and
the popup menu is located at the position of the click.
v2:
Factor out popup_menu, for future use by keyboard accelerators
Jon Turney [Thu, 8 Dec 2016 17:57:59 +0000 (17:57 +0000)]
Add methods for listing possible actions on, and applying one to, a package
The 'action id' is a value of the _actions enum, if positive, otherwise it's
absolute value is a 0-based index into the 'versions' collection to identify
a specific version to install.
Jon Turney [Wed, 7 Dec 2016 16:17:12 +0000 (16:17 +0000)]
Custom draw checkboxes in ListView control
Future work: What does this look like when a theme is in used? Does the row
size need to be slightly adjusted to ensure it accomodates checkbox height?
v2:
erase to background colour before drawing checkbox
Jon Turney [Wed, 7 Dec 2016 14:09:35 +0000 (14:09 +0000)]
Use a ListView common control rather than a hand-built grid
Each line is implemented by an object of a subclass of ListViewLine, either
PickPackageLine, or (in catgeory view) PickCategoryLine
v2:
Defer constructing category tree until packagedb is available
Also handle an empty category tree
Remove unused bitmaps
Scoping of strings returned to LVN_GETDISPINFO
Avoid doubled 'all' category
Update some number of lines, rather than just the current one
v3:
Speed up calculating column widths, by caching the DC used
Don't bother recalculating column widths when obsolete packages are
shown/hidden, just allow for obsolete packages always (which makes hardly
any difference)
Don't bother calculating column widths separately for category view since
they are now always the same.
v4:
Store current category action in CategoryTree
Recurse category action onto packages
This slightly changes the behaviour: previously, a category action only
effected packages which matched the name search filter. Now all packages in
contained by the category are effected.
v5:
When updating, turn off redraw before emptying listview
Make headers a parameter to init
Don't leak contents
Only resize columns once
Remove ListView OnMessage as it has nothing to do
Never use a column width less than minimum
Use LVS_SINGLESEL
Factor out string cache for re-use
Preserve focused row over ListView::setContents()