summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2013-09-18makepkg: use c-style for loops for integrity checksDave Reisner1-27/+24
These loops already maintain an independent loop counter, so cut out the middle man. While this change doesn't necessarily require that we drop support for sparse arrays, we do via this patch. A new lint check is added in check_sanity to abort when a sparse array is encountered. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-18makepkg: always use read's -r flag with filenamesDave Reisner1-5/+5
These are all cases where we're reading filenames -- any backslashes are intentional and should not be interpreted. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-18makepkg: inline creation of checksum indentingDave Reisner1-12/+7
With some simple math and printf formatting tokens, we can create the whitespace necessary for this without the need for a loop and string concatentation. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-18makepkg: cleanup a few format string injectionsDave Reisner1-5/+5
Signed-off-by: Dave Reisner <dreisner@archlinux.org> 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 Reisner3-0/+85
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-04libalpm: introduce a usage level for reposDave Reisner9-4/+107
This defines a level of interest a user has in a repository. These are described by the bitmask flags in the alpm_db_usage_t enum: ALPM_DB_USAGE_SEARCH: repo is valid for searching ALPM_DB_USAGE_INSTALL: repo is valid for installs (e.g. -S pkg) ALPM_DB_USAGE_UPGRADE: repo is valid for sysupgrades ALPM_DB_USAGE_ALL: all of the above are valid Explicitly listing the contents of a repo will always be valid, and the repo will always be refreshed appropriately on sync operations. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-04proto: remove redundancy in cd for each functionDave Reisner2-7/+7
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-04makepkg: add support for sha224 checksumsDave Reisner1-1/+1
Implements FS#36776. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-04makepkg: unify list of known hash algorithmsDave Reisner1-15/+16
Unifying this list makes adding new algorithms easier. There's also some menial cleanup in this patch to avoid use of eval and properly treat lists of data as array instead of simple strings. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-04libalpm: avoid name space conflictSami Kerola1-35/+35
The symbol 'err' refers to err() from err.h, and is wisest to be avoided as a variable name. Reference: http://man7.org/linux/man-pages/man3/err.3.html Signed-off-by: Sami Kerola <kerolasa@iki.fi> 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-09-04makepkg.8: fix typo in usageDave Reisner1-1/+1
Looks like I fat fingered something when I refactored the original submissions. Woops. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-04alpm: log errors for scriptlets terminated by a signalDave Reisner1-0/+9
Fixes FS#36618. Signed-off-by: Dave Reisner <dreisner@archlinux.org> 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-21conflict.c: fix directory ownership checkAndrew Gregory3-4/+45
* append "/" to directories before searching package file lists * use lstat over stat so symlinks aren't resolved * fix the inverted check for stat's return value Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21doc/repo-add: Add note on when signatures are added to the dbOlivier Brunel1-0/+3
Signed-off-by: Olivier Brunel <i.am.jack.mail@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21makepkg: allow make-style environment var overridesDave Reisner2-1/+16
This allows for VAR=value and VAR+=value variable declarations. Signed-off-by: Dave Reisner <dreisner@archlinux.org> 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 McRae5-6/+6
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-08-21pactest: remove results summaryAndrew Gregory2-71/+1
This functionality can be provided by a test harness. Having pactest output this information as well clutters the result log created by automake. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21integrate tests with automakeAndrew Gregory5-21/+960
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21pactest: accept test names without a switchAndrew Gregory2-19/+6
This removes the --test switch, making it easier to call pactest from a test harness. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21provide default values for test scriptsAndrew Gregory4-24/+21
Our test scripts currently require that the first argument be the library or binary to be tested. This makes integrating them with automake which doesn't have a mechanism for passing specific arguments to individual tests. Instead, provide a default built from paths in the environment which can be provided to all test scripts by automake. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21convert pactest to TAP outputAndrew Gregory7-59/+121
Each test produces a single TAP result with the rules run in a sub-test. This reduces output when run under automake and makes it possible to continue setting expectfailure at the test level rather than per-rule. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21pactest: treat unknown rules as failuresAndrew Gregory2-6/+3
Tests should only be skipped when they aren't relevant, not when the test itself is bad. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21convert test scripts to tap outputAndrew Gregory4-46/+58
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21query006: only set expectfailure on 32-bit systemsAndrew Gregory1-1/+4
Use the architecture of the python interpreter running the test to detect 32bit systems. 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-30Remove setlocale usage from the backendAllan McRae3-22/+1
Using setlocale in the backend is bound to lead to frontend issues and we have have been using epoch in our databases since April 2007 (commit 47622eef). Remove support for old style times. Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30Warn when directory ownership differs between filesystem and packageAllan McRae2-7/+27
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 makepkg.sh.in and makepkg-template.pl.inJason St. John2-5/+5
Replace spaces with tabs in one instance. Remove extra spaces. 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. 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-30pacdiff: provide an --output option to show any .pac* filesJonathan Frazier1-1/+10
This is an option to just echo's the pacnews/pacsaves instead of merging or removing them. This can be used to check the config status such as in a cron job without modifying the system. Signed-off-by: Jonathan Frazier <eyeswide@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30pacdiff: make pacmandb search the default type.Jonathan Frazier1-2/+2
Signed-off-by: Jonathan Frazier <eyeswide@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30pacdiff: improve speed, accuracy finding active configs using pacmandbJonathan Frazier1-6/+46
This is a new search type, using -p or --pacmandb options. It reads config file locations directly from the local pacman db. It will find active configs anywhere they are defined in installed packages. It is not dependant on outside configs such as updatedb.conf or scanning a large set of directories for find. This will find more pacnews than find when searching with the current default of /etc, and it is faster than both find and updatedb when searching the entire fs. When run directly after an update, the local db is more likely to be cached than all files in /etc or / as other methods read. This will increase performance further post upgrade. After a package is removed and a pacsave is created, this method will not find these pacsaves until the base config is added to the local db again. These files have no influence in a working system and only take up a few blocks of disk space. Active configs need to be dealt with immediately to keep a system working. pacsaves related to removed configs can remain for weeks or months without problems. I would recommend occasionally running other methods such as --locate to remove them. Signed-off-by: Jonathan Frazier <eyeswide@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30pacdiff: rework search type handling, add --find optionJonathan Frazier1-11/+22
Change cmd tests to if (( USE_FIND ))... as it is cleaner. All search cmds have an option and a variable initialized to zero. The active option should be set to 1. Add a switch to exclude multiple search options. set the default when all are equal to zero. Signed-off-by: Jonathan Frazier <eyeswide@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30pacdiff: add --nocolor option for the terminally challenged.Jonathan Frazier1-2/+5
Allow colors to be disabled for use on broken/serial terminals. Signed-off-by: Jonathan Frazier <eyeswide@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>