summaryrefslogtreecommitdiff
path: root/lib/libalpm/remove.c
AgeCommit message (Collapse)Author
2007-09-23libalpm/add.c: fix backup array issueDan McGee
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>
2007-09-23libalpm/remove.c: fix up arguments to unlink_fileDan McGee
Move the progressbar code out of unlink_file so we can pass half the args. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-16trans.c : reworking of transaction interruptionsChantry Xavier
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>
2007-09-02libalpm/remove.c : avoid duplicated packages in removal list.Chantry Xavier
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>
2007-08-23libalpm: add newlines to all strings passed to log callbackDan McGee
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>
2007-08-23libalpm/remove.c: check for ability to unlink is wrongDan McGee
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>
2007-08-16Fix some errors spit out by -WextraDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-16Clean up MD5 code.Andrew Fyfe
* 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>
2007-08-16Remove support for SHA1 from pacman.Andrew Fyfe
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>
2007-07-14Ensure requiredby entries are removed during an upgradeDan McGee
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>
2007-07-13libalpm/remove.c : revert part of commit to fix remove044 pactestChantry Xavier
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>
2007-07-13libalpm/deps.c : fix for remove044 pactest.Chantry Xavier
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>
2007-07-13libalpm/remove.c : Rsd combination.Chantry Xavier
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>
2007-07-12Remove versioncmp.{c,h}, clean up selective #ifdefsDan McGee
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>
2007-07-10Remove gettext calls from all PM_LOG_DEBUG messagesDan McGee
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>
2007-07-01Remove unnecessary and extra includesDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-28libalpm/remove.c : file variable used before being initialized.Chantry Xavier
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-06-26Remove unnecessary trans parameter from _alpm_checkdepsNagy Gabor
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>
2007-06-10Ensure correct and consistent usage of depmissChantry Xavier
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>
2007-04-28Remove FREELISTPTR macroDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-26Clean up gettext on the libalpm sideDan McGee
Remove inclusion of libintl.h from all files, because we can do it once in util.c where the _() macro is defined. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-05Really run scriptlet on pre_remove and post_removeRoman Kyrylych
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-01Move the 100% progress bar call before remove scriptlet for output reasonsVMiklos
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-03-22* Correct install scriptlet usage (reuse of handle->root when not needed)Aaron Griffin
* Skip running scriptlet when chroot fails - to prevent issues in the host filesystem
2007-03-09* Two fixes when running under a new root (-r|--root)Aaron Griffin
- Check EACCES in can_remove_file, to verify - we're only checking for a read-only FS here... if write permissions fail, we can still remove it - Switched the message when creating DB directories from an error to a debug message * Fix the dep tests once and for all (it wasn't working for provides=() packages)
2007-03-05This commit looks much more monumental than it is. Almost all just #includeDan McGee
reordering and adding ones that were forgotten (noticed when trying to compile after reordering). * Updated the HACKING file to include information on #include usage. * print -> vprint in "making dir" function in pactest.
2007-03-04* Maybe that call to _alpm_trans_update_depends was necessary. Added it backDan McGee
in but did it right by duplicating the package first.
2007-03-03* Remove unnecessary call to _alpm_trans_update_depends that was erroringDan McGee
anyway. * Spelling/commenting etc.
2007-03-03Big commit this time:Aaron Griffin
* Moved entirely to alpm_pkg_get_* accessors, to read data on demand * Mostly removed the INFRQ_ parameters from outside the be_files backend (making the backend more extensible in the long run) * packages created from _alpm_db_scan now have the db and origin set (making accessors actually work for these packages) * removed _alpm_db_ensure_pkgcache * totally revamped the _alpm_checkconflicts function, making it cleaner and easier to read (and thus fix in the long run) - maintainable code ftw NOTE: feel free to rename the functions... I couldn't think of anything better * removed an extra loop in sync.c:find_replacements - no sense in looping over an entire DB while strcmp'ing the name, when we have get_pkgfromcache Other: * package struct "license" -> "licenses" * Created _alpm_sync_find (duplicate code in some places, find_pkginsync * Minor const correctness changes along the way * fixed a couple extra '/' pathing issues (non-issues really) * removed a duplicate pkg_cmp function
2007-02-26* Enforce const char* params when using stringsAaron Griffin
* Unified some functions names "package" -> "pkg" for consistency * Removed the goofy 'faketarget' stuff used for dep testing * Renamed alpm_pkg_isin -> alpm_pkg_find * Renamed alpm_db_readpkg -> alpm_db_get_pkg
2007-02-21* Re-added a compare function for syncpkg's - it was removed without thinkingAaron Griffin
properly * Error when re-reading the DB for replacements, wrong info level * Removed an duplicate debug message "checking for package replacements" * Check ignorepkg for REAL upgrades... * Properly check the NOSAVE flag * some unlink_file (remove.c) cleanup * fix indent level on handle.c * Force libalpm paths to end with a '/' char * Fixed 'target' looping in conflict.c (pmsyncpkg_t, not pmpkg_t) * Added some debug output to cache and db scanning ** All pactest tests succeed again, yay **
2007-02-20* Updated conflict checking one last time. You can finally have a file moveDan McGee
from one package to another seemlessly (knock on wood). This is implemented through the use of two skip lists in the trans struct- skip_add and skip_remove, which replace the former trans->skiplist. * Removed an unnecessary function parameter, added a necessary one. * If a package has no backup files, print '(none)' under the heading so it is more obvious. * Updated my TODO list.
2007-02-19* Updated bash_completion script to 3.0 options.Dan McGee
* Changed that removal message again, hopefully it sounds good now. * Shortened a usage option description so it would not wrap at 81 chars.
2007-02-19* Added some improved debug output to file conflict checking.Dan McGee
* Small change to string in remove.c (translators may or may not have to worry about this, depending on their already existing translation).
2007-02-18Moved the update_depends function to trans.c, as it depends on a transactionAaron Griffin
object
2007-02-17* A whole mess of backup changesAaron Griffin
- the code should be clearer, more organized, commented, and have worthwhile variable names now - proactive backup=()s now work. That is, adding a file to a backup array does what it should on the upgrade to that package, no longer forcing you to wait a full upgrade cycle for it to take effect * ldconfig was being run twice on an upgrade operation - fixed * fixed another pm_fprintf/printf output corruption with the progress bars * refactored some duplicate code for adjusting 'requiredby' lists * Added config.rpath to .cvsignore
2007-02-13* Refactored conflict checking within packages. Profiling from Dan showed anAaron Griffin
unbelievable amount of strcmp() calls (25 million) due to the list searching. This has been reimplemented with a set-intersection scheme, due to the fact that file lists are always ordered. - NEEDS TESTING * Minor clean up, "globalized" the str_cmp helper to match the alpm comparison signature, so we can use it elsewhere.
2007-02-12This should be an ERROR, not a WARNINGAaron Griffin
2007-02-08Attempt to NOT remove packages on filesystem errors (like a read-onlyAaron Griffin
filesystem). See FS#5887
2007-01-31Debug logging changes:Aaron Griffin
* The --debug params were goofy. New setup allows --debug without params, --debug=<level> where level 1=debug output, 2=debug and download output, 3=debug, download, and function tracing output. This seems more sane to me. * Removed PM_LOG_FLOW1 and PM_LOG_FLOW2. They were just confusing. When adding new functions, it is near impossible to determin if your output should be "flow1" or "flow2" without tracking all the way up the call chain. Rarely would one ever say "ok, lets just show "flow2" output. These have both been replaced with PM_LOG_DEBUG * Removed the need for the root parameter on alpm_initialize. it is now defaulted to PM_ROOT just like dbpath and cachedir. This allows alpm to be initialized BEFORE option parsing in the front end, saving us some duplicate variables in the frontend. * Cleaned up front end variables due to early alpm_initialize call.
2007-01-30K. Piche <kevin.piche@cgi.com>Aaron Griffin
* ALPM_LOG_FUNCTION macro and all the great work to add this macro everywhere
2007-01-30Discussed on IRC for a bit, this makes the following changes for clarity:Dan McGee
* alpm_list_is_in --> alpm_list_find * alpm_list_is_strin --> alpm_list_find_str * Flip parameters of both functions to be inline with rest of alpm_list. First commit, woohoo.
2007-01-23James Rosten <seinfeld90@gmail.com>Aaron Griffin
* attempt to unlink file AFTER moving to .pacsave always fails
2007-01-19Preliminary checkin for alpm_list conversionAaron Griffin
* renamed pmlist_t -> alpm_list_t * made alpm_list_t a public type (alpm_list.h header) * removed additional storage for registered DBs in pacman source * some code cleanup * removed duplicate (pm)list_display functions from pacman source * misc code cleanup
2007-01-18Some confusion with variable names in unlink_file caused unlink to try and ↵Aaron Griffin
find the _relative_ file instead of absolute. The absolute path name has also been used in some of the output there too.
2007-01-18Added strerror() output on unlink failureAaron Griffin
2007-01-17James Rosten <seinfeld90@gmail.com>Aaron Griffin
* _alpm_remove_commit refactoring * clean up/fixes by Dan McGee <dpmcgee@gmail.com>
2007-01-03* Bug fix FS#6058Aaron Griffin
properly remove entries from "Required By" instead of wiping it out entirely
2006-12-01* Cosmetic changes and typo fixesAaron Griffin
* IgnorePkg and --ignore work again * Partial changes to support removal of conflicts for -U and -A (INCOMPLETE)
2006-11-24* Fixed some error output for "-Sd" and "-Rsc" dealing with missing/ignoredAaron Griffin
depends * Added valgrind suppression file