summaryrefslogtreecommitdiff
path: root/src/solver.c
AgeCommit message (Collapse)AuthorFilesLines
2020-08-24fix, simplify and document upgrade --ignoreTimo Teräs1-4/+5
2020-08-24solver: add more dbg_printfsOliver Smith1-19/+62
2020-05-19make the atom functions not use global stateTimo Teräs1-12/+12
This greatly helps with memory management on applications that may want to daemonize and open/close database several times. Also the lifetime and "owner" of memory for all data is now explicitly bound to owning struct apk_database, which might be helpful when writing language bindings. As side effect, the interned "atoms" are unique only within what apk_database, so comparing packages from different apk_database may not work as expected. Fixes #10697
2020-05-07use SPDX-License-Identifier in source filesTBK1-3/+1
2019-12-12upgrade: implement --ignore to exclude some packages from upgradenrybowski1-2/+4
2019-06-05solver: fix common dependency merging to inherit pinning and flagsTimo Teräs1-3/+7
Notably this fixes occasional issues when doing upgrade with multiple versions of same packages. Without this the upgrade flag is not always propagated properly down the dependency chain.
2018-11-12fix orphan package handling for certain provides casesTimo Teräs1-15/+17
2018-11-12prefer selecting packages by their primary nameTimo Teräs1-8/+16
2018-11-12fix package preference based on it's conflicts in --latest modeTimo Teräs1-4/+5
remove also redundant pkg_selectable check in repair mode.
2018-06-14fetch: ignore conflicts when solving --recursive fetchesTimo Teräs1-8/+23
2018-02-21solver: allow names with only one provider to be autoselected regardless of ↵William Pitcock1-2/+3
priority
2018-01-03split --force to several --force-[type] optionsTimo Teräs1-1/+1
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.
2017-12-12solver: fix potential install_if processing failure, fixes #8237Timo Teräs1-46/+49
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-11-02solver: prefer highest requirer count above installed statusWilliam Pitcock1-5/+5
This ensures a swap is emitted when replacing a virtual with apk add.
2017-11-02solver: fix dbg_printf() call in select_package()William Pitcock1-2/+2
2017-11-02solver: only select a default if there is at least one provider with a ↵William Pitcock1-0/+6
declared provider_priority
2017-11-02solver: instead of tracking selected packages, score by requirer count for ↵William Pitcock1-6/+13
tiebreaking
2017-11-02solver: implement support for choosing default virtualsWilliam Pitcock1-7/+17
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-10-27solver: consider virtual provides to exclude non-provides transitivelyTimo Teräs1-12/+19
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-04-27solver: don't clobber package swaps in cases where an installed package is ↵William Pitcock1-5/+18
being replaced by a provider
2017-02-27fetch: fix --recursive mode to work with pure virtual packagesTimo Teräs1-1/+3
The virtual package provider still needs to be explicitly given on command line.
2016-07-22upgrade: improve self upgrade functionality a bitTimo Teräs1-4/+5
trigger it only if apk-tools can be upgrade, add test cases
2015-12-10solver: more debug output for package errorsTimo Teräs1-7/+11
2015-01-30sort world dependencies alphabeticallyTimo Teräs1-0/+8
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-30remove reverse dependencies firstTimo Teräs1-0/+6
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.
2014-10-06solver: enforce conflicts during upgrades and new pkg installsTimo Teräs1-2/+11
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-05-19solver: fix installation of non-repository packages during tmpfs bootTimo Teräs1-2/+6
allow packages in the cache's installed to be selected for installation by the solver. add test case for the issue.
2014-04-10solver: purge install_if packages deleted from repositories on upgrade -aTimo Teräs1-2/+9
2014-04-10solver: fix cleaning of packages that got replaced by providesTimo Teräs1-1/+4
2014-04-04solver: fix inherited flags/pinning for install_if packagesTimo Teräs1-56/+28
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-04solver: do not consider packages in cache as 'available'Timo Teräs1-5/+16
'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-03-12solver: additional improvements to install_if handlingTimo Teräs1-4/+20
2014-03-11solver: fixes to install_if handlingTimo Teräs1-14/+21
2013-09-06solver: if pinning is specified, it overrides preferred reposTimo Teräs1-1/+1
add also a test case for this
2013-07-17solver: do not disqualify already disqualified packagesNatanael Copa1-1/+1
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-04solver: use ffs (posix) instead of ffsl (gnu extension)Timo Teräs1-1/+2
for musl compatibility
2013-06-20solver: fix pinning+cache to workTimo Teräs1-16/+27
Mistakenly allowed masked out package to be installed if it was in cache.
2013-06-19solver: fix package deletion to consier provides properlyTimo Teräs1-22/+36
2013-06-19solver: properly order deletion of unneeded packagesTimo Teräs1-71/+129
2013-06-19solver: add logic: transitive provides exclusionTimo Teräs1-24/+65
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-19upgrade: new option: --latest (-l)Timo Teräs1-56/+87
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-18errors: improve analysis for virtual packagesTimo Teräs1-6/+4
if all packages named N provide the virtual package, list only the name N instead of all packages providing it.
2013-06-17db: refactor repository file constructionTimo Teräs1-1/+1
Fixes also 'fetch' applet to prefer copying/linking to files from cache if possible.
2013-06-14solver: use array_foreach_item and clean upsTimo Teräs1-156/+130
2013-06-13errors: rewrite the logic how errors are reportedTimo Teräs1-0/+3
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-13solver: prune broken world dependencies with --forceTimo Teräs1-22/+54
mostly useful for reboot, when all packages are not available.
2013-06-13solver: corner case fixesTimo Teräs1-3/+19
- 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-13solver: rewrite as deductive solver -- pinning supportTimo Teräs1-26/+135
Fix also pinning test cases to be more sane.
2013-06-13solver: rewrite as deductive solver -- per name flagsTimo Teräs1-8/+24
Handle properly per-name preference flags, and add test cases for testing those via fix applet.
2013-06-13solver: rewrite as deductive solver -- core featuresTimo Teräs1-1830/+418
Implementing basic dependency handling, install_if and awareness of pinning.