summaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2013-11-08support ALPM_SIG_USE_DEFAULT for file siglevelsAndrew Gregory1-3/+1
This brings file siglevels in line with how db siglevels are handled. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-08Remove spaces between the opening "if" and the opening parenthesisJason St. John2-2/+2
Signed-off-by: Jason St. John <jstjohn@purdue.edu> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31upgrade.c: use iterator variableAndrew Gregory1-3/+3
remote was being used to loop over itself, making the FREELIST ineffective. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31check for -1 return value from getopt_longAndrew Gregory1-8/+4
getopt_long returns -1 when it has finished parsing all args. A return value of 0 indicates that a flag was set directly by getopt_long and parsing should continue. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31callback.c: check for negative xfered sizeAndrew Gregory1-1/+1
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31pacman -Si/-Qi: Autodetect best fitting file size unitFlorian Pritz1-2/+5
I've tracked this back to e223366 and it looks like this just forces KiB because back then humanize_size didn't exist, but the size was just divided by 1024 to keep it somewhat readable. When humanize_size got introduced in 3c8a448 this was just carried over. The unit detected for "Download Size" is reused for "Installed Size" to make it easier to read. Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31Use getuid instead of geteuidVladimir A. Nazarenko1-1/+1
If someone gives the pacman binary setuid permissions, the geteuid check allows it to start running but subsequently fail. As we do not support setting pacman setuid, use getuid to check permissions instead. FS#37174. Signed-off-by: Vladimir A. Nazarenko <naszar@ya.ru> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31Indicate ignored packages in -Qu outputAllan McRae1-0/+4
Add "[ignored]" in the "pacman -Qu" output after packages that have their upgrades ignored. Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31Fix detection of joint --native and --foreign usageAllan McRae1-1/+2
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31List signiture keyids in -Sii outputAllan McRae1-2/+13
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14include invalid options in error messagesAndrew Gregory2-2/+8
On invalid combinations of flags we were only printing the unhelpfully vague message "invalid option". Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14pacman: die on invalid option combinationsAndrew Gregory1-0/+140
Fixes FS#20950 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14rename PKG_LOCALITY_LOCAL -> PKG_LOCALITY_NATIVEAndrew Gregory3-5/+5
PKG_LOCALITY_LOCAL was confusing because the enum is used with -Q, so all packages are "local". Also reversed the config->op_q_locality assignment so that the locality matches the option used. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14do not run scriptlets with --dbonlyAndrew Gregory1-0/+1
Running an install script does not fall under "Adds/removes the database entry only." Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14imply --print from --print-formatAndrew Gregory1-0/+1
--print-format is totally useless without --print. Implying --print will also save us the hassle of checking it when we add transaction option validation. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14use non-ascii identifiers for optflagsAndrew Gregory2-70/+206
Removes the overlap between optflags for different operations that allowed non-sensical combinations of flags such as: $ pacman -Si --changelog $package --changelog is -c, meaning --clean for -S $ pacman -Q --sysupgrade --sysupgrade is -u, meaning --upgrades for -Q Also add a few missing braces. Original-work-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14pacman/util: remove strsplitAndrew Gregory3-40/+5
strsplit was used in only one place and did the same thing as strtok. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14Display old and new version in pacman -Qu outputFlorian Pritz1-1/+8
This changes the output from "foo 1.0" to "foo 1.0 -> 1.1" which makes cronjobs that mail the -Qu output way more helpful. Signed-off-by: Florian Pritz <bluewind@xinu.at> 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-04pacman: add front end support for repo usage levelDave Reisner2-0/+64
Add a "Usage" key to the repo section of the config which allows for the tokens "Search", "Install", "Upgrade", "All", which correspond to values in the alpm_db_usage_t enum. Users can specify "Usage" multiple times for a given repo, or multiple flags per "Usage" line and they will be OR'd together. If unspecified, the default is full usage of the repo. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-04pacman/util.c: use switch when there are fall through statementsSami Kerola1-8/+6
An 'if' clause with empty statement is allowed, but unusual construct. When 'if' is used this way the statement should at least have orphan semicolon ';'. For empty statements 'switch' feels like a native way express what is meant. Signed-off-by: Sami Kerola <kerolasa@iki.fi> [Allan] Keep comment Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-04Improve --help switch output for pacman utilsJason St. John6-28/+28
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-09-04common: compare value rather than pointer addressSami Kerola1-1/+1
Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21Store fgetc output as an int.Allan McRae1-1/+3
Bug exposed on ARM when char is unsigned resulting in the comparison to EOF always failing. Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21check.c: break backup file search loop after matchAndrew Gregory1-1/+1
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21Do not refer to FlySpray numbersAllan McRae2-3/+3
These references to bug numbers assume we will forever be using that bug tracker. It is better to properly comment the code instead (which was done in almost all cases anyway). Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21ini.c: give recursion limit file scopeAndrew Gregory1-3/+5
The recursion limit is an artificial limitation imposed to prevent memory exhaustion in a recursive function. Giving it file-level scope increases its visibility. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21ini.c: make errors in includes fatalAndrew Gregory1-1/+5
If an error in the main file would be fatal there is little reason to ignore the error in an included file. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21ini.c: reuse line bufferAndrew Gregory1-5/+5
By the time we make the recursive call we have already finished with the line buffer, making it safe to reuse. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21conf.c: extract ini parsing code to separate filesAndrew Gregory4-158/+245
Move _parseconfig to ini.c as _parse_ini and create a convenient wrapper for the public API. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21conf.c: pass _parse_directive as a callbackAndrew Gregory1-8/+12
This will allow passing arbitrary key/value handlers. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21conf.c: move section handling out of _parseconfigAndrew Gregory1-15/+34
_parseconfig now tracks the current section name directly so that the name stored in the section struct is just a pointer to the one stored by _parseconfig. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21conf.c: move directive parsing out of _parseconfigAndrew Gregory1-17/+21
Include directives no longer have to be within a section. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21conf.c: move repo parsing out of _parseconfigAndrew Gregory1-26/+39
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21conf.c: add parse_options to section_tAndrew Gregory1-13/+13
This consolidates all of our state information into a single variable. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30Report missing directory if we can not initialise alpm libraryAllan McRae1-2/+2
When pacman failed to initialise the alpm library due to the database directory being missing (either via the root not existing or the database directory itself not existing), it just printed the non-informative message "could not find or read directory". Add the directory information the the error output. E.g.: error: failed to initialize alpm library (could not find or read directory: /this/does/not/exist/var/lib/pacman/) Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30Warn when directory ownership differs between filesystem and packageAllan McRae1-6/+12
We currently only warn if a directory's permissions differ, but using -Qkk on my system shows that directory permissions tend to change in packages reasonably frequently without notice. Provide a warning in such cases so that it can be altered. Example output: (1/1) reinstalling nginx warning: directory ownership differs on /var/lib/nginx/proxy/ filesystem: 33:0 package: 0:0 Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30Only note backup file changes with -QkkAllan McRae1-11/+36
Backup files are expected to be changed and should not be flagged by -Qkk. Note changed back-up files in -Qkk but do not count them as altered. Do not report backup files in -Qqkk. Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30Fix whitespace in pacsort.c and pactree.cJason St. John2-20/+20
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-22Corrected return codes for Sg flagAshley Whetter1-1/+10
Non-zero is now returned if a group is searched for that doesn't exist. Fixes FS#36097. Signed-off-by: Ashley Whetter <awhetter.2011@my.bristol.ac.uk> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-22Fix typoAllan McRae1-1/+1
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-07-22Clarify inter-conflicts messageAllan McRae1-1/+1
Use a clear message rather than using a made up word to describe what we are doing. Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-22Update gitignore files for use with autoreconfAllan McRae1-1/+9
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-22Remove autotools filesAllan McRae1-444/+0
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-05do not check error from close(2)Dave Reisner1-4/+1
On operating systems we support, the behavior is always such that the kernel will do the right thing as far as invalidating the file descriptor, regardless of the eventual return value. Therefore, potentially looping and calling close multiple times is wrong. At best, we call close again on an invalid FD and throw a spurious EBADF error. At worst, we might close an FD which doesn't belong to us when a multi-threaded application opens its own file descriptor between iterations of the loop. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-05Consolidate and improve table implementationsSimon Gomizelj1-115/+122
Implement both the VerbosePkgList and the summary message with the same table. Improve VerbosePkgList by caching attributes and cell's lengths instead of recaculating them. Right align every cell that containing a file size in both the VerbosePkgList and the summary. Simplify the printf statements and the alignment application. Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-26query_fileowner: resolve trailing . or .. in pathsAndrew Gregory1-1/+1
The full path needs to resolved any time it ends with "." or "..", not just when those are the entire path. This allows strange-but-valid paths such as: "/home/." to be queried. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-26query_fileowner: remove useless path variableAndrew Gregory1-27/+3
We no longer need it for resolving package files and using it to resolve root is unnecessary as alpm does that for us. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-26query_group: allow package filtersAndrew Gregory1-41/+47
Relocated query_group() to allow calling filter(). Fixes FS#19716 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>