summaryrefslogtreecommitdiff
path: root/lib/libalpm/remove.c
Commit message (Collapse)AuthorAge
* Require handle argument to alpm_logaction()Dan McGee2011-06-09
| | | | | | | This is the first in a series of patches to update the API to remove the implicit global handle variable. Signed-off-by: Dan McGee <dan@archlinux.org>
* Kill all remaining 'PATH_MAX + 1' usagesDan McGee2011-06-09
| | | | | | | | | The few remaining instances were utilized for buffers in calls to snprintf() and realpath(). Both of these functions will always ensure the returned value is padded with '\0', so there is no need for the extra byte. Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove global handle from remove.cDan McGee2011-06-03
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove global handle from util.cDan McGee2011-06-03
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Push down extern handle variable to files that need itDan McGee2011-06-03
| | | | | | | This will make the patching process less invasive as we start to remove this variable from all source files. Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove ALPM_LOG_FUNC macroDan McGee2011-06-03
| | | | | | | | | The usefulness of this is rather limited due to it not being compiled into production builds. When you do choose to see the output, it is often overwhelming and not helpful. The best bet is to use a debugger and/or well-placed fprintf() statements. Signed-off-by: Dan McGee <dan@archlinux.org>
* Merge branch 'maint'Dan McGee2011-05-19
|\ | | | | | | | | | | Conflicts: lib/libalpm/trans.c src/pacman/query.c
| * Fix segfault when uninstalling broken backed-up symlinkDan McGee2011-05-16
| | | | | | | | | | | | | | | | | | Issue FS#24230. If a symlink is broken and included in the removal process of a package, we blew up and segfaulted due to alpm_compute_md5sum() returning NULL and then performing a strcmp() operation. Signed-off-by: Dan McGee <dan@archlinux.org>
* | cleanup: add_pkg() and remove_pkg()Dan McGee2011-04-22
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* | Header inclusion cleanupDan McGee2011-04-20
| | | | | | | | | | | | | | | | This does touch a lot of things, and hopefully doesn't break things on other platforms, but allows us to also clean up a bunch of crud that no longer needs to be there. Signed-off-by: Dan McGee <dan@archlinux.org>
* | syntax: if/while statements should have no trailing spaceDan McGee2011-04-20
| | | | | | | | | | | | | | | | | | | | | | This is the standard, and we have had a few of these introduced lately that should not be here. Done with: find -name '*.c' | xargs sed -i -e 's#if (#if(#g' find -name '*.c' | xargs sed -i -e 's#while (#while(#g' Signed-off-by: Dan McGee <dan@archlinux.org>
* | style cleanup: cast as (type *) not (type*)Dave Reisner2011-04-20
| | | | | | | | | | Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2011-04-15
|\| | | | | | | | | | | | | | | Conflicts: lib/libalpm/alpm.h lib/libalpm/trans.c Signed-off-by: Dan McGee <dan@archlinux.org>
| * Fix broken documentation for alpm_trans_prepare()Rémy Oudompheng2011-04-09
| | | | | | | | | | | | | | The current state of the code does not allow to see immediately that it returns a list of pmdepmissing_t structures. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Style change: return(x) --> return xDan McGee2011-03-20
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was discussed and more or less agreed upon on the mailing list. A huge checkin, but if we just do it and let people adjust the pain will end soon enough. Rebasing should be relatively straighforward for anyone that sees conflicts; just be sure you use the new return style if possible. The following semantic patch was used to do the change, along with some hand-massaging in order to preserve parenthesis where appropriate: The semantic match that finds this problem is as follows, although some hand-massaging was done in order to keep parenthesis where appropriate: (http://coccinelle.lip6.fr/) // <smpl> @@ expression a; @@ - return(a); + return a; // </smpl> A macros_file was also provided with the following content: Additional steps taken, mainly for ASSERT() macros: $ sed -i -e 's#return(NULL)#return NULL#' lib/libalpm/*.c $ sed -i -e 's#return(-1)#return -1#' lib/libalpm/*.c Signed-off-by: Dan McGee <dan@archlinux.org>
* alpm: alpm_db_get_pkgcache_list => alpm_db_get_pkgcacheDave Reisner2011-02-25
| | | | | | | This avoids needless breakage of the public API. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Read pkgcache into hashAllan McRae2011-02-04
| | | | | | | | | | | | Read the package information for sync/local databases into a pmpkghash_t structure. Provide a alpm_db_get_pkgcache_list() method that returns the list from the hash object. Most usages of alpm_db_get_pkgcache are converted to this at this stage for ease of implementation. Review whether these are better accessing the hash table directly at a later stage. Signed-off-by: Allan McRae <allan@archlinux.org>
* alpm: drop old target interfacesXavier Chantry2011-01-29
| | | | | | | | | | It's likely that these interfaces will break sooner or later, now that pacman no longer uses them. So better force the two people who use them to migrate their code to the new add_pkg/remove_pkg interface, which is very easy anyway. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
* alpm: new alpm_remove_pkg interfaceXavier Chantry2011-01-29
| | | | | | | | | For consistency with alpm_add_pkg. The new recommended interface is alpm_add_pkg / alpm_remove_pkg, all others interfaces are deprecated. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
* Fix double filelist issue when upgrading a packageDan McGee2011-01-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to the way we funk around with package data loading, we had a condition where the filelist got doubled up because it was loaded twice. Packages are originally loaded with INFRQ_BASE. In an upgrade/sync, the package is checked for file conflicts next, leaving us in an "INFRQ_BASE | INFRQ_FILES" state. Later, when committing a single package, we have an explicit call to _alpm_local_db_read() with INFRQ_ALL as the level. Because the package's level did not match this, we skipped over our previous "does the incoming level match where I'm at" shortcut, and continued to load things again, because of a lack of fine-grained checking for each of DESC, FILES, and INSTALL. The end result is we loaded the filelist twice, causing our remove logic to iterate twice over the installed files, spewing a bunch of "cannot find file X" messages. Fix the problem by doing a bit more bitmasking logic throughout the load method, and also fix the sanity check at the beginning of the function- this should *only* be used for local packages as opposed to the "not a package" check that was there before. A debug log message was added to upgraderemove as well to match the one already in the normal remove codepath. Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove need for floating point division in backendDan McGee2011-01-10
| | | | | | | | | | | All of these can be done with integer division; the only slightly interesting part is ensuring we round up like before with calling the ceil() function. We can also remove the math library from requirements; now that the only ceil() calls are gone, we don't need this anymore. Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix some more simple conversion "errors"Dan McGee2011-01-07
| | | | | | | | None of these warn at the normal "-Wall -Werror" level, but casts do occur that we are fine with. Make them explicit to silence some warnings when using "-Wconversion". Signed-off-by: Dan McGee <dan@archlinux.org>
* Use size_t for alpm_list sizesAllan McRae2011-01-07
| | | | | | | | | | | | | There is a lot of swtiching between size_t and int for alpm_list sizes in the codebase. Start converting these to all be size_t by adjusting the return type of alpm_list_count and fixing all additional warnings given by -Wconversion that are generated by this change. Dan: a few more small changes to ensure things compile, adjusting some printf format string characters to accommodate the larger size on x86_64. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Update copyright years for 2011Allan McRae2011-01-07
| | | | | Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Add const to some ALPM function signaturesJakob Gruber2010-12-30
| | | | | | char * -> const char *. Signed-off-by: Dan McGee <dan@archlinux.org>
* alpm/remove.c : respect --dbonly during remove-upgradeXavier Chantry2010-12-12
| | | | | | | | | | | | | | | | | When a -Sk or -Uk operation induced a removal of an existing local package, --dbonly was not in effect and the files were all removed. Fixing this behavior was already marked as TODO in database012 pactest ------------ TODO: I honestly think the above should NOT delete the original les, it hould upgrade the DB entry without touching anything on the file stem. E.g. this test should be the same as: pacman -R --dbonly dummy && pacman -U --dbonly dummy.pkg.tar.gz ------------ Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> [Dan: small coding style touchup] Signed-off-by: Dan McGee <dan@archlinux.org>
* Merge branch 'maint'Dan McGee2010-10-18
|\
| * libalpm/remove: fix funny progress bar problem with empty packagesXavier Chantry2010-10-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | $ pacman -Rd kde-meta Remove (15): kde-meta-kdewebdev-4.5-1 [0.00 MB] kde-meta-kdeutils-4.5-1 [0.00 MB] kde-meta-kdetoys-4.5-1 [0.00 MB] kde-meta-kdesdk-4.5-1 [0.00 MB] kde-meta-kdeplasma-addons-4.5-1 [0.00 MB] kde-meta-kdepim-4.5-1 [0.00 MB] kde-meta-kdenetwork-4.5-1 [0.00 MB] kde-meta-kdemultimedia-4.5-1 [0.00 MB] kde-meta-kdegraphics-4.5-1 [0.00 MB] kde-meta-kdegames-4.5-1 [0.00 MB] kde-meta-kdeedu-4.5-1 [0.00 MB] kde-meta-kdebase-4.5-1 [0.00 MB] kde-meta-kdeartwork-4.5-1 [0.00 MB] kde-meta-kdeadmin-4.5-1 [0.00 MB] kde-meta-kdeaccessibility-4.5-1 [0.00 MB] Total Removed Size: 0.06 MB Do you want to remove these packages? [Y/n] ( 1/15) removing kde-meta-kdewebdev [------------------------] 100% $ it stopped here.. On one side, libalpm did not initialize the progress bar at 0 percent. So with meta-packages that have 0 files, there was only one progress bar call with percent == 100. On the other side, pacman callback kept track of the last percent that it received. When there are only meta-packages, we always received only 100, so pacman believed the progress bar needed not update. Thus only the first package was actually displayed. A proper fix for the callback would be to keep track of last package name to make sure the recorded prev percent applies. But since we now specify that both Add and Remove should at least send percent=0 at beginning and percent=100 at the end, there is no need for that. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Separate be_files into be_sync and be_localAllan McRae2010-10-14
| | | | | | | | | | | | | | | | | | | | | | | | | | The file be_files.c is "split" to be_local.c and be_sync.c in order to achieve separate handling of sync and local databases. Some basic clean-up of functions that are only of use for local or sync databases has been performed and some rough function renaming in duplicated code has been performed to prevent compilation errors. However, most of the clean-up and final separation of sync and local db handling occurs in following patches. Signed-off-by: Allan McRae <allan@archlinux.org>
* | Move the cache stuff where it should beDan McGee2010-10-13
|/ | | | | | | | Cache bullshit only has relevance to be_files, so move it there. Signed-off-by: Dan McGee <dan@archlinux.org> [Allan: BIG rebase] Signed-off-by: Allan McRae <allan@archlinux.org>
* Bump copyright dates to 2010Dan McGee2010-03-14
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Reduce calls to list_count() in removing packageDan McGee2009-10-11
| | | | | | | | We don't need to count the number of packages left once per file when removing; we only need to do it once per package. Also move a variable into the correct scope. Signed-off-by: Dan McGee <dan@archlinux.org>
* Fully implement database lazy loadingDan McGee2009-09-20
| | | | | | | | | | | | | | | Commit 34e1413d75 attempted to implement lazy loading of package databases. Although it took care of my main complaint (creating the database directory if it didn't exist), it didn't allow sync repos to be registered before alpm_option_set_dbpath() had been called. With this patch, we no longer compute the individual repository DB paths until necessary, allowing full lazy loading to work as intended, and allowing us to drop the extra setlibpath() calls from the frontend. This allows the changes introduced in a2cd48960 (but later reverted) to be added back in again. Signed-off-by: Dan McGee <dan@archlinux.org>
* Merge branch 'maint'Dan McGee2009-09-20
|\ | | | | | | | | | | | | | | Message updates made this one a bit messy, but nothing too bad. Conflicts: lib/libalpm/add.c lib/libalpm/remove.c
| * String improvementsXavier Chantry2009-09-16
| | | | | | | | | | | | | | Add more untranslated strings, improve consistency, etc. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
| * Catch an untranslated warning in lib/remove.cNagy Gabor2009-09-15
| | | | | | | | | | Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Change the interface for target loadingXavier Chantry2009-09-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -int alpm_trans_sysupgrade(int enable_downgrade); -int alpm_trans_sync(char *target); -int alpm_trans_add(char *target); -int alpm_trans_remove(char *target); +int alpm_sync_sysupgrade(int enable_downgrade); +int alpm_sync_target(char *target); +int alpm_sync_dbtarget(char *db, char *target); +int alpm_add_target(char *target); +int alpm_remove_target(char *target); * functions renaming * add new sync_dbtarget which allows to specify the db * repo/ syntax handling is moved to frontend ( should implement FS#15141) * group handling is moved to backend ( see http://www.archlinux.org/pipermail/pacman-dev/2009-June/008847.html )
* | Remove transaction typeXavier Chantry2009-09-08
|/ | | | | | | | | | | | | | | This basically started with this change : /* Transaction */ struct __pmtrans_t { - pmtranstype_t type; pmtransflag_t flags; pmtransstate_t state; - alpm_list_t *packages; /* list of (pmpkg_t *) */ + alpm_list_t *add; /* list of (pmpkg_t *) */ + alpm_list_t *remove; /* list of (pmpkg_t *) */ And then I have to modify all the code accordingly.
* Fix a minor memleakNagy Gabor2009-07-21
| | | | | Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
* Do not create .pacsave with -R, if the file is unchangedXavier Chantry2009-07-20
| | | | | | | | | | This fixes FS#15546 Also fix the interface of unlink_file which was really stupid.. (alpm_list_t used with only one element) Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Run ldconfig inside chroot.Xavier Chantry2009-07-16
| | | | | | | | | This fixes FS#15294. The code to run a command inside a chroot was refactored from the _alpm_runscriptlet function to _alpm_run_chroot. Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
* Update copyright headers and messagesDan McGee2009-07-01
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Allow remove to accept 'local/' prefixDan McGee2009-07-01
| | | | | | | See FS#14642- this allows -Qs output to be fed back into pacman without problems or having to strip off the 'local/' prefix manually. Signed-off-by: Dan McGee <dan@archlinux.org>
* HoldPkg reworkNagy Gabor2009-01-12
| | | | | | | | | | | | | | | | | | | The HoldPkg feature is even more important when the packages to be held are pulled automatically by pacman, in a -Rc and -Rs operation. Before, it only applied when the packages were explicitly requested by the user to be removed. This patch extends holdpkg to -Rc and -Rs by doing the HoldPkg check just before trans_commit. Additionally, the whole HoldPkg stuff was moved to the front-end. I changed the default behavior to "don't remove", so I modified remove030.py pactest as well. See also: FS#9173. Original-work-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
* Merge branch 'maint'Dan McGee2009-01-03
|\
| * Log pacsave warnings to pacman.logSterling Winter2009-01-02
| | | | | | | | | | | | | | | | | | | | | | Pacman currently logs .pacnew warnings to pacman.log but a similar history of .pacsave warnings isn't kept. The user should be able to search pacman.log to discover when and where all .pac* files were created by pacman. Addresses FS#12531. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Change checkdeps and checkdbconflicts to be more flexible.Xavier Chantry2008-08-25
|/ | | | | | | | These two functions now take directly a package list rather than a database. checkdbconflicts was renamed to checkconflicts. Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
* Fix a possible segfault in alpm/remove.cNagy Gabor2008-07-17
| | | | | | | | Before removing a package from target list (in remove_prepare_keep_needed), we should check whether we have already removed it. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix for remove052.py by moving recursedeps before checkdeps.Nagy Gabor2008-05-29
| | | | | | | | | | | | | | | | | In the case of -Rs operation, first pulling the dependencies with recursedeps before calling checkdeps takes care of the dependency chain of remove052 pactest. In the case of -Rcs, we can keep the old behavior because we have no problem there (any dependency returned by checkdeps will be added to the remove list because of -Rc) and we have to run recursedeps on the final remove list anyway to catch all orphans. Ref.: http://www.archlinux.org/pipermail/pacman-dev/2008-April/011569.html Signed-off-by: Nagy Gabor <ngaba at bibl.u-szeged.hu> Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Cleanup usages of alpm_list_find and alpm_list_remove.Chantry Xavier2008-05-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>