summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/deps.h
AgeCommit message (Collapse)AuthorFilesLines
2019-10-23Update copyright yearsAllan McRae1-1/+1
make update-copyright OLD=2018 NEW=2019 Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-14Remove all modelines from the projectEli Schwartz1-2/+0
Many of these are pointless (e.g. there is no need to explicitly turn on spellchecking and language dictionaries for the manpages by default). The only useful modelines are the ones enforcing the project coding standards for indentation style (and "maybe" filetype/syntax, but everything except the asciidoc manpages and makepkg.conf is already autodetected), and indent style can be applied more easily with .editorconfig Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-14Update coyrights for 2018Allan McRae1-1/+1
make update-copyright OLD=2017 NEW=201 Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04Update copyright yearsAllan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-09-25Do not #define _RESERVED_IDENTIFIERSIvy Foster1-3/+3
Signed-off-by: Ivy Foster <ivy.foster@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-04Update copyright years for 2016Allan McRae1-1/+1
make update-copyright OLD=2015 NEW=2016 Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-01Update copyright notices for 2015Allan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-30libalpm: export alpm_splitdep as alpm_dep_from_depstring and alpm_dep_freeFlorian Pritz1-2/+0
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-09-30deps.c: split _alpm_depcmp into _alpm_depcmp_providesFlorian Pritz1-0/+1
This allows to reuse the provision checker for a simple list of provisions without a package. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-02-04alpm: export *_free functionsAndrew Gregory1-1/+0
Front-ends should be able to free memory that alpm hands them. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-28Remove ts and sw from vim modeline when noet is setFlorian Pritz1-1/+1
Forcing vim users to view files with a tabstop of 2 seems really unnecessary when noet is set. I find it much easier to read code with ts=4 and I dislike having to override the modeline by hand. Command run: find . -type f -exec sed -i '/vim.* noet/s# ts=2 sw=2##' {} + Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06Update copyright years for 2014Allan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31deps.c: pass alpm_list** to _alpm_recursedepsAndrew Gregory1-1/+1
Improves consistency and makes it clear that targs will be modified by _alpm_recursedeps. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31sortbydeps: include local pkgs in dep graphAndrew Gregory1-1/+2
Detecting indirect dependencies by traversing a package's entire dependency tree is prohibitively slow for larger transactions. Instead add local packages to the dependency graph. This additionally requires delaying dependency ordering for sync operations so that removed packages may be excluded from dependency detection. tests/sync012.py was also updated to ensure that the dependency cycle was actually detected. Fixes FS#37380 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-03Update copyright year for 2013Allan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-02-20Update copyright yearsAllan McRae1-1/+1
Add 2012 to the copyright range for all libalpm and pacman source files. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19Be more robust when copying package dataDan McGee1-1/+1
This changes the signature of _alpm_pkg_dup() to return an integer error code and provide the new package in a passed pointer argument. All callers are now more robust with checking the return value of this function to ensure a fatal error did not occur. We allow load failures to proceed as otherwise we have a chicken and egg problem- if a 'desc' local database entry is missing, the best way of restoring said file is `pacman -Sf --dbonly packagename`. This patch fixes a segfault that was occurring in this case. Fixes the segfault reported in FS#25667. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18Add an _alpm_depcmp_literal() functionDan McGee1-0/+1
This omits the finding of matching provisions and only checks the package itself against the provided dep. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-28Rename pmdepmissing_t to alpm_depmissing_tAllan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28Rename pmdepend_t to alpm_depend_tAllan McRae1-4/+4
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28Rename pmpkg_t to alpm_pkg_tAllan McRae1-2/+2
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28Rename pmdb_t to alpm_db_tAllan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28Rename pmhandle_t to alpm_handle_tAllan McRae1-2/+2
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-16Make pmdepend_t and pmdepmissing_t publicDan McGee1-15/+0
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14Switch all logging to use handle directlyDan McGee1-1/+1
This is the last user of our global handle object. Once again the diff is large but the functional changes are not. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14Add handle argument to two more alpm methodsDan McGee1-1/+1
This takes care of alpm_checkdeps() and alpm_find_dbs_satisfier(). Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-25Ensure reported missing dependencies show correct version comparisonDan McGee1-1/+0
This addresses FS#23424. The -dd backend code was introduced in commit b6ec9019d77, and unfortunately the munged depend used for comparison did not carry through to the eventual display of this version. To fix this, we undo some of the depcmp_tolerant() business introduced, and instead make a new pmdepend_t object if necessary when the no dependency version flag is set. This results in the correct depend being copied to the missing depend passed onto the frontend. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-25Mark various functions in deps.c staticDan McGee1-5/+0
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-31alpm/depcmp: new NODEPVERSION flagXavier Chantry1-0/+1
This flag allows to disable version checking in dependency resolving code. depcmp_tolerant respects the NODEPVERSION flag but we still keep the original strict depcmp. The idea is to reduce the impact of the NODEPVERSION flag by using it in fewer places. I replaced almost all depcmp calls by depcmp_tolerant in deps.c (except in the public find_satisfier used by deptest / pacman -T), but I kept depcmp in sync.c and conflict.c Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-08Update copyright years for 2011Allan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-30Correct type for hash value storageAllan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-22Use name hashes in depends to avoid strcmp callsDan McGee1-1/+2
Just like we did for package name comparsions, if we add a depend name_hash field on depend struct initialization, we can use it instead of doing a string name comparison, saving us a lot of checks in the depcmp code. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13alpm: don't expose alpm_depcmpXavier Chantry1-0/+1
Either we expose all low levels function dealing with pmdepend_t (splitdep and depfree come to mind), or we don't. Since none of the tools use depcmp, I chose to remove it. In the future, we might want to expose higher level functions such as alpm_find_satisfier, or just lower level functions like splitdep and depfree together with depcmp. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-18Partial fix for the phonon/qt issueNagy Gabor1-1/+1
This patch fixes the phonon/qt issue, if all to-be-upgraded packages are explicit targets (ie. only not-yet-installed packages are pulled by resolvedeps). This condition covers the most common situations, for example it should hold with every -Su operation. After this patch sync405.py passes, but sync406.py doesn't. The work is inspired by the patch of Henning Garus, thanks for his work: http://mailman.archlinux.org/pipermail/pacman-dev/2010-February/010429.html (I moved the alpm_list_diff computation to sync.c in order to compute it only once.) Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-15Bump copyright dates to 2010Dan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-01Update copyright headers and messagesDan McGee1-1/+2
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11Look in target-list first to resolve dependenciesBryan Ischo1-1/+2
This fixes a bug introduced by my previous changes which changes the behavior of IgnorePkg/IgnoreGroup to allow the user to remove unresolvable packages from the transaction. The bug is that the target-list was no longer being consulted first to resolve dependencies, which means that if two packages in the sync database satisfied a dependency, and the user explicitly requested one of those two packages in the sync, the other package was still being pulled in. A new test was added, sync993.py, to verify the desired behavior. Signed-off-by: Bryan Ischo <bji-keyword-pacman.3644cb@www.ischo.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-02-24Don't prompt the user for unignore of IgnorePkg/IgnoreGroup packagesBryan Ischo1-1/+1
Don't prompt the user for unignore of IgnorePkg/IgnoreGroup packages, except for packages explicitly listed for sync by the user. This eliminates many unnecessary prompts when IgnorePkg/IgnoreGroup is used. Signed-off-by: Bryan Ischo <bryan@ischo.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-02-19Reorganize code for one-at-a-time resolvingBryan Ischo1-2/+2
This change reorganizes the internal code so that packages are resolved one at a time instead of all at once from a list. This will allow a future checkin to prompt the user to see if they'd rather remove unresolvable packages from the transaction and continue, or fail the transaction. This change does not affect the actual behavior of libalpm and all tests pass without changes. Signed-off-by: Bryan Ischo <bryan@ischo.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-13sync_addtarget reworkNagy Gabor1-1/+0
Now '-S provision' handling is done in the back-end. In case of multiple providers, the first one is selected (behavior change: deleted provision002.py). The old processing order was: literal, group, provision; the new one: literal, provision, group. This is more rational, but "pacman -S group" will be slower now. "pacman -S repo/provision" also works. Provision was generalized to dependencies, so you can resolve deps by hand: "pacman -S 'bash>2.0'" or "pacman -S 'core/bash>2.0'" etc. This can be useful in makepkg dependency resolving. The changes were documented in pacman manual. alpm_find_pkg_satisfiers and _alpm_find_dep_satisfiers functions were removed, since they are no longer needed. I added some verbosity to "select provider instead of literal" and "fallback to group". Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-08Resolvedeps reworkNagy Gabor1-3/+3
I divided resolvedeps into 2 functions. The new _alpm_resolvedep function will resolve one dependency, for example the 'foo>=1.0-1' dependency. It can be useful in sync_addtarget refactoring. The resolvedeps parameters were changed, to be coherent with recursedeps: * the target-list is an alpm_list* instead of alpm_list**. This is OK, because alpm_list_add == alpm_list_add_last * syncpkg param was removed. list contains the to-be-installed packages, resolvedeps will add the required dependencies into this list * trans param was removed, it was used in QUESTION() only, which can be used on the main (handle->trans) transaction only (because the front-end cannot access our pseudo-transactions at all!). The patch fixes some wrong dynamic pmdepmissing_t usage. I did a behavior change (and sync1003.py was modified accordingly), which needs some explanation: The old resolvedeps didn't elect packages from 'remove' list. I've dropped this because I don't want that 2nd excluding list param. In fact, in real life, we ~never need this rule. Resolvedeps is called before checkconflicts, so only -Su's %REPLACES% packages are sitting in 'remove' list. This means, that we have the replacement packages in our target list. Usually "foo replaces bar" means, that bar isn't in our repos any more, so resolvedeps *cannot* elect it; but usually it won't try it at all, because foo is in the target list, and it is expected to satisfy 'bar>=1.0-1'-like dependencies too. Since checkdeps and checkconflicts is done after resolvedeps, this cannot cause any harm. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-08New _alpm_find_dep_satisfier functionNagy Gabor1-0/+1
This function finds the first satisfier package in a pkglist. Using it instead of _alpm_find_dep_satisfiers eliminates some memleaks and it is faster. (_alpm_find_dep_satisfiers and _alpm_find_pkg_satisfiers will be removed soon.) Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-08New _alpm_dep_edge functionNagy Gabor1-0/+1
The function is introduced to kill some code duplication. The function name uses the 'dependency graph' terminology. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-13Cleanup usages of alpm_list_find and alpm_list_remove.Chantry Xavier1-0/+1
* remove obsolete and unused *_cmp helper functions like deppkg_cmp and _alpm_grp_cmp * new alpm_list_remove_str function, used 6 times in handle.c * remove _alpm_prov_cmp / _alpm_db_whatprovides and replace them by a more general alpm_find_pkg_satisfiers with a cleaner implementation. before: alpm_db_whatprovides(db, targ) after: alpm_find_pkg_satisfiers(alpm_db_getpkgcache(db), targ) * remove satisfycmp and replace alpm_list_find + satisfycmp usage by _alpm_find_dep_satisfiers. before : alpm_list_find(_alpm_db_get_pkgcache(db), dep, satisfycmp) after : _alpm_find_dep_satisfiers(_alpm_db_get_pkgcache(db), dep) * remove _alpm_pkgname_pkg_cmp, which was used with alpm_list_remove, and use _alpm_pkg_find + alpm_list_remove with _alpm_pkg_cmp instead. This commit actually get rids of all complicated and asymmetric _cmp functions. I first thought these functions were worth it, be caused it allowed us to reuse list_find and list_remove. But this was at the detriment of the clarity and also the ease of use of these functions, dangerous because of their asymmetricity. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-18Kill PM_TRANS_TYPE_ADD.Chantry Xavier1-1/+1
This was totally useless. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-16Move pmgraph_t struct and functions to their own header fileDan McGee1-10/+0
This will allow us to utilize this helpful type and functions in places besides dependency calculations. In addition, remove the public declaration of pmgraph_t in alpm.h- there is zero need to expose this internal type. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-06New remove option : -u / --unneeded (FS#6505).Nagy Gabor1-1/+3
With --unneeded option 'pacman -R' doesn't stop in case of dependency error; it removes the needed-dependency targets from the target-list instead. See also: http://archlinux.org/pipermail/pacman-dev/2007-October/009653.html . The patch also adds a new causingpkg field to pmdepmissing_t which indicates the to-be-removed package which would cause a dependency break. This is needed, because miss->depend.name may be a provision. miss->causingpkg will be useful in -R dependency error messages too. [Xavier: renamed inducer to causingpkg, removed the _alpm_pkgname_pkg_cmp helper function as requested by Aaron. This might be added by a further commit. Other small cleanups, updated manpage and bash completion.] Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-01-22Move the deptest code from frontend to backend.Chantry Xavier1-1/+3
The deptest code (pacman -T) used by makepkg was mostly in the frontend. There were 2 drawbacks: 1) the public splitdep function returns a pmdepend_t struct, but the _alpm_dep_free function for freeing it is private. So there was a memleak. 2) there is a helper in the backend (satisfycmp in deps.c) which makes this function much easier. So this adds a new public alpm_deptest in libalpm/deps.c, which cleans pacman_deptest in pacman/deptest.c a lot. Besides, alpm_splitdep was made private, because the frontend no longer requires it, and _alpm_dep_free is also private. Finally the deptest001 pactest was extended. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-12Add functions to manipulate pmdepend_t objectsDan McGee1-3/+5
We didn't have a free function before, causing some memory leaks. We also need a dup function now that strings are not in the structure but are dynamically allocated. Also adapt pmdepmissing_t to use a pointer to a depend struct instead of an inclusive one so we can use the functions we created here. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-11Use dynamic string allocation in package structuresDan McGee1-3/+4
This also affects all structures with static strings, such as depmiss, conflict, etc. This should help a lot with memory usage, and hopefully make things a bit more "idiot proof". Currently our pactest pass/fail rate is identical before and after this patch. This is not to say it is a perfect patch- I have yet to pull valgrind out. However, this should be quite safe to use in all situations from here on out, and we can start plugging the memleaks. Original-work-by: Aaron Griffin <aaronmgriffin@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>