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>
Jon Turney [Thu, 1 Sep 2016 19:30:44 +0000 (20:30 +0100)]
Refuse to run on Windows XP and earlier
Refuse to run on Windows versions less than 6.0 (XP or previous), as they
are no longer supported by Cygwin.
Future work: The version checked against should be read from setup.ini,
rather than hard-coded here, so that this version of setup cannot be used to
download a future version of Cygwin which isn't compatible with the Windows
version it's running on...
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Jon Turney [Thu, 1 Sep 2016 18:21:55 +0000 (19:21 +0100)]
Fix incorrect heap memory access in SimpleSocket::gets()
nl is dereferenced to check if it's '\n' or '\r', before we check if we have
passed the start of the buffer. Re-order the check so we check if we have
passed the start of the buffer first.
Fix scope problem when using the return value of get_root_dir()
Let get_root_dir return a reference instead of a temporary
std::string object. In directory_is_absolute() and
directory_is_rootdir(), use std::string methods rather than
falling back to plain C techniques.
Jon Turney [Wed, 3 Aug 2016 21:15:25 +0000 (22:15 +0100)]
Build C++ code with -std=gnu++11
Use BASECXXFLAGS rather then AM_CXXFLAGS to make AM_CFLAGS
Rationalize BASECXXFLAGS, adding -Werror and removing -Wno-uninitialized
(since the bug preventing it being used is long fixed)
Fix a bug detected by -Wuninitialized
Build C++ code with -std=gnu++11 -Wno-deprecated-declarations
Jon Turney [Mon, 1 Aug 2016 17:05:14 +0000 (18:05 +0100)]
Add an additional filter view, showing packages which were user picked
Add an additional filter view, showing installed packages which were
selected for installation by the user, not installed as dependencies.
Future work:
Why is PickView::views is not an enum?
The view button would make more sense as a pop-up menu, allowing a specific
filter view to be directly selected, rather than cycling around the possible
filter views (and this situation is made worse by adding another filter
view)
Jon Turney [Tue, 2 Aug 2016 11:19:09 +0000 (12:19 +0100)]
Track if a package was installed by user, or as a dependency
Update the installed.db file format to version 3, containing the user_picked
flag.
This extends the semantics of user_pick somewhat: currently it is only used
for UI purposes, to record if a package was picked in the current session.
Now we also use it to record if an installed package has ever been picked
via the UI (otherwise it is only installed because it is a dependency).
So, we are careful not to set it when a currently installed package has it's
installed version adjusted via the GUI.
We also arrange for user_pick to be set when a package was selected for
installation via CLI.
Add a heuristic to initially populate user_pick when upgrading from older
installed.db formats: All non-base installed packages which aren't
dependencies are assumed to be user_pick-ed.
Note: other tools (e.g. cygcheck) which read the installed.db file will need
updating appropriately
v2:
Don't gratuitously break compatiblity with other existing readers of
installed.db, keep recording version as a notional filename.
Don't treat unknown future installed.db format versions as format version 1,
instead treat setup downgrading as a fatal error.
After rearranging the chooser controls in commit 6a36f6a,
the search field wasn't the first control anymore, thus it
didn;'t have the focus anymore. Fix that by setting the focus
to the search field explicitely in ChooserPage::OnInit.
Achim Gratz [Tue, 2 Aug 2016 08:47:43 +0000 (10:47 +0200)]
fromcwd.cc: Truncate search at the first extension in preference order
* fromcwd.cc (FindVisitor): Truncate search at the first extension
found in preference order in the same directory so that no multiple
setup files for the same (sub-)mirror are processed by do_local_ini.
* proppage.h (PropertyPage)
New member OnTimerMessage (delegates similarly to OnMouseWheel)
* proppage.cc
(DialogProc) Added handling of WM_TIMER
* choose.h (ChooserPage)
(OnTimerMessage) New function prototype
(timer_id) New member variable
Added DEFINE-ed default values for timer_id and search timer delay
Reorganized private members for consistency
* choose.cc
(constructor) Initialize timer_id
(OnMessageCmd) Replaced search-refresh with a SetTimer
(OnSearchTimer) New; contains search-refresh removed from OnMessageCmd