summaryrefslogtreecommitdiff
path: root/lib/libalpm/remove.c
Commit message (Collapse)AuthorAge
* remove.c: refactor into functionsK. Piche2008-04-14
| | | | | | | | Pulled two loops out of _alpm_remove_prepare and gave them their own functions. Signed-off-by: K. Piche <kevin@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove unnecessary header file, move one macro to util.cDan McGee2008-04-06
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Merge branch 'maint'Dan McGee2008-03-30
|\
| * Use pkgcache instead of db_scan in remove.cNagy Gabor2008-03-28
| | | | | | | | | | | | | | This should be a notable speed-up (apart from kernel cache). Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Kill PM_TRANS_TYPE_ADD.Chantry Xavier2008-03-17
| | | | | | | | | | | | | | This was totally useless. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Add -Rss optionNagy Gabor2008-03-10
| | | | | | | | | | | | | | | | * -Rss removes all dependencies (including explicitly installed ones). * updated documentation * two pactest files added to test the difference between -Rs and -Rss Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
* | Merge branch 'maint'Dan McGee2008-03-09
|\| | | | | | | | | | | Conflicts: configure.ac
| * Remove a bogus comment from libalpm/remove.cNagy Gabor2008-03-09
| | | | | | | | | | | | We do the opposite. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
* | libalpm/package.c : add _alpm_pkgname_pkg_cmp function.Nagy Gabor2008-02-06
| | | | | | | | | | | | | | | | | | | | | | _alpm_pkgname_pkg_cmp(pkgname, pkg) returns true iff pkg's name is pkgname. This is useful if you want to remove a package from pmpkg_t* list, and you want to search for package name. This allows cleaning the -Ru code a bit, by removing the need of a dummy pkg. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
* | New remove option : -u / --unneeded (FS#6505).Nagy Gabor2008-02-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'maint'Dan McGee2008-01-13
|\|
| * don't send CHECKDEPS_DONE event when NODEPS is set.Chantry Xavier2008-01-12
| | | | | | | | | | Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2008-01-11
|\|
| * Only notify of dependency check in removal if performedAllan McRae2008-01-11
| | | | | | | | | | | | | | | | | | Moves "checking dependencies..." notification into code block where dependency checking is performed to stop spurious notification. Reference: http://archlinux.org/pipermail/pacman-dev/2008-January/010714.html Signed-off-by: Allan McRae <mcrae_allan@hotmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Use dynamic string allocation in package structuresDan McGee2008-01-11
|/ | | | | | | | | | | | | | 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>
* libalpm/remove.c : switch back to lstat usage.Chantry Xavier2007-12-28
| | | | | | | | | | commit b55abdce7a changed every instance of lstat to alpm_stat to remove an eventual trailing /, but in remove.c, this is not wanted. Ref: http://www.archlinux.org/pipermail/pacman-dev/2007-December/010451.html Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Update GNU GPL boilerplate and copyright datesDan McGee2007-12-10
| | | | | | | Update the GPL boilerplate to direct people to the GNU website for a copy of the license, as well as bump all of Judd's copyrights to 2007. Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix for sync1003 and sync1004 pactestsNagy Gabor2007-11-25
| | | | | | | | | | | | | | | checkdeps and resolvedeps now take both a remove list and an install list as arguments, allowing dependencies to be calculated correctly. This broke the sync990 pactest, but this pactest used dependencies and provides in an unusual way, so it has been changed. Dan: the sync990 pactest was just plain wrong. It didn't satisfy the dependencies correctly, so should never have succeeded. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> [Dan: some variable renaming, clarification in commit message] Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix several memleaks, mostly related to errors handling.Chantry Xavier2007-11-25
| | | | | | | | | | | | | | | | | | | | | | | * The frontend calls alpm_trans_prepare(&data), and in case of errors, receive the missing dependencies / conflicts / etc in the data pointer. It apparently needs to free this structure totally with : alpm_list_free_inner(data, free) alpm_list_free(data) So I added alpm_list_free_inner(data, free) in pacman/{sync.c,remove.c,add,c} * in _alpm_sync_prepare, the deps and asked lists were not freed in case of errors (unresolvable conflicts). Besides the code for handling this case was duplicated. * in _alpm_remove_commit, free was used instead of alpm_list_free for newfiles. * newline fix in pacman/sync.c Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Simple s/conflict/fileconflict/ renaming.Chantry Xavier2007-11-18
| | | | | | | | | | | | | | | | | | | | The names related to conflicts are misleading : For dependencies conflicts, the type is pmdepmissing, and the function names contain just "conflict". For file conflicts, the type is pmconflict, and some functions contained just "conflict", some others "fileconflict". So this is the first step for improving the situation. Original idea/patch from Nagy, but the patch already didn't apply anymore, so I did it again. The main difference is that I kept the conflictype, with the following renaming : pmconflicttype_t -> pmfileconflicttype_t PM_CONFLICT_TYPE_TARGET -> PM_FILECONFLICT_TARGET PM_CONFLICT_TYPE_FILE -> PM_FILECONFLICT_FILESYSTEM Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
* Remove provide.c and provide.h .Chantry Xavier2007-11-17
| | | | | | | | | This file only contained one private function : _alpm_db_whatprovides . And the public alpm_db_whatprovides was in db.c , so I moved everything there. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> [Dan: updated POTFILES.in as well] Signed-off-by: Dan McGee <dan@archlinux.org>
* War on whitespaceDan McGee2007-11-16
| | | | | | Run the kernel's cleanfile script on all of our source files. Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove REQUIREDBY usage from libalpmDan McGee2007-11-14
| | | | | | | | | | | | Instead of using the often-busted REQUIREDBY entries in the pacman database, compute them each time they are required. This should help many things: 1. Simplify the codebase 2. Prevent future database corruption 3. Ensure when we do use requiredby, it is always correct 4. Shrink the pmpkg_t memory overhead Signed-off-by: Dan McGee <dan@archlinux.org>
* alpm_list_add == alpm_list_add_lastNagy Gabor2007-11-14
| | | | | | | | | | | | | | It's time to define that alpm_list_add(list, foo) adds 'foo' to the end of 'list' and returns with 'list', because: 1. list is a list, not a set. 2. sortbydeps _needs_ an alpm_list_add definition to work properly. As a first step, I used this definition in recursedeps. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> [Dan: punctuation cleanup in commit message and code comments, added comment to alpm_list_add] Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix memleak with new alpm_list_reverse usageDan McGee2007-11-11
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Maintain list tail pointers in the head nodeAaron Griffin2007-11-06
| | | | | | | | | | | | | | | | | | | | | | | | | List head nodes contain null 'prev' pointer, which we can (ab)use to maintain a back reference to the tail pointer of the list. While list additions are not _significantly_ improved, they are still sped up. Original $ time pacman -Qo /usr/bin/wtpt /usr/bin/wtpt is owned by lcms 1.17-2 real 0m3.623s user 0m1.883s sys 0m1.473s New $ time pacman -Qo /usr/bin/wtpt /usr/bin/wtpt is owned by lcms 1.17-2 real 0m2.006s user 0m0.263s sys 0m1.627s Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
* libalpm: use an lstat wrapper so we never dereference dir symlinksDan McGee2007-11-04
| | | | | | | | Linux lstat follows POSIX standards and dereferences a symlink pointing to a directory if there is a trailing slash. For purposes of libalpm, we don't want this so make a lstat wrapper that suppresses this behavior. Signed-off-by: Dan McGee <dan@archlinux.org>
* Readd scriptlet logging that got lost in an earlier commitDan McGee2007-11-04
| | | | | | | | | I broke scriptlet logging with ad691001e20272b794d2ed574b556f520e3555c0. Readd more or less what was there before, although it still needs a lot of work including hopefully rewriting it to a new event subsystem and having it log to a seperate file. Signed-off-by: Dan McGee <dan@archlinux.org>
* dependency error message fix in libalpm/remove.cNagy Gabor2007-10-26
| | | | | | Normally you must never see that error message. Signed-off-by: Dan McGee <dan@archlinux.org>
* Add gcc format attribute to _alpm_log, catch a few bugs in the processDan McGee2007-10-08
| | | | | | | This fixed a few of our formatted output strings that were broken before but never being checked. Signed-off-by: Dan McGee <dan@archlinux.org>
* Minor "cannot remove" message cleanupAaron Griffin2007-09-28
| | | | | | | The strings differed in quotes only, this way we have only one i18n string for translation Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
* libalpm/add.c: fix backup array issueDan McGee2007-09-23
| | | | | | | | | | | | As seen with the recent upgrade of pacman and the removal of the pacman.d/current mirrorlist, files that were formerly in the backup array get deleted upon their removal, which could be dangerous. Instead, we should use the combined backup array of the old and new package. This fix should address this issue in a relatively straightforward way. In addition, old files should be moved to pacsave locations as expected. Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm/remove.c: fix up arguments to unlink_fileDan McGee2007-09-23
| | | | | | Move the progressbar code out of unlink_file so we can pass half the args. Signed-off-by: Dan McGee <dan@archlinux.org>
* trans.c : reworking of transaction interruptionsChantry Xavier2007-09-16
| | | | | | | | | | | | | | | | | | | | | | | | | | My two previous hacks related to this part (8038190c7c4786e1c49494eea1b40cdddcbd5136 and b15a5194d1a8485a2769560e49e6ff03e1862533) were caused by the lack of understanding of a feature introduced a while ago: Better control over CTRL-C interruptions -- do not leave the DB in an inconsistent state (54008798efcc9646f622f6b052ecd83281d57cda). Now I have been looking at this commit, and the added feature is indeed interesting. The main problem I had with it is that it does a rather unusual use of alpm_trans_release, which caused a few problems that I tried to fix in a weird way. I think these problems were caused by the fact that there weren't any difference between "interrupt transaction" and "release a transaction which failed" actions from the alpm_trans_release POV. So I decided to add a new function instead, alpm_trans_interrupt, which is called on Ctrl+C, and which only sets trans->state to STATE_INTERRUPTED so that remove_commit and add_commit can exit cleanly at a safe moment. This allowed me to revert my two previous hacks as well. Also ensure we handle SIGINT correctly in all cases- if a transaction is not ongoing, then we can free the transaction and exit quickly. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm/remove.c : avoid duplicated packages in removal list.Chantry Xavier2007-09-02
| | | | | | | | | | | | | Suppose a package foo depends on foo1, foo2, ..., foon. Doing pacman -Rc foo1 foo2 ... foon added foo n times to the removal list, because what checkdeps return is something like : foo1 is requiredby foo foo2 is requiredby foo ... foon is requiredby foo Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm: add newlines to all strings passed to log callbackDan McGee2007-08-23
| | | | | | | | | This allows us to remove the hack in the frontend where we added a newline to everything coming out of the pm_printf functions, and instead let the developer put newlines where they want them. This should be the last hangover of that auto-newline stuff. Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm/remove.c: check for ability to unlink is wrongDan McGee2007-08-23
| | | | | | | As reported by JGC in FS #7652, the check for EACCES is not exactly correct. We need to check for the ETXTBSY error as well. This is necessary on FreeBSD. Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix some errors spit out by -WextraDan McGee2007-08-16
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Clean up MD5 code.Andrew Fyfe2007-08-16
| | | | | | | | | | | | | | * Move alpm md5 functions to lib/libalpm/util.c * Remove unneeded includes for md5.h * Replace md5 implementation with one from http://www.xyssl.org Dan: clean up XySSL code by removing parts we don't use, and add a note saying what changed. Dan: fix alpm_get_md5sum, off by one error on the malloc call and other small things. Signed-off-by: Andrew Fyfe <andrew@neptune-one.net> Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove support for SHA1 from pacman.Andrew Fyfe2007-08-16
| | | | | | | | There's no need for a second hashing algorithm. MD5 serves the purpose of verifying that a package file hasn't been corrupted during download. Signed-off-by: Andrew Fyfe <andrew@neptune-one.net> Signed-off-by: Dan McGee <dan@archlinux.org>
* Ensure requiredby entries are removed during an upgradeDan McGee2007-07-14
| | | | | | | | | | | This fixes the failure of the requiredby004 pactest in a not so pretty way, but it gets the job done. I purposely used the extremely long name of PM_TRANS_TYPE_REMOVEUPGRADE to be both clear and in the hope that someone else will figure out a better solution. Original idea from Nagy Gabor, patch updated and cleaned for current code. Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm/remove.c : revert part of commit to fix remove044 pactestChantry Xavier2007-07-13
| | | | | | | | | | | In 1c9f30b9fab998e2d89dd307a90122618d746cb6 This change should be done AFTER the TODO in recursedeps is implemented. Then we'll be able to first sort the list, then call recursedeps which keeps it sorted. For now, the sorting should still be done as the last step. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm/deps.c : fix for remove044 pactest.Chantry Xavier2007-07-13
| | | | | | | | | | | | | | Patch from Nagy that makes removedeps use alpm_depcmp. I also renamed removedeps to recursedeps, as it can have a more general usage, and added an include_explicit argument, so we can control if packages explictly installed are added or not. Note: Small changes made by me (Dan) as well- mostly some English grammar correction and a few other cleanups. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm/remove.c : Rsd combination.Chantry Xavier2007-07-13
| | | | | | | | | | Currently the d (nodeps) option skips the s (recursive) part, rendering the Rsd combination totally useless. This patch makes a recursive removal still possible using the nodeps option, as Romashka asked there : http://bugs.archlinux.org/task/6057#comment17784 Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
* Remove versioncmp.{c,h}, clean up selective #ifdefsDan McGee2007-07-12
| | | | | | | | | Remove versioncmp.c by moving all functions to locations that make sense. Move replacement functions (for building without glibc) into util.c where they belong, and do proper checks for them instead of using __sun__, etc. Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove gettext calls from all PM_LOG_DEBUG messagesDan McGee2007-07-10
| | | | | | | There is no real reason to burden our translators with these messages, as anyone helping to debug these will probably want them in English. Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove unnecessary and extra includesDan McGee2007-07-01
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm/remove.c : file variable used before being initialized.Chantry Xavier2007-06-28
| | | | Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
* Remove unnecessary trans parameter from _alpm_checkdepsNagy Gabor2007-06-26
| | | | | | | The trans parameter was never used, so remove it. Signed-off-by: Nagy Gabor <ngaba@petra.hos.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
* Ensure correct and consistent usage of depmissChantry Xavier2007-06-10
| | | | | | | | | See comment from Nagy here : http://www.archlinux.org/pipermail/pacman-dev/2007-April/008134.html This also makes easier correct usage of checkdeps in sync.c, which fixes sync901 pactest (and so bug 6057). Signed-off-by: Dan McGee <dan@archlinux.org>