summaryrefslogtreecommitdiffstats
path: root/src/pacman/pacman.c
AgeCommit message (Collapse)AuthorFilesLines
2011-06-09Require handle argument to alpm_logaction()Dan McGee1-1/+1
This is the first in a series of patches to update the API to remove the implicit global handle variable. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-07Revamp pacman setup code to handle new alpm initialize routineDan McGee1-40/+12
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-01Let pacman -v print GPG DirPang Yan Han1-0/+1
Signed-off-by: Pang Yan Han <pangyanhan@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-20Merge branch 'maint'Dan McGee1-2/+3
Conflicts: lib/libalpm/trans.c src/pacman/query.c
2011-05-19Coding style cleanups; add a null checkDan McGee1-1/+2
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-16Ensure --print doesn't enable --noconfirm when not expectedDan McGee1-1/+1
This is at best a hack around the way we currently do our --print magic, but at least prevents someone from shooting themselves in the foot as indicated in FS#24287. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05Make config parsing a two-part affairDan McGee1-1/+1
This ensures we call any alpm_option type functions before registering databases, making sure all paths and other defaults (e.g. sig verification levels) have been set first. This will ensure we can continue to allow crazy config files where [options] doesn't come first. The diffstat on this commit is misleading; view with -w/--ignore-all-space to get a better idea of what needed to be touched. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05Move parseconfig to conf.cDan McGee1-590/+5
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-21Header inclusion cleanupDan McGee1-2/+0
This does touch a lot of things, and hopefully doesn't break things on other platforms, but allows us to also clean up a bunch of crud that no longer needs to be there. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-21syntax: if/while statements should have no trailing spaceDan McGee1-24/+24
This is the standard, and we have had a few of these introduced lately that should not be here. Done with: find -name '*.c' | xargs sed -i -e 's#if (#if(#g' find -name '*.c' | xargs sed -i -e 's#while (#while(#g' Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-21Allow VerifySig to act as a default verification in [options]Dave Reisner1-0/+12
* add _alpm_db_get_sigverify_level * add alpm_option_{get,set}_default_sigverify And set the default verification level to OPTIONAL if not set otherwise. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-21style cleanup: cast as (type *) not (type*)Dave Reisner1-2/+2
Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-21New VerbosePkgLists optionJakob Gruber1-0/+3
If enabled, displays package lists for upgrade, sync and remove operations formatted as a table. Falls back to default list display if insufficient terminal columns are available. Example output: :: Starting full system upgrade... :: Replace libjpeg with testing/libjpeg-turbo? [Y/n] resolving dependencies... looking for inter-conflicts... Remove (1): Name Old Version Size libjpeg 8.3.0-1 0.83 MB Total Removed Size: 0.83 MB Targets (5): Name Old Version New Version Size libjpeg-turbo 1.1.0-1 0.20 MB linux-firmware 20110201-1 20110227-1 8.23 MB ncurses 5.7-4 5.8-1 0.92 MB ppl 0.11.1-1 0.11.2-1 2.74 MB v4l-utils 0.8.1-1 0.8.3-1 0.23 MB Total Download Size: 12.32 MB Total Installed Size: 58.82 MB Signed-off-by: Jakob Gruber <jakob.gruber@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-21Remove ShowSize optionJakob Gruber1-3/+0
Dan: The commit message originally referenced "VerbosePkgLists", but I'm going to change the name of the option. In addition, this patch serves a purpose being standalone- we should really do things like this with -S --print and hopefully -Q --print in the future. Signed-off-by: Jakob Gruber <jakob.gruber@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-16libalpm: consistently use int as return type for option settersRémy Oudompheng1-5/+8
Currently the only error case then when handle == NULL. However several handle functions return -1 on this error, and a uniform API makes things simpler. Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
2011-04-05pacman.c : useless extra parenthesisXavier Chantry1-1/+1
clang 3.0 git complained about these Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-28Merge branch 'maint'Dan McGee1-8/+9
Conflicts: lib/libalpm/deps.c
2011-03-25Update usage instruction stringsDan McGee1-8/+9
* Address FS#23433 by documenting -d vs. -dd * Drop the useless "as well", "also", "too", and "that won't break packages" strings from -R usage * Fix alignment of multiline strings in source (no string change) Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-25Merge branch 'maint'Dan McGee1-0/+4
2011-03-25Add -T, --deptest to usage messageRay Kohler1-0/+4
Fixes FS #23369 Signed-off-by: Ray Kohler <ataraxia937@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23Added gpg verification options per repo to the config file.Xavier Chantry1-0/+18
Once we do this, add support for VerifySig to pactest. We just check if the repo name contains Always, Never or Optional to determine the value of VerifySig. The default is Never. pacman uses Always by default but this is not suitable for pactest. Original-work-by: shankar <jatheendra@gmail.com> Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23Let pacman specify GnuPG's home directory.Chris Brannon1-0/+22
GnuPG looks for configuration files and keyrings in its home directory. For a user, that is typically ~/.gnupg. This patch causes pacman to use /etc/pacman.d/gnupg/ as the default GnuPG home. One may override the default using --gpgdir on the command-line or GPGDir in pacman's configuration file. Signed-off-by: Chris Brannon <cmbrannon@cox.net> Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-21Merge branch 'maint'Dan McGee1-10/+8
Conflicts due to change in return calling style. Conflicts: src/pacman/pacman.c src/pacman/sync.c
2011-03-21Restore --debug/--verbose output without a primary operationDan McGee1-7/+7
This is by no means a guarantee of this behavior remaining the same in the future, but it is easy enough to do what we used to in this case by delaying any sort of error condition until after we are completely done parsing options. Addresses FS#23370. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-21Remove unnecessary NULL checkDan McGee1-3/+1
fp can never be NULL at this point in the code, proven by Coccinelle. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-21Style change: return(x) --> return xDan McGee1-51/+51
This was discussed and more or less agreed upon on the mailing list. A huge checkin, but if we just do it and let people adjust the pain will end soon enough. Rebasing should be relatively straighforward for anyone that sees conflicts; just be sure you use the new return style if possible. The following semantic patch was used to do the change, along with some hand-massaging in order to preserve parenthesis where appropriate: The semantic match that finds this problem is as follows, although some hand-massaging was done in order to keep parenthesis where appropriate: (http://coccinelle.lip6.fr/) // <smpl> @@ expression a; @@ - return(a); + return a; // </smpl> A macros_file was also provided with the following content: Additional steps taken, mainly for ASSERT() macros: $ sed -i -e 's#return(NULL)#return NULL#' lib/libalpm/*.c $ sed -i -e 's#return(-1)#return -1#' lib/libalpm/*.c Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-17Warn but don't error for unknown pacman.conf directivesDan McGee1-26/+24
This makes all the pacman developers' jobs harder as we have to switch files whenever running multiple pacman versions and are using newly introduced options. Instead of erroring out, print warnings and continue on. This patch also fixes a const-correctness issue. We immediately cast a 'const char *' to a 'char *' in setrepeatingoption(), which is just plain wrong as we manipulate the underlying string. Fix the types and remove the now unnecessary variable. Finally, a few messages change here for consistency and clarity and because we continue parsing rather than bailing out on a problem. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-17Only read from stdin if '-' is provided as a targetDave Reisner1-2/+6
This prevents a regression for people who enjoy piping yes to pacman to avoid prompts. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-31make -d less strict; add -dd optionFlorian Pritz1-1/+7
-d skips checking the version of a dependency. -dd skips the whole dependency check. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Florian Pritz <bluewind@server-speed.net> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-31Allow both cleanmethod values to be specified at the same timeDan McGee1-9/+13
No reason to disallow this- it allows keeping even more packages around in the cache. Test cases included for this case and to ensure the default behavior is preserved. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-29Remove need to explicitly register the local DBDan McGee1-9/+0
Perform the cheap struct and string setup of the local DB at handle initialization time to match the teardown we do when releasing the handle. If the local DB is not needed, all real initialization is done lazily after DB paths and other things have been configured anyway. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-12Merge branch 'maint'Dan McGee1-2/+2
Conflicts: lib/libalpm/be_files.c
2011-01-12Make debug config messages consistent in capitalizationDan McGee1-2/+2
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-08Fix some more simple conversion "errors"Dan McGee1-3/+3
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>
2011-01-08Update copyright years for 2011Allan McRae1-2/+2
Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-30Declare all local functions staticAllan McRae1-1/+1
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>
2010-12-13Add configuration option to control disk space checkingAllan McRae1-0/+2
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>
2010-12-13Remove AC_TYPE_SIGNAL usageDan McGee1-1/+1
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>
2010-12-13alpm/remove.c : respect --dbonly during remove-upgradeXavier Chantry1-2/+1
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>
2010-12-13pacman: sort --help outputXavier Chantry1-51/+98
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>
2010-12-13CLI args: update --help and manpageXavier Chantry1-83/+81
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>
2010-12-13Ensure stdin args are correctly terminatedDan McGee1-3/+4
And don't require pm_targets to be empty to read from stdin either. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-11-05Support reading package args from stdinDave Reisner1-0/+33
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>
2010-10-12CLI args: stricter/better parsingJakob Gruber1-32/+45
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>
2010-10-12CLI args: reorganize parsingJakob Gruber1-160/+280
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>
2010-07-01Check return value of chdir and getcwdAllan McRae1-2/+13
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>
2010-06-30Do not compare signed and unsigned typesAllan McRae1-1/+1
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>
2010-05-18Allow to include a path containing wildcardsMarc-A. Dahlhaus1-2/+29
Dan: line wrapping and man page touchup. Signed-off-by: Marc-A. Dahlhaus <mad@wol.de> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-18Allow Include directive in any sectionsXavier Chantry1-12/+16
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>
2010-05-05Improve documentation of -k/--dbonlyDan McGee1-1/+2
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>