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.
Ken Brown [Mon, 4 Sep 2017 20:44:31 +0000 (16:44 -0400)]
Fix 'SolverTasks::taskList' typedef
Remove the '&'. This was causing source installs to all refer to the
same package, due to the call to q.add(pkg->desired.sourcePackage(),
SolverTasks::taskInstall) in PrereqChecker::isMet.
Ken Brown [Sat, 2 Sep 2017 16:37:29 +0000 (12:37 -0400)]
Improve the reading of installed.db
When creating a packageversion for a package listed in installed.db,
use the information for the installed version rather than the
"current" version. Add a new function packagedb::findBinaryVersion to
help with this.
Get as much information about an installed information as possible
from the prior reading of setup.ini.
Improve detection of installed test releases. An installed test
release might not appear in setup.ini because it is no longer
available (e.g., it might have been replaced by a newer test release).
Detect this by comparing its version to the current version.
Ken Brown [Sat, 2 Sep 2017 15:57:25 +0000 (11:57 -0400)]
Fix setup.ini parsing
The IniDBBuilderPackage::process function wasn't fully resetting the
addPackageData for a new version of a package. This caused SHA512
failures among other things.
Jon Turney [Fri, 19 May 2017 10:26:07 +0000 (11:26 +0100)]
Download/checksum/install/uninstall what transaction wants
Some of this goes rather around the houses to avoid lots of churm: In lots
of cases, we're looking up packagemeta for a given packageversion just so we
can use the pacakgemeta to access the name, which we could do via
packageversion just as easily.
We do actually need packagmeta for a couple of things: To note the package
as installed/uninstalled, and to note postinstalls scripts.
If IncludeSource is on source packages installs will have been added to the
task list in post-processing, so we don't need to handle that specially
anymore.
Source packages to be installed are kept in a separate queue as they are
installed differently to binary packages (root is /usr/src, install isn't
recorded, etc.)
v2:
Avoid use of packagemeta in install.cc, when all we use is the package name
(kbrown)
Jon Turney [Sat, 29 Apr 2017 14:43:52 +0000 (15:43 +0100)]
Use solver to check for problems and produce a list of package transactions
Convert chooser UI selections into a SolverTaskList
Apply SolverSolution to that task list (with choice of keep, upgrade,
upgrade with test, IncludeSource) to produce a vector of SolverTransactions.
Store a solution object in packagedb
The transaction list returned by the solver is postprocessed to add
reinstall and IncludeSource actions
Very crudely present solver problems in the PrereqChecker page UI, as text.
Change tickbox to say "accept default solutions" and don't allow to preceed
unless those solutions are accepted (ideally we would have a UI to choose
solutions). Remove warning about missing dependencies.
Also pass initial trust state to PrereqChecker
v2:
Fix comment typo (kbrown)
Tweak comment in OnActivate() (kbrown)
v3:
Drop stray \n at end of report() output (kbrown)
Jon Turney [Fri, 7 Apr 2017 20:52:17 +0000 (21:52 +0100)]
Change to using a libsolv pool for storing package information
Add class SolverVersion, a wrapper around a Solvable Id. The interface is
similar to class packageversion, the name change is just to make sure I've
got everything.
Place test packages into separate repos.
Expressing that curr: packages are preferred to prev: ones when that is not
the version number ordering should be done with epoch numbers.
Wire up various bits of data in packageversion to Solvable attributes,
including sourcepackage, stability, archive (packagesource) and depends.
Store sourcePackage() by the id rather than name, for much faster lookup.
SolverVersions for the same package can be ordered and compared by evr.
Factor out packagedb:addBinary() and also use it in IniDBBuilder, rather
that inlining the process of adding a package there. Add an analagous
packagedb:addSource() to do the same thing for source packages.
Change to reading installed.db after setup.ini's have been read, so we can
supplement the installed.db packages with information from setup.ini.
Make packagemeta::add_version() check for successful insertion of version.
Record the version at a stability level. The last version wins in setting
curr/test.
Use a Solver object inside packagedb
v2:
Link with libregex rather than libgnurx
Use -lregex rather than -lgnurx, as the Fedora mingw{32,63}-libgnurx
cross-packages only contain the library under that name.
(The Cygwin mingw63-{i686,x86_64}-libgnurx cross-packages have both names).
Check for libregex at configure time
(Done properly this should use PKG_CHECK_MODULES, rather than checking
for the header...)
Jon Turney [Fri, 5 May 2017 11:36:42 +0000 (12:36 +0100)]
Opaque how PackageDepends is stored
We want to be more opaque about how the PackageDepends for a packageversion
is stored, so rather than exposing a pointer to a PackageDepends object
inside class packageversion, access it by value.
This also makes us be more explicit about set/get of package depends()
Fix some iterations to deal with depends() returning a value rather than a
pointer.
Ken Brown [Tue, 9 Jan 2018 17:04:20 +0000 (12:04 -0500)]
Query the user if a corrupt local file is found
Also reorganize package validation.
Move the size-validation code in download.cc and the hash-validation
code in install.cc into new member functions of the packagesource
class. Add a bool member 'validated' to the class to make sure that
the checking is done only once.
Change download.cc:check_for_cached() so that it offers to delete a
corrupt package file instead of throwing an exception. The latter
previously caused a fatal error when check_for_cached() was called
from do_download_thread and download_one. Now we get a fatal error
only if the user chooses not to delete the file.
Also make check_for_cached() check the hash of the file in addition to
the size. Similarly, check the hash in addition to the size after
downloading a file.
Jon Turney [Sun, 7 Jan 2018 19:46:26 +0000 (19:46 +0000)]
Improve help text
Various clarifications to option descriptions
Consistently start option descriptions with a capital letter
Add an extra line to mention download & install/download/install modes
Ken Brown [Tue, 19 Dec 2017 16:10:22 +0000 (11:10 -0500)]
Throw exceptions instead of exiting with error codes
There were two places in PickView.cc and one in choose.cc where setup
would silently die with an error code. Change this so that setup now
throws exceptions. The exceptions are caught by
TOPLEVEL_CATCH("DialogProc") in PropertyPage::DialogProc().
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.