summaryrefslogtreecommitdiff
path: root/lib/libalpm
Commit message (Collapse)AuthorAge
* Correct scriptlet usage patternAaron Griffin2007-12-10
| | | | | | | | | | | | The new pattern is as follows: . /path/to/scriptlet post_upgrade X Y This requires less frameworking in the install scripts (the three lines that shift and eval a function are nasty) Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Update GNU GPL boilerplate and copyright datesDan McGee2007-12-10
| | | | | | | Update the GPL boilerplate to direct people to the GNU website for a copy of the license, as well as bump all of Judd's copyrights to 2007. Signed-off-by: Dan McGee <dan@archlinux.org>
* Improve changelog handling through addition of open/read/close functionsDan McGee2007-12-09
| | | | | | | | | | | | | | | | | | | | | | | Thanks to Allan for inspiring all this work on what was one little TODO item in the codebase. :) Change changelog handling so we can now dump a changelog from both installed packages and package files (fixes FS#7371). We do this by moving all of the machinery to the backend where it should have been in the first place. The changelog reading is now done through a open/read/close interface similar to the fopen/fread/fclose functions (can you guess how it is done?). It is buffered by the frontend, so programs using the library can read as much or as little as they want at a time. Unfortunately, I could not implement a changelog_feof function due to some shortcomings of libarchive. However, I left the stub code in there, commented out, in case it becomes possible later or anyone wants to take a stab at it. Original-work-by: Allan McRae <mcrae_allan@hotmail.com> Improved-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* _alpm_unpack: return 1 when the file is not found.Chantry Xavier2007-12-08
| | | | | | | | If _alpm_unpack has a specific file to extract (not NULL), but doesn't find it, it'll now return 1, for indicating the failure. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm/server.c : fix segfault when downloading failed.Chantry Xavier2007-12-07
| | | | | | | | The alpm_list_free(complete) needs to be done OUTSIDE the loop walking through the server list. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove duplicated PM_TRANS_CONV_INSTALL_IGNOREPKG messageNagy Gabor2007-12-05
| | | | | | | | Now alpm_checkdeps first search for literals, then search for no-literal satisfiers Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> [Dan: fix spelling of INTALL, fix line wrapping] Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm/backup.c : simple refactoring.Chantry Xavier2007-12-04
| | | | Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
* Update it translation for 3.1Giovanni Scafora2007-12-03
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Update en_GB translation for 3.1Jeff Bailes2007-12-02
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Update all translation files in anticipation of 3.1 releaseDan McGee2007-12-02
| | | | | | | | | | | Update all of the pot and po files with the latest messages available. Translators- you are encouraged to do this as well every time you update the translation, and the directions in 'translation-help' should help. Also feel free to delete all the old translations that end up at the bottom of these files and only clutter things up. Signed-off-by: Dan McGee <dan@archlinux.org>
* alpm_list : change the alpm_list_find* to return the matching item.Chantry Xavier2007-12-02
| | | | | | | | alpm_list_find and alpm_list_find_ptr will now return a void *, and alpm_list_find_str will return a char *, instead of an int. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove _alpm_depmiss_isinDan McGee2007-12-02
| | | | | | | This is unneeded now that commit 2ed6b482d2fce916466e44e37930f0b0c0d928bb has eliminated the last user of this function. Signed-off-by: Dan McGee <dan@archlinux.org>
* Add 4 new pactests to get better code coverage by pactestDan McGee2007-12-02
| | | | | | | | I started playing around with gcov today and it showed a few places in the code that we don't test at all. This is the start of ensuring that we execute most of the code in our codebase. Signed-off-by: Dan McGee <dan@archlinux.org>
* Add new --needed option for -S.Chantry Xavier2007-12-02
| | | | | | | | | | | | | | | | | During a pacman operation such as a group install, pacman can ask several questions such as "local version is up to date. Upgrade anyway?". They are usually all answered either by yes or by no: * yes when you want to reinstall all the targets. * no when you only want to install the missing ones (either because you are installing a group, or because you are copying a pacman -S line from wiki or whatever). So instead of asking this question for each target, it is now now configured with a flag. Yes will be the default -S behavior, No will be achieved with the --needed flag. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Minor fixes in sync.c and deps.c.Chantry Xavier2007-12-01
| | | | | | | | | | * memleak found by Nagy in checkdeps * an useless line found by Nagy in resolvedeps * data wasn't set to the missing dependencies in sync_prepare * use the MALLOC macro in resolvedeps Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Ensure 0644 permissions for install and changelog filesAaron Griffin2007-12-01
| | | | | Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove alpm_depcmp DEBUG outputDan McGee2007-11-30
| | | | | | | | | | alpm_depcmp is simple enough that we shouldn't need constant debug logging, and the logging we do have in there negatively impacts our speed regardless of whether we actually are seeing it or not. If it ever needs debugging, it would be trivial to reimplement it by just temporarily reverting this commit. Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove some null checks in _alpm_checkdepsDan McGee2007-11-30
| | | | | | | | Hopefully these are unnecessary, as they were probably added originally to cover up a problem instead of finding the root cause. I'd rather fail hard in these cases anyway. Signed-off-by: Dan McGee <dan@archlinux.org>
* alpm_checkdeps clean-upNagy Gabor2007-11-30
| | | | | | | No bugfixes, just makes the code human-readable Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
* _alpm_checkconflicts splitNagy Gabor2007-11-25
| | | | | | | | | | | | | _alpm_innerconflicts: check for target<->target conflicts _alpm_outerconflicts: check for target<->localpkg conflicts This will be useful in sync.c clean-up and in testdb.c As an application the patch also fixes a misleading message (and a memleak) in add.c Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix for sync1003 and sync1004 pactestsNagy Gabor2007-11-25
| | | | | | | | | | | | | | | checkdeps and resolvedeps now take both a remove list and an install list as arguments, allowing dependencies to be calculated correctly. This broke the sync990 pactest, but this pactest used dependencies and provides in an unusual way, so it has been changed. Dan: the sync990 pactest was just plain wrong. It didn't satisfy the dependencies correctly, so should never have succeeded. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> [Dan: some variable renaming, clarification in commit message] Signed-off-by: Dan McGee <dan@archlinux.org>
* Force mode of all database files to 644Aaron Griffin2007-11-25
| | | | | | | | | | In the case of a packaging error where install or changelog had bad permissions, pacman respected the original permissions without trying to fix it - this means that some operations (changelog) artificially required root permissions to run In addition, minor function housekeeping on _alpm_unpack Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
* Additionally search for non-regex strings on a db search operationAaron Griffin2007-11-25
| | | | | | | This closes out FS#6500 and covers cases where the package names contain regex characters (i.e. the case of dvd+rw-tools) Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
* Make the download failure message more clearAaron Griffin2007-11-25
| | | | | | Use the word "disk" in place of the host name for local files Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
* Fix several memleaks, mostly related to errors handling.Chantry Xavier2007-11-25
| | | | | | | | | | | | | | | | | | | | | | | * The frontend calls alpm_trans_prepare(&data), and in case of errors, receive the missing dependencies / conflicts / etc in the data pointer. It apparently needs to free this structure totally with : alpm_list_free_inner(data, free) alpm_list_free(data) So I added alpm_list_free_inner(data, free) in pacman/{sync.c,remove.c,add,c} * in _alpm_sync_prepare, the deps and asked lists were not freed in case of errors (unresolvable conflicts). Besides the code for handling this case was duplicated. * in _alpm_remove_commit, free was used instead of alpm_list_free for newfiles. * newline fix in pacman/sync.c Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix a memleak in _alpm_sync_free.Chantry Xavier2007-11-25
| | | | | | | | | An alpm_list_free call was missing. Also make use of alpm_list_free_inner in both _alpm_sync_free and _alpm_trans_free. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove -F/--freshen operationDan McGee2007-11-21
| | | | | | | | | | This operation made sense in the days before sync DBs existed, but it no longer has the same usefulness it once did. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
* Improved 'dependency cycle' warningNagy Gabor2007-11-21
| | | | | | | | From now on libalpm informs user about packages which will be installed/removed in wrong order. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove duplicated get_upgrades function, use sysupgrade instead.Chantry Xavier2007-11-21
| | | | | | | | | | | | | | | | The alpm_get_upgrades was exactly the same as find_replacements + _alpm_sync_sysupgrade, except that it automatically made the eventual replacements, without asking the user : Replace %s with %s/%s? [Y/n] The replace question, asked in find_replacements. can now be skipped by using a NULL trans argument, so that we get the same behavior as with alpm_get_upgrades. So alpm_db_get_upgrades() can now be replaced by alpm_sync_sysupgrade(db_local, syncdbs). Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* New alpm_list_join functionNagy Gabor2007-11-20
| | | | | | | This O(1) function joins 2 lists. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
* Add missing header includes for setlocaleDan McGee2007-11-20
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Versioned provisions.Nagy Gabor2007-11-18
| | | | | | | | | | | | | | | | | | | This patch introduces versioned provisions in "provision 1.0-1" format. _alpm_db_whatprovides was modified accordingly (added sync500.py), alpm_depcmp was modified accordingly (add043.py passes now; added add044.py and add045.py). Notes: alpm_db_search now uses the whole versioned %PROVIDES% string in its search. debug logging was simplified in alpm_depcmp. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> [Xavier: fixed a few typos, duplicate const strings with strdup before modifying them, put some debugging back in alpm_depcmp, minor code cleanups (var/function renaming), added a note in PKGBUILD man page.] Signed-off-by: Chantry Xavier <shiningxc@gmail.com> [Dan: made strcmp checks clearer, added a comment] Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix sh and scriptlet interactionDan McGee2007-11-18
| | | | | | | | dash doesn't pass positional parameters to sourced scripts, causing install scripts to fail. Instead of sourcing the script, make it executable and call it directly which allows positional parameters to be passed correctly. Signed-off-by: Dan McGee <dan@archlinux.org>
* Add the pmconflict_t type.Nagy Gabor2007-11-18
| | | | | | | | | | | | | | | | | | pmdepmissing_t was used for two totally different things : missing dependencies, and dependency conflicts. So this patch simply adds a type for dep conflicts, and convert the code to use it. This fix the TODO in conflict.c : /* TODO WTF is a 'depmissing' doing indicating a conflict? */ Additionally, the code in conflict.c now eliminates the duplicated conflicts. If pkg1 conflicts with pkg2, and pkg2 conflicts with pkg1, only one of them will be stored. However the conflict handling in sync_prepare (sync.c) is still very asymetrical, and very ugly too. This should be improved in the future (there is already a pending patch from Nagy that cleans it a lot). Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
* Simple s/conflict/fileconflict/ renaming.Chantry Xavier2007-11-18
| | | | | | | | | | | | | | | | | | | | The names related to conflicts are misleading : For dependencies conflicts, the type is pmdepmissing, and the function names contain just "conflict". For file conflicts, the type is pmconflict, and some functions contained just "conflict", some others "fileconflict". So this is the first step for improving the situation. Original idea/patch from Nagy, but the patch already didn't apply anymore, so I did it again. The main difference is that I kept the conflictype, with the following renaming : pmconflicttype_t -> pmfileconflicttype_t PM_CONFLICT_TYPE_TARGET -> PM_FILECONFLICT_TARGET PM_CONFLICT_TYPE_FILE -> PM_FILECONFLICT_FILESYSTEM Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
* POSIX shell does not specify meaning of source operationDan McGee2007-11-18
| | | | | | Just use '.' operator instead. Oops. Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm/deps.c : improves IgnorePkg handling in resolvedeps.Nagy Gabor2007-11-18
| | | | | | | resolvedeps will now search for other satisfiers when we don't let it add a package from IgnorePkg. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
* Remove the IgnorePkg handling from alpm_pkg_compare_version.Chantry Xavier2007-11-18
| | | | | | | | And check the IgnorePkg handling is done correctly in the other places. For example, -Qu and -Su will automatically skip the ignored packages (-Su will print a warning), but -S will install ignored packages anyway, because it was asked explicitly. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
* Remove provide.c and provide.h .Chantry Xavier2007-11-17
| | | | | | | | | This file only contained one private function : _alpm_db_whatprovides . And the public alpm_db_whatprovides was in db.c , so I moved everything there. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> [Dan: updated POTFILES.in as well] Signed-off-by: Dan McGee <dan@archlinux.org>
* Generalized alpm_list_find.Nagy Gabor2007-11-17
| | | | | | | | | | | | | The old alpm_list_find was renamed to alpm_list_find_ptr, and a new alpm_list_find was introduced, which uses the fn comparison-function parameter in its decision. Now both alpm_list_find_ptr (a new ptrcmp helper function was also added) and alpm_list_find_str are just an alpm_list_find call. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Chantry Xavier <shiningxc@gmail.com> [Dan: made ptrcmp a static function] Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix memleak in _alpm_trans_free with package listsDan McGee2007-11-17
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm: use FREELIST when possibleDan McGee2007-11-16
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* War on whitespaceDan McGee2007-11-16
| | | | | | Run the kernel's cleanfile script on all of our source files. Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm: simplify sync db lastupdateDan McGee2007-11-16
| | | | | | | | | | | Legacy code is hitting the trash here. Remove unnecessary _alpm_time2string time storage abstraction in favor of just writing the time_t value to the disk. The only drawback is that everyone's sync DBs will have to be updated at least once so that the lastupdate values are stored right. :) Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix a would-be memleak with the new compute requiredby stuffDan McGee2007-11-15
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm: change graph malloc to MALLOC macroDan McGee2007-11-14
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix alpm_list_copy_dataDan McGee2007-11-14
| | | | | | | | | | So I spent a good 4 hours tracking a bug down tonight due to alpm_list_copy_data not actually doing what I expected to do. We can't find the size of an object we don't know the type of, so rewrite it so we pass in the size explicitly. This was making _alpm_pkg_dup fail and causing all sorts of other issues. Signed-off-by: Dan McGee <dan@archlinux.org>
* Move alpm_splitdep usage to db_readDan McGee2007-11-14
| | | | | | | | | | | | | Holy inefficient batman! For a pacman -Qt operation (when we are using compute_requiredby and not database entries), splitdep was being called ~1.3 million times on my local database. By splitting when we read the DB, we drop this number to around 1700 and save a LOT of time in doing so (a 5x increase in pacman -Qt speed here). Note that the depends alpm_list_t in the package struct is no longer a string list, but a list of pmdepent_t objects. Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove REQUIREDBY usage from libalpmDan McGee2007-11-14
| | | | | | | | | | | | Instead of using the often-busted REQUIREDBY entries in the pacman database, compute them each time they are required. This should help many things: 1. Simplify the codebase 2. Prevent future database corruption 3. Ensure when we do use requiredby, it is always correct 4. Shrink the pmpkg_t memory overhead Signed-off-by: Dan McGee <dan@archlinux.org>
* alpm_list_add == alpm_list_add_lastNagy Gabor2007-11-14
| | | | | | | | | | | | | | It's time to define that alpm_list_add(list, foo) adds 'foo' to the end of 'list' and returns with 'list', because: 1. list is a list, not a set. 2. sortbydeps _needs_ an alpm_list_add definition to work properly. As a first step, I used this definition in recursedeps. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> [Dan: punctuation cleanup in commit message and code comments, added comment to alpm_list_add] Signed-off-by: Dan McGee <dan@archlinux.org>