summaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2018-01-19add pacman-conf utilityAndrew Gregory3-1/+455
Parsing pacman's configuration file is non-trivial and extremely difficult to do correctly from scripts; even our own do it incorrectly. pacman-conf is a dedicated tool specifically to allow scripts to parse config files, getting the same value that pacman itself would use. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-18extract default settings to separate functionAndrew Gregory2-78/+89
Default values for configuration settings were being set during alpm setup and in some cases were never saved back to the original config struct. Refactoring all default settings into a separate function and saving them onto the original config struct will allow pacman-conf to resolve the defaults without having to setup alpm. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-18extract raw config file parserAndrew Gregory2-4/+10
To allow pacman-conf to parse the configuration file without having to also setup alpm. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-09Handle empty string passed to query_ownerAllan McRae1-0/+5
Passing an empty string to pacman -Qo results in: error: No package owns <first directory in $PATH> Catch empty strings and report an error. Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-06vercmp: remove --usage variant of the -help optionEli Schwartz1-2/+1
I think two ways to ask for this are enough for everyone, and we have never documented this anyway. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2017-07-28Fix coding style issue in pacman/util.cMichael Straube1-4/+8
Add missing braces to some one-line if blocks. Signed-off-by: Michael Straube <straubem@gmx.de> Signed-off-by: Allan McRae <allan@archlinux.org>
2017-07-11clarify broken dependency error messagesAndrew Gregory1-5/+6
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2017-07-11provide command for downloading missing databasesAndrew Gregory1-2/+3
This is primarily to help users who are not aware that -F operations use a separate set of databases that need to be separately downloaded. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2017-05-16remove unused byte from user agent bufferAndrew Gregory1-1/+1
snprintf prints at most n bytes including the terminating '\0'. The extra reserved byte was never being used. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2017-05-16check for overflow when setting HTTP_USER_AGENTAndrew Gregory1-1/+6
gcc7 issues a warning about a potential overflow if left unchecked. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2017-05-16query_fileowner: avoid buffer overflowAndrew Gregory1-0/+1
Copying a string into a buffer that has just been determined to not be able to hold it is obviously incorrect. The actual error handling appears to have been unintentionally removed in 47762ab687959e48acc2de8592fcf3ba3cfa502b. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2017-05-08free memory for --overwrite listsAndrew Gregory1-0/+1
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2017-04-17add --sysroot optionAndrew Gregory3-6/+23
--root is not sufficient to properly operate on a mounted guest system. Using --root still uses the host system's configuration and there is no way to correctly use the guest configuration without manually modifying any Include directives. --sysroot provides an easier way to operate on a guest system by chrooting immediately after option parsing before configuration parsing or performing any operations. It is currently limited to the root user, but that's enough for restoring a guest system to a working state, which is the primary intended use case. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2017-04-17conflict: include owner for filesystem conflictsAndrew Gregory1-2/+7
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2017-04-12deprecate --force in favor of --overwriteAndrew Gregory1-1/+2
--force is widely misunderstood and the same effect can now be achieved with --overwrite, which is better named and can be used more safely. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2017-04-12add --overwrite option to ignore file conflictsAndrew Gregory3-0/+10
Allows for safer, more fine-grained control for overwriting files than --force's all-or-nothing approach. Implements FS#31549. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2017-04-04parse stdin as newline-separatedAndrew Gregory1-32/+23
Newline-separated input is more reliable because most of the arguments we accept over stdin can validly contain spaces but not newlines. Resolves FS#52992 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-13Introduce a 'disable-download-timeout' optionChristian Hesse3-1/+13
Add command line option ('--disable-download-timeout') and config file option ('DisableDownloadTimeout') to disable defaults for low speed limit and timeout on downloads. Use this if you have issues downloading files with proxy and/or security gateway. Signed-off-by: Christian Hesse <mail@eworm.de> Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04ini: only recognize comments at beginning of lineAndrew Gregory1-7/+2
Allows the hash sign to be used in values in config files and hooks. Fixes #48702 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04pacman: ensure linkage against libarchiveDave Reisner1-1/+4
Fixes build on ubuntu/debian platforms. Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04Update copyright yearsAllan McRae28-29/+29
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-12-05Suppress more output messages on successful -D options with -qAllan McRae1-4/+6
Suppress output on successful use of --asdeps and --asexplicit. Signed-off-by: Allan McRae <allan@archlinux.org>
2016-12-05Give a "success!" message on database checkPatrick Eigensatz2-0/+9
'pacman -Dk' prints a "success!" message if there were no errors. It is possible to suppress the output using the '-q / --quiet' flag. This implements the feature discussed at https://bugs.archlinux.org/task/50087 Signed-off-by: Patrick Eigensatz <patrick.eigensatz@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-12-05Remove pacsortAllan McRae3-558/+1
Moved to the pacman-contrib project Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-22Represent bitfields as ints, not enumsIvy Foster9-32/+34
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>
2016-10-22Remove pactreeAllan McRae3-516/+1
This has been moved to the pacman-contrib project. Signed-off-by: Allan McRae <allan@archlinux.org>
2016-09-25Do not #define _RESERVED_IDENTIFIERSIvy Foster9-27/+27
Signed-off-by: Ivy Foster <ivy.foster@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30Normalize alpm download callback's frontend cb argumentsIvy Foster1-8/+11
When curl calls alpm's dlcb, alpm calls the frontend's cb with the following (dlsize, totalsize) arguments: 0, -1: initialize 0, 0: no change since last call x {x>0, x<y}, y {y>0}: data downloaded, total size known x {x>0}, x: download finished If total size is not known, do not call frontend cb (no change to original behavior); alpm's callback shouldn't be called if there is a download error. See agregory's original spec here: https://wiki.archlinux.org/index.php/User:Apg#download_callback Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30Handle all POSIX compliant systems in mbscasecmp.Tobias Stoeckmann1-3/+5
The width of wchar_t is allowed to be of the same width as long, according to standards. The return type of mbscasecmp is int though. On amd64 with a 32 bit int, this means that mbscasecmp can return zero (indicating that strings are equal) even though the input strings differ. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30Remove obsolete TODOAllan McRae1-1/+0
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30Turn off colours once finished using themAllan McRae2-4/+5
The colour of the package version could leak onto the next line in both -Qo and -Fo. Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-18Report local file URL for -Sp operations if package is in cacheAllan McRae1-3/+24
When using "pacman -Sp" operation to get URLs of packages to download, it is useful to know which packages are already in the file cache and do not need downloaded. Print packages in the cache with a file:// prefix. e.g $ pacman -Sp glibc file:///var/cache/pacman/glibc-2.23-1-x86_64.pkg.tar.xz Also use package locations in case statements rather than opersations. This allows the ALPM_PKG_SYNCDB to fall thorough to just printing the package name for weird serverless repo setups. Fixes FS#15868 Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05pacsort help clearly states that files contain inputs to be sortedAshley Whetter1-1/+4
Fixes FS#44121 Signed-off-by: Ashley Whetter <ashley@awhetter.co.uk> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05Add colour to the output of the "-{F, Q}o" operations.Xavion2-4/+7
Matching output for -s operations, the repository is coloured 'magenta', the package name is 'bold', and the version is outputted in 'green'. Signed-off-by: Xavion <Xavion (dot) 0 (at) Gmail (dot) com> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05Add colour to group selection dialogXavion2-4/+6
Colour the group name in 'blue' and the repository names in 'magenta'. Signed-off-by: Xavion <Xavion (dot) 0 (at) Gmail (dot) com> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05Handle provides with -QAllan McRae1-0/+3
It is useful to be able to use "pacman -Qi" on any dependency, even if that dependency is a provide. For example, on Arch Linux systems, "sh" is provided by the "bash" package, and many packages depend on "sh". Querying the package that provides the "sh" dependency currently requires first searching for "sh". This patch allows the use of "pacman -Qi" on a provide. Fixes FS#20650. Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05pacman_query: move error messages into relevant if statementsAllan McRae1-16/+16
This ensures any additions to these test do not have to rely on the correct error condition being set by libalpm. Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05Remove notification of system upgrade when only printing URLsAllan McRae1-3/+5
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05Print replacements when using -SupAllan McRae1-4/+8
When printing a list of URLs of packages to be updated, pacman was ignoring any replacements that would be made in the update process. Fixes FS#35812 Signed-off-by: Allan McRae <allan@archlinux.org>
2016-03-28Do not add root prefix twice when checking database filesAllan McRae1-24/+30
When checking .INSTALL and .CHANGELOG files in the mtree file, we need to find the path they are stored in the local database. This was appending the root prefix twice as alpm_option_get_dbpath already returns the absolute path to the database. While fixing that issue I added checks that the paths for the database files were not longer than PATH_MAX. Fixes FS#48563. Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26use multi-byte character matching for user inputAndrew Gregory1-2/+34
Fixes FS#47992 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26Failed database downloads cause transaction to stopAllan McRae1-10/+3
Previously, we errored only if all databases failed to download. If any database downloads fail, we are unable to determine whether an update is still considered safe. So now if any database download fails, the transaction is aborted (after attempting all database downloads). Fixes FS#47599. Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26Use versions specified in optdependsAllan McRae1-2/+2
Checking install status and if a package is optionally required on removal now considers the version of the optdepend. Fixes FS#44957. Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26Consider provides when labelling optdepends status as pending installAllan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-23Regenerate translations for 5.0.1Allan McRae45-4149/+7581
2016-02-23Manually fix space before ellipses in translationsAllan McRae49-97/+97
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-23Fix inconsistent status messagesStefan Tatschner1-1/+1
This patch fixes an inconsistency in the status messages. :: Proceed with installation? [Y/n] :: Retrieving packages ... <--- Space before "...". blas-3.6.0-4-x86_64 cblas-3.6.0-4-x86_64 lapack-3.6.0-4-x86_64 (3/3) checking keys in keyring (3/3) checking package integrity (3/3) loading package files (3/3) checking for file conflicts (3/3) checking available disk space :: Processing package changes... <--- No space before "..." (1/3) upgrading blas (2/3) upgrading cblas (3/3) upgrading lapack Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-23Pull translation updates from TransifexAllan McRae44-5851/+2444
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-20dump_pkg_info: fix wide character title alignmentAndrew Gregory1-5/+12
The padding added to the end of the title was based on the return value of mbstowcs which is the number of characters. This caused alignment issues for languages with characters that span multiple columns. Instead, base the padding on the number of columns needed by the translated string as returned by wcswidth. Fixes #47980 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-30Update translationsAllan McRae50-672/+2477
Signed-off-by: Allan McRae <allan@archlinux.org>