summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
AgeCommit message (Collapse)AuthorFilesLines
2007-10-09Add gcc format attribute to _alpm_log, catch a few bugs in the processDan McGee4-6/+8
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>
2007-10-09libalpm/package.c: ensure we use package name when loading packagesDan McGee1-4/+7
Some of the error messages in _alpm_pkg_load failed to use the pkgname value when printing, which made error messages rather hard to decode. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-09Update usage of gcc __attribute__ flagsDan McGee2-2/+2
Change the default visibility of libalpm functions to internal instead of hidden- this allows for slightly better optimization because it tells GCC that the function can never be called outside of the current module (see http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html). Also added some attributes to the pacman print functions so that they check the format strings being passed to them. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-09Clean 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-09Fix backward compatibility with non-epoch builddatesDan McGee1-3/+8
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-05Fail 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-29libalpm: Optimize/inline the md5 functionalityDan McGee2-29/+5
The md5 routines are one of the chokepoints of libalpm (main chokepoint being archive extraction). Although IO delay causes a lot of it, we can at least inline some of the md5 stuff as we aren't that concerned about space and eliminate quite a few function calls. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-29libalpm/deps.c: fix memleak found by valgrindDan McGee1-0/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-29libalpm/be_files: Fix outdated code setting path for lastupdate fileDan McGee1-2/+2
The code for setting the lastupdate file path still referenced both the root and dbpath, when we should only be using dbpath. Fix it. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28Minor "cannot remove" message cleanupAaron Griffin1-1/+2
The strings differed in quotes only, this way we have only one i18n string for translation Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-28Remove buildtype package accessor prototypeAaron Griffin1-1/+0
This was removed a while ago, but the prototype was still hanging out. Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-28Support for localized times in metadataAaron Griffin5-23/+44
Packages and DBs now support using the UNIX epoch (seconds since Jan 1, 1970) for use in builddate and installdate. This will only affect newly built packages. Old existing packages with the text format are still supported, but this is deprecated. In the case of removal of text time support, this code will fail gracefully, returning the start of the epoch for broken packages. Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-28Add 'full' parameter to alpm_pkg_loadDan McGee4-18/+30
In most cases, we want to fully scan a package when we load it, which serves as a integrity verification check. However, there are times when it is only desired to read the metadata and nothing else, so allow the caller of pkg_load to choose the behavior they need. This pays big dividends in speeding up pacman cache cleaning functionality. Old (729 packages): real 1m43.717s user 1m20.785s sys 0m2.993s New (729 packages): real 0m25.607s user 0m19.389s sys 0m0.543s Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28Update comments dealing with pkgext/dbext strippingDan McGee1-2/+1
pacman/callback.c already did the work I set out to do with this commit, so update the comments accordingly in the frontend and backend. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28Remove package name dependency from libalpmDan McGee6-157/+55
Previously, package names must match a specified scheme or they will cause pacman add operations to fail. This is not a very intelligent or necessary way to act, so remove the dependency on the name of the package to be installed and read all relevant information from the metadata instead. This does have one causality to be addressed later- pacman cache cleaning functionality, which has never been phenomenal, just lost most capability. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28libalpm: Add newline to alpm log function outputDan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-26Preliminary support for optdependsDan McGee4-1/+31
Add some alpm functions for getting optdepends, have makepkg include them in the PKGINFO file, and have a pacman -Qi operation display the raw string as stored by libalpm. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-24libalpm/add.c: fix backup array issueDan McGee2-20/+26
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-24libalpm/remove.c: fix up arguments to unlink_fileDan McGee1-19/+15
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-23alpm: removed unused strtoupper wrapper, remove installeddate on parse_descfileDan McGee3-16/+0
installdate should never be present in a package descfile, so get rid of it. With the last commit, we also don't need the util strtoupper function. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-23libalpm/package.c : fix for FS#8081, case sensitive comparisons in ↵Chantry Xavier1-17/+16
parse_descfile. This fix FS#8081. The tr_TR locale has known issue with case insensitive comparisons, mostly because upper(i) != I. So the .PKGINFO files generated by makepkg MUST contain all keywords in lowercases now. This was already done, but was not mandatory. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-09-19libalpm/add.c : fix backup handling (2)Chantry Xavier1-2/+2
The mistake fixed in commit 26441cf65ca10d4bf218203df5db5e8a7270787b was actually done at two places. This fix the second one. Also remove one unnecessary newline introduced by commit d34b2c4ed84bc40f4a895846785481fad88116a2 Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-09-18libalpm/add.c : newline fix.Chantry Xavier1-2/+2
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-09-18Avoid segfaults whet calling alpm_option_get_* before initializationStefano Esposito1-19/+164
When calling a function of the alpm_option_get_* group, you get a segfault if you don't call alpm_initialize() first. With this patch those functions set pm_errno to PM_ERR_HANDLE_NULL and return an error value if handle == NULL. (Dan: modified to meet pacman coding standards) Signed-off-by: Stefano Esposito <stefano.esposito87@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-17trans.c : reworking of transaction interruptionsChantry Xavier5-23/+31
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-17Remove the DB consistency check from pacman and libalpm.Chantry Xavier4-47/+0
This reverts commit dfc85cb5f516ffbcff557522e9703c5c7d88b047 and b6f3fe6957d0206485eac98fb2120578b75d0058. This DB check is already in testdb (among others). Also testdb now uses the db path set at make time by default, so specifying the db path is optional. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-12make alpm_strerror binding friendlyStefano Esposito3-1/+7
I'm currently working on python bindings for alpm written in pyrex. While working i found that declaring alpm_strerror as char * alpm_strerror (void) instead of char * alpm_strerror (int err) and then using pm_errno in the implementation instead of err, could make it more bindings-friendly. Dan: cleaned up and added void to declaration. Instead of replacing existing function, add a new function called 'alpm_strerrorlast(void)'. Signed-off-by: Stefano Esposito <stefano.esposito87@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-12libalpm/deps.c : export _alpm_checkdeps (-> alpm_checkdeps).Chantry Xavier2-1/+10
Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-12libalpm/package.c : add new alpm_pkg_compute_requiredby function.Chantry Xavier2-38/+48
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-09-07libalpm/trans.c : remove the lock even on interrupted transactions.Chantry Xavier1-2/+3
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-09-07Add a few missing includes, caught while compiling on cygwinDan McGee1-0/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-04libalpm: remove outdated files from POTFILES.inDan McGee1-2/+0
Fixes 'make dist' target as sha1.c and md5driver.c no longer exist. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-04Fix compile-time error with de.po, runtime error with db.cTravis Willard2-2/+6
One string in de.po differed pretty strongly with its translated version. It may still be totally wrong as far as translations go, but it compiles now. Get translater to check. Also, ensure the proper dbpath gets set in the db when it's created. Signed-off-by: Travis Willard <travis@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-02Update German translationMatthias Gorissen1-20/+17
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-02libalpm/remove.c : avoid duplicated packages in removal list.Chantry Xavier1-3/+5
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-27separate local from sync dbs on filesystemTravis Willard3-38/+88
Introduce two new methods into the API - alpm_db_register_sync and alpm_db_register_local, which replace the functionality of alpm_db_register. db_register_local always returns the local DB, and db_register_sync will always try to register a sync DB. This conceptually separates the local DB from sync DBs in the code. Also updated the pacman frontend to use the new functions. In addition, this changes the location of all sync DBs in the filesystem from $DBPATH/$REPO to $DBPATH/sync/$REPO, This removes the silly limitation that a sync DB couldn't be named 'local', along with structurally separating sync DBs and the local DB in the filesystem. Signed-off-by: Travis Willard <travis@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-26libalpm/add.c : fix backup handling.Chantry Xavier1-1/+1
During last refactoring, a "continue" somehow became a "return(0)" :) Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-08-24libalpm: add newlines to all strings passed to log callbackDan McGee14-301/+302
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-24libalpm/remove.c: check for ability to unlink is wrongDan McGee1-1/+2
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-22Various valgrind mem leak fixesDan McGee4-27/+38
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-22Post trial install changes, round oneDan McGee11-85/+151
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 Gabor3-98/+15
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-20Fix for FS 6404 and functionalize some cachedir handling stuffDan McGee6-143/+137
In order to best resolve bug 6404, move some cachedir handling stuff out of sync.c and into util.c and create two new functions: filecache_find and filecache_setup. sync.c was rewritten to use these, and alpm_fetch_pkgurl now also uses these routines. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-20Add const qualifier to md5_file and alpm_get_md5sumDan McGee4-6/+8
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-17libalpm/sync.c : don't go back on STATE_PREPARED when committing fails.Chantry Xavier1-2/+0
In my opinion, a commiting transaction that failed isn't equivalent to a prepared transaction. Some things could have been done in the meantime. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-08-16Fix some errors spit out by -WextraDan McGee4-8/+8
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-16Clean up MD5 code.Andrew Fyfe8-412/+422
* 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 Fyfe11-631/+18
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-08-16libalpm/db.c : add alpm_db_unregister_all.Chantry Xavier4-25/+56
This basically moves the code from alpm_release, which was mostly about unregistering all databases, to a safer alpm_db_unregister_all. This allows to avoid modifying the dbs_sync list while iterating over it, and and also prevent alpm_release from looping infinitely when a database can't be unregistered. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-08-16libalpm/db.c : allow unregistering db for interrupted transaction.Chantry Xavier1-1/+2
This prevents alpm_release to loop infinitely in case of an interrupted transaction, where the database wasn't unregistered. alpm_release should probably also be fixed, as it can still loop if db_unregister fails for another reason. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>