summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAge
* Populate sync db from archiveAllan McRae2010-10-14
| | | | | | | | | 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>
* Completely separate local and sync db handlingAllan McRae2010-10-14
| | | | | | | 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>
* 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 db cache handling functionsAllan McRae2010-10-13
| | | | | | | 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>
* Move database handling utility functionsAllan McRae2010-10-13
| | | | | | | | | 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>
* Fix documentation syntax and typoAllan McRae2010-10-13
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Initial hack at a DB operations structDan McGee2010-10-13
| | | | | | | 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>
* 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>
* Move changelog functions to callback structDan McGee2010-10-13
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Complete rework of package accessor logicDan McGee2010-10-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Allow local and sync db to be treated separatelyDan McGee2010-10-13
| | | | | | | | | | | | | | | | | | | | | | | 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>
* Unify caching concerns in package accessorsDan McGee2010-10-13
| | | | | | | | | | 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>
* Avoid stat call to determine is_directory if possibleDan McGee2010-10-11
| | | | | | | | | | 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>
* Set pm_errno on libarchive errors while readingSebastian Nowicki2010-09-27
| | | | | Signed-off-by: Sebastian Nowicki <sebnow@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Update gettext Makefiles to 0.18Dan McGee2010-09-23
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Merge branch 'maint'Dan McGee2010-09-15
|\
| * Update Kazakh translationBaurzhan Muftakhidinov2010-09-15
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
| * Minor translation file updates after `make distcheck`Dan McGee2010-09-03
| | | | | | | | | | | | | | 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>
* | Fix libfetch configure checkingDan McGee2010-09-06
| | | | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'maint'Dan McGee2010-09-03
|\|
| * libalpm Swedish translation updateTobias Eriksson2010-09-03
| | | | | | | | | | Signed-off by: Tobias Eriksson <tobier@tobier.se> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Clean up libfetch checking in configureDan McGee2010-09-02
| | | | | | | | | | | | | | | | | | | | 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>
* | Use OpenSSL MD5 crypto functions if availableDan McGee2010-09-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | libalpm md5: use larger and dynamic bufferDan McGee2010-09-02
| | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'maint'Dan McGee2010-09-01
|\|
| * Add new European Portuguese translationGaspar Santos2010-09-01
| | | | | | | | | | | | | | | | | | | | | | 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>
* | use execv to avoid using sh just to run ldconfigJonathan Conder2010-08-27
| | | | | | | | | | Signed-off-by: Jonathan Conder <j@skurvy.no-ip.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | redirect scriptlet stderr synchronously through alpmJonathan Conder2010-08-27
| | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'maint'Dan McGee2010-08-23
|\|
| * Add Slovak translationJozef Riha2010-08-23
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
| * Updates for Polish translationsMateusz Herych2010-08-18
| | | | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Fix some whitespace issuesAllan McRae2010-08-23
| | | | | | | | | | | | | | | | The combination of tabs and spaces is annoying in any editor that does not use a tab width of 2 spaces. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | fgets invocation cleanupDan McGee2010-08-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | From the fgets manpage: fgets() reads in at most one less than size characters from stream and stores them into the buffer pointed to by s. Reading stops after an EOF or a newline. If a newline is read, it is stored into the buffer. A '\0' is stored after the last character in the buffer. This means there is no need at all to do 'size - 1' math. Remove all of that and just use sizeof() for simplicity on the buffer we plan on reading into. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Enable libfetch connection cachingDan McGee2010-08-23
| | | | | | | | | | | | | | | | | | | | | | | | | | This will allow downloads to reuse connections if possible, which could make big differences on perceived FTP speed as the connection won't have to be reestablished each time. For the most part, HTTP requests wouldn't be using keep alive anyway so this won't have an effect there. I'm not enthused about having to do this with the library initialization, but there isn't a much better place due to the fact that the loop over databases occurs on the frontend and not the backend. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2010-07-27
|\|
| * Small fix to Kazakh translationBaurzhan Muftakhidinov2010-07-27
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
| * Mark sync_pkg and sync_target as static functionsDan McGee2010-07-27
| | | | | | | | | | | | | | We no longer use these anywhere outside of sync.c, so do the rename and add static to their definition to meet our coding standards. Signed-off-by: Dan McGee <dan@archlinux.org>
| * Maintain a list of seen packages when installing a groupDan McGee2010-07-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | As reported in FS#20221, we don't always do the right thing when installing a group and using the --needed option. This was due to the code pulling packages based on what was already in the transaction's add list, but completely ignoring the fact that we may have already seen and skipped this same package in an earlier repository. Add a list to the private _alpm_sync_pkg() function that allows us to have this extra information so we don't mistakenly downgrade a package when using --needed. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Download sync db into DBPath/syncAllan McRae2010-07-07
| | | | | | | | | | | | | | | | | | | | | | The sync db should be stored in the sync/ folder. This cleans up DBPath to only have local/ and sync/ directories in it. A nice side effect is that the db are now in the right place so we can implement directly reading from them. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Remove DBEXT usageAllan McRae2010-07-07
| | | | | | | | | | | | | | | | | | With commit 5dffef78, the repo database always has a symlink of the form reponame.db. Use that filename and let libarchive determine the compression type. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Check return value of fgets callsAllan McRae2010-07-07
| | | | | | | | | | | | | | Prevents compiler warnings with -D_FORTIFY_SOURCE=2 Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Check return value of chdir and getcwdAllan McRae2010-07-01
| | | | | | | | | | | | | | Prevents compiler warnings when building with -D_FORTIFY_SOURCE=2 Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Check return value of fwrite when copying filesAllan McRae2010-06-30
| | | | | | | | | | | | | | | | | | | | | | Check that writing to destination file actually occurs in _alpm_copyfile. Required adding a new error (PM_ERR_WRITE) as none of the others appeared appropriate. Prevents compiler warning when using -D_FORTIFY_SOURCE=2. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Do not compare signed and unsigned typesAllan McRae2010-06-30
| | | | | | | | | | | | | | | | | | The casting of nread is safe as it is tested to be >0 when it is initally assigned. It is also being implicitly cast in the fwrite call in the line above. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2010-06-20
|\|
| * Handle sync target + ignore properlyDan McGee2010-06-20
| | | | | | | | | | | | | | | | | | | | | | Rather than say we can't find the target after saying "No, I guess I don't want to install this", we should make sure the ignored status gets passed all the way through. This fixes FS#19866. Pactest is also included that failed before due to the fact that we normally treat an unfound package as a reason to exit with a non-zero status. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Clarify testing within conditional statementsAllan McRae2010-06-21
| | | | | | | | | | | | | | | | | | Follow the HACKING guidelines and always use != 0 or == 0 rather than negation within conditional statements to improve clarity. Most of these are !strcmp usages which is the example of what not to do in the HACKING document. Signed-off-by: Allan McRae <allan@archlinux.org>
* | libalpm: compare pkgname with strcollAndres P2010-06-21
|/ | | | | | | | | Use strcoll to compare package names to provide output sorted according to a users LC_COLLATE settings. Signed-off-by: Andres P <aepd87@gmail.com> [Allan: added commit message] Signed-off-by: Allan McRae <allan@archlinux.org>
* Update Romanian translationIonuț Bîru2010-06-14
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Revise Portuguese (Brazil) translationLeandro Inácio2010-06-14
| | | | | | | Fix the '\t' characters that got introduced by the last update of this translation that should not have been there. Signed-off-by: Dan McGee <dan@archlinux.org>