Commit Graph

142 Commits (0dcbd933c8d3d305395a99b7b1690a187ce5ec8c)

Author SHA1 Message Date
William Pitcock 0dcbd933c8 solver: allow names with only one provider to be autoselected regardless of priority 2018-02-21 15:35:53 +00:00
Timo Teräs 039ff3bd46 split --force to several --force-[type] options
This unloads --force as several of the things are really not wanted
together. E.g. --force-refresh is a lot different from --force-broken-world
and doing --force to get the other might introduce unwanted behaviour.

--force is still kept for backwards compatibility and it enables
most things --force was used for.
2018-01-03 16:00:38 +02:00
Timo Teräs 8e7fd3e06f solver: fix potential install_if processing failure, fixes #8237
In discovery phase, there was logic to not process packages
multiple times. However, that logic failed to account the package's
depth and install_if state for the name being processed. This
caused install_if processing failure in certain topologies of the
dependency graph. Adds also a test case that should catch this
issue reliably.
2017-12-12 15:16:52 +02:00
William Pitcock 20ae27c1da solver: prefer highest requirer count above installed status
This ensures a swap is emitted when replacing a virtual with
apk add.
2017-11-02 17:15:00 +00:00
William Pitcock 6aabb96c20 solver: fix dbg_printf() call in select_package() 2017-11-02 17:14:18 +00:00
William Pitcock 0a17a648db solver: only select a default if there is at least one provider with a declared provider_priority 2017-11-02 16:31:50 +00:00
William Pitcock 9165aa3894 solver: instead of tracking selected packages, score by requirer count for tiebreaking 2017-11-02 16:24:09 +00:00
William Pitcock f18c708183 solver: implement support for choosing default virtuals
By introducing a new package metadata field, `provider_priority`
(index letter `k`), we can specify default packages to satisfy a
virtual.

If a user wishes to select an alternative provider for the virtual,
a changeset swapping the default provider for the selected provider
will be generated by the dependency resolver.
2017-11-02 03:08:24 +00:00
Timo Teräs e03716ff3b solver: consider virtual provides to exclude non-provides transitively
this fixes package selection when a 'real' package exists, but would
need to be provided by another package with 'virtual provides'.

In current package database this can happen with postgresql which is
also provided by postgresql-bdr. Normally postgresql would be satisfied
by postgresql, but if any package depends on postgresql-bdr and there's
no versioned dependency on postgresql this will help apk figure out
that postgresql-bdr should be used.
2017-10-27 15:20:03 +03:00
William Pitcock ba7b50c0f8 solver: don't clobber package swaps in cases where an installed package is being replaced by a provider 2017-04-27 23:23:47 +00:00
Timo Teräs 0fe3f3964b fetch: fix --recursive mode to work with pure virtual packages
The virtual package provider still needs to be explicitly
given on command line.
2017-02-27 14:56:57 +02:00
Timo Teräs ac0a9659d1 upgrade: improve self upgrade functionality a bit
trigger it only if apk-tools can be upgrade, add test cases
2016-07-22 11:13:33 +03:00
Timo Teräs 8a41fd98a4 solver: more debug output for package errors 2015-12-10 13:45:18 +02:00
Timo Teräs cab03b6912 sort world dependencies alphabetically
this makes 'lbu diff' and aaudit diffs nice when a world
dependency is added or removed. sorting also makes the ordering
more deterministic as the world targets constraints are always
applied in the same order. test suite updated accordingly.
2015-01-30 15:53:11 +02:00
Timo Teräs 0276e22731 remove reverse dependencies first
when removing large sets of packets, the ordering of removal
was not quaranteed to honor dependencies. this fixes the removal
order to be in reverse dependency order as far as possible.
2015-01-30 14:30:15 +02:00
Timo Teräs e0f9b0897b solver: enforce conflicts during upgrades and new pkg installs
This makes sure any conflicted packages will be removed first.
Useful if we know there are conflicting files, and want to avoid
adding potentially harmful replaces line. Add a test case for
this too.
2014-10-06 16:30:09 +03:00
Timo Teräs 1dc70477b5 solver: fix installation of non-repository packages during tmpfs boot
allow packages in the cache's installed to be selected for installation
by the solver. add test case for the issue.
2014-05-19 11:50:10 +03:00
Timo Teräs c35086dc92 solver: purge install_if packages deleted from repositories on upgrade -a 2014-04-10 11:10:40 +03:00
Timo Teräs 9fa64ca1db solver: fix cleaning of packages that got replaced by provides 2014-04-10 09:52:40 +03:00
Timo Teräs 06071700c5 solver: fix inherited flags/pinning for install_if packages
noticeable fixes upgrading of packages which get pulled in only
by install_if rule. this also simplifies the inheritance calculation
for packages, as well as the place where it is done for install_if
triggered packages.
2014-04-04 13:05:52 +03:00
Timo Teräs ec1a3d57ab solver: do not consider packages in cache as 'available'
'available' really means 'available in one or more configured
repository'. Cache is not a repository we track, so those are
only available for installation, but not available as preferred
to be installed from repository. fixes #2831.
2014-04-04 10:56:13 +03:00
Timo Teräs 065715a377 solver: additional improvements to install_if handling 2014-03-12 13:10:19 +02:00
Timo Teräs 5fdc391c10 solver: fixes to install_if handling 2014-03-11 18:38:39 +02:00
Timo Teräs 462bb3b8d3 solver: if pinning is specified, it overrides preferred repos
add also a test case for this
2013-09-06 14:21:59 +03:00
Natanael Copa ed06091189 solver: do not disqualify already disqualified packages
We should not disqualify non-selectable packages as it would mark it as
dirty, forcing it to reconsider the name again, which could end up in
an endless loop.

fixes #2135
2013-07-17 08:31:40 +03:00
Timo Teräs 4fad6d9c15 solver: use ffs (posix) instead of ffsl (gnu extension)
for musl compatibility
2013-07-04 09:00:23 +03:00
Timo Teräs 3f27da2ade solver: fix pinning+cache to work
Mistakenly allowed masked out package to be installed if it was
in cache.
2013-06-20 14:08:16 +03:00
Timo Teräs 17145f82ae solver: fix package deletion to consier provides properly 2013-06-19 21:39:01 +03:00
Timo Teräs e4c65886dd solver: properly order deletion of unneeded packages 2013-06-19 20:46:53 +03:00
Timo Teräs a984fd3679 solver: add logic: transitive provides exclusion
If name N is required, and all providers of A also provide B, it
means that only instances of B can be selected that provide N. This
is strong help with cases when so:libfoo.so.1 is updated to
so:libfoo.so.2 and not everything is recompiled.
2013-06-19 13:15:53 +03:00
Timo Teräs d315c9019c upgrade: new option: --latest (-l)
Select latest version of package (if it is not pinned), and print
error if it cannot be installed due to other dependencies.

Together with --available, it selects the latest package which is
present at least in some repository.

This also fixes few solver issues with ordering of package selection
that got quite apparent with this flag. Namely, we cannot "lock"
a package until it's reverse dependencies are locked or not all of
the solver flags are propagated properly.
2013-06-19 08:33:51 +03:00
Timo Teräs 01ec60f718 errors: improve analysis for virtual packages
if all packages named N provide the virtual package, list only the
name N instead of all packages providing it.
2013-06-18 08:03:40 +03:00
Timo Teräs 9d10037807 db: refactor repository file construction
Fixes also 'fetch' applet to prefer copying/linking to files from
cache if possible.
2013-06-17 14:38:27 +03:00
Timo Teräs 56b623b9e2 solver: use array_foreach_item and clean ups 2013-06-14 21:24:33 +03:00
Timo Teräs e51232e710 errors: rewrite the logic how errors are reported
Instead of the dependency oriented logic, switch to print them
for each package or name needed. Might give a bit more readable
errors now. There's still few corner cases that proper error is
not output, which are cought by the test cases.
2013-06-13 18:22:00 +03:00
Timo Teräs 25ff68a87e solver: prune broken world dependencies with --force
mostly useful for reboot, when all packages are not available.
2013-06-13 18:22:00 +03:00
Timo Teräs 59678309ea solver: corner case fixes
- try harder to not change anything during self-upgrade
- also honor locking to packages that where earlier used in
  merging common dependencies
- clarify upgrade applet help messages
2013-06-13 18:22:00 +03:00
Timo Teräs e7fd4d03bf solver: rewrite as deductive solver -- pinning support
Fix also pinning test cases to be more sane.
2013-06-13 18:22:00 +03:00
Timo Teräs 426a12686e solver: rewrite as deductive solver -- per name flags
Handle properly per-name preference flags, and add test cases
for testing those via fix applet.
2013-06-13 18:22:00 +03:00
Timo Teräs b8c44536ca solver: rewrite as deductive solver -- core features
Implementing basic dependency handling, install_if and awareness
of pinning.
2013-06-13 18:22:00 +03:00
William Pitcock 860aa642f0 Revert "Revert "solver: increase score fields to 32-bits (from 16-bits)""
This reverts commit a2d873a77c.
2013-06-12 10:47:11 -05:00
root a2d873a77c Revert "solver: increase score fields to 32-bits (from 16-bits)"
This reverts commit 84bfef1a6b.
2013-06-11 10:30:31 -05:00
Timo Teräs aec93ee730 db: unify handling of special packages
make cache a special kind of repository, and automatically cache
special packages (virtual packages, or ones installed from command
line). add test cases for handling virtual packages. fixes #1617.
2013-05-30 08:48:32 +03:00
Timo Teräs 84bfef1a6b solver: increase score fields to 32-bits (from 16-bits)
We are having so many packages that they might overflow otherwise.
"ERROR: Preference overflow" was already reported.
2013-04-29 14:14:57 +03:00
Timo Teräs 72cd34cf81 solver: remove backjumping by name
It is incorrect optimization causing valid solutions to be skipped.
Any performance it might've gained, should be fixed by reintroduction
of the minimum penalty logic added in previous commit.
2013-01-28 15:34:09 +02:00
Timo Teräs cb98b55b7e solver: reintroduce minimum penalty logic
Basic per-name per-package specific scoring added.
2013-01-28 15:31:34 +02:00
Timo Teräs 528156a9fa solver: do not backtrack over "exclude none"
Otherwise we can return no solution at all instead of partially
satisfied solution (and give proper error message).
2013-01-22 16:23:16 +02:00
Timo Teräs 93bd305713 solver: simplify strength evaluation in constraint handling 2013-01-21 15:37:23 +02:00
Timo Teräs 2a194f3e7b solver: check if solution is not found at all
This is an internal error.
2013-01-21 09:12:44 +02:00
Timo Teräs b960759daa solver: fix reset of last_touched to zero 2013-01-18 16:21:38 +02:00