summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
* Small fix to download size lookup and a loggerDan McGee2011-01-11
| | | | | | | | These were just two small things I came across today and found could be fixed or helpful, so I've added them and I'm not sure what else to bundle them with. commit_count++ Signed-off-by: Dan McGee <dan@archlinux.org>
* Use double rather than float everywhereDan McGee2011-01-10
| | | | | | No real need to use the smaller floating point types here. Signed-off-by: Dan McGee <dan@archlinux.org>
* Progress callback cleanups and fixesDan McGee2011-01-10
| | | | | | | | * Remove a stale comment * Fix a logic error- the conditional disagreed with the comments * Remove some unnecessary floating point casts Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix some more simple conversion "errors"Dan McGee2011-01-07
| | | | | | | | None of these warn at the normal "-Wall -Werror" level, but casts do occur that we are fine with. Make them explicit to silence some warnings when using "-Wconversion". Signed-off-by: Dan McGee <dan@archlinux.org>
* Use size_t for alpm_list sizesAllan McRae2011-01-07
| | | | | | | | | | | | | There is a lot of swtiching between size_t and int for alpm_list sizes in the codebase. Start converting these to all be size_t by adjusting the return type of alpm_list_count and fixing all additional warnings given by -Wconversion that are generated by this change. Dan: a few more small changes to ensure things compile, adjusting some printf format string characters to accommodate the larger size on x86_64. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Update copyright years for 2011Allan McRae2011-01-07
| | | | | Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* vercmp: always return 0 if we perform a compareDan McGee2011-01-05
| | | | | | | | | And change the wording slightly to indicate we *print* a value, not *return* it. You can't return negative values (they get coerced to 255), so it isn't worth it to try and cram the result into the return code. Acked-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Declare all local functions staticAllan McRae2010-12-30
| | | | | | | | | | | | All functions that are limited to the local translation unit are declared static. This exposed that the _pkg_get_deltas declaration in be_local.c was being satified by the function in packages.c which when declared static caused linker failures. Fixes all warnings with -Wmissing-{declarations,prototypes}. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Detect undefined PATH_MAXAllan McRae2010-12-29
| | | | | | | | | | | | | POSIX does not require PATH_MAX be defined when there is not actual limit to its value. This affects HURD based systems. Work around this by defining PATH_MAX to 4096 (as on Linux) when this is not defined. Also, clean up inclusions of limits.h and remove autoconf check for this header as we do not use macro shields for its inclusion anyway. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* testdb: update for new database formatDan McGee2010-12-20
| | | | | | | | | Sync DB's no longer have an extracted directory, so remove the files check for those. Local databases no longer have a 'depends' file, so kill that check as well. Finally, do a little other cleanup and remove the need for PATH_MAX. Signed-off-by: Dan McGee <dan@archlinux.org>
* Always specify arguement type in function delcarationsAllan McRae2010-12-20
| | | | | | | | Always declare a function with (void) rather than () when we expect no arguements. Fixes all warnings with -Wstrict-prototypes. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Explicitly test time difference is greater than zeroAllan McRae2010-12-12
| | | | | | | | | | We are comparing a floating point number so should use an inequality rather than implicitly testing != 0. Prevents warning given by -Wfloat-equal. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Display progress bar for disk space checkingAllan McRae2010-12-12
| | | | | | | | Checking disk space needed for a transaction can take a while so add an informative progress bar. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Add configuration option to control disk space checkingAllan McRae2010-12-12
| | | | | | | | | Disk space checking is likely to be an unnecessary bottleneck to people with reasonable partition sizes so add a configuration option to allow it to be disabled/enabled as wanted. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove AC_TYPE_SIGNAL usageDan McGee2010-12-12
| | | | | | | | | This macro is deemed unnecessary by even the autoconf guys, so we really don't need to use it. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* dirent usage cleanupDan McGee2010-12-12
| | | | | | | | | | We were including the header in a lot of places it is no longer used. Additionally, use the correct autoconf macro for determining whether d_type is available as a member: HAVE_STRUCT_DIRENT_D_TYPE. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* src/util: update .gitignoreDan McGee2010-12-12
| | | | | | Add pactree and sort entries. Signed-off-by: Dan McGee <dan@archlinux.org>
* pactree: use variables for color and tree outputXavier Chantry2010-12-12
| | | | | | | | This allows to very easily support non-color and linear mode, by just setting the variables to an empty string, very much like it was done in the bash script. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
* pactree: separate dependency and print logicXavier Chantry2010-12-12
| | | | | | | | | | The deps walking code simply calls print_start, print, print_end, and all the printing logic is handled there. The unresolvable printing is disabled for now because it does not handle linear mode, and the linear and color output will be re-written. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
* pactree: rewrite in CDave Reisner2010-12-12
| | | | | | | | | | | | | | | | Use the bash script in contrib as the basis for a C rewrite using libalpm. The speedup can go from dozens of seconds to less than one second. Colorized output is preserved. The --graph option generates output that graphviz's `dot' utility will understand to draw us a graph. Output is written to stdout and it is left up to the user to pipe the data and determine the output characteristics. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
* alpm/remove.c : respect --dbonly during remove-upgradeXavier Chantry2010-12-12
| | | | | | | | | | | | | | | | | When a -Sk or -Uk operation induced a removal of an existing local package, --dbonly was not in effect and the files were all removed. Fixing this behavior was already marked as TODO in database012 pactest ------------ TODO: I honestly think the above should NOT delete the original les, it hould upgrade the DB entry without touching anything on the file stem. E.g. this test should be the same as: pacman -R --dbonly dummy && pacman -U --dbonly dummy.pkg.tar.gz ------------ Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> [Dan: small coding style touchup] Signed-off-by: Dan McGee <dan@archlinux.org>
* pacman: sort --help outputXavier Chantry2010-12-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example with pacman -Uh : $ pacman -Uh options: -b, --dbpath <path> set an alternate database location -d, --nodeps skip dependency checks -f, --force force install, overwrite conflicting files -k, --dbonly only modify database entries, not package files -r, --root <path> set an alternate installation root -v, --verbose be verbose --arch <arch> set an alternate architecture --asdeps install packages as non-explicitly installed --asexplicit install packages as explicitly installed --cachedir <dir> set an alternate package cache location --config <path> set an alternate configuration file --debug display debug messages --ignore <pkg> ignore a package upgrade (can be used more than once) --ignoregroup <grp> ignore a group upgrade (can be used more than once) --logfile <path> set an alternate log file --noconfirm do not ask for any confirmation --noprogressbar do not show a progress bar when downloading files --noscriptlet do not execute the install scriptlet if one exists --print only print the targets instead of performing the operation --print-format <string> specify how the targets should be printed Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> [Dan: small coding style touchups] Signed-off-by: Dan McGee <dan@archlinux.org>
* CLI args: update --help and manpageXavier Chantry2010-12-12
| | | | | | | | | | | | | | | The three parts (help, manpage and code) are now organized in the same way and much easier to compare : - specific options - install/upgrade options for -S and -U - transaction options for -S -R and -U - global options After this re-organization, it was easy to update and sync the three components together. Duplication is also avoided. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* pacman/deptest: reimplement with alpm_find_satisfierXavier Chantry2010-12-12
| | | | | | | | | It's very easy to re-implement the -T feature with the more generic alpm_find_satisfier rather then the more specific and less useful alpm_deptest. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix a few problems reported by clang-analyzerXavier Chantry2010-12-12
| | | | | | | One missing NULL-check and 3 dead assignments. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Ensure stdin args are correctly terminatedDan McGee2010-12-12
| | | | | | And don't require pm_targets to be empty to read from stdin either. Signed-off-by: Dan McGee <dan@archlinux.org>
* Support reading package args from stdinDave Reisner2010-11-04
| | | | | | | | | | | | | | Only occurs if no arguments were provided directly. Arguments can be separated by any amount of valid whitespace. This allows for piping into pacman from other programs or from itself, e.g.: pacman -Qdtq | pacman -Rs This is better than using xargs, as xargs will not reconnect stdin to the terminal. The above operation performed using xargs would require the --noconfirm flag to be passed to pacman. Signed-off-by: Dave Reisner <d@falconindy.com>
* Clean up all old database files and directoriesAllan McRae2010-10-14
| | | | | | | | Clean-up the previous download location of the sync database and any old extracted sync database directories which are unneeded with the tar-db backend. Signed-off-by: Allan McRae <allan@archlinux.org>
* CLI args: stricter/better parsingJakob Gruber2010-10-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | In the following, the letters SRUDQ refer to the corresponding pacman operations. Most of the work in this commit is about removing as many options as possible from the global section and moving them to where they actually belong. Additionally, --ignore{,group} are added to U and --dbonly is added to S. --dbonly added to S --asdeps moved to S/U/D --asexplicit moved to S/U/D --print-format moved to S/U/R --noprogressbar moved to S/U/R --noscriptlet moved to S/U/R --ignorepkg added to U --ignoregrp added to U -d moved to S/U/R (--nodeps) and Q (--deps) -p moved to S/U/R (--print) and Q (--file) -f moved to S/U Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* CLI args: reorganize parsingJakob Gruber2010-10-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Split parsing of CLI arguments into separate functions: parsearg_op (operations) parsearg_global (global options) parsearg_{database,query,remove,sync,deptest,upgrade} Organization strictly follows the manpage (even where the manpage is incorrect) - these cases will be fixed in the following commits. Switch cases are copy/pasted and statements unrelated to chosen operation are deleted. Parsing logic adjusted as follows: 1) Parse operation 2) If we can bail out early (duplicate op, help/version requested) do so 3) Parse arguments again: foreach arg: if arg is operation: continue tryparse_args_specific_to_op if unsuccessful tryparse_args_global if unsuccessful print error message and exit Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* util: fall cleaning on single file programsDan McGee2010-10-11
| | | | | | | | | | | * Add a bunch of static declarations where possible * Fix void functions to be proper syntax, e.g. void func(void) * Consistency fixes (such as argv references) * Remove dead str_cmp() function from testdb * Remove unneeded config.h header includes * vercmp: remove completely unnecessary string copying Signed-off-by: Dan McGee <dan@archlinux.org>
* Add wrapper around asprintf callsAllan McRae2010-09-27
| | | | | | | | | | | Not checking the return value of asprintf calls reuslts in a warning when using -D_FORTIRFY_SOURCE=2. This adds a simple wrapper around asprintf calls which checks the return value. Currently the check does nothing more than outputing a message to stderr on failure, but that is at least an improvement over silent failures. Signed-off-by: Allan McRae <allan@archlinux.org>
* Restore trimming of db and pkg extensionsDan McGee2010-09-07
| | | | | | | | These keep having to change because we are getting really good at changing the downloaded filename. Shorten the match sequences to just .db and .pkg and trim everything after and including these strings. Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix some whitespace issuesAllan McRae2010-08-23
| | | | | | | | The combination of tabs and spaces is annoying in any editor that does not use a tab width of 2 spaces. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* fgets invocation cleanupDan McGee2010-08-23
| | | | | | | | | | | | | | From the fgets manpage: fgets() reads in at most one less than size characters from stream and stores them into the buffer pointed to by s. Reading stops after an EOF or a newline. If a newline is read, it is stored into the buffer. A '\0' is stored after the last character in the buffer. This means there is no need at all to do 'size - 1' math. Remove all of that and just use sizeof() for simplicity on the buffer we plan on reading into. Signed-off-by: Dan McGee <dan@archlinux.org>
* Use the plural features of gettextDan McGee2010-07-27
| | | | | | | | | | | | | Gettext has this whole 'Plural-Form' thing that until now we haven't taken advantage of. Given that not all languages have the same plural form rules as English, take advantage of it by defining a new _n() macro which will normally define to ngettext(), and adjust a few messages as an example of how to use. There are surely other places where we do singular/plural logic without me having noticed, so further patches are welcome to fix those up too. Signed-off-by: Dan McGee <dan@archlinux.org>
* Merge branch 'maint'Dan McGee2010-07-27
|\
| * Fix compile error in certain casesDan McGee2010-07-27
| | | | | | | | | | | | | | | | | | | | | | | | | | I'm not sure why it doesn't happen everywhere, but we need <sys/stat.h> for umask and mkdir in this file. I hit this today: cc1: warnings being treated as errors util.c: In function ‘makepath’: util.c:128:2: error: implicit declaration of function ‘umask’ util.c:141:5: error: implicit declaration of function ‘mkdir’ make[2]: *** [util.o] Error 1 Signed-off-by: Dan McGee <dan@archlinux.org>
* | Check return value of chdir and getcwdAllan McRae2010-07-01
| | | | | | | | | | | | | | Prevents compiler warnings when building with -D_FORTIFY_SOURCE=2 Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Do not compare signed and unsigned typesAllan McRae2010-06-30
| | | | | | | | | | | | | | | | | | The casting of nread is safe as it is tested to be >0 when it is initally assigned. It is also being implicitly cast in the fwrite call in the line above. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Clarify testing within conditional statementsAllan McRae2010-06-21
|/ | | | | | | | | Follow the HACKING guidelines and always use != 0 or == 0 rather than negation within conditional statements to improve clarity. Most of these are !strcmp usages which is the example of what not to do in the HACKING document. Signed-off-by: Allan McRae <allan@archlinux.org>
* Remove unnecessary gettext callDan McGee2010-06-05
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Allow to include a path containing wildcardsMarc-A. Dahlhaus2010-05-18
| | | | | | | Dan: line wrapping and man page touchup. Signed-off-by: Marc-A. Dahlhaus <mad@wol.de> Signed-off-by: Dan McGee <dan@archlinux.org>
* Allow Include directive in any sectionsXavier Chantry2010-05-17
| | | | | | | | | Fix a regression of 51f9e5e40a7 that only allowed Include in repo sections. Thanks to Marc - A. Dahlhaus for reporting the issue. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Allow -Qo to perform a functional 'which'Allan McRae2010-05-11
| | | | | | | | | | | | When pacman queries the ownership of an object that is not a path, it will check in the users PATH for a match. Implements FS#8798. Dan: did some small refactoring and error message changes when PATH is searched and nothing is found. Original-patch-by: Shankar <jatheendra@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Improve documentation of -k/--dbonlyDan McGee2010-05-05
| | | | | | | We had the long option wrong in some places and its behavior wasn't documented at all with regards to -U/--upgrade. Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove unused 'z' option from getopt_long's optstringNagy Gabor2010-05-05
| | | | | | | In addition, I permuted shortopts to make it more readable. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
* Introduce -D, --databaseNagy Gabor2010-05-05
| | | | | | | | | | | | | The request of FS#12950 is implemented. On the backend side, I introduced a new function, alpm_db_set_pkgreason(), to modify the install reason of a package in the local database. On the front-end side, I introduced a new main operation, -D/--database, which has two options, --asdeps and --asexplicit. I documented this in pacman manual. I've created two pactests to test -D: database001.py and database002.py. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
* Build vercmp without needing link to libalpmDan McGee2010-05-04
| | | | | | | | Include the object file directly from the libalpm version comparison code as it is the only thing we need. This drops the dependency of vercmp on libalpm and all of the stuff we know it drags in. Signed-off-by: Dan McGee <dan@archlinux.org>
* check for valid optarg before using strdupSerge Ziryukin2010-04-26
| | | | | | Signed-off-by: Serge Ziryukin <ftrvxmtrx@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>