summaryrefslogtreecommitdiff
path: root/src/util
Commit message (Collapse)AuthorAge
...
* alpm: alpm_db_get_pkgcache_list => alpm_db_get_pkgcacheDave Reisner2011-02-25
| | | | | | | This avoids needless breakage of the public API. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Mark log callback format string constDan McGee2011-02-24
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Read pkgcache into hashAllan McRae2011-02-04
| | | | | | | | | | | | Read the package information for sync/local databases into a pmpkghash_t structure. Provide a alpm_db_get_pkgcache_list() method that returns the list from the hash object. Most usages of alpm_db_get_pkgcache are converted to this at this stage for ease of implementation. Review whether these are better accessing the hash table directly at a later stage. Signed-off-by: Allan McRae <allan@archlinux.org>
* Remove need to explicitly register the local DBDan McGee2011-01-29
| | | | | | | | | Perform the cheap struct and string setup of the local DB at handle initialization time to match the teardown we do when releasing the handle. If the local DB is not needed, all real initialization is done lazily after DB paths and other things have been configured anyway. Signed-off-by: Dan McGee <dan@archlinux.org>
* Allow version comparison to contain epoch specifierDan McGee2011-01-21
| | | | | | | | | Adapting from RPM, follow the [epoch:]version[-release] syntax. We can also borrow some of their parsing code for our purposes (thanks!). Add some new tests to our vercmp shell script tester for epoch comparisons, and then make the code work with these newfangled epoch specifiers. Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix some more simple conversion "errors"Dan McGee2011-01-07
| | | | | | | | None of these warn at the normal "-Wall -Werror" level, but casts do occur that we are fine with. Make them explicit to silence some warnings when using "-Wconversion". Signed-off-by: Dan McGee <dan@archlinux.org>
* Update copyright years for 2011Allan McRae2011-01-07
| | | | | Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* vercmp: always return 0 if we perform a compareDan McGee2011-01-05
| | | | | | | | | And change the wording slightly to indicate we *print* a value, not *return* it. You can't return negative values (they get coerced to 255), so it isn't worth it to try and cram the result into the return code. Acked-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Declare all local functions staticAllan McRae2010-12-30
| | | | | | | | | | | | All functions that are limited to the local translation unit are declared static. This exposed that the _pkg_get_deltas declaration in be_local.c was being satified by the function in packages.c which when declared static caused linker failures. Fixes all warnings with -Wmissing-{declarations,prototypes}. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Detect undefined PATH_MAXAllan McRae2010-12-29
| | | | | | | | | | | | | POSIX does not require PATH_MAX be defined when there is not actual limit to its value. This affects HURD based systems. Work around this by defining PATH_MAX to 4096 (as on Linux) when this is not defined. Also, clean up inclusions of limits.h and remove autoconf check for this header as we do not use macro shields for its inclusion anyway. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* testdb: update for new database formatDan McGee2010-12-20
| | | | | | | | | Sync DB's no longer have an extracted directory, so remove the files check for those. Local databases no longer have a 'depends' file, so kill that check as well. Finally, do a little other cleanup and remove the need for PATH_MAX. Signed-off-by: Dan McGee <dan@archlinux.org>
* Always specify arguement type in function delcarationsAllan McRae2010-12-20
| | | | | | | | Always declare a function with (void) rather than () when we expect no arguements. Fixes all warnings with -Wstrict-prototypes. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* src/util: update .gitignoreDan McGee2010-12-12
| | | | | | Add pactree and sort entries. Signed-off-by: Dan McGee <dan@archlinux.org>
* pactree: use variables for color and tree outputXavier Chantry2010-12-12
| | | | | | | | This allows to very easily support non-color and linear mode, by just setting the variables to an empty string, very much like it was done in the bash script. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
* pactree: separate dependency and print logicXavier Chantry2010-12-12
| | | | | | | | | | The deps walking code simply calls print_start, print, print_end, and all the printing logic is handled there. The unresolvable printing is disabled for now because it does not handle linear mode, and the linear and color output will be re-written. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
* pactree: rewrite in CDave Reisner2010-12-12
| | | | | | | | | | | | | | | | Use the bash script in contrib as the basis for a C rewrite using libalpm. The speedup can go from dozens of seconds to less than one second. Colorized output is preserved. The --graph option generates output that graphviz's `dot' utility will understand to draw us a graph. Output is written to stdout and it is left up to the user to pipe the data and determine the output characteristics. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
* util: fall cleaning on single file programsDan McGee2010-10-11
| | | | | | | | | | | * Add a bunch of static declarations where possible * Fix void functions to be proper syntax, e.g. void func(void) * Consistency fixes (such as argv references) * Remove dead str_cmp() function from testdb * Remove unneeded config.h header includes * vercmp: remove completely unnecessary string copying Signed-off-by: Dan McGee <dan@archlinux.org>
* Clarify testing within conditional statementsAllan McRae2010-06-21
| | | | | | | | | Follow the HACKING guidelines and always use != 0 or == 0 rather than negation within conditional statements to improve clarity. Most of these are !strcmp usages which is the example of what not to do in the HACKING document. Signed-off-by: Allan McRae <allan@archlinux.org>
* Build vercmp without needing link to libalpmDan McGee2010-05-04
| | | | | | | | Include the object file directly from the libalpm version comparison code as it is the only thing we need. This drops the dependency of vercmp on libalpm and all of the stuff we know it drags in. Signed-off-by: Dan McGee <dan@archlinux.org>
* Bump copyright dates to 2010Dan McGee2010-03-14
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* delta : add external cleanup scriptXavier Chantry2010-03-14
| | | | | Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* testdb : fix many memleaksXavier Chantry2009-09-22
| | | | | | | | | | Yes, it was that bad :P We still have memleaks left because we cannot free the error data returned by libalpm, but pacman has the same issue. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* testdb : less verboseXavier Chantry2009-08-18
| | | | | | | http://bbs.archlinux.org/viewtopic.php?id=77396 Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Update copyright headers and messagesDan McGee2009-07-01
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove unused included headers from testdb.c and testpkg.cGerardo Exequiel Pozzi2009-05-18
| | | | | | | | libgen.h was used for basename() in function main() from src/util/testdb.c string.h was used for strlen() in function output_cb() from src/util/testpkg.c Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> Signed-off-by: Dan McGee <dan@archlinux.org>
* Rename alpm_get_md5sum to alpm_compute_md5sum and alpm_dep_get_string to ↵Nagy Gabor2009-01-12
| | | | | | | | | | | alpm_dep_compute_string This patch introduces the following function name convention: _compute_ in function name: the return value must be freed. _get_ in function name: the return value must not be freed. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
* testdb : extend the tool to allow checking sync dbs too.Xavier Chantry2008-10-28
| | | | | | | | | | | | | | | | | | | | | | | | | Example usage and output : > src/util/testdb -h usage: testdb [-b <pacman db>] : check the local database testdb [-b <pacman db>] core extra ... : check the listed sync databases > src/util/testdb Checking the integrity of the local database in /var/lib/pacman/ > src/util/testdb core extra testing community Checking the integrity of the sync databases in /var/lib/pacman/ missing dependency for archboot : bcm43xx-fwcutter>=006-2 missing dependency for xvattr : xfree86 missing dependency for eclipse-ve : eclipse<3.3 missing dependency for flumotion : twisted-web missing dependency for gg2 : arts missing dependency for man-pages-cs : groff-utf8 missing dependency for qc-usb : kernel26<2.6.26 Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Rename alpm_db_get{pkg,grp}cache to alpm_db_get_{pkg,grp}cacheXavier Chantry2008-08-25
| | | | | | | | This is more consistent with the private functions : _alpm_db_get_{pkg,grp}cache Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Change checkdeps and checkdbconflicts to be more flexible.Xavier Chantry2008-08-25
| | | | | | | | These two functions now take directly a package list rather than a database. checkdbconflicts was renamed to checkconflicts. Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
* 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-04-07
|\
| * Add *.exe ignores for certain other platformsDan McGee2008-04-07
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* | libalpm error cleanup, step 1Dan McGee2008-04-06
| | | | | | | | | | | | Remove unused error codes, begin refactoring some of the others. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2008-03-09
|\| | | | | | | | | | | Conflicts: configure.ac
| * testpkg reworkNagy Gabor2008-03-01
| | | | | | | | | | | | | | | | | | | | * mainly code cosmetics (indent fixes) * remove debug message "spam" * print also user friendly result Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> [Dan: a few more whitespace/linebreak cleanups added] Signed-off-by: Dan McGee <dan@archlinux.org>
* | testdb : add conflicts checking.Chantry Xavier2008-01-23
|/ | | | | | | | | | | | Testdb will now scan the local database to check there are no conflicts. I'm not sure how it's possible to get this situation. At least pacman doesn't allow installing a package that conflicts with a local one, without removing the local one. But maybe in a very weird situation, or because of a bug, it could be possible. But anyway, this only requires 5 lines of code. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* testdb : fix wrong usage of checkdeps.Chantry Xavier2007-12-21
| | | | | | | | | | During last rebase where the checkdeps prototype changed, I messed up the arguments order (remove list, then upgrade list). That made testdb totally useless. Also remove the newline that was manually added by the log callback. Signed-off-by: Chantry Xavier <shiningxc@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>
* testdb.c : add vim modeline according to HACKING, and reindent the file.Chantry Xavier2007-12-08
| | | | | 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>
* 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>
* testdb: remove requiredby checkingDan McGee2007-11-14
| | | | 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>
* vercmp: add some usage instructionsDan McGee2007-11-04
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix basename usage in pacman and utilitiesDan McGee2007-11-04
| | | | | | | | | basename() is a rather untrusty function call on a lot of platforms as it does some weird and different things. To solve this, I added a mbasename fuction to pacman to take its place, and simply removed its usage in the utilities (it isn't worth dealing with there). Signed-off-by: Dan McGee <dan@archlinux.org>
* Dependency error/log messages fixNagy Gabor2007-10-26
| | | | | | | | | The old code used only the depend.name in messages, which might have not been informative. The new code uses the whole dependency string in %DEPENDS% format. (Dan: slight English clarification in one of the messages) Signed-off-by: Dan McGee <dan@archlinux.org>
* One more added include to help compilation elsewhereDan McGee2007-10-23
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* util/testdb: fix up function namingDan McGee2007-10-10
| | | | | | We shouldn't use the _alpm prefix (copy-paste issue, no big deal). Signed-off-by: Dan McGee <dan@archlinux.org>
* Add 'full' parameter to alpm_pkg_loadDan McGee2007-09-28
| | | | | | | | | | | | | | | | | | | In most cases, we want to fully scan a package when we load it, which serves as a integrity verification check. However, there are times when it is only desired to read the metadata and nothing else, so allow the caller of pkg_load to choose the behavior they need. This pays big dividends in speeding up pacman cache cleaning functionality. Old (729 packages): real 1m43.717s user 1m20.785s sys 0m2.993s New (729 packages): real 0m25.607s user 0m19.389s sys 0m0.543s Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove the DB consistency check from pacman and libalpm.Chantry Xavier2007-09-16
| | | | | | | | | | | | This reverts commit dfc85cb5f516ffbcff557522e9703c5c7d88b047 and b6f3fe6957d0206485eac98fb2120578b75d0058. This DB check is already in testdb (among others). Also testdb now uses the db path set at make time by default, so specifying the db path is optional. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>