summaryrefslogtreecommitdiff
path: root/src/util
AgeCommit message (Collapse)Author
2013-03-10testdb: quote output substitutionsAndrew Gregory
Quoting output substitutions makes whitespace errors such as FS#30101 much more obvious: old: missing perl-test-pod dependency for perl-test-output new: missing 'perl-test-pod ' dependency for 'perl-test-output' Several of the quoted substitutions should not be capable of containing whitespace in theory, but this errs on the side of caution as the point of the tool is to find error conditions. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10testdb: pass empty local pkglist to alpm_checkdepsAndrew Gregory
Passing the local package list to alpm_checkdeps as both the local packages and packages to be upgraded did nothing but cause extra overhead as the packages were all removed from the installed package list because they were being upgraded. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-13Add format attributes to all required functionsAllan McRae
Fixes all clang warnings with -Wformat-literal. Also, fix genuine formating issue discovered once adding these attributes and add a cast to prevent a gcc warning. Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-28pacsort: add -f, --files option for sorting filenamesDave Reisner
Teach pacsort to understand package filenames and optionally strip away some of the context. alpm_pkg_vercmp() intentionally only understands pure versions, so strings such as '18.0-2-x86_64' and '18.0.1-1-x86_64' will be compared wrongly. Partially addresses FS#33455. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-04Fix space between control structure and open parensGerardo Exequiel Pozzi
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-04Fix open braces styleGerardo Exequiel Pozzi
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-04fix comment style // -> /* */Gerardo Exequiel Pozzi
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-03util/pactree: correctly free the deps list in walk_deps()Dan McGee
If we are reversed, then we were correctly freeing both the list and the contained data. However, we were leaking a list in the case of a non-reversed traversal. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27pactree: unindent first limbAndrew Gregory
Removing the leader for the toplevel package shifted the name left but not it's limb. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27pactree: unify output between utf8 and asciiDave Reisner
Ensure that both output formats have equal spacing, and therefore an equivalent layout. This change also removes the styling from the toplevel package being searched for. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27pactree: fix style violationsDave Reisner
Stick to c89 and avoid mixed code and declarations, and always brace block statements, even if they're only 1 line. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27pactree: autodetect and use unicode line drawing charactersDave Reisner
Add a compile time check for langinfo.h so that we can possibly use unicode line drawing characters if the current locale is supportive of them. This can be explicitly disabled at runtime with the use of a new switch: -a, --ascii. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27pactree: style last branch node differentlyAndrew Gregory
Also removes the less helpful provides-specific branch tip. Old: New: |--pkg |--pkg +--dep1 provides dep5 |--dep1 provides dep5 | |--dep2 | `--dep2 |--dep3 `--dep3 |--dep4 `--dep4 [dreisner@archlinux.org: switch original suggestion of \-- to `--] Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27pactree: fix --sync getopt valueAndrew Gregory
The long --sync options has apparently never worked. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27buildsys: eschew use of DEFS, prefer AM_CPPFLAGSDave Reisner
This is redundant, and any usage of -D should belong to CPPFLAGS. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-01pactree: show tree vertical "limbs"Andrew Gregory
Showing vertical limbs makes the tree easier to follow. Old: New: |--pkg |--pkg |--dep1 |--dep1 |--dep2 | |--dep2 |--dep3 |--dep3 |--dep4 |--dep4 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> [Allan: fix shadow warning] Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-01pactree: consolidate both walk_deps functionsAndrew Gregory
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> [Allan: fix shadow warning] Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-24util/testdb: don't return crazy error valuesDan McGee
With some contrived examples, you could easily make testdb return a very high error count, which could easily overflow the 8-bit unsigned integer limit. Instead, simply return 1 or 0 based on whether errors were found. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-08buildsys: define warning CFLAGS in separate varDave Reisner
Continue the trend of not touching the environment CFLAGS, ensuring that the user always has the final say. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08buildsys: use pkg-config for openssl detectionDave Reisner
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-02-13Merge branch 'maint'Dan McGee
Conflicts: lib/libalpm/sync.c src/util/pactree.c
2012-02-13testpkg: set gpgdirAllan McRae
Without setting gpgdir, testpkg outputs: warning: Public keyring not found; have you run 'pacman-key --init'? Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-13Move ROOTDIR definition into config.hAllan McRae
This was the only variable of its kind when a define was done on the compiler command line. Move it into config.h instead. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-11pactree: allow comments after repo section headerAllan McRae
Duplicate the fix in config file parsing from d95c0494. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-06ALPM API adjustments for sanity and consistencyDan McGee
This makes several small adjustments to our exposed method names, and in one case, parameters. The justification here is to make methods less odd in their naming convention. If a method takes an alpm_db_t argument, the method should be named 'alpm_db_*', but perhaps more importantly, if it doesn't take a database as the first parameter, it should not. Summary of changes: alpm_db_register_sync -> alpm_register_syncdb alpm_db_unregister_all -> alpm_unregister_all_syncdbs alpm_option_get_localdb -> aplpm_get_localdb alpm_option_get_syncdbs -> aplpm_get_syncdbs alpm_db_readgroup -> alpm_db_get_group alpm_db_set_pkgreason -> alpm_pkg_set_reason All methods keep the same argument list except for alpm_pkg_set_reason; there we drop the 'handle' argument as it can be retrieved from the passed in package object. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-07testdb: check local database for duplicate filesDan McGee
This adds an additional check step to find files in the local database that claim to be owned by more than one package at once, which is definitely not a supported setup. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-23pactree: cleanup register_syncsDave Reisner
- take advantage of the new strtrim return value - tighten scope on line pointer Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-12-23pactree: update with new strtrim functionDave Reisner
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-12-21include config.h via MakefilesDave Reisner
Ensures that config.h is always ordered correctly (first) in the includes. Also means that new source files get this for free without having to remember to add it. We opt for -imacros over -include as its more portable, and the added constraint by -imacros doesn't bother us for config.h. This also touches the HACKING file to remove the explicit mention of config.h as part of the includes. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-14create a typedef for enum _alpm_errno_tJonathan Conder
This is consistent with the other enums and structs, and should be slightly more readable. Signed-off-by: Jonathan Conder <jonno.conder@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-01Merge branch 'maint'Dan McGee
2011-11-01src/util: link vercmp against .lo, not the .oDave Reisner
This seems to fix FS#26652. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12Remove alpm_list_getdata wrapper functionDan McGee
This one is pretty darn useless. Just derefence the ->data attribute since the type is public anyway and save yourself the function call. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-10pactree: Make error message smarter in register_syncs()Lukas Fleischer
Our error message used to be very unclear when the configuration file could not be found: $ ./pactree -lsr gtk error: failed to register sync DBs Instead, display an accurate message and include the file name: $ ./pactree -lsr gtk error: config file /usr/local/etc/pacman.conf could not be read Also, move the error message inside register_syncs() to allow for differentiating between different errors that might require a handler in the future. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-10pactree: Add "--config" optionLukas Fleischer
This allows for specifying an alternate configuration file path, similar to pacman's "--config" option. Given that there is currently no other way to tell pactree to read from another configuration file (except for patching or symlinking), this seems totally sensible - even if there are plans to refactor and/or replace the standalone configuration file parser. We do not define a short option for the sake of consistency with pacman's set of command line options. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-20utils/cleanupdelta: remove unneeded syncdbpathDan McGee
This variable was totally unused. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-18src/util: provide strndup definitions where neededDave Reisner
Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-18pactree: include missing ctype.h headerDave Reisner
needed for isspace() -- avoids warnings on OSX. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-29pacsort: use boolean, not binary OR operationDave Reisner
Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-28Better error handling out of package load methodDan McGee
There are many other ways to fail a package load other than "file not found". We should also use the correct error code in this case. Clean it up a bit in the various callers. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-25strtrim: don't move empty stringDan McGee
There were many cases where the string coming in was a blank line, e.g. "\n\0", length 1. The trim routine starts by trimming leading spaces, thus trimming everything. We would then proceed to do a memmove of the NULL byte, which is completely worthless as we can just assign it instead. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22pacsort: correct list freeingPang Yan Han
Signed-off-by: Pang Yan Han <pangyanhan@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22pacsort: ensure list is freed if size is 0Dan McGee
Found using: `valgrind ./src/util/.libs/lt-pacsort /dev/null` Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22pacsort: correct pointer type in list_newPang Yan Han
Pointer sizes are the same but this makes intention clearer. Signed-off-by: Pang Yan Han <pangyanhan@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-08mark option structs as constDave Reisner
These are never modified and even getopt_long's prototype shows this modifier on the parameter. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-08src/util/Makefile.am: alphabetize targetsDave Reisner
Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-08pacsort: add new utilityDave Reisner
pacsort is a command line sorting utility that implements libalpm's alpm_pkg_vercmp algorithm. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-28Tidy up testdb to match coding stylesDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05Remove most usages of strncmp()Dan McGee
The supposed safety blanket of this function is better handled by explicit length checking and usages of strlen() on known NULL-terminated strings rather than hoping things fit in a buffer. We also have no need to fully fill a PATH_MAX length variable with NULLs every time as long as a single terminating byte is there. Remove usages of it by using strcpy() or memcpy() as appropriate, after doing length checks via strlen(). Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05signing: move to new signing verification and return schemeDan McGee
This gives us more granularity than the former Never/Optional/Always trifecta. The frontend still uses these values temporarily but that will be changed in a future patch. * Use 'siglevel' consistenly in method names, 'level' as variable name * The level becomes an enum bitmask value for flexibility * Signature check methods now return a array of status codes rather than a simple integer success/failure value. This allows callers to determine whether things such as an unknown signature are valid. * Specific signature error codes mostly disappear in favor of the above returned status code; pm_errno is now set only to PKG_INVALID_SIG or DB_INVALID_SIG as appropriate. Signed-off-by: Dan McGee <dan@archlinux.org>