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()
I think strlcat() was meant here, which MinGW doesn't have. In it's
absence, open-code it's equivalent.
(SHGetSpecialFolderLocation() returns a pathname of length at most MAX_PATH,
and make_link() is limited to accepting a pathname of length MAX_PATH, so we
want to append our folder name, while truncating the result to MAX_PATH.)
Fix message spam when package vendor is something other than "cygwin"
Installed packages are getting coerced to vendor "cygwin", so there will be
warnings if the vendor string of the single repo is something other than
that.
Jon Turney [Sat, 14 Jul 2018 15:46:57 +0000 (16:46 +0100)]
Initialize file_size in NetIO constructor
At the moment, this is not initialized anywhere. If it's value happens to
be greater than zero, that will be used as the size to report download
progress against.
Ken Brown [Sat, 17 Mar 2018 14:59:54 +0000 (10:59 -0400)]
Internalize the libsolv repo attribute data after each setup.ini
Call SolverPool::internalize() in the IniDBBuilderPackage destructor. This
makes attribute data from all previously processed setup.ini files available
when the next setup.ini is being processed.
Remove the now unneeded call to SolverPool::internalize() at the beginning
of packagedb::read().
Jon Turney [Sat, 7 Jul 2018 08:09:02 +0000 (09:09 +0100)]
Propagate exit code of elevated process
Propagate the exit code of elevated process, when --wait is used.
This addresses part of the problem about exit code noted in [1], although we
also need to audit that a non-zero exit code is reported in all error
situations.
Ken Brown [Wed, 21 Mar 2018 19:38:07 +0000 (15:38 -0400)]
Finish providing support for provides: and conflicts:
Introduce member functions SolvableVersion::provides() and
SolvableVersion::conflicts(). This enables packagedb::read() to access
provides and conflicts lists from setup.ini.
Corinna Vinschen [Mon, 18 Jun 2018 17:16:59 +0000 (19:16 +0200)]
netio.cc: fix a bug in string handling
commit ed6137e5f94f45e50a12994aeae310278b2bf758 back in 2003(!)
introduced a bug in creating an empty password string which,
embarrassingly, only now has been catched by gcc.
Ken Brown [Thu, 7 Jun 2018 17:37:24 +0000 (13:37 -0400)]
Fix detection of automatically added packages
In the "confirm" dialog, report a package as automatically added for install
if the version being installed is different from the version requested by
the user. This can happen if the global update mode is "Keep" but a package
needs to be updated because of a versioned dependency.
Ken Brown [Thu, 7 Jun 2018 17:37:23 +0000 (13:37 -0400)]
Improve the preparation of the package database
Introduce a new function packagedb::noChanges() to set the database to a "no
changes requested" state. Call it the first time the chooser page is
activated, before calling ChooserPage::applyCommandLinePackageSelection().
Also use it to simplify the code in two places.
Remove code from ChooserPage::changeTrust() that was making changes to the
database after ChooserPage::applyCommandLinePackageSelection() had already
been called.
Ken Brown [Sat, 17 Mar 2018 14:59:53 +0000 (10:59 -0400)]
Make sure that the IniDBBuilderPackage destructor is called when needed
The IniDBBuilderPackage destructor contains code that is intended to be run
after each setup.ini file is processed. But the IniDBBuilderPackage
variables in do_local_ini() and do_remote_ini were declared outside the loop
that processed the files. Move the declaration inside the loop so that the
destructor is called after each iteration.
Ken Brown [Wed, 21 Mar 2018 18:03:00 +0000 (14:03 -0400)]
Give a fatal error on a checksum failure during install
This only affects local installs, where the hash of an archive is not
checked until we reach do_install_thread(). At this point it seems
too late to recover safely.