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.
Jon Turney [Tue, 6 Mar 2018 14:56:40 +0000 (14:56 +0000)]
Fix packagemeta::ScanDownloadedFiles
packagemeta::scan clears the site list if the package was not found, and
packagemeta::ScanDownloadedFiles uses packageversion::accessible() to check
that.
Instead communicate via a return value
v2:
empty packages were always inaccessible, even though we returned early from
scan() without clearing the sites list, so return false in that case
Jon Turney [Fri, 19 Jan 2018 15:36:03 +0000 (15:36 +0000)]
Add setup-minimum-version: to setup.ini
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.
Jon Turney [Tue, 23 Jan 2018 17:50:13 +0000 (17:50 +0000)]
Add a new page to let the user review and confirm actions
Add a new page to let the user review and confirm actions, after
dependencies have been added and problems solved.
Ideally, this would re-use the picker-page grid to present these actions,
but for the moment just write it as text (as we did before in the prereq
page) (This is still a slight improvement as it shows all actions for
review, not just the ones added by the solver)
Jon Turney [Mon, 22 Jan 2018 22:33:54 +0000 (22:33 +0000)]
Add handling for 'replace-versions:' in setup.ini
Sometimes we make mistakes and release versions which are broken or have a
version which is wildly incorrect. We can remove those versions from future
download, but they can linger indefinitely in installs (until a distupgrade
is done), as there is a higher version already installed.
Allow setup.ini to contain a per-package 'replace-versions:' header, which
identifies any versions which should be forcibly dist-upgraded (i.e.
downgraded to the best version in setup.ini).
(It's not possible to just instruct the solver to disfavour these specific
versions, as that's not implemented, see libsolv issue #170)
Jon Turney [Fri, 19 Jan 2018 19:04:38 +0000 (19:04 +0000)]
Add 'depends2:' as an alternative to 'depends':
Prior versions of setup recognize 'depends:', but don't handle it properly:
(i) they always use the dependencies of the current version, not the version
actually being installed
(ii) they cannot parse any version-relation containing a relation and
version identifier (i.e. they can only handle a bare package name)
Thus, there is no safe way to start using 'depends:' lines without getting
undesirable behaviour from old versions of setup
(In case (i), it may install incorrect dependencies if a non-current version
is installed, potentially resulting in a broken package.
In case (ii), it will fail to parse the setup.ini with an error.)
Add 'depends2:', so calm can supply per-version dependencies in a form
useful to setup with libsolv-based dependency solving, without effecting
older versions of setup.
Jon Turney [Wed, 6 Dec 2017 17:52:45 +0000 (17:52 +0000)]
Apply default solution to dependency problems
Mark the default solution in the problem report
Refactor of SolverSolution::update() so we can apply the default
solution(s).
Also:
Break out logging of the task list, so we can show it in the "dependency
problems exists, but don't use the default solution, just do what I ask"
case.
Break out 'include-source' process, so it can have effect in the case where
dependency problems exist.
v2:
Actually re-solve after adjusting the task list with default solutions.
Use the last solution as the default solution. The solver sorts the
solutions, and I think the last one will normally be the one which removes
the problematic task from the task list
Jon Turney [Mon, 6 Nov 2017 18:02:08 +0000 (18:02 +0000)]
More crash avoidance in SolvableVersion member functions
The following call-stack means we end up calling SolvableVersion methods
before packagedb::prep(), i.e. before attributes have been internalized, so
their values aren't available.
Ken Brown [Sat, 28 Oct 2017 17:46:19 +0000 (13:46 -0400)]
Avoid clobbering installed.db when no setup.ini is found
If no setup.ini is found, do_ini_thread is never called. But we need to
ensure that packagedb::read is called, or else installed.db gets emptied.
Move the calls to packagedb::read and other packagedb functions from
do_ini_thread to ChooserPage::OnInit.
Ken Brown [Fri, 20 Oct 2017 10:59:54 +0000 (06:59 -0400)]
Don't override a Skip selection
Introduce SolverTasks::taskSkip, and generate it when the user chooses
to Skip a package that the solver wants to install. Implement it by
sending a SOLVER_LOCK command on the package name.
Ken Brown [Thu, 19 Oct 2017 18:44:45 +0000 (14:44 -0400)]
Fix the functionality of taskKeep
A taskKeep is generated whenever the user wants to keep an installed
version that's different from the default_version, where the latter is
whatever the solver has chosen. We need to make sure that
default_version is set appropriately wherever it is needed.
Ken Brown [Tue, 17 Oct 2017 12:12:48 +0000 (08:12 -0400)]
Extend the SolvableVersion member functions to the empty package
Currently some of these functions cause crashes when the package is
empty because the libsolv function pool_id2solvable unconditionally
dereferences its first argument ('pool').
Jon Turney [Mon, 9 Oct 2017 17:10:52 +0000 (18:10 +0100)]
Take command line package/category install/uninstall into account
Rather than overwriting the packagedb changes made from processing command
line options in ChooserPage::OnInit(), use the 'initial' flag to
changeTrust() in createListview() to take them into consideration.
--upgrade-also and --force-current are now handled directly.
Jon Turney [Mon, 9 Oct 2017 14:37:06 +0000 (15:37 +0100)]
Change UI to add 'Sync' choice and change 'Test' to checkbox
Set the initial update mode in UI correctly:
- 'Sync', if --force-current option is used
- 'Keep', if packages are selected on command line without --upgrade-also
- 'Current', otherwise
Add mapping of 'Sync' to SolverSolution::updateForce to mapping of UI
update mode to solver update mode.
Jon Turney [Fri, 29 Sep 2017 13:46:46 +0000 (14:46 +0100)]
Use solver for initial pick list when upgrading
Use the solver to determine initial pick list for Curr or Test, rather than
directly picking packages. Thus the solver's initial solution in the pending
view should be the first thing the user sees.
Note: Keep is magical, and the package db pick list gets reset by
ChooserPage::keepClicked(), rather than going through changeTrust().
We don't unify these two paths, because the trust level passed to
changeTrust() gets recorded in PickView::defTrust and used by the line
picker in some mysterious way, and seems to only be expected to be
TRUST_CURR or TRUST_TEST. There's probably a subtle bug here, in that the
line picker might behave differently depending on if Curr or Test was
selected before Keep.
Drop passing upgrade flag to solver run after the user has made their
selections: the picker selection now reflects what the user is asking for.
Jon Turney [Fri, 26 May 2017 13:30:40 +0000 (14:30 +0100)]
Handle 'Source:' lines in setup.ini
This is somewhat awkward:
Storing the source package by Id rather than by name is looking a bit like a
premature optimization, but being to able to refer to source packages by Id
is very handy.
If the src pkg isn't seen until after the pkg, we don't know what it's Id
will be. So we have to go back and fixup the Ids after we've seen all
packages.
Ken Brown [Sat, 16 Sep 2017 15:39:40 +0000 (11:39 -0400)]
Allow user to refuse the default problem solutions
Add new method SolverSolution::db2trans to change the solver's
transaction list to reflect the package database. Use it if the user
refuses the default problem solutions. Reinstate warning that this
could cause breakage.
Remove PrereqPage::OnMessageCmd, which is no longer needed (and which
disallows clicking Next if the "Accept default problem solutions" box
is unchecked).
Ken Brown [Fri, 8 Sep 2017 15:16:24 +0000 (11:16 -0400)]
Add new member function SolverSolution::trans2db
This resets the package database to reflect the solver's transaction
list. Call this if the user clicks Back on the Prerequisite page, to
allow reviewing and making changes before accepting the solver's
solution.
v2:
Drop text about seeing default solutions. They aren't applied as we want
the user to choose there own solution.