summaryrefslogtreecommitdiff
path: root/src/util
Commit message (Collapse)AuthorAge
* Update copyright yearsAllan McRae2017-01-04
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Remove pacsortAllan McRae2016-12-05
| | | | | | Moved to the pacman-contrib project Signed-off-by: Allan McRae <allan@archlinux.org>
* Represent bitfields as ints, not enumsIvy Foster2016-10-22
| | | | | | | | | | Many bitfield variables are declared to be enums, because they are generated using bitwise operations on enums such. However, their actual values aren't necessary members of their parent enum, so declaring them 'int' is more accurate. Signed-off-by: Ivy Foster <ivy.foster@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Remove pactreeAllan McRae2016-10-22
| | | | | | This has been moved to the pacman-contrib project. Signed-off-by: Allan McRae <allan@archlinux.org>
* pacsort help clearly states that files contain inputs to be sortedAshley Whetter2016-05-05
| | | | | | | Fixes FS#44121 Signed-off-by: Ashley Whetter <ashley@awhetter.co.uk> Signed-off-by: Allan McRae <allan@archlinux.org>
* pacsort, introduce define for escape_char error codeRikard Falkeborn2016-01-04
| | | | | | | | | | | | | | The signedness of char is implementation defined. On systems where char is unsigned, comparing a variable of type char with -1 is never true, due to integer promotion rules. To avoid this, introduce a define for invalid field separators where -1 is cast to char. This will ensure that the return value check works for both unsigned and signed char. Fixes one warning [-Wtype-limits] for comparissons with -1 when compiling with -funsigned-char. Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Update copyright years for 2016Allan McRae2016-01-04
| | | | | | make update-copyright OLD=2015 NEW=2016 Signed-off-by: Allan McRae <allan@archlinux.org>
* pacsort: clean up if errorRikard Falkeborn2015-10-21
| | | | | | | | * free memory * close open file Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* pacsort: don't overwrite memory if realloc failsRikard Falkeborn2015-10-21
| | | | | | | That makes it impossible to free it later. Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* pacsort: handle failing list_addRikard Falkeborn2015-10-21
| | | | | | | | | Since it can fail, check the return value. If it fails, we need to free the memory of the object we wanted to add to the list. Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* move strtrim to util-commonAndrew Gregory2015-09-20
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Fix compilation if libarchive headers are not in standard locationCharles Duffy2015-05-12
| | | | | | | | | | | | | With commit 097d5a478b32, including alpm.h also drags in archive.h. Ensure the tools we build that depend on ALPM also include the necessary flags to find libarchive headers if they are not installed in a standard location. [Dan: Add commit message] Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
* pacsort: fix warning about signed overflow potential during comparison.Andrew Gregory2015-05-12
| | | | | | Some crazy person assumed we would have fewer than INT_MAX columns. Signed-off-by: Allan McRae <allan@archlinux.org>
* util: Use util-common for strndup in pacsort and pactreeWill Miles2015-03-03
| | | | | | | | This small refactor reduces the number of replications of the local imeplementation of strndup. Signed-off-by: Will Miles <wmiles@sgl.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* pacsort: test string is not NULL before strlenAllan McRae2015-03-03
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Update copyright notices for 2015Allan McRae2015-02-01
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Remove testdbAllan McRae2015-01-02
| | | | | | Replaced by pacman -Dk / -Dkk Signed-off-by: Allan McRae <allan@archlinux.org>
* pacsort: fix memory leakAllan McRae2014-12-27
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Fix pointer declarations to be globally consistentMicah Saint Germain2014-12-18
| | | | | | | | | | | | Refactored inconsistent pointer declarations to better improve consistency throughout the pacman codebase which will, in turn, increase readability to the user. Expected format of a pointer declaration: `typename *varname` Signed-off-by: Micah Saint Germain <micah@lexme.org> Signed-off-by: Allan McRae <allan@archlinux.org>
* pacsort: parse inputs up front into control structDave Reisner2014-11-20
| | | | | | | | | | | | | | | | | | | | | | This moves most of the parsing work out of the sorting path. The explode and splitfile functions now call input_new and append input_t structs to the list of sort candidates instead of raw strings. This lets us make smarter and easier decisions in the sorting callbacks, which are now also split into the version and file comparison methods for clarity. This fixes two bugs: 1) Incorrect ordering with filenames containing epoch in the pkgver 2) Incorrect ordering with package names which are substrings of each other (e.g. "systemd" and "systemd-sysvcompat"). Performance of the --files mode degrades slightly as a result of this change, but not unreasonably. Sorting with small inputs (5-10) doubles in runtime, but larger inputs (4000+) only increase by 20%. ref: https://bugs.archlinux.org/task/37631 Signed-off-by: Allan McRae <allan@archlinux.org>
* testdb: ignore ALPM_DB_VERSIONAndrew Gregory2014-10-19
| | | | | | | | Replaces the test for hidden files which appears to be leftover from 2e431e1cc before sync db checking was moved to a separate function. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Revert "Remove log_cb, add ALPM_EVENT_LOG instead"Andrew Gregory2014-09-30
| | | | | | | | | | | | | | | Moving logging to the event callback caused warnings under clang due to non-literal format strings and silenced all log messages when --print was used. This reverts commit cd793c5ab7689cc8cbc18277375b368060e5acfe. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Conflicts: lib/libalpm/alpm.h src/pacman/callback.c Signed-off-by: Allan McRae <allan@archlinux.org>
* strtrim: reset pointer after trimming leading whitespaceDave Reisner2014-04-21
| | | | | | | | | Breakage introduced in 92216c5864efccac when we changed the signature of strtrim to return something more useful. Fixes FS#39976. Signed-off-by: Allan McRae <allan@archlinux.org>
* Remove log_cb, add ALPM_EVENT_LOG insteadOlivier Brunel2014-03-03
| | | | | | | | When ALPM emits a log message, it still goes through _alpm_log() but instead of calling a specific log callback, it goes as an event. Signed-off-by: Olivier Brunel <jjk@jjacky.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* pactree: removed 'provision' from linear outputPierre Neidhardt2014-02-04
| | | | | | | | | | | Linear output is especially useful when piped to other commands, e.g. $ pactree -lu pacman | pacman -Qqkk - The above command would previously show errors on packages with provisions. Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Another NULL check removedSilvan Jegen2014-01-30
| | | | | Signed-off-by: Silvan Jegen <s.jegen@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* pacman: use exit status 0 for --help and --versionAndrew Gregory2014-01-30
| | | | | | | The user requesting usage or version information is not an error. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Remove ts and sw from vim modeline when noet is setFlorian Pritz2014-01-28
| | | | | | | | | | | | Forcing vim users to view files with a tabstop of 2 seems really unnecessary when noet is set. I find it much easier to read code with ts=4 and I dislike having to override the modeline by hand. Command run: find . -type f -exec sed -i '/vim.* noet/s# ts=2 sw=2##' {} + Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Allan McRae <allan@archlinux.org>
* Update copyright years for 2014Allan McRae2014-01-06
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* pactree: set full usage on DBs when registeringDave Reisner2013-09-04
| | | | | Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
* Improve --help switch output for pacman utilsJason St. John2013-09-04
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fix whitespace in pacsort.c and pactree.cJason St. John2013-07-30
| | | | | | | | Replace spaces with tabs. Remove extra spaces. Signed-off-by: Jason St. John <jstjohn@purdue.edu> Signed-off-by: Allan McRae <allan@archlinux.org>
* clarified descriptions for pactree -r (--help)Zulker Nayeen Nahiyan2013-07-22
| | | | | Signed-off-by: Zulker Nayeen Nahiyan <nahiyan02@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* testdb: quote output substitutionsAndrew Gregory2013-03-10
| | | | | | | | | | | | | | | | | 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>
* testdb: pass empty local pkglist to alpm_checkdepsAndrew Gregory2013-03-10
| | | | | | | | | | 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>
* Add format attributes to all required functionsAllan McRae2013-02-13
| | | | | | | | | 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>
* pacsort: add -f, --files option for sorting filenamesDave Reisner2013-01-28
| | | | | | | | | | | | 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>
* Fix space between control structure and open parensGerardo Exequiel Pozzi2013-01-04
| | | | | Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> Signed-off-by: Allan McRae <allan@archlinux.org>
* Fix open braces styleGerardo Exequiel Pozzi2013-01-04
| | | | | Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> Signed-off-by: Allan McRae <allan@archlinux.org>
* fix comment style // -> /* */Gerardo Exequiel Pozzi2013-01-04
| | | | | Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> Signed-off-by: Allan McRae <allan@archlinux.org>
* util/pactree: correctly free the deps list in walk_deps()Dan McGee2013-01-03
| | | | | | | | | 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>
* pactree: unindent first limbAndrew Gregory2012-11-27
| | | | | | | | 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>
* pactree: unify output between utf8 and asciiDave Reisner2012-11-27
| | | | | | | | | 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>
* pactree: fix style violationsDave Reisner2012-11-27
| | | | | | | | 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>
* pactree: autodetect and use unicode line drawing charactersDave Reisner2012-11-27
| | | | | | | | | | 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>
* pactree: style last branch node differentlyAndrew Gregory2012-11-27
| | | | | | | | | | | | | | | | | 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>
* pactree: fix --sync getopt valueAndrew Gregory2012-11-27
| | | | | | | 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>
* buildsys: eschew use of DEFS, prefer AM_CPPFLAGSDave Reisner2012-11-27
| | | | | | | 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>
* pactree: show tree vertical "limbs"Andrew Gregory2012-08-01
| | | | | | | | | | | | | | | | | 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>
* pactree: consolidate both walk_deps functionsAndrew Gregory2012-08-01
| | | | | | | | 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>