summaryrefslogtreecommitdiffstats
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2010-12-13alpm: kill alpm_deptestXavier Chantry2-26/+0
This has been replaced by the more flexible alpm_find_satisfier function, and alpm_deptest was completely unsused now. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13alpm: add new alpm_find_satisfier functionXavier Chantry2-0/+15
whatprovides and splitdep were removed, so depcmp alone is quite useless now without splitdep, and deptest is not flexible enough. Introduce a new alpm_find_satisfier which is hopefully more flexible, this should make implementation of deptest very easy, and also help alpm tools such as pactree. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13Fix a few problems reported by clang-analyzerXavier Chantry2-9/+6
One missing NULL-check and 3 dead assignments. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13Merge branch 'maint'Dan McGee1-1/+1
Conflicts: lib/libalpm/be_local.c lib/libalpm/trans.c
2010-12-13be_files: write EPOCH instead of FORCEXavier Chantry1-3/+4
This patch is only meant for 3.4.x. It prepares the place for the future epoch-aware release. All force packages that get reinstalled or upgraded will get an EPOCH entry in the local database, and thus the new pacman with epoch won't reinstall them by mistake on the first -Su. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-11Fix possible null pointer deref in check_archDan McGee1-1/+1
If we have a corrupted database, a package can come through without an arch, causing the code to blow up when making strcmp() calls. It might even be possible with perfectly valid database entries lacking an 'arch =' line. This behavior was seen as at least one of the problems in FS#21668. Ensure pkgarch is not null before doing anything further. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-18Merge branch 'maint'Dan McGee2-1/+7
2010-10-18alpm/sync: very small memleak fixXavier Chantry1-1/+3
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-18libalpm/remove: fix funny progress bar problem with empty packagesXavier Chantry1-0/+4
$ 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>
2010-10-15be_package: read force entry and convert to epochXavier Chantry1-0/+5
We still need to read force entry in epoch-aware pacman, so that when we install an old force package, EPOCH gets written to the local db. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-14Add epoch support to pacman/libalpmDan McGee6-22/+47
This will allow for better control of what was previously the 'force' option in a PKGBUILD and transferred into the built package. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-14Small tweaks after backend mergeDan McGee3-19/+4
Just a few small things I noticed looking through the code. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-14Only write to local reposAllan McRae1-53/+38
We do not write to sync repos so kill the code for that. Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14Clean-up parsing sync databaseAllan McRae1-26/+1
Remove unnecessary parsing of fields not found in sync desc file. Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14Clean-up parsing local databaseAllan McRae1-24/+3
Remove unnecessary parsing of fields not found in local desc files. Leave %FORCE% parsing as this likely will make an appearance in desc files in the future. Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14Remove lazy loading of deltasAllan McRae2-26/+3
Local packages do not have deltas so remove lazy loading of delta information. Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14Move and rename splitnameAllan McRae6-50/+49
The splitname function is a general utility function and so is better suited to util.h. Rename it to _alpm_splitname to indicate it is an internal libalpm function as was the case prior to splitting local and sync db handling. Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14Restrict visibility of checkdbdir and get_pkgpathAllan McRae3-39/+34
These functions are only needed by be_local and were only promoted to db.{h,c} as part of the splitting of handling the local and sync dbs. Move them into be_local.c and make them static again. Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14Only download sync databasesAllan McRae1-163/+2
As the sync databases are read directly from the tarball, we no longer need to extract them. Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14Parse sync databaseAllan McRae2-414/+132
Read in package information for a tar based sync database. Do not use lazy loading for sync db. Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14Populate sync db from archiveAllan McRae3-27/+42
Read in list of packages for sync db from tar archive. Breaks reading in _alpm_sync_db_read and a lot of pactests (which is expected as they do not handle sync db in archives...). Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14Completely separate local and sync db handlingAllan McRae6-77/+81
Put the db_operations struct to use and completely split the handling of the sync and local databases. Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14Separate be_files into be_sync and be_localAllan McRae8-325/+943
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>
2010-10-13Move db cache handling functionsAllan McRae2-242/+243
These will be needed for the handling of both local and sync database caches, so put them in a common location. Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-13Move database handling utility functionsAllan McRae3-74/+81
Move splitname, checkdbdir, get_pkgpath into db.{h,c} as these will be needed to parse both the local and sync databases during the initial splitting. They will be moved out of db.{h,c} at to more appropriate locations at a later stage. Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-13Fix documentation syntax and typoAllan McRae2-2/+2
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-13Initial hack at a DB operations structDan McGee3-7/+29
It doesn't do a whole lot yet, but these type of operations will potentially be different for the DBs we load. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13Move the cache stuff where it should beDan McGee13-335/+259
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>
2010-10-13Move changelog functions to callback structDan McGee3-75/+175
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13Complete rework of package accessor logicDan McGee5-92/+398
Hopefully we've finally arrived at package handling nirvana, or at least this commit will get us a heck of a lot closer. The former method of getting the depends list for a package was the following: 1. call alpm_pkg_get_depends() 2. this method would check if the package came from the cache 3. if so, ensure our cache level is correct, otherwise call db_load 4. finally return the depends list Why did this suck? Because getting the depends list from the package shouldn't care about whether the package was loaded from a file, from the 'package cache', or some other system which we can't even use because the damn thing is so complicated. It should just return the depends list. So what does this commit change? It adds a pointer to a struct of function pointers to every package for all of these 'package operations' as I've decided to call them (I know, sounds completely straightforward, right?). So now when we call an alpm_pkg_get-* function, we don't do any of the cache logic or anything else there- we let the actual backend handle it by delegating all work to the method at pkg->ops->get_depends. Now that be_package has achieved equal status with be_files, we can treat packages from these completely different load points differently. We know a package loaded from a zip file will have all of its fields populated, so we can set up all its accessor functions to be direct accessors. On the other hand, the packages loaded from the local and sync DBs are not always fully-loaded, so their accessor functions are routed through the same logic as before. Net result? More code. However, this code now make it roughly 52 times easier to open the door to something like a read-only tar.gz database backend. Are you still reading? I'm impressed. Looking at the patch will probably be clearer than this long-winded explanation. Signed-off-by: Dan McGee <dan@archlinux.org> [Allan: rebase and adjust] Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-13Allow local and sync db to be treated separatelyDan McGee5-34/+37
Implement this seemingly simple change in package.h: typedef enum _pmpkgfrom_t { - PKG_FROM_CACHE = 1, - PKG_FROM_FILE + PKG_FROM_FILE = 1, + PKG_FROM_LOCALDB, + PKG_FROM_SYNCDB } pmpkgfrom_t; which requires flushing out several assumptions from around the codebase with regards to usage of the PKG_FROM_CACHE value. Make some changes where required to allow the switch, and now the correct value should be set (via a crude hack) depending on whether a package was loaded as an entry in a local db or a sync db. This patch underwent some big rebasing from Allan and Dan. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-13Unify caching concerns in package accessorsDan McGee1-181/+30
Move almost all of the caching related stuff into a single #define (which should maybe even just be a static function) so we don't duplicate logic all over the place. This also makes the code a heck of a lot shorter and means further changes to this stuff don't have to touch each and every getter function. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-12Read 'force' entry from packagesDan McGee1-0/+2
We weren't reading this in from our packages, thus causing us not to write it out to our local database. Adding this now will help ease the upgrade path for epoch later and not require reinstallation of all force packages. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11Avoid stat call to determine is_directory if possibleDan McGee1-10/+19
On Linux and OS X, we can determine if an entry obtained through a readdir() call is a directory without also having to stat it. This can save a significant number of syscalls. The performance increase isn't dramatic, but it could be on some platforms (e.g. Cygwin) so it shouldn't hurt to use this unconditionally where supported. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-27Set pm_errno on libarchive errors while readingSebastian Nowicki1-3/+13
Signed-off-by: Sebastian Nowicki <sebnow@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-23Update gettext Makefiles to 0.18Dan McGee1-39/+128
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-15Merge branch 'maint'Dan McGee2-14/+12
2010-09-15Update Kazakh translationBaurzhan Muftakhidinov1-9/+9
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-06Fix libfetch configure checkingDan McGee3-8/+8
I don't know what I tested in commit 3e7b90ff6950, but it definitely wasn't working as advertised. Fix the checks in the source code itself to match the right define (HAVE_LIBFETCH), as well as make sure the configure check defaults to looking for the library but not bailing if it could not be found. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-04Minor translation file updates after `make distcheck`Dan McGee1-5/+3
It touched up these a bit after it ran, so might as well check the changes in so we don't have to deal with them again later. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-04Merge branch 'maint'Dan McGee1-12/+12
2010-09-04libalpm Swedish translation updatev3.4.1Tobias Eriksson1-12/+12
Signed-off by: Tobias Eriksson <tobier@tobier.se> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-02Clean up libfetch checking in configureDan McGee3-8/+8
Model it after the new OpenSSL check, and have it be a bit more useful. If you do not explicitly pass a command line option, it will be linked if available but will not error out if it is missing. Also bump the version to that where connection caching was introduced as we use these new features in the codebase. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-02Use OpenSSL MD5 crypto functions if availableDan McGee2-2/+48
I've noticed my Atom-powered laptop is dog-slow when doing integrity checks on packages, and it turns out our MD5 implementation isn't near as good as that provided by OpenSSL. Using their routines instead provided anywhere from a 1.4x up to a 1.8x performance benefit over our built-in MD5 function. This does not remove the MD5 code from our codebase, but it does enable linking against OpenSSL to get their much faster implementation if it is available on whatever platform you are using. At configure-time, we will default to using it if it is available, but this can be easily changed by using the `--with-openssl` or `--without-openssl` arguments to configure. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-02libalpm md5: use larger and dynamic bufferDan McGee1-2/+11
This gave at least a 10% improvement on a few tested platforms due to the reduced number of read calls from files when computing the md5sum. It really is just a precursor to another patch to come which is to use MD5 functions that do the job a lot better than anything we can do. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-02Merge branch 'maint'Dan McGee2-0/+618
2010-09-02Add new European Portuguese translationGaspar Santos2-0/+618
This is being checked in as 'pt' rather than 'pt_PT' as that is what Transifex seems to want, and it is also the dominant choice of packages already installed on my system when doing a count of the files located in the /usr/share/locale translation directories. Thanks for the new translation! Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-27use execv to avoid using sh just to run ldconfigJonathan Conder3-7/+11
Signed-off-by: Jonathan Conder <j@skurvy.no-ip.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-27redirect scriptlet stderr synchronously through alpmJonathan Conder1-36/+55
Fixes FS#18770, and hopefully an occasional deadlock in my frontend as well. For simplicity it redirects all scriptlet output through SCRIPTLET_INFO, and all callbacks in the child process have been replaced for thread-safety. Signed-off-by: Jonathan Conder <j@skurvy.no-ip.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-24Merge branch 'maint'Dan McGee3-88/+530