summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2008-07-24Implement AND based package searching.Xavier Chantry
This fixes FS#2334. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> [Dan: add some comments to the code] Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-24Remove unused strverscmp substituteDan McGee
Our internal vercmp function was the only user of this, and it no longer relies on it. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-24libalpm/package.c : fix infolevel bug in pkg_dupXavier Chantry
The pkg_dup function shouldn't call any alpm_pkg_get_ accessors because this can fill the old package with all INFRQ_DESC fields for example, and this won't necessarily be reproduced in the new package (for all the fields that were copied before). Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-24Fix vercmp and add additional testsDan McGee
This vercmp issue has been a sticking point but this should resolve many of the issues that have come up. Only a few minor code changes were necessary to get the behavior we desired, and this version appears to beat any other vercmp rendition on a few more cases added in this commit. This commit passes all 58 vercmp tests currently out there. Other 'fixes' still fail on a few tests, namely these ones: test: ver1: 1.5.a ver2: 1.5 ret: -1 expected: 1 ==> FAILURE test: ver1: 1.5 ver2: 1.5.a ret: 1 expected: -1 ==> FAILURE test: ver1: 1.5-1 ver2: 1.5.b ret: 1 expected: -1 ==> FAILURE test: ver1: 1.5.b ver2: 1.5-1 ret: -1 expected: 1 ==> FAILURE 4 of 58 tests failed Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-22Update Portuguese (Brazil) translationHugo Doria
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2008-07-22Update Polish translationMateusz Herych
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2008-07-22Update Russian translationSergey Tereschenko
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2008-07-22Update Czech translationVojtěch Gondžala
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2008-07-22Update British English translationJeff Bailes
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2008-07-22Update Turkish translationSamed Beyribey
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2008-07-22Update Chinese Simplified translation甘露(Lu.Gan)
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-22Update Hungarian translationNagy Gabor
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-22Update Spanish translationJuan Pablo González Tognarelli
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-22Update Italian translationGiovanni Scafora
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-22Update German translationMatthias Gorissen
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-22Update French translationXavier Chantry
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-22Update pot files.Xavier Chantry
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2008-07-19Rephrase some debug messages in alpm/sync.cNagy Gabor
Debug messages were removed from _alpm_sync_find, because it is a general purpose function; debug messages should be placed in the caller function. I inserted "adding package foo-1.0-1 to the transaction targets" debug message to find_replacements and sync_sysupgrade. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-19Use NULL instead of "" as no causingpkgNagy Gabor
Our STRDUP macro (used in _alpm_depmiss_new) is NULL safe. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-17alpm_list_remove treat NULL needle as "nothing"Nagy Gabor
So if you want to remove NULL needle from a list, alpm_list_remove will return with "not found". Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-17Fix a possible segfault in alpm/remove.cNagy Gabor
Before removing a package from target list (in remove_prepare_keep_needed), we should check whether we have already removed it. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-15_alpm_db_add_pkgincache reworkNagy Gabor
Commit 8240da6cb3ff95ad480efe3e1876104024398fae broke some alpm hierarchy and introduced a new memleak (trans->packages was never freed in case of add transaction, even if the transaction wasn't committed), so it is reverted now. We follow a different approach to reduce memory usage: _alpm_db_add_pkgincache doesn't duplicate the whole package before adding it to the cache, only the package name and version (INFRQ_BASE). This method needs very small extra memory (compared to the reverted method), and after transaction commit we use less memory than before (since the big 'files' fields are not copied to cache), this is useful in GUIs. Note: The old add_pkgincache was a bit broken, since pkg->origin wasn't filled in correctly. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Acked-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-15Fix some memleaks in alpm/add.cNagy Gabor
In case of error some allocated memory wasn't freed in commit_single_pkg. Note: The return value of this function is not used. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-15Fix a wrong FREELIST usage in add.cNagy Gabor
The dynamic pmconflict_t must be freed with _alpm_conflict_free. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-13sync_addtarget reworkNagy Gabor
Now '-S provision' handling is done in the back-end. In case of multiple providers, the first one is selected (behavior change: deleted provision002.py). The old processing order was: literal, group, provision; the new one: literal, provision, group. This is more rational, but "pacman -S group" will be slower now. "pacman -S repo/provision" also works. Provision was generalized to dependencies, so you can resolve deps by hand: "pacman -S 'bash>2.0'" or "pacman -S 'core/bash>2.0'" etc. This can be useful in makepkg dependency resolving. The changes were documented in pacman manual. alpm_find_pkg_satisfiers and _alpm_find_dep_satisfiers functions were removed, since they are no longer needed. I added some verbosity to "select provider instead of literal" and "fallback to group". Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-07Merge branch 'maint'Dan McGee
2008-07-07Fix a bogus message in Hungarian translationNagy Gabor
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-07Resolvedeps reworkNagy Gabor
I divided resolvedeps into 2 functions. The new _alpm_resolvedep function will resolve one dependency, for example the 'foo>=1.0-1' dependency. It can be useful in sync_addtarget refactoring. The resolvedeps parameters were changed, to be coherent with recursedeps: * the target-list is an alpm_list* instead of alpm_list**. This is OK, because alpm_list_add == alpm_list_add_last * syncpkg param was removed. list contains the to-be-installed packages, resolvedeps will add the required dependencies into this list * trans param was removed, it was used in QUESTION() only, which can be used on the main (handle->trans) transaction only (because the front-end cannot access our pseudo-transactions at all!). The patch fixes some wrong dynamic pmdepmissing_t usage. I did a behavior change (and sync1003.py was modified accordingly), which needs some explanation: The old resolvedeps didn't elect packages from 'remove' list. I've dropped this because I don't want that 2nd excluding list param. In fact, in real life, we ~never need this rule. Resolvedeps is called before checkconflicts, so only -Su's %REPLACES% packages are sitting in 'remove' list. This means, that we have the replacement packages in our target list. Usually "foo replaces bar" means, that bar isn't in our repos any more, so resolvedeps *cannot* elect it; but usually it won't try it at all, because foo is in the target list, and it is expected to satisfy 'bar>=1.0-1'-like dependencies too. Since checkdeps and checkconflicts is done after resolvedeps, this cannot cause any harm. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-07Swap parameters on PM_TRANS_CONV_INSTALL_IGNOREPKG callback functionNagy Gabor
PM_TRANS_CONV_INSTALL_IGNOREPKG callback function can get 2 params: foo, bar in this order (packages), bar can be NULL. Old API: foo, NULL: Do you want to install foo from IgnorePkg? foo, bar: foo requires bar from IgnorePkg. Do you want to install bar? New API: foo, bar: Do you want to install foo from IgnorePkg? (If bar!=NULL:) bar requires it. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-07New _alpm_find_dep_satisfier functionNagy Gabor
This function finds the first satisfier package in a pkglist. Using it instead of _alpm_find_dep_satisfiers eliminates some memleaks and it is faster. (_alpm_find_dep_satisfiers and _alpm_find_pkg_satisfiers will be removed soon.) Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-07New _alpm_dep_edge functionNagy Gabor
The function is introduced to kill some code duplication. The function name uses the 'dependency graph' terminology. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-07Don't duplicate packages in requiredby listNagy Gabor
This is a "fix" for FS#10226. I think that multiple versioned dependencies are quite common now, and the old behavior is quite annoying there. This patch won't cause any slow-down. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-19Merge branch 'maint'Dan McGee
2008-06-19Add libalpm Türkçe (Turkish) translationAlper KANAT
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-15Use access() instead of stat() when possibleDan McGee
We were using the stat() system call in quite a few places when we didn't actually need anything the stat struct returned- we were simply checking for file existence. access() will be more efficient in those cases. Before (strace pacman -Ss pacman): % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 33.16 0.005987 0 19016 stat64 After: % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 34.85 0.003863 0 12633 1 access 7.95 0.000881 0 6391 7 stat64 Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-12Merge branch 'maint'Dan McGee
2008-06-12Spanish translation updatesJuan Pablo González Tognarelli
Fixes to old translations and new strings for upcoming 3.2 release. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-08Various updates needed prior to a new releaseDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-07Minor fix to German translationThomas Bächler
Signed-off-by: Thomas Bächler <thomas@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-04Don't display filename on -Qip operation.Xavier Chantry
Some previous commits apparently broke the get_filename function for package loaded with pkg_load (on a -Qip operation) because this field was no longer filled. Now pkg_load fills it. But the -Qip operation needs to be run like this : -Qip <filename>, so the filename is already known. There is no need to display it again. Besides, on a normal -Qi operation, the filename is not displayed either because this information is not stored in the local database. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-04Get rid of double / in database paths.Xavier Chantry
Errors like the following one happen regularly (for unknown reasons...) : error: could not open file /var/lib/pacman/local//glibc-2.7-9/depends: No such file or directory Anyway, every time an user reported an error like that, it always seemed like he thought the error was caused by the double /, which is obviously wrong. Since db->path always include a trailing /, there is no need to add one when concatenating paths in be_files.c or add.c. Additionally, some static strings were switched to dynamic. And the computation of the "dbpath"/"pkgname"-"pkgversion" was refactored in db_read, db_write and db_remove with a get_pkgpath static function. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-04Reimplement TotalDownload functionalityDan McGee
Add a new totaldlcb callback function to libalpm and make pacman utilize it when the TotalDownload option is enabled. This callback function is pretty simple- it is meant to be called once at the beginning of a "list download" action, and once at the end (with value 0 to indicate the list has been finished). The frontend is responsible for keeping track of adding individual file download amounts to the total xfered amount in order to display some sort of overall progress. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-04Use correct C type for file sizesDan McGee
We have been using unsigned long as a file size type for a while, which works but isn't quite correct and could easily break. Worse was probably our use of int in the download callback functions, which could be restrictive for packages > 2GB in size. Switch all file size variables to use off_t, which is the preferred type for file sizes. Note that at least on Linux, all applications compiled against libalpm must now be sure to use large file support, where _FILE_OFFSET_BITS is defined to be 64 or there will be some weird issues that crop up. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-03libalpm/md5: Fix license headerDan McGee
This was mistakenly referencing the LGPL even after the XySSL code bump, so fix the license clause to be correct. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-30Fix versioncmp regression after updateDan McGee
Commit 84283672853350a84d2a71b72dc06e180cad1587 introduced the regression, and a previous commit introduced the vercmptest.sh test script to track down these issues. This commit solves the problem by removing the previous attempt at locating the pkgrel portions and replacing it with something that performs the correct logic. While tracking down everything I needed to, I also found a mistake in one of the pactests which is fixed here as well as increased the functionality and verbosity of the vercmptest script to both print out each test it is running as well as automatically run the mirror of each test case. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29Tidy up of the handle struct in libalpmAllan McRae
Removed unused handle->uid from pmhandle_t. The need to check permissions should be determined by the frontend (and is in pacman). Fixed comment on noextract in pmhandle_t. Signed-off-by: Allan McRae <mcrae_allan@hotmail.com> Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29Remove PM_TRANS_EVT_EXTRACT_START.Xavier Chantry
This event was unused, was missing the equivalent EXTRACT_DONE event, and was useless because we already have ADD / UPGRADE START and DONE events. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29be_files : stores REPLACES and FORCE in desc.Xavier Chantry
repo-add and db_read both assume that REPLACES and FORCE fields are in the desc file, so do that for db_write as well (instead of depends file). Note that db_write is currently only used on the local database. And the only purpose of replaces and force in local database is for information purpose (available on -Qi operations). So this is not a big problem. Ref: http://www.archlinux.org/pipermail/pacman-dev/2008-May/011859.html Acked-by: Dan McGee <dan@archlinux.org> Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29Add some verbosity to _alpm_db_read.Nagy Gabor
Name and version are computed from "/var/lib/pacman/..." pathname. And the %NAME% and %VERSION% fields from the desc file were not even read. So now, when we read the desc file, we make sure the %NAME% and %VERSION% fields are consistent. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29Fix for remove052.py by moving recursedeps before checkdeps.Nagy Gabor
In the case of -Rs operation, first pulling the dependencies with recursedeps before calling checkdeps takes care of the dependency chain of remove052 pactest. In the case of -Rcs, we can keep the old behavior because we have no problem there (any dependency returned by checkdeps will be added to the remove list because of -Rc) and we have to run recursedeps on the final remove list anyway to catch all orphans. Ref.: http://www.archlinux.org/pipermail/pacman-dev/2008-April/011569.html Signed-off-by: Nagy Gabor <ngaba at bibl.u-szeged.hu> Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>