Commit Graph

158 Commits (cute-signatures)

Author SHA1 Message Date
Timo Teräs e4dc2373d6 solver: do not auto select virtual-only package with one provider
This reverts most of 0dcbd933 which allowed automatic selection
of package with a "virtual provides" having only one provider.
While convenient, it creates problems if multiple versions of the
same package exist, or if in future other providers would be added
to one of the repositories. This restore the original behaviour,
and improve the error message to tell the user to mention one of
the providers explicitly.

fixes #10810
2022-02-24 14:18:41 +02:00
Timo Teräs 3ad4d6bed1 solver: require package layer to be enabled for install 2022-02-21 10:24:05 +02:00
Timo Teräs f69ae30272 db: sort world dependencies to layers 2022-02-21 10:24:05 +02:00
Timo Teräs 7167bc9e7b solver: don't consider requirer count for preference
The original intent was to choose packages to which there is most
dependencies. However, since the code has evolved this is has been
mostly obsolete. And in fact now interferes with the provides and
provides priority mechanism. Remove this as obsolete.

Fixes #10742
2021-05-19 16:29:55 +03:00
Timo Teräs 354713d2f7 rename apk_db_options to apk_ctx, rework logging
makes apk_verbosity non-global

fixes #10682
2020-10-09 16:09:19 +03:00
Timo Teräs 9afb4e8fd1 make apk_force non-global, remove left-over apk_arch
ref #10682
2020-10-09 16:09:19 +03:00
Timo Teräs e2afc7e7a9 fix, simplify and document upgrade --ignore 2020-08-24 15:26:25 +03:00
Oliver Smith f3cf824948 solver: add more dbg_printfs 2020-08-24 14:25:40 +03:00
Timo Teräs d0edeec8fb make the atom functions not use global state
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-19 12:02:56 +03:00
TBK 5d796b5678 use SPDX-License-Identifier in source files 2020-05-07 10:45:42 +03:00
nrybowski 695a2f8231 upgrade: implement --ignore to exclude some packages from upgrade 2019-12-12 13:47:11 +02:00
Timo Teräs b0be9f610c solver: fix common dependency merging to inherit pinning and flags
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.
2019-06-05 08:51:00 +03:00
Timo Teräs 0565e9bb05 fix orphan package handling for certain provides cases 2018-11-12 15:00:14 +02:00
Timo Teräs 47570f80e9 prefer selecting packages by their primary name 2018-11-12 14:16:36 +02:00
Timo Teräs a86c8ed082 fix package preference based on it's conflicts in --latest mode
remove also redundant pkg_selectable check in repair mode.
2018-11-12 13:20:14 +02:00
Timo Teräs 7561a501b4 fetch: ignore conflicts when solving --recursive fetches 2018-06-14 20:40:05 +03:00
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