summaryrefslogtreecommitdiff
path: root/src/pacman/pacman.c
Commit message (Collapse)AuthorAge
* Fix formatting in parsearg_upgradeAllan McRae2015-07-14
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Update copyright notices for 2015Allan McRae2015-02-01
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Integrate testdb into pacmanAllan McRae2015-01-02
| | | | | | | | | | | | The functionality of testdb is now available in pacman. pacman -Dk will check the local database for consistency, and pacman -Dkk will check the sync databases. Note that unlike testdb, you can not specify individual sync databases to check as sync databases act as a whole and not individually. A single database can be checked using an alternative pacman.conf file. Signed-off-by: Allan McRae <allan@archlinux.org>
* shut up GCC on -Wmaybe-initialized warningsDave Reisner2014-12-18
| | | | | | Admittedly, these are totally bogus, but a clean build is a happy build. 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>
* Add --assume-installed to pacman --helpFlorian Pritz2014-11-05
| | | | | Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Allan McRae <allan@archlinux.org>
* pacman: add --confirm optionAndrew Gregory2014-10-13
| | | | | | | | | --confirm cancels the effect of a previous --noconfirm. This makes it easier for scripts to default to --noconfirm but allow users to override it. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Add --assume-installed optionFlorian Pritz2014-09-30
| | | | | | This allows to ignore specific dependencies. Signed-off-by: Florian Pritz <bluewind@xinu.at>
* pacman.c: Add -gg, -ii, and -yy to help summaryJohannes Löthberg2014-09-23
| | | | | | | | | | | | | The sync help summaries was missing the information about: * -gg: View all groups and members * -ii: View extended information * -yy: Force refresh even if DBs are up to date Fixes FS#41388. Original-work-by: Earnestly <zibeon@gmail.com> Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* pacman: set SA_RESTART for signal handlerAndrew Gregory2014-09-23
| | | | | | | Calling a signal handler interrupts some functions, most notably read() and therefore fgets(). Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
* pacman.c: simplify stdin parsingAndrew Gregory2014-08-04
| | | | | | | | Incorporate memory exhaustion and end-of-stream checks into the main loop. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* cache terminal size, add SIGWINCH handler to resetDave Reisner2014-06-29
| | | | | | | | | | | | | Refactoring getcols, yet again. We do the following: 1) Introduce a static global in src/pacman/util.c 2) getcols always prefers this cached value, but will derive it from the COLUMNS environment var, the characteristics of stdout, or a sane default (in that order). 3) Introduce a SIGWINCH signal handler to reset the cached value, meaning we only call ioctl when we don't know the value. On my machine, pacman -Syy goes from ~4300 ioctl calls to 3.
* Revert refactoring in fa0c1e14Allan McRae2014-06-29
| | | | | | | This will cause the code to break as soon as we handle another signal such as SIGWINCH... Signed-off-by: Allan McRae <allan@archlinux.org>
* pacman: Correct signal handler comment and refactorSilvan Jegen2014-06-24
| | | | | | | | | | | | | One of the comments for this function is out of sync with the code. Since the code exhibits the more sane behavior of treating SIGINT and SIGHUB the same way (by not exiting pacman when there is a commit in flight) we adjust the comment. Given this code flow, the if/else statements can be simplified somewhat as well. Signed-off-by: Silvan Jegen <s.jegen@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Move break to a new line for consistencyHong Shick Pak2014-06-23
| | | | | | | | This was the only break that didn't have its own line in the function parsearg_query. Signed-off-by: Hong Shick Pak <hong@hspak.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Clarify that -Ql prints a file listAllan McRae2014-05-25
| | | | | | FS#40234 Signed-off-by: Allan McRae <allan@archlinux.org>
* check config_new return valueAndrew Gregory2014-03-27
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Move NULL check before dereferenceSilvan Jegen2014-01-30
| | | | | Signed-off-by: Silvan Jegen <s.jegen@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Remove unneeded NULL checkSilvan 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>
* pacman.c: free string commandline optionsAndrew Gregory2014-01-28
| | | | | | | Plugs a memory leak when values were passed twice. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* pacman.c: remove unnecessary optarg checksAndrew Gregory2014-01-28
| | | | | | | | | | getopt takes care of making sure that options that require a value have one. These checks were only added to silence clang, which no longer complains about optarg being unchecked, and newer options already use optarg unchecked. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Update copyright years for 2014Allan McRae2014-01-06
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Fix whitespace and other formatting issuesJason St. John2013-11-15
| | | | | | | | | This commit: -- replaces space-based indents with tabs per the coding standards -- removes extraneous whitespace (e.g. extra spaces between function args) -- adds missing braces for a one-line if statement Signed-off-by: Jason St. John <jstjohn@purdue.edu>
* check for -1 return value from getopt_longAndrew Gregory2013-10-31
| | | | | | | | | 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>
* Use getuid instead of geteuidVladimir A. Nazarenko2013-10-31
| | | | | | | | | | | 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>
* Fix detection of joint --native and --foreign usageAllan McRae2013-10-31
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* include invalid options in error messagesAndrew Gregory2013-10-14
| | | | | | | | 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>
* pacman: die on invalid option combinationsAndrew Gregory2013-10-14
| | | | | | | Fixes FS#20950 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* rename PKG_LOCALITY_LOCAL -> PKG_LOCALITY_NATIVEAndrew Gregory2013-10-14
| | | | | | | | | 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>
* do not run scriptlets with --dbonlyAndrew Gregory2013-10-14
| | | | | | | | 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>
* imply --print from --print-formatAndrew Gregory2013-10-14
| | | | | | | | | --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>
* use non-ascii identifiers for optflagsAndrew Gregory2013-10-14
| | | | | | | | | | | | | | | | | 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>
* pacman/util: remove strsplitAndrew Gregory2013-10-14
| | | | | | | 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>
* Store fgetc output as an int.Allan McRae2013-08-21
| | | | | | | Bug exposed on ARM when char is unsigned resulting in the comparison to EOF always failing. Signed-off-by: Allan McRae <allan@archlinux.org>
* Make --unrequired filter packages that are optdep as wellOlivier Brunel2013-06-26
| | | | | | | Specify it twice to only filter direct dependencies. Signed-off-by: Olivier Brunel <i.am.jack.mail@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* die if '-' is given with empty stdinAndrew Gregory2013-06-06
| | | | | | | | | | Several operations default to all packages/repos/etc if no targets are provided. If a user provides '-' they almost certainly expect there to be targets on stdin and will be surprised if pacman falls back to the default because there are none. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Fix spelling errors using 'codespell' toolAnatol Pomozov2013-04-18
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* pacman: add -Qkk to usage() helpAndrew Gregory2013-04-09
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* ctypes.h shouldn't be included twiceSimon Gomizelj2013-04-06
| | | | | | | Earnestly spotted this on #archlinux. Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Fix typoAllan McRae2013-03-15
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* introduce colstr for colourizingSimon Gomizelj2013-03-07
| | | | | | | colstr_t colstr will hold the colourizing agents. Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* add a config settings and flag for coloursSimon Gomizelj2013-03-07
| | | | | | | | | | | | | | Colours can be enabled in two ways: - Add Color to pacman.conf. This enables colours automatically. - Use --color=WHEN where WHEN is none/auto/always. WHEN as 'never' disables colours (overrides config file), as 'auto' enables colours when stdout is a tty, and 'always' enables colours no matter what. Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* pacman: print version information in debug outputAllan McRae2013-02-09
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Better error message with "-" is specified without stdinAllan McRae2013-02-07
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Consolidate --foreign/--native filteringSimon Gomizelj2013-01-29
| | | | | | | | Also fix a small bug where pacman won't check if the sync dbs are first downloaded when invoked with --native (it should). Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* add caller prefix to alpm_logactionAndrew Gregory2013-01-28
| | | | | | | prefix defaults to "UNKOWN" if null or an empty string is provided. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> 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>
* Remove checks for geteuidAllan McRae2013-01-03
| | | | | | | The geteuid function is defined in POSIX and we will not support any operating systems without it. Signed-off-by: Allan McRae <allan@archlinux.org>