summaryrefslogtreecommitdiff
path: root/lib/libalpm
Commit message (Collapse)AuthorAge
* Update translation file indexes and MakevarsDan McGee2011-02-04
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Add comment about download file resolutionDan McGee2011-02-04
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Merge remote-tracking branch 'allan/hash'Dan McGee2011-02-04
|\
| * Improve pkghash_remove algorithmDan McGee2011-02-04
| | | | | | | | | | | | | | | | | | | | Rather than potentially move every item to the next NULL, attempt to move at most one item at a time by iterating backwards from the NULL location in the hash array. If we move an item, we repeat the process on the now shorter "chain" until no more items need moving. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
| * Use alpm_list_remove_item in pkghash_removeDan McGee2011-02-04
| | | | | | | | | | | | | | Removes the code that was duplicated and has now been refactored into a separate method. Signed-off-by: Dan McGee <dan@archlinux.org>
| * Add new alpm_list_remove_item() functionDan McGee2011-02-04
| | | | | | | | | | | | | | | | | | | | | | | | This takes in the list and a list item, and does the pointer dance necessary to remove it from the list regardless of whether it is first, last, or somewhere in the middle. It is useful for callers that already know what item needs to be removed and have a pointer to it rather than doing a search by data that the plain alpm_list_remove() does. Refactor alpm_list_remove() to use this function as well. Signed-off-by: Dan McGee <dan@archlinux.org>
| * Actually remove packages from pkghash on removalAllan McRae2011-02-04
| | | | | | | | | | | | | | | | Fully removes a package from the hash. Also unify prototype with removal from an alpm_list_t, fixing issues when removing a package from the pkgcache. Signed-off-by: Allan McRae <allan@archlinux.org>
| * Refactor finding position for new hash entryAllan McRae2011-02-04
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rehash efficientlyAllan McRae2011-02-04
| | | | | | | | | | | | | | Rehash without recreating the hash table list or reallocating the memory for holding the list nodes. Signed-off-by: Allan McRae <allan@archlinux.org>
| * Slightly more efficient rehash size selectionAllan McRae2011-02-04
| | | | | | | | | | | | | | | | | | While probably still not optimal in terms of everyday usage in pacman, this reduces the absolute size increase to "more reasonable" levels. For databases greater than 5000 in size, the minimum size increase is used which is still on the order of a 10% increase. Signed-off-by: Allan McRae <allan@archlinux.org>
| * Error handling for maximum database sizeAllan McRae2011-02-04
| | | | | | | | | | | | | | | | Check that the requested size of a pkghash is not beyond the maximum prime. Also check for successful creation of a new hash before rehashing. Signed-off-by: Allan McRae <allan@archlinux.org>
| * Change default sync hash table sizing to 66% fullDan McGee2011-02-04
| | | | | | | | | | | | | | | | Since the sync database never changes size once we initialize it, we allow it to be filled a bit more. This reduces the overall memory footprint needed by the hash table. Signed-off-by: Dan McGee <dan@archlinux.org>
| * Implement a quick and dirty rehash functionDan McGee2011-02-04
| | | | | | | | | | | | | | | | This allows us to get through the rehash required by smoke001 and pass all pactests. It is by no means the best or most efficient implementation but it does do the job. 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>
| * Get estimated package count when populating databasesDan McGee2011-02-04
| | | | | | | | | | | | | | | | | | | | | | | | | | This works for both local and sync databases in slightly different ways. For the local database, we can use the directory hard link count on the local/ folder. For sync databases, we use the archive size coupled with some computed average per-package sizes to determine an estimate. This is currently a dead assignment once calculated, but could be used to set the initial size of a hash table. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
| * Add a hash table for holding packagesAllan McRae2011-02-04
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* | Add more error checking and loggingDan McGee2011-02-04
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* | Ensure found files are actually filesDan McGee2011-02-04
|/ | | | | | | | | We located files in a few places but didn't check if they were files or directories. Ensure they are actually files using stat() and S_ISREG(); this showed itself when trying to download to the directory name itself in FS#22645. Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix locale.h/setlocale inclusion with --disable-nlsDan McGee2011-02-01
| | | | | | | | | Noted in FS#22697. When I factored out _alpm_parsedate() into a common function, I didn't move the <locale.h> include properly, causing a build failure when NLS is disabled and this header isn't automatically included everywhere. Signed-off-by: Dan McGee <dan@archlinux.org>
* alpm/depcmp: new NODEPVERSION flagXavier Chantry2011-01-31
| | | | | | | | | | | | | | | | This flag allows to disable version checking in dependency resolving code. depcmp_tolerant respects the NODEPVERSION flag but we still keep the original strict depcmp. The idea is to reduce the impact of the NODEPVERSION flag by using it in fewer places. I replaced almost all depcmp calls by depcmp_tolerant in deps.c (except in the public find_satisfier used by deptest / pacman -T), but I kept depcmp in sync.c and conflict.c Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm: fix db_update documentationXavier Chantry2011-01-31
| | | | | | return codes were mixed up Signed-off-by: Dan McGee <dan@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: deprecate old interfaceXavier Chantry2011-01-29
| | | | | | | | | | | | | | Old interface is marked as deprecated: 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); New recommended interface: int alpm_add_pkg(pmpkg_t *pkg); int alpm_remove_pkg(pmpkg_t *pkg); 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>
* alpm: add alpm_find_grp_pkgsXavier Chantry2011-01-29
| | | | | | | | This group function is meant to help group handling from frontend : it scans all dbs, handling ignored packages and duplicate members (the first repo where a member is found has the priority). Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
* alpm: new alpm_add_pkg interfaceXavier Chantry2011-01-29
| | | | | | | | | | | | | This new function is meant to deprecate all existing sync/add target functions : int alpm_sync_target(char *target); int alpm_sync_dbtarget(char *db, char *target); int alpm_add_target(char *target); Rather than dropping these 3 interfaces, it might be better to rewrite them using alpm_add_pkg for now. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
* alpm/dep: add alpm_find_dbs_satisfierXavier Chantry2011-01-29
| | | | | | | | | | | This is a public interface for resolvedep. It looks nicer to expose it this way rather than through sync_target. This function can also be helpful for external tools as it should give good results close to how pacman select a package for satisfying a given dep. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
* Add interactive provider selectionXavier Chantry2011-01-29
| | | | | | | | | | | | | | | | | | | | | | | | If there are multiple providers in one db, pacman used to just stop at the first one (both during dependency resolution or for pacman -S 'provision' which uses the same code). This adds a new conversation callback so that the user can choose which provider to install. By default (user press enter or --noconfirm), the first provider is still chosen, so for example the behavior of sync402 and 403 is preserved. But at least the user now has the possibility to make the right choice in a manual run. If one of the provider is already installed, it is picked for reinstall/upgrade, so that provision 002/003 pactest now pass. $ pacman -S community/smtp-server :: There are 3 providers available for smtp-server: 1) courier-mta 2) esmtp 3) exim Which one do you want to install? Enter a number (default=1): Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
* Merge branch 'maint'Dan McGee2011-01-29
|\
| * libalpm: Fix a missing "nicht" (not) in German translation.Thomas Bächler2011-01-28
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* | Remove need to explicitly register the local DBDan McGee2011-01-29
| | | | | | | | | | | | | | | | | | Perform the cheap struct and string setup of the local DB at handle initialization time to match the teardown we do when releasing the handle. If the local DB is not needed, all real initialization is done lazily after DB paths and other things have been configured anyway. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Ignore known but unused package descfile fieldsDan McGee2011-01-28
| | | | | | | | | | | | | | | | We explicitly place 'pkgbase' (and used to place 'force') fields inside PKGINFO files, so ignore them silently instead of printing an error for them. Also make the error message for unknown keys actually contain the key. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Fix memory leak and error code in DB readingDan McGee2011-01-24
| | | | | | | | | | | | | | We were returning a package error code rather than a DB one, and we would leak the archive memory if the database file didn't exist. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Compute download size for sync packages onlyDan McGee2011-01-22
| | | | | | | | | | | | | | Neither packages from files nor packages from the local database will ever have a download size. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2011-01-22
|\|
| * Copy new backend translation over from frontend translationDan McGee2011-01-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since it is the same string. Done with some bash looping and sed magic. for src in po/*.po; do echo $src newtrans=$(grep -A1 "msgid.*$1" $src | tail -n1) newtrans=${newtrans//\\/\\\\} echo "$newtrans" fname=${src##*/} dest=lib/libalpm/po/$fname sed -i -e "/msgid.*$1/{N; s/msgstr.*$/$newtrans/}" $dest done Signed-off-by: Dan McGee <dan@archlinux.org>
| * Fix double read issue in maint releasesDan McGee2011-01-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is essentially a backport/cherry-pick of commit 33240e87b99e from master, but has to be done by hand because the DB format has diverged. Read more in the commit message used there, which follows. 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. Signed-off-by: Dan McGee <dan@archlinux.org>
| * Back out anticipated epoch changesDan McGee2011-01-11
| | | | | | | | | | | | | | | | | | After all the debate as to what to do on maint, we are going to end up just incorporating epoch into the version string, so we don't need this separate field at all. Revert commit 5c8083baa4a and also kill the force flag we were recording here as well. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Remove epoch as an independent fieldDan McGee2011-01-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead, go the same route we have always taken with version-release in libalpm and treat it all as one piece of information. Makepkg is the only script that knows about epoch as a distinct value; from there on out we will parse out the components as necessary. This makes the code a lot simpler as far as epoch handling goes. The downside here is that we are tossing some compatibility to the wind; packages using force will have to be rebuilt with an incremented epoch to keep their special status. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Allow version comparison to contain epoch specifierDan McGee2011-01-21
| | | | | | | | | | | | | | | | | | Adapting from RPM, follow the [epoch:]version[-release] syntax. We can also borrow some of their parsing code for our purposes (thanks!). Add some new tests to our vercmp shell script tester for epoch comparisons, and then make the code work with these newfangled epoch specifiers. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Add a likely_pkg hint argument to sync_db_readDan McGee2011-01-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In most (all?) cases, we will process all files for a given sync database entry sequentially. The code currently does an _alpm_pkg_find() for every file in the database, but we had the "current" package readily available. Shift some local variables around a bit to expose this to sync_db_read() and use it if the package is the correct one. On my system, this cuts calls to _alpm_pkg_find() from 20,769 to 10,349 calls during a -Qu operation, and results in a ~30% speedup of the same operation (0.35 sec -> 0.27 sec). This benefit should be apparent anywhere we read in the full contents of the sync databases. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Improve splitname memory allocationDan McGee2011-01-21
| | | | | | | | | | | | | | | | We don't need to create a temporary copy of the string if we are smart with our pointer manipulation and string copying. This saves a bunch of string duplication during database parsing, both local and sync. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Improve depends string parsingDan McGee2011-01-21
| | | | | | | | | | | | | | | | | | Remove the need for an unconditional string duplication by using pointer arithmetic instead, and strndup() instead of an unspecified-length strdup(). This should reduce memory churn a fair amount as this is called pretty frequently during database loads. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Add strndup fallback function to libalpm utilDan McGee2011-01-21
| | | | | | | | | | | | The same fallback we are currently using in the pacman frontend. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Fix integrity check status when installing from fileDan McGee2011-01-18
| | | | | | | | | | | | | | | | When installing packages from a file, the integrity check count stays at (0/x) complete. This ensures it is bumped to (x/x) at the end of the process. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'diskspace-fixes'Dan McGee2011-01-11
|\ \
| * | Call archive_read_data_skip() while checking diskspaceDan McGee2011-01-11
| | | | | | | | | | | | | | | | | | | | | libarchive eventually calls it anyway, but backtraces make a lot more sense if we call it, as well as matching our precedent from alpm_pkg_load(). Signed-off-by: Dan McGee <dan@archlinux.org>
| * | Add error message stating which partition is fullDan McGee2011-01-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is helpful anyway to the user, and should also be helpful to us if we see problems cropping up in the check during development. Also add a missing ->used = 0 initialization in the code path less taken. Signed-off-by: Dan McGee <dan@archlinux.org>
| * | Unify two free diskspace error messagesDan McGee2011-01-11
| | | | | | | | | | | | | | | | | | | | | Although they won't be the same in the gettext catalog because of the '\n' we should still use the same text. Signed-off-by: Dan McGee <dan@archlinux.org>
* | | Merge branch 'fix-double-load'Dan McGee2011-01-11
|\ \ \ | |/ / |/| |