summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/trans.c
AgeCommit message (Collapse)AuthorFilesLines
2008-03-10Remove trans->targetsNagy Gabor1-18/+0
Its implementation was quite broken: * add_loadtarget() might have silently filtered out some targets when replacing an older version. * This was used in sync.c to determine whether a target is implicit or not, which is incorrect behavior. Before this patch we silently removed user confirmed replacements; now we always warn on a replacement. * remove001.py behavior was quite odd in adding same target 5 times to the target list, we can change this behavior to be a failure. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> [Xav: changed remove001 pactest accordingly] Signed-off-by: Chantry Xavier <shiningxc@gmail.com> [Dan: rewrote commit message] Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-23libalpm/cache.c : don't duplicate packages in pkgcache.Chantry Xavier1-1/+2
Edit _alpm_db_add_pkgincache to not duplicate packages, because this is not needed, is slower, and uses more memory. This made the max memory usage during base reinstall go from 10.4MB to 9.7MB. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-13FS#9183 : force correct permissions on tmp/.Jaroslaw Swierczynski1-1/+1
[Xav: removed unneeded makepath_internal function, and fixed the permission value : 1777 -> 01777] Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-28Allow NULL parameter in alpm_trans_commitAllan McRae1-1/+3
Fixes FS#7380: alpm crashes on passing NULL to alpm_trans_commit in a sync operation. Adds check that data parameter is not NULL in several functions. Signed-off-by: Allan McRae <mcrae_allan@hotmail.com> [Dan: fix whitespace] Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-10popen does NOT require /bin/sh in a subchrootAaron Griffin1-3/+3
I appears that when chrooted, the /bin/sh used by popen is that of the parent process. This is true until the process forks once chrooted, which we do not want to do. As such, this actually makes things nicer. We don't need a /bin/sh in a chroot to run install scriptlets, and don't need to check for it in the root directory Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-10Correct scriptlet usage patternAaron Griffin1-5/+2
The new pattern is as follows: . /path/to/scriptlet post_upgrade X Y This requires less frameworking in the install scripts (the three lines that shift and eval a function are nasty) Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-10Update GNU GPL boilerplate and copyright datesDan McGee1-4/+2
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>
2007-11-25Fix a memleak in _alpm_sync_free.Chantry Xavier1-8/+2
An alpm_list_free call was missing. Also make use of alpm_list_free_inner in both _alpm_sync_free and _alpm_trans_free. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-21Remove duplicated get_upgrades function, use sysupgrade instead.Chantry Xavier1-1/+2
The alpm_get_upgrades was exactly the same as find_replacements + _alpm_sync_sysupgrade, except that it automatically made the eventual replacements, without asking the user : Replace %s with %s/%s? [Y/n] The replace question, asked in find_replacements. can now be skipped by using a NULL trans argument, so that we get the same behavior as with alpm_get_upgrades. So alpm_db_get_upgrades() can now be replaced by alpm_sync_sysupgrade(db_local, syncdbs). Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-18Fix sh and scriptlet interactionDan McGee1-4/+11
dash doesn't pass positional parameters to sourced scripts, causing install scripts to fail. Instead of sourcing the script, make it executable and call it directly which allows positional parameters to be passed correctly. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-18POSIX shell does not specify meaning of source operationDan McGee1-2/+2
Just use '.' operator instead. Oops. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-17Remove provide.c and provide.h .Chantry Xavier1-1/+0
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>
2007-11-17Fix memleak in _alpm_trans_free with package listsDan McGee1-8/+5
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-16War on whitespaceDan McGee1-2/+2
Run the kernel's cleanfile script on all of our source files. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-14Remove REQUIREDBY usage from libalpmDan McGee1-65/+0
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>
2007-11-04Remove the newline automatically added by alpm_logaction.Chantry Xavier1-1/+1
This way, _alpm_logaction behaves like _alpm_log, and gives more control. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-11-04Readd scriptlet logging that got lost in an earlier commitDan McGee1-2/+17
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>
2007-10-29libalpm: introduce MALLOC and CALLOC macrosDan McGee1-4/+1
These macros take the place of the common 4 or 5 line blocks of code we had in most places that called malloc or calloc. This should reduce some code duplication and make memory allocation more standard in libalpm. Highlights: * Note that the MALLOC macro actually uses calloc, this is just for safety so that memory is initialized to 0. This can be easily changed in one place. * One malloc call was completely eliminated- it made more sense to do it on the stack. * The use of RET_ERR in public functions (mainly the alpm_*_new functions) was standardized, this makes sense so pm_errno is set. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-14libalpm/trans.c : fix a recently introduced breakage in scriptlets handling.Chantry Xavier1-6/+10
Commit 4853a4aad97fe36f9237ffb7356201adab507a1c used the tmpdir variable for checking the existence of /bin/sh, without resetting it. This caused /bin/sh to be deleted during the cleanup part, as soon as a scriptlet other than pre_upgrade or pre_install was executed. For example, on the first post_upgrade during a -Su. I introduced two variables : clean_tmpdir and restore_cwd, for deciding what should be done in the cleanup part. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-10-14libalpm/trans.c : remove the DBPath <-> RootDir dependence in runscriptlet.Chantry Xavier1-15/+21
This code assumed that DBPath was under RootDir, while this is not necessarily the case : pacman doesn't enforce anymore than DBPath is under RootDir. So now, all scriptlets will be put somewhere in RootDir/tmp/, so that when it chroots in RootDir, the scriptlets are still available inside the chroot. This also removes the need of normalizing both dbpath and rootdir, in order to do computation on the paths. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-10-08Clean up the scriptlet fork code a bit, honor the child return valueDan McGee1-3/+20
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-04Fail loudly is scriptlets cannot be run via /bin/shAaron Griffin1-0/+7
If /bin/sh is missing in the root directory, scriptlets cannot be executed, as we're explicitly calling it. Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-16trans.c : reworking of transaction interruptionsChantry Xavier1-11/+23
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-06libalpm/trans.c : remove the lock even on interrupted transactions.Chantry Xavier1-2/+3
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-08-23libalpm: add newlines to all strings passed to log callbackDan McGee1-19/+19
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-21Post trial install changes, round oneDan McGee1-1/+1
A bunch of changes related to my first "real" install of pacman-git into /usr/local and trying to use it. * Shift some uses of free -> FREE in libalpm. * Move stat and sanity checks of config paths into libalpm from the config and argument parsing in pacman.c. * Fix issue where dbpath still was not defined early enough due to its requirement for being used in alpm_db_register. This should be rewritten so it doesn't have this dependency, but this will work for now. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-20libalpm/add.c,trans.c : cleanup of requiredby handling.Nagy Gabor1-61/+12
This patch cleans up and fix the _alpm_trans_update_depends function and ensure that all requiredby fields are filled in case of multiple satisfiers (previously, the handling of mutliple satisfiers in that function was inconsistent). This makes a special case handling of requiredby in commit_single_pkg() obsolete, and so allows cleaning that code as well. Also fixed upgrade056 pactest because : 1) the requiredby fields were wrong, and this wouldn't happen with the fixed _alpm_trans_update_depends(). 2) this is a very unusual case anyway (and handling all corner cases combined to a broken database seems nearly impossible to achieve). References : http://www.archlinux.org/pipermail/pacman-dev/2007-July/008919.html http://www.archlinux.org/pipermail/pacman-dev/2007-July/008920.html Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-08-16Fix some errors spit out by -WextraDan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-14Ensure requiredby entries are removed during an upgradeDan McGee1-7/+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>
2007-07-12Some doxygen comments.Andrew Fyfe1-0/+5
Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
2007-07-12Remove some more conditional include stuffDan McGee1-3/+0
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-10Remove gettext calls from all PM_LOG_DEBUG messagesDan McGee1-8/+8
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-09libalpm/trans.c : exit the forked process correctly in case of errors.Chantry Xavier1-2/+2
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-07-09Clean up the alpm handleDan McGee1-6/+0
Add some comments in handle.h, and remove the pmaccess_t part that we don't even use. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-09Remove gettext from any alpm_logaction callsDan McGee1-1/+1
We shouldn't translate log messages to pacman.log so it is consistant and can be parsed by other tools. Remove all gettext _() around these strings. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-27Remove scriptlet START and DONE commands that we don't useDan McGee1-32/+1
The scriptlet calling had some unneeded complexity for the time being which we aren't using here. Let's get rid of it until we find a good way to implement it correctly. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-04Move functions out of alpm.c to where they belongDan McGee1-0/+166
alpm.h is the only "publically viewable" file, so there is no reason to have functions in alpm.c that belong in package.c, db.c, etc. Move the functions where they belong and leave only the library init functions in alpm.c. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-02Remove freespace checking codeDan McGee1-79/+0
This code depends on /etc/mtab existance, which is not very reliable in all cases, especially in a chroot or non-Linux environment. Dump it for now until we can find a better way. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-05-14Remove unnecessary casts on malloc and elsewhereDan McGee1-3/+3
We had many unnecessary casts, most of them dealing with malloc and other memory allocations. The variable type should take care of it; no need to do it explicitly. In addition, I caught a const error while removing the casts. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-29libalpm util.c and util.h cleanupDan McGee1-2/+256
* Remove some unnecessary conditional compiling in util.h- move the functions tha required it to trans.c (along with a bunch of new header includes). * Clean up util.h a bit- remove some header includes, remove universal libarchive include and only put it in the files that need it. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-28Remove FREELISTPTR macroDan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-28Remove FREEPKG macro and correctly type _alpm_pkg_freeDan McGee1-1/+6
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-27Remove FREEGRP macro and correctly type _alpm_grp_freeDan McGee1-2/+2
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-27Remove FREESYNC macro and correctly type _alpm_sync_freeDan McGee1-1/+2
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-27Remove FREETRANS macro and correctly type _alpm_trans_freeDan McGee1-3/+1
Remove an unnecessary macro, and get rid of the void pointer. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-26Clean up gettext on the libalpm sideDan McGee1-1/+0
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-04Backport changes from 3.0.1Aaron Griffin1-1/+2
* Align makepkg -g checksums (Tom Killian <tom@archlinux.org>) * Use additional case-sensitive string compare to defeat locale issues (tr_TR) * Added Russian mirror * Fix a -R failure when trying to remove the same target twice * Bump configure.ac version to 3.0.1 Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-03-12* Fix an issue where the same dependency was recorded multiple times in theDan McGee1-11/+22
'required by' field.
2007-03-07* Bug fix for makepkg dependency testing. This requires that weAaron Griffin1-1/+1
expose alpm_splitdep and alpm_depcmp as public symbols * Removed a duplicate strtrim for question responses
2007-03-06* Added missing header include guards in md5.h and sha1.h.Dan McGee1-1/+1
* Some header cleanup on the pacman side of things - we had alpm.h instead alpm_list.h in a few headers. * removed an extra slash in path-building snprintf in server.c.