summaryrefslogtreecommitdiff
path: root/lib/libalpm
Commit message (Collapse)AuthorAge
* Resolvedeps reworkNagy Gabor2008-07-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Swap parameters on PM_TRANS_CONV_INSTALL_IGNOREPKG callback functionNagy Gabor2008-07-07
| | | | | | | | | | | | | | | 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>
* New _alpm_find_dep_satisfier functionNagy Gabor2008-07-07
| | | | | | | | | | 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>
* New _alpm_dep_edge functionNagy Gabor2008-07-07
| | | | | | | | 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>
* Don't duplicate packages in requiredby listNagy Gabor2008-07-07
| | | | | | | | | 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>
* Merge branch 'maint'Dan McGee2008-06-19
|\
| * Add libalpm Türkçe (Turkish) translationAlper KANAT2008-06-19
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* | Use access() instead of stat() when possibleDan McGee2008-06-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'maint'Dan McGee2008-06-12
|\|
| * Minor fix to German translationThomas Bächler2008-06-07
| | | | | | | | | | Signed-off-by: Thomas Bächler <thomas@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Spanish translation updatesJuan Pablo González Tognarelli2008-06-12
| | | | | | | | | | | | Fixes to old translations and new strings for upcoming 3.2 release. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Various updates needed prior to a new releaseDan McGee2008-06-08
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* | Don't display filename on -Qip operation.Xavier Chantry2008-06-04
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Get rid of double / in database paths.Xavier Chantry2008-06-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Reimplement TotalDownload functionalityDan McGee2008-06-04
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Use correct C type for file sizesDan McGee2008-06-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | libalpm/md5: Fix license headerDan McGee2008-06-03
| | | | | | | | | | | | | | 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>
* | Fix versioncmp regression after updateDan McGee2008-05-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Tidy up of the handle struct in libalpmAllan McRae2008-05-29
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Remove PM_TRANS_EVT_EXTRACT_START.Xavier Chantry2008-05-29
| | | | | | | | | | | | | | | | 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>
* | be_files : stores REPLACES and FORCE in desc.Xavier Chantry2008-05-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Add some verbosity to _alpm_db_read.Nagy Gabor2008-05-29
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Fix for remove052.py by moving recursedeps before checkdeps.Nagy Gabor2008-05-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Fix compilation warning on x86_64Dan McGee2008-05-14
| | | | | | | | | | | | | | 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>
* | Remove wrapper call around versioncmpDan McGee2008-05-14
| | | | | | | | | | | | | | 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>
* | Update _alpm_versioncmpDan McGee2008-05-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Simplify _alpm_pkg_new()Dan McGee2008-05-13
| | | | | | | | | | | | | | | | 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>
* | Remove lazy init code from pkg name and version functionsDan McGee2008-05-13
| | | | | | | | | | | | | | | | | | | | 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>
* | Fix rewinddir regression by cleaning up db_scanXavier Chantry2008-05-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Remove an outdated exception check in file conflict codeDan McGee2008-05-13
| | | | | | | | | | | | | | | | | | 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>
* | Cleanup usages of alpm_list_find and alpm_list_remove.Chantry Xavier2008-05-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* | Swap the parameters of alpm_pkg_findNagy Gabor2008-05-13
| | | | | | | | | | | | | | 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>
* | Remove errant include of error.hDan McGee2008-05-13
| | | | | | | | | | | | | | This doesn't exist anymore, the header file was removed a while back in commit 4c872594da321aa406cfb306c32c94ce2929d59e. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2008-05-11
|\| | | | | | | | | | | Conflicts: lib/libalpm/package.c - comment location moved to be_package.c
| * Add detailed description to alpm_pkg_loadSebastian Nowicki2008-05-10
| | | | | | | | | | | | | | | | | | 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>
* | Refactor pkg_load/parse_descfile into a new backend fileDan McGee2008-05-11
| | | | | | | | | | | | | | | | | | | | 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>
* | Remove some useless abstraction and start db cleanupDan McGee2008-05-11
| | | | | | | | | | | | | | | | | | | | 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>
* | Update makepath to remove PATH_MAX usageDan McGee2008-05-10
| | | | | | | | | | | | | | 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>
* | Use strdup() instead of a static bufferDan McGee2008-05-08
| | | | | | | | | | | | | | | | 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>
* | Update md5 routinesDan McGee2008-05-08
| | | | | | | | | | | | | | | | | | | | | | 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>
* | be_files.c: PATH_MAX cleanupDan McGee2008-05-08
| | | | | | | | | | | | | | 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>
* | Add documentation for transaction eventsSebastian Nowicki2008-04-29
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Updates to _alpm_copyfile()Dan McGee2008-04-28
| | | | | | | | | | | | | | 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>
* | Rework extract_single_file() temp file creationDan McGee2008-04-28
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Remove unnecessary archive_entry_set_pathname() callsDan McGee2008-04-27
| | | | | | | | | | | | | | 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>
* | Fix some fallout from the delta/download changesDan McGee2008-04-26
| | | | | | | | | | | | | | | | 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>
* | get_filename : use the FILENAME db field only.Chantry Xavier2008-04-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | libalpm/sync.c : memleak fixes.Chantry Xavier2008-04-26
| | | | | | | | Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
* | Get rid of the delta patches listChantry Xavier2008-04-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Completely rework delta algorithmChantry Xavier2008-04-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>