aboutsummaryrefslogtreecommitdiffstats
path: root/libopkg/solvers
AgeCommit message (Collapse)Author
2022-05-27libsolv: Error on unknown package install requestChaitanya Vadrevu
Existing implementation silently returns when an abstract package (with no real package to back it) is requested to be installed. E.g., package 'a' recommends unknown package 'dne' but installing 'dne' succeeds even though no operation has taken place. This change makes sure an error is returned during such install operations. A package is deemed unkonwn if it is absent from repos 'repo_installed', 'repo_available', 'repo_preferred', 'repo_to_install'. Signed-off-by: Chaitanya Vadrevu <chaitanya.vadrevu@ni.com> Signed-off-by: Alex Stewart <alex.stewart@ni.com>
2022-03-10libsolv: add missing break statement in switch caseShruthi Ravichandran
This patch adds a missing break in a switch case while parsing a package's dependencies. This was causing a package's pre-dependency to be added twice to the solvable, each time with a different marker. Signed-off-by: Shruthi Ravichandran <shruthi.ravichandran@ni.com> Signed-off-by: Alex Stewart <alex.stewart@ni.com>
2021-10-19opkg_solver_libsolv: Fix parameter list for callbackBill Pittman
Fix parameter list for callback to remove compiler warnings. Signed-off-by: Bill Pittman <bill.pittman@ni.com> Signed-off-by: Alex Stewart <alex.stewart@ni.com>
2021-07-13opkg_solver_libsolv: blacklist excluded packages instead of ignoring themBrandon Streiff
Currently, packages specified with --add-exclude aren't registered at all with libsolv. Because as far as libsolv is concerned they don't exist, if an installation requires an excluded package, you get a less-than-ideal message that "nothing provides" the excluded package. Instead of pretending that they don't exist, instead utilize libsolv's recent support for "blacklisted" packages. This changes the error output to indicate that the excluded package "can only be installed by a direct request" Signed-off-by: Brandon Streiff <brandon.streiff@ni.com> Signed-off-by: Alex Stewart <alex.stewart@ni.com>
2020-10-27opkg_solver_libsolv: Pass opkg_config->noaction as 'noaction' parameter to ↵Zavaczki Raul
libsolv_solver_transaction_preamble Currently, if the option for 'download first' is true, opkg will download packages even when noaction is set to false Changing the function call to pass opkg_config->noaction instead of 0 will fix this behaviour Signed-off-by: Zavaczki Raul <raul.zavaczki@ni.com> Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2020-02-06libsolv: ignore missing recommends of installed packagesAlejandro del Castillo
If package 'a' recommends package 'b' and 'a' is installed using --no-install-recommends, any following operation will install 'b', since the solver will detect that 'a' has a missing recommends. Fixes bugzilla #13758 Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2020-02-05libopkg: add glob support for --add-ignore-recommends and --add-excludeAlejandro del Castillo
Fixes bugzilla #13759 Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2020-02-04libsolv_solver_solv: show all solver problemsYann Dirson
Currently, when the solver fails opkg calls solver_problem2str, which does an educated guess on what the main problem is, from a longer list of problems. From the libsolv documentation: * search for a rule that describes the problem to the * user. Actually a pretty hopeless task that may leave the user * puzzled. To get all of the needed information use * solver_findallproblemrules() instead. Call solver_findallproblemrules and print all problems instead. Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2020-01-17libsolv_solver_execute_transaction: treat obsolete operations as upgradesAlejandro del Castillo
When the Replace/Conflict pattern is used to split a package [1], opkg is configuring libsolv to return replace operations in two steps. This works well for a package that is split in 2, but falls apart when a package is split into more than 2 packages. Insted, instruct libsolv to treat OBSOLETE operations as upgrades. [1] https://www.debian.org/doc/debian-policy/ch-relationships.html Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2020-01-17opkg_install_pkg: allow upgrades between packages with different namesAlejandro del Castillo
Required to be able to process OBSOLETE operations as upgrades. Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2019-10-25add SPDX License identifierYann CARDAILLAC
Signed-off-by: Yann CARDAILLAC <yann.cardaillac@smile.fr> Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2019-02-12libsolv_solver_execute_transaction: propagate download errorAlejandro del Castillo
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2019-02-04libopkg: add --add-ignore-recommends optionAlejandro del Castillo
Add option to ignore specific recommended packages. On the libsolv backed, this feature will only work on libsolv version > 0.7.2 [1]. [1] https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_openSUSE_libsolv_issues_254&d=DwIBaQ&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=wNcrL2akRn6jfxhHaKavUrJB_C9JAMXtynjLd8ZzgXQ&m=GObNHzFJpWpf_PripIrf-K2RhsktYdAUEieAJexXOKw&s=3G-meChUqClFggFPqsrAxIZBfLnRKIHm62Uuy1X6nQQ&e= Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2019-02-04libsolv_solver_init: make --no-install-recommends case consistentAlejandro del Castillo
Currently, the --no-install-recommends case doesn't set the flag SOLVER_FLAG_INSTALL_ALSO_UPDATES, which causes inconsitent behavior between installs with/without the flag. To be consistent, always set the flag. Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2018-08-30libsolv_solver_execute_transaction: abort transaction on first failureAlejandro del Castillo
If package A depends on B, and B is corrupted, if you install A, opkg will try to install B, fail and continue installing A. Change logic to abort the transaction on first failure. This is consistent with the internal solver behavior. Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2018-06-26populate_installed_repo: add Essential field supportAlejandro del Castillo
Debian "Essential" field is being enforced at package removal time, instead of at solve time. This is problematic, since other packages can be removed before the Essential package is processed. For each installed Essential package, add a job that will ensure the package will stay installed (but upgradable). Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2018-03-28libsolv_solver_transaction_preamble: add arch information to get matching ↵Alejandro del Castillo
package The function pkg_hash_fetch_by_name_version is called to find the pkg object that corresponds to the solvable returned by libsolv. The matching is done using name and version, which is incomplete as there might be several packages with the same name/version, but with different architecture. Add architecture information to the comparision. Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2018-02-19src, libopkg: don't use non-portable malloc.hMichał Łyszczek
Since malloc.h is an extension to the language and is not available on all systems (like BSD family), stdlib.h should be used instead, which defines malloc function family. Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl> Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2018-02-15populate_available_repos: make missing packages solvable non-version constrainedAlejandro del Castillo
If a Package index is stale, installations might fail, leaving the status file with entries for missing packages. Those entries add solvables that need to match specific versions, which is too restrictive as newer versions of the same package are likely to satisfy the dependency tree. Fixes bugzilla #8351 (test case provided by Julia Cartwright) Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2018-01-30libsolv_solver_execute_transaction: add case for obsolete packagesAlejandro del Castillo
Given a system that have package 'a' installed, where both package 'a' and 'b' Replaces/Conflicts/Provides 'v'. Installing package 'b' should remove 'a' first. Currently, that operation is expressed as install b, remove a, which end up running the maintainer scripts in the wrong order. Add code to treat the Obsolete operation separetely, as a remove a, install b. bugzilla #11362 Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2018-01-29opkg_install_pkg: remove unused parameter from_upgradeAlejandro del Castillo
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2017-09-29Implement list-upgradable for the external libsolv solverBöszörményi Zoltán
Copy&pasted and modified opkg_solver_upgrade() and libsolv_solver_execute_transaction() in libopkg/solvers/libsolv/opkg_solver_libsolv.c to only print the transaction. Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com> Removed unused include in opkg_cmd.c Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2017-07-31is_pkg_a_provides: stick to name comparison for satisfied dependenciesAlejandro del Castillo
Limit comparison to package names when checking if a satisfied dependency Provides is already installed. This enable upgrades of installed packages that Provide virtual packages already installed. fixes bugzilla 11826 Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2017-05-22libsolv_solver_add_job: force target dist-upgrade operationAlejandro del Castillo
Use SOLVER_TARGETED libsolv flag on dist-upgrade operations to configure libsolv to prefer an upgrade of the same package over an upgrade to a package that replaces the targeted package. Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2017-05-08solv_solver_solve: print solver errors to stderrAlejandro del Castillo
opkg_message(NOTICE, ....) logs to stdout, while opkg_message(ERROR, ...) logs to stderr. Logging from solver_printsolution is done via printsolution_callback. Fixes bugzilla #10407 Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2017-05-08calculate_dependencies_for: skip error message if --force-dependsAlejandro del Castillo
Fixes bugzilla #9060 Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2017-05-08is_provides_installed: check all installed and to be installed pkgsAlejandro del Castillo
Previously, only installed providers were searched, which left out providers that were already set to be installed. fixes bugzilla #10781 Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2017-05-08pkg_hash_fetch_all_installed: add option for installed and to be installed pkgsAlejandro del Castillo
Will be use in is_provides_installed to check if a provider is installed or if a provider is already set to be installed. Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2017-05-08is_pkg_a_provides: extend check to Provides of pkgAlejandro del Castillo
Currently this function is only checking for packages that provide pkg_scout->name. However, if pkg_scout->provides_count == 2 (package provides itself and only one virtual package), the check needs to be extended to cover the package provided by pkg_scout. Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2017-05-08internal_solver_solv: do not return if provider is already installedAlejandro del Castillo
If package 'a' Provides 'd' and is installed, and 'b' also Provides 'd' and is available, when: opkg install 'd' 'd' should be able to be installed. The unnecessary is_provides_installed check is currently incorrectly succeeding since it only checks for providers that match the package name, instead of also checking the Provides field of the package. Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2017-05-08calculate_dependencies_for: check return value on recursive callAlejandro del Castillo
Currently, calculate_dependencies_for return values are being ignored when called from calculate_dependencies_for. If a conflict is detected, an error is reported, but the operation is allowed to continue. Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2017-04-14Add support for installing packages with version constraints other than '='Michael Hansen
Signed-off-by: Michael Hansen <michael.j.hansen@hp.com> Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2017-04-03pkg_get_provider_replacees: do not add duplicated replaceesAlejandro del Castillo
If package 'a' Provides X, and package 'b' Provides/Replaces/Conflicts X, and 'a' is installed, installing 'b' fails, since 'a' is removed twice. Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2017-04-03pkg_get_installed_replacees: do not add duplicated replaceesAlejandro del Castillo
Since every package provides itself, replacees were added two times to the list of installed_replacees. Ensure there is no duplication. Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2017-03-16libsolv_solver_init: upgrade recommended dependenciesAlejandro del Castillo
During targeted install/upgrade operations, also upgrade Recommends. This is consistent with dpkg behavior. Fixes bugzilla #9939 Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2017-02-07opkg_solver_internal.c: do not process orphans if --download-onlyAlejandro del Castillo
Fixes bugzilla #10243 Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2017-01-12populate_installed_repo: make autoinstalled packages removableAlejandro del Castillo
In a system that has package 'a' & 'b' installed, where package 'a' recommends 'b', trying to install package 'c', which depends on 'd' (which conflicts with 'b'), the expected behavior is for the package manager to uninstall the recommended package 'b', then proceed to install 'c' & 'd'. By making autoinstalled packages potentially removable, libsolv will correctly remove installed recommended packages that conflict with a to be installed package (or any of it's dependencies). Fixes bugzilla 10777 (libsolv only) Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2016-12-08libsolv: add globbing support for upgradeAlejandro del Castillo
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2016-12-08libsolv: add globbing support for installAlejandro del Castillo
The wildcards accepted for globs are '*', '?' and '[]'. For example: opkg install 'a*' -> Installs all packages that start with 'a' opkg install 'a-?' -> Installs all packages that start with 'a-' and only have 3 characters opkg install '[ab]*' -> Installs all packages that start with either 'a' or 'b' Fixes bugzilla #9792 Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2016-12-08opkg_solver_libsolv.c: move pkg name/version parsing outside ↵Alejandro del Castillo
libsolv_solver_add_job To be able to use globing during installs, opkg_solver_install needs to parse the name & version from the command arguments. Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2016-10-07Display libsolv version in --version output, if enabled.Michael Hansen
Signed-off-by: Michael Hansen <michael.j.hansen@hp.com> Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2016-10-07Handle 'opkg remove' and 'opkg install' (libsolv) correctly for packages in ↵Michael Hansen
SS_HALF_INSTALLED state due to a previously failed installation. Signed-off-by: Michael Hansen <michael.j.hansen@hp.com> Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2016-09-22libsolv: Allow package names to be matched against provides.Michael Hansen
When using internalsolv, you can request to install/upgrade a virtual package; that is, one that only exists as a 'Provides' name from another package name but does not exist as a named package. This updates libsolv to behave the same way. Signed-off-by: Michael Hansen <michael.j.hansen@hp.com> Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2016-09-21Tell libsolv to treat version comparisons as Debian-compatible.Michael Hansen
Requires libsolv to be built with MULTI_SEMANTICS=ON (otherwise it will use your system's default version semantics). I don't know if this completely matches opkg's version comparison semantics, but it's at least a lot closer than the RPM version that is used by default on many systems. Signed-off-by: Michael Hansen <michael.j.hansen@hp.com> Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2016-09-20Make libsolv messages more consistent with internalsolv messages.Michael Hansen
Fixes some consistency issues between libsolv and internalsolv messages during install/remove/upgrade actions: * Two (different) removal messages were printed with libsolv * Add version to removal message shared by both libsolv and internalsolv * Print the destination name on install/upgrade messages with libsolv * Don't print install/upgrade messages when --download-only is used with libsolv (matches internalsolv behavior) Signed-off-by: Michael Hansen <michael.j.hansen@hp.com> Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2016-09-08opkg_solver_remove: enable use of globs for opkg remove commandAlejandro del Castillo
Globs are supported on the opkg remove command on the internal solver. This change adds support for the libsolv backend. Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2016-09-08libsolv_solver_add_job: make pkg_name argument constAlejandro del Castillo
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2016-09-08dep2id: initialize Id variables to zero, instead of NULLAlejandro del Castillo
The current initializations triggers compiler warnings of the type: warning: initialization makes integer from pointer without a cast [-Wint-conversion] Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2016-07-19libopkg: kill active_listJosh Cartwright
The active_list abstraction has a long history in opkg. It's purpose was to be a richer list type which, given information about a dependency relationship, can use it to control order of traversal. However, the "richness" of this data type has never been used. In fact, as of commit d0c00a26eb ("active_list_add_depend: remove unused function"), the interface used to specify dependencies was removed. Get rid of the abstraction entirely by converting users to using the basic list type. Signed-off-by: Josh Cartwright <joshc@ni.com> Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2016-07-13opkg_solver_remove: add pkg to pkg_to_remove vector only if there aren't any ↵Alejandro del Castillo
installed dependents During removal processing, packages are added to the pkg_to_remove vector even when the package being processed have installed dependents. Move insertion after the has_installed_dependents check. Fixes issue 9862 Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>