summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
AgeCommit message (Collapse)AuthorFilesLines
2007-12-03Remove _alpm_depmiss_isinDan McGee2-20/+0
This is unneeded now that commit 2ed6b482d2fce916466e44e37930f0b0c0d928bb has eliminated the last user of this function. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-03Add 4 new pactests to get better code coverage by pactestDan McGee2-2/+2
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>
2007-12-02Add new --needed option for -S.Chantry Xavier2-11/+11
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>
2007-12-01Minor fixes in sync.c and deps.c.Chantry Xavier2-5/+4
* 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>
2007-12-01Ensure 0644 permissions for install and changelog filesAaron Griffin1-0/+2
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-01Remove alpm_depcmp DEBUG outputDan McGee1-4/+0
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>
2007-12-01Remove some null checks in _alpm_checkdepsDan McGee1-10/+2
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>
2007-12-01alpm_checkdeps clean-upNagy Gabor1-117/+34
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>
2007-11-25_alpm_checkconflicts splitNagy Gabor3-40/+39
_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>
2007-11-25Fix for sync1003 and sync1004 pactestsNagy Gabor6-240/+159
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>
2007-11-25Force mode of all database files to 644Aaron Griffin1-11/+24
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>
2007-11-25Additionally search for non-regex strings on a db search operationAaron Griffin1-0/+4
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>
2007-11-25Make the download failure message more clearAaron Griffin1-1/+5
Use the word "disk" in place of the host name for local files Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-11-25Fix several memleaks, mostly related to errors handling.Chantry Xavier2-25/+19
* 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>
2007-11-25Fix a memleak in _alpm_sync_free.Chantry Xavier2-13/+4
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>
2007-11-21Remove -F/--freshen operationDan McGee2-12/+3
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>
2007-11-21Improved 'dependency cycle' warningNagy Gabor1-1/+8
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>
2007-11-21Remove duplicated get_upgrades function, use sysupgrade instead.Chantry Xavier5-240/+136
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>
2007-11-21New alpm_list_join functionNagy Gabor2-0/+34
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>
2007-11-20Add missing header includes for setlocaleDan McGee2-0/+2
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-19Versioned provisions.Nagy Gabor4-25/+52
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>
2007-11-18Fix sh and scriptlet interactionDan McGee1-4/+11
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>
2007-11-18Add the pmconflict_t type.Nagy Gabor7-76/+118
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>
2007-11-18Simple s/conflict/fileconflict/ renaming.Chantry Xavier5-26/+26
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>
2007-11-18POSIX shell does not specify meaning of source operationDan McGee1-2/+2
Just use '.' operator instead. Oops. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-18libalpm/deps.c : improves IgnorePkg handling in resolvedeps.Nagy Gabor1-27/+25
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>
2007-11-18Remove the IgnorePkg handling from alpm_pkg_compare_version.Chantry Xavier3-29/+16
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>
2007-11-17Remove provide.c and provide.h .Chantry Xavier12-100/+29
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>
2007-11-17Generalized alpm_list_find.Nagy Gabor5-20/+34
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>
2007-11-17Fix memleak in _alpm_trans_free with package listsDan McGee1-8/+5
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-17libalpm: use FREELIST when possibleDan McGee3-8/+4
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-17War on whitespaceDan McGee41-156/+155
Run the kernel's cleanfile script on all of our source files. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-16libalpm: simplify sync db lastupdateDan McGee7-74/+54
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>
2007-11-15Fix a would-be memleak with the new compute requiredby stuffDan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-15libalpm: change graph malloc to MALLOC macroDan McGee1-1/+2
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-15Fix alpm_list_copy_dataDan McGee3-8/+12
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>
2007-11-15Move alpm_splitdep usage to db_readDan McGee3-41/+22
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>
2007-11-15Remove REQUIREDBY usage from libalpmDan McGee11-174/+18
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>
2007-11-15alpm_list_add == alpm_list_add_lastNagy Gabor4-33/+24
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>
2007-11-13Enforce const correctness on dep functions and rewrite alpm_dep_get_stringDan McGee2-34/+36
Add some const specifiers to the dep functions that can have them. In addition, rewrite alpm_dep_get_string to use snprintf and cover all of the bases (operators). Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-13Fix display of -Qip output when a package file is givenDan McGee1-0/+4
Too many fields were being shown on -Qip output, and sizes were not always correct (-Qi and -Qip output on the same package did not agree). Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11Fix memleak with new alpm_list_reverse usageDan McGee1-2/+4
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11Add a horrible little hack to get symlink001.py to pass againDan McGee1-5/+14
This really doesn't give us any regressions in behavior, so it is safe to do although quite ugly. Tell the conflict checking code to ignore symlinks to dirs so that they are not seen as conflicts. Hopefully this entire commit will get factored out soon enough. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11Ensure list tail pointer is updated when we remove tail nodeDan McGee1-2/+10
Commit 2ee90ddae23dd86c68223c0d6c49f0b92d62429d did a special check to see if we were removing the head node, but not the tail node. Add a special case for the tail node to ensure all relevant pointers get updated. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11Incorrect usage of alpm_db_whatprovides in sync.cNagy Gabor1-4/+4
The old code thought that alpm_db_whatprovides returns with a list of strings (package names). Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11libalpm: fix lstat wrapper to actually use newpathDan McGee1-1/+1
Commit b55abdce7aebb142ce79da3aa3645afe7693a3c4 introduced an lstat wrapper function that never dereferences paths with a trailing slash, but still called lstat on path instead of newpath. Oops! Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11Remove unused and broken alpm_list_remove_node functionDan McGee2-30/+0
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11Implement TotalDownload option.Nathan Jones5-16/+55
Setting this option will change the download progress to show the amount downloaded, download rate, ETA, and download percent of the entire download list rather than per each individual file. The progress bar is still based on the completion of the current file regardless if the TotalDownload option is set. This closes FS#7205. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11Implement IgnoreGroup.Nathan Jones5-7/+37
This option acts as if IgnorePkg was set on each package in the group. This closes FS#1592. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11Add IgnoreGroup and --ignoregroup option.Nathan Jones3-0/+26
This will be used in the next commit. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>