summaryrefslogtreecommitdiffstats
path: root/src/util/pactree.c
AgeCommit message (Collapse)AuthorFilesLines
2014-01-06Update copyright years for 2014Allan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-04pactree: set full usage on DBs when registeringDave Reisner1-1/+2
Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-04Improve --help switch output for pacman utilsJason St. John1-3/+4
Unify the formatting of the --help switch for pacman utils, if it exists. All of the pacman utils will now output help text using the following format: util-name (pacman) v<pacman version> one line description of util's purpose Usage: util-name [options] -b, --bar whatever --bar does -f, --foo whatever --foo does -h, --help display this help message The --help switch does not exist for a couple of the utils, so the help/usage text for those will be displayed when the util is run with no arguments. Reported-by: Karol Błażewicz <karol.blazewicz at gmail.com> Signed-off-by: Jason St. John <jstjohn@purdue.edu> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30Fix whitespace in pacsort.c and pactree.cJason St. John1-10/+10
Replace spaces with tabs. Remove extra spaces. Signed-off-by: Jason St. John <jstjohn@purdue.edu> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-22clarified descriptions for pactree -r (--help)Zulker Nayeen Nahiyan1-1/+1
Signed-off-by: Zulker Nayeen Nahiyan <nahiyan02@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-04Fix open braces styleGerardo Exequiel Pozzi1-3/+4
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 McGee1-1/+3
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 Gregory1-1/+1
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 Reisner1-16/+20
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 Reisner1-2/+3
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 Reisner1-3/+34
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 Gregory1-13/+17
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 Gregory1-1/+1
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-08-01pactree: show tree vertical "limbs"Andrew Gregory1-18/+62
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 Gregory1-61/+28
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-02-13Merge branch 'maint'Dan McGee1-6/+6
Conflicts: lib/libalpm/sync.c src/util/pactree.c
2012-02-11pactree: allow comments after repo section headerAllan McRae1-6/+6
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 McGee1-3/+3
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>
2011-12-23pactree: cleanup register_syncsDave Reisner1-6/+9
- 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 Reisner1-9/+9
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-12-22include config.h via MakefilesDave Reisner1-2/+0
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 Conder1-1/+1
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-10-12Remove alpm_list_getdata wrapper functionDan McGee1-3/+3
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-11pactree: Make error message smarter in register_syncs()Lukas Fleischer1-1/+1
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-11pactree: Add "--config" optionLukas Fleischer1-3/+15
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-18src/util: provide strndup definitions where neededDave Reisner1-0/+22
Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-18pactree: include missing ctype.h headerDave Reisner1-0/+1
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-26strtrim: don't move empty stringDan McGee1-1/+6
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-08mark option structs as constDave Reisner1-1/+1
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-07-05signing: move to new signing verification and return schemeDan McGee1-1/+2
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>
2011-06-28Rename pmerrno_t to alpm_errno_tAllan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28Rename pmdepend_t to alpm_depend_tAllan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28Rename pmpkg_t to alpm_pkg_tAllan McRae1-6/+6
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28Rename pmhandle_t to alpm_handle_tAllan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-27Fix several -Wshadow warningsDan McGee1-2/+2
Only one of these looked like a real red flag, in find_requiredby(), but it doesn't hurt to fix several of them up anyway. Unfortunately, we can't turn this on universally due to things like the sync(), remove(), etc. builtins which we often use as variable names. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24pactree: add -s option to walk sync DBsDave Reisner1-4/+92
Add a whole lot of bloat to parse pacman.conf and only a few lines to use the list of sync DBs instead of the local DB. Dan: I fully plan on this being temporary and us finding a better way in the future to parse pacman.conf from multiple binaries. Adding a standalone config parser is probably not the right way of going about things, but for now it is by far the easiest. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24pactree: carry a list of databases for dep resolutionDave Reisner1-12/+25
Declare an alpm_list which, for now, only holds our local database. walk_deps and walk_reverse_deps are refactored to account for this, and a helper function is added to wrap alpm_db_get_pkg for traversing a list. This is groundwork for letting pactree walk the sync DBs. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-16Make pmdepend_t and pmdepmissing_t publicDan McGee1-4/+4
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14Move pm_errno onto the handleDan McGee1-19/+11
This involves some serious changes and a very messy diff, unfortunately. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-09Require handle argument to all alpm_option_(get|set)_*() methodsDan McGee1-5/+1
This requires a lot of line changes, but not many functional changes as more often than not our handle variable is already available in some fashion. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-07Update utilities for new initialize/release methodsDan McGee1-15/+6
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-04pactree: make -Wwrite-strings friendlyDan McGee1-50/+62
Use a few structs to hold configuration values we change given certain options so we can be const-correct with string assignment across the board. Behavior should be completely unchanged. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-21style cleanup: cast as (type *) not (type*)Dave Reisner1-2/+2
Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-21Style change: return(x) --> return xDan McGee1-9/+9
This was discussed and more or less agreed upon on the mailing list. A huge checkin, but if we just do it and let people adjust the pain will end soon enough. Rebasing should be relatively straighforward for anyone that sees conflicts; just be sure you use the new return style if possible. The following semantic patch was used to do the change, along with some hand-massaging in order to preserve parenthesis where appropriate: The semantic match that finds this problem is as follows, although some hand-massaging was done in order to keep parenthesis where appropriate: (http://coccinelle.lip6.fr/) // <smpl> @@ expression a; @@ - return(a); + return a; // </smpl> A macros_file was also provided with the following content: Additional steps taken, mainly for ASSERT() macros: $ sed -i -e 's#return(NULL)#return NULL#' lib/libalpm/*.c $ sed -i -e 's#return(-1)#return -1#' lib/libalpm/*.c Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-25alpm: alpm_db_get_pkgcache_list => alpm_db_get_pkgcacheDave Reisner1-2/+2
This avoids needless breakage of the public API. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04Read pkgcache into hashAllan McRae1-2/+2
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>
2011-01-29Remove need to explicitly register the local DBDan McGee1-1/+1
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>
2011-01-08Fix some more simple conversion "errors"Dan McGee1-1/+1
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>
2011-01-08Update copyright years for 2011Allan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-21Always specify arguement type in function delcarationsAllan McRae1-1/+1
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>