Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2011-01-29alpm: drop old target interfacesXavier Chantry
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>
2011-01-29alpm: deprecate old interfaceXavier Chantry
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>
2011-01-29alpm: new alpm_remove_pkg interfaceXavier Chantry
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>
2011-01-29alpm: add alpm_find_grp_pkgsXavier Chantry
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>
2011-01-29alpm: new alpm_add_pkg interfaceXavier Chantry
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>
2011-01-29alpm/dep: add alpm_find_dbs_satisfierXavier Chantry
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>
2011-01-29Add interactive provider selectionXavier Chantry
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>
2011-01-29Merge branch 'maint'Dan McGee
2011-01-29Remove need to explicitly register the local DBDan McGee
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>
2011-01-28Ignore known but unused package descfile fieldsDan McGee
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>
2011-01-28libalpm: Fix a missing "nicht" (not) in German translation.Thomas Bächler
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-24Fix memory leak and error code in DB readingDan McGee
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>
2011-01-22Compute download size for sync packages onlyDan McGee
Neither packages from files nor packages from the local database will ever have a download size. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22Merge branch 'maint'Dan McGee
2011-01-21Remove epoch as an independent fieldDan McGee
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>
2011-01-21Allow version comparison to contain epoch specifierDan McGee
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>
2011-01-21Copy new backend translation over from frontend translationDan McGee
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>
2011-01-21Add a likely_pkg hint argument to sync_db_readDan McGee
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>
2011-01-21Improve splitname memory allocationDan McGee
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>
2011-01-21Improve depends string parsingDan McGee
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>
2011-01-21Add strndup fallback function to libalpm utilDan McGee
The same fallback we are currently using in the pacman frontend. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-18Fix integrity check status when installing from fileDan McGee
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>
2011-01-12Fix double read issue in maint releasesDan McGee
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>
2011-01-11Back out anticipated epoch changesDan McGee
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>
2011-01-11Merge branch 'diskspace-fixes'Dan McGee
2011-01-11Merge branch 'fix-double-load'Dan McGee
2011-01-11Fix double filelist issue when upgrading a packageDan McGee
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. A debug log message was added to upgraderemove as well to match the one already in the normal remove codepath. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11Call archive_read_data_skip() while checking diskspaceDan McGee
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>
2011-01-11Add error message stating which partition is fullDan McGee
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>
2011-01-11Unify two free diskspace error messagesDan McGee
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>
2011-01-11Add a progressbar for package integrity checkingDan McGee
This can take a while too, and it is really easy to add the necessary callback stuff for adding a progressbar. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11Small fix to download size lookup and a loggerDan McGee
These were just two small things I came across today and found could be fixed or helpful, so I've added them and I'm not sure what else to bundle them with. commit_count++ Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-10Ensure we use local package when calculating removed sizeDan McGee
We were checking if a package existed locally, but then using the incoming package to calculate removed size rather than the currently installed package. Also adjust the local variable in the replaces loop to make it more clear that we are always dealing with local packages here. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-10Remove need for floating point division in backendDan McGee
All of these can be done with integer division; the only slightly interesting part is ensuring we round up like before with calling the ceil() function. We can also remove the math library from requirements; now that the only ceil() calls are gone, we don't need this anymore. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07libalpm/be_package.c: fix small memleakXavier Chantry
file_pkg_ops can be a static struct like in other backends, we just need to initialize it at some point. Dan: add initialization flag. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07Fix some more simple conversion "errors"Dan McGee
None of these warn at the normal "-Wall -Werror" level, but casts do occur that we are fine with. Make them explicit to silence some warnings when using "-Wconversion". Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07Use size_t for alpm_list sizesAllan McRae
There is a lot of swtiching between size_t and int for alpm_list sizes in the codebase. Start converting these to all be size_t by adjusting the return type of alpm_list_count and fixing all additional warnings given by -Wconversion that are generated by this change. Dan: a few more small changes to ensure things compile, adjusting some printf format string characters to accommodate the larger size on x86_64. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07Refactor old date parsing into single methodDan McGee
We've managed to duplicate this four times at this point, so make it a method in util.c instead. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07Update copyright years for 2011Allan McRae
Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-05Remove FORCE reading from local DBDan McGee
We never wrote it here, so no need to read it in either. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-02Fix function indentationDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-30Merge branch 'maint'Dan McGee
Conflicts: lib/libalpm/sync.c test/pacman/tests/ignore007.py
2010-12-30Declare all local functions staticAllan McRae
All functions that are limited to the local translation unit are declared static. This exposed that the _pkg_get_deltas declaration in be_local.c was being satified by the function in packages.c which when declared static caused linker failures. Fixes all warnings with -Wmissing-{declarations,prototypes}. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-30Respect Ignore{Pkg,Group} for group membersJakob Gruber
Fixes FS#19854. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-30Move group code to separate functionJakob Gruber
This makes the following commits more readable. No logic was changed in this commit. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-30Add const to some ALPM function signaturesJakob Gruber
char * -> const char *. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29Use limits.h for PATH_MAXAllan McRae
We use PATH_MAX everywhere by including limits.h so there is no point in doing a check for it in a different header when dealing with FreeBSD's libfetch. Also, remove autoconf check for strings.h header as it is not used anywhere. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29Detect undefined PATH_MAXAllan McRae
POSIX does not require PATH_MAX be defined when there is not actual limit to its value. This affects HURD based systems. Work around this by defining PATH_MAX to 4096 (as on Linux) when this is not defined. Also, clean up inclusions of limits.h and remove autoconf check for this header as we do not use macro shields for its inclusion anyway. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29Correct type for hash value storageAllan McRae
Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29Merge branch 'depcmp-perf'Dan McGee