summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
AgeCommit message (Collapse)AuthorFilesLines
2008-07-08Swap parameters on PM_TRANS_CONV_INSTALL_IGNOREPKG callback functionNagy Gabor1-2/+2
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-08New _alpm_find_dep_satisfier functionNagy Gabor2-6/+20
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-08New _alpm_dep_edge functionNagy Gabor3-40/+31
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-08Don't duplicate packages in requiredby listNagy Gabor1-3/+2
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 McGee2-0/+586
2008-06-19Add libalpm Türkçe (Turkish) translationAlper KANAT2-0/+586
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-16Use access() instead of stat() when possibleDan McGee3-15/+10
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-13Merge branch 'maint'Dan McGee1-1/+1
2008-06-13Spanish translation updatesJuan Pablo González Tognarelli1-140/+87
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 McGee1-2/+5
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-07Minor fix to German translationThomas Bächler1-1/+1
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 Chantry1-3/+6
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 Chantry2-31/+63
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 McGee4-3/+42
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 McGee11-44/+57
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-04libalpm/md5: Fix license headerDan McGee2-6/+4
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 McGee1-9/+27
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 McRae2-5/+1
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 Chantry2-3/+0
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 Chantry1-11/+10
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 Gabor1-2/+18
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 Gabor1-1/+7
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>
2008-05-15Fix compilation warning on x86_64Dan McGee1-1/+1
Glad we have so many developers using this as their native architecture. int/size_t issue here. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-14Remove wrapper call around versioncmpDan McGee5-19/+5
Actually, just rename _alpm_versioncmp to alpm_pkg_vercmp and get rid of the need for a wrapper since it did nothing anyway. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-14Update _alpm_versioncmpDan McGee1-50/+102
This code hasn't been looked at in some time. I grabbed a more recent version of the RPM source (4.4.2.3) and attempted to sync up any changes they have made, as well as make the libalpm additional code much cleaner and limited to only a few added lines of code. The size of this patch might make you think we added code, but bloat-o-meter actually tells us otherwise: <function> <old> <new> <diff> _alpm_versioncmp 1485 1021 -464 Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-14Simplify _alpm_pkg_new()Dan McGee5-14/+8
Any real call of this function doesn't specify a name or version ahead of time, so just kill that functionality off. Now to remove those dummy packages... Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-14Remove lazy init code from pkg name and version functionsDan McGee1-16/+0
If we have a package without name and/or version, we are really out of luck. Speed these functions up by removing unnecessary code. Note that both the splitname and pkg_load functions, where the name and version of packages are initially populated for databases and pkg.tar.gz files respectively, enforce that every new package struct created has a name and version. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-14Fix rewinddir regression by cleaning up db_scanXavier Chantry3-91/+37
Commit 046003844739416ff6d168dd2dec76490adb0727 caused a regression when rereading the pkgcache after updating the on-disk databases. A rewinddir call was errantly removed. Instead of replacing the call to rewindir, clean up this whole mess. db_scan is used only once and with target == NULL so there was actually half the code of db_scan which was unused. This is gone now and replaced by a single new db_populate function. Dan: add_sorted ended up being 3x slower than one msort at the end, so I changed back to that. I also made one pointer variable const and merged this whole patch with my original fix for the rewinddir issue. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-13Remove an outdated exception check in file conflict codeDan McGee1-20/+0
This has been around since at least pacman 2.9.8. Frugalware just dumped it in commit 113ec73bfcfdc, and deleting it here and running pactest shows that nothing that we have actually tested changes. If someone can pactest the edge case where this is needed, then show me the money. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-13Cleanup usages of alpm_list_find and alpm_list_remove.Chantry Xavier15-142/+87
* remove obsolete and unused *_cmp helper functions like deppkg_cmp and _alpm_grp_cmp * new alpm_list_remove_str function, used 6 times in handle.c * remove _alpm_prov_cmp / _alpm_db_whatprovides and replace them by a more general alpm_find_pkg_satisfiers with a cleaner implementation. before: alpm_db_whatprovides(db, targ) after: alpm_find_pkg_satisfiers(alpm_db_getpkgcache(db), targ) * remove satisfycmp and replace alpm_list_find + satisfycmp usage by _alpm_find_dep_satisfiers. before : alpm_list_find(_alpm_db_get_pkgcache(db), dep, satisfycmp) after : _alpm_find_dep_satisfiers(_alpm_db_get_pkgcache(db), dep) * remove _alpm_pkgname_pkg_cmp, which was used with alpm_list_remove, and use _alpm_pkg_find + alpm_list_remove with _alpm_pkg_cmp instead. This commit actually get rids of all complicated and asymmetric _cmp functions. I first thought these functions were worth it, be caused it allowed us to reuse list_find and list_remove. But this was at the detriment of the clarity and also the ease of use of these functions, dangerous because of their asymmetricity. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-13Swap the parameters of alpm_pkg_findNagy Gabor6-14/+14
Now the syntax is coherent with alpm_list_find and alpm_sync_find. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-13Remove errant include of error.hDan McGee1-1/+0
This doesn't exist anymore, the header file was removed a while back in commit 4c872594da321aa406cfb306c32c94ce2929d59e. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-12Merge branch 'maint'Dan McGee1-0/+3
Conflicts: lib/libalpm/package.c - comment location moved to be_package.c
2008-05-12Refactor pkg_load/parse_descfile into a new backend fileDan McGee4-244/+285
alpm_pkg_load() and parse_descfile() are specific to getting information from package files, just as other code is specific to getting information into or out of a package database. Move this code out of package.c, which should eventually only contain operators on the pmpkg_t struct that do not depend at all on where the data came from. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-12Remove some useless abstraction and start db cleanupDan McGee4-181/+149
We have some useless abstractions like an alpm_db_rewind function. I've read somewhere that readdir() was the worst filesystem function call invented, and what do we do? Add a wrapper around it. Kill this abstraction and move some other things into be_files that should be there anyway because they are so tied to how a files backend works. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-10Add detailed description to alpm_pkg_loadSebastian Nowicki1-0/+3
It was unclear what "loading the full package" actually did. The detailed description should clear that up, without having to look at the code. Signed-off-by: Sebastian Nowicki <sebnow@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-10Update makepath to remove PATH_MAX usageDan McGee1-17/+21
The start of a few commits to remove some PATH_MAX usage from our code. Use a dynamically allocated string instead. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-09Use strdup() instead of a static bufferDan McGee1-14/+24
We only need a copy of this string once we know we are going to extract it, and we don't need a static buffer to copy it into since it is coming from a known-length string. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-09Update md5 routinesDan McGee2-64/+51
XySSL 0.9 was released; sync our code with the upstream source. Note that there weren't any real changes besides renaming of macros, so nothing much to see here. The biggest change may be the licence- it is now GPL/BSD software rather than LGPL/BSD. The license header is changed to reflect this. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-09be_files.c: PATH_MAX cleanupDan McGee1-6/+13
Most of these are not easy to remove, but I could kill the ones in the two lastupdate functions. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-29Add documentation for transaction eventsSebastian Nowicki1-1/+58
It is hard to decipher what the transaction events actually notify you of, and what parameters are passed to the callback function, without looking at the code. This patch adds documentation for the _pmtransevt_t enum in order to clarify what the event is for and what data is passed when the callback is called. Signed-off-by: Sebastian Nowicki <sebnow@gmail.com> Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-29Updates to _alpm_copyfile()Dan McGee1-8/+14
Rework to use a single #define for the buffsize, and in the process clean up some other code and double the default buffer size. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-29Rework extract_single_file() temp file creationDan McGee1-29/+35
We were a bit juryrigged using one call to mkstemp() before rather than extracting the new files side-by-side and doing our comparisons there. We were also facing some permissions issues. Instead, make our life easier by extracting all temp files to a '.paccheck' extension, doing our md5 comparisons, and then taking the correct actions. Still to be done here- a cleanup of the use of PATH_MAX which should not be necessary if we use dynamic allocation on the heap. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-28Remove unnecessary archive_entry_set_pathname() callsDan McGee1-4/+0
I'm not sure why these were ever here, as by this point we have already extracted the file meaning a call to this function is basically a no-op. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-26Fix some fallout from the delta/download changesDan McGee2-5/+15
We removed one too many FREELIST() calls when trying to fix some memleaks, and add a safety/sanity check to ensure filename is set, as packages in old DBs are likely to not have this field. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-26get_filename : use the FILENAME db field only.Chantry Xavier2-13/+4
Reference : FS#9547. The get_filename function first tries to get the filename field from the database, and if it doesn't find it, it tries to guess it based on the name, version and arch. This field was introduced in 3.0, but there are still many old entries in the official databases without it. So the databases need to be regenerated first before this patch can be applied. There is a second problem with the delta code, which needs the filename for locally installed packages too, but this field is not present in the local db. So the delta code needs to be fixed first. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-26libalpm/sync.c : memleak fixes.Chantry Xavier1-9/+8
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-04-26Get rid of the delta patches listChantry Xavier1-76/+67
As Nathan noticed, the new informations in the delta struct allows us to get rid of this list : http://www.archlinux.org/pipermail/pacman-dev/2008-February/011163.html So I rewrote apply_deltas for that. The previous apply_deltas also had a limitation: it assumed that the initial package and the deltas were in the first cache dir, which is not necessarily the case. That situation is supported now. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-26Completely rework delta algorithmChantry Xavier8-208/+217
Using the graph structures that Nagy set up for dependency sorting, we now do a similar process for deltas. Load up all of the deltas into a graph object on which we can then apply Dijkstra's algorithm, using the new weight field of graph struct. We initialize the nodes weight using the base files that we can use in our filecache (both filename and md5sum must match). The algorithm then picks the best path among those that can be resolved. Note that this algorithm has a few advantages over the old one: 1. It is completely file agnostic. These delta chains do not have to consist of package files- this could be adopted to do delta-fied DBs. 2. It does not use the local_db anymore, or even care if a package or file is currently installed. Instead, it only looks in the filecache for files and packages that match delta chain entries. Original-work-by: Dan McGee <dan@archlinux.org> Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-04-26Rework delta struct and modify code accordinglyDan McGee4-68/+67
Start to move the delta struct away from an assumed package name scheme and towards something that is package (or even filename) agnostic. This will allow us much greater flexibility in the usage of deltas (maybe even sync DBs some day) as well as allowing code outside of delta.h/delta.c to be much cleaner with less of a need for snprintf() calls. Signed-off-by: Dan McGee <dan@archlinux.org>