summaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2011-06-03Merge branch 'maint'Dan McGee3-20/+22
Conflicts: src/pacman/callback.c
2011-06-03Show net upgrade size on -U/-S operationsDan McGee2-2/+13
If it is different than the raw installed size metric we already show, compute the net upgrade size. For some sync operations, this can even be negative if newer packages are smaller than the ones they replace locally. Implements FS#12566. Example: Targets (1): telepathy-glib-0.14.7-1 Total Download Size: 1.07 MiB Total Installed Size: 15.72 MiB Net Upgrade Size: -0.29 MiB Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-01Ensure list_display works on outputs of unknown widthDan McGee3-19/+21
If getcols() returns 0, we were getting stuck before in a loop of no return. Teach getcols() to take a default value to return if the width is unknown, and use this everywhere as appropriate. Also make a few other cleanups while diagnosing this issue, such as const-ifying some variables. Noticed-by: Dave Reisner <d@falconindy.com> 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 McGee2-2/+7
Conflicts: lib/libalpm/trans.c src/pacman/query.c
2011-05-19Coding style cleanups; add a null checkDan McGee2-5/+10
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-11Don't balk on .sig files being invalid in package cacheDan McGee1-4/+19
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05Rework config parsing to reduce variable duplicationDan McGee1-32/+25
This removes the need to strdup() the section name at every decent into an Include statement, as well as having duplicate DB pointers around that are never used independently. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05Refactor VerifySig option value parsing into standalone methodDan McGee1-21/+32
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05Improve database server APIDan McGee1-1/+1
Currently we have one call that has all sorts of crazy behavior and doesn't make a whole lot of sense. Go from one method to the normal four methods we have for all of our other lists we use in the library to make it a lot easier for a frontend to manipulate server lists. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05Make config parsing a two-part affairDan McGee3-74/+92
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 McGee4-593/+611
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-04pactree: make -Wwrite-strings friendlyDan McGee1-50/+62
Use a few structs to hold configuration values we change given certain options so we can be const-correct with string assignment across the board. Behavior should be completely unchanged. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-04Fix warnings reported by -Wwrite-stringsDan McGee4-6/+7
These are places where we stuck a string constant in a variable not marked as const. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24Perform package verification at package load timeDan McGee4-4/+7
Both md5sum verification and PGP verification can and should be done at package load time. This allows verification to happen as early as possible for packages provided by filename and loaded in the frontend, and moves more stuff out of sync_commit that doesn't really belong there. This should also set the stage for simplified parallel loading of packages later down the road. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-23Make dump_pkg_full a little less insaneDan McGee4-38/+34
The various "level" values were a bit crazy to decipher, and we were doing some very interesting comparisons in certain places. Break it out into two parameters instead so we can seperate the type from the extra information display, and do things accordingly. Nothing changes with the display of any of the five types we currently show: -Si, -Sii, -Qi, -Qii, -Qip. Something to note- we should expose the PKG_FROM enum type somehow, this patch leaves the door open to do that quite easily. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-21Header inclusion cleanupDan McGee6-10/+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 McGee7-44/+44
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 Reisner5-8/+8
Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-21New VerbosePkgLists optionJakob Gruber3-8/+94
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-21Table formatted output functionsJakob Gruber2-0/+111
table_display takes a list of lists of strings (representing the table cells) and displays them formatted as a table. The exact format depends on the longest string in each column. Signed-off-by: Jakob Gruber <jakob.gruber@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-21Refactor display_targets for readabilityJakob Gruber1-12/+10
Row handling is moved to its own function in preparation for verbose package lists. Signed-off-by: Jakob Gruber <jakob.gruber@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-21Use IEC unit prefixesJakob Gruber1-2/+2
Display {KiB, MiB, ...} instead of {KB, MB, ...} since that's what's actually being displayed. Signed-off-by: Jakob Gruber <jakob.gruber@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-21Add a utility function to humanize sizesJakob Gruber4-50/+68
Converts the given size in bytes in two possible ways: 1) target_unit is specified (!= 0): size is converted to target unit. 2) target_unit is not specified (== '\0'): size is converted to the first unit which will bring size to below 2048. If specified, label will point to the long label ('MB') if long_labels is set or the short label ('M') if it is not. Dan: use '\0' rather than 0 for the special value as a matter of coding style for char variables. Signed-off-by: Jakob Gruber <jakob.gruber@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-21Remove ShowSize optionJakob Gruber5-30/+2
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-16Merge branch 'maint'Dan McGee1-16/+32
Conflicts: lib/libalpm/alpm.h lib/libalpm/trans.c 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-15pacman/query: correctly handle root files with -QoXavier Chantry1-16/+32
spotted by clang-analyzer (strcmp with NULL rpath is bad) Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-05Merge branch 'maint'Dan McGee1-5/+13
Conflicts: lib/libalpm/be_sync.c lib/libalpm/db.c src/pacman/util.c
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-04-05Coding style cleanupsDan McGee1-5/+8
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-01Ensure stdout/stderr are flushed when asking questionsDan McGee1-0/+5
Addresses FS#23492, where the question was shown without knowing what one was answering to. Ensure we flush our output streams before printing the question, and flush the stream on which we ask the question before waiting for an answer. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-29Merge branch 'maint'Dan McGee1-1/+2
2011-03-29call alpm_option_get_localdb once in syncfirst()Andrea Scarpino1-1/+2
Signed-off-by: Andrea Scarpino <andrea@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-28pacman/util: flush terminal input before reading responseDave Reisner1-0/+21
Addresses FS#20538 Signed-off-by: Dave Reisner <d@falconindy.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 Brannon3-1/+27
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 McGee2-24/+34
Conflicts due to change in return calling style. Conflicts: src/pacman/pacman.c src/pacman/sync.c
2011-03-21Do not query group selection when using -SpAllan McRae1-14/+26
Remove unnecessary output when using -Sp. Fixes FS#23340. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
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 McGee16-244/+244
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-20Fix handling of ignored packagesPang Yan Han1-0/+7
Noted in FS#23342. When the user attempts to install an ignored package and answers no when asked whether to install it, pacman bails out with: "error: target not found: packagename" This is because satisfiers are not found for the package and execution continues to process_group(), where the package is treated as a group (which does not exist). In addition, test ignore006.py is updated with PACMAN_RETCODE=0 since saying no to installing an ignored package should not be considered an error. Signed-off-by: Pang Yan Han <pangyanhan@gmail.com> Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> 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>