summaryrefslogtreecommitdiff
path: root/src/pacman/callback.c
Commit message (Collapse)AuthorAge
* Add reason to corrupted package callbackDan McGee2011-08-08
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* pacman/callback: show .sig suffix on sig downloadDave Reisner2011-07-18
| | | | | Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Prefix alpm_transprog_t members with ALPMAllan McRae2011-07-02
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Prefix alpm_transconv_t members with ALPMAllan McRae2011-07-02
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Prefix alpm_transevt_t members with ALPMAllan McRae2011-07-02
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Rename pmtransprog_t to alpm_transprog_tAllan McRae2011-06-28
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Rename pmtransconv_t to alpm_transconv_tAllan McRae2011-06-28
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Rename pmtransevt_t to alpm_transevt_tAllan McRae2011-06-28
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Rename pmloglevel_t to alpm_loglevel_tAllan McRae2011-06-28
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Rename pmdepend_t to alpm_depend_tAllan McRae2011-06-28
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Fix several -Wshadow warningsDan McGee2011-06-27
| | | | | | | | | | Only one of these looked like a real red flag, in find_requiredby(), but it doesn't hurt to fix several of them up anyway. Unfortunately, we can't turn this on universally due to things like the sync(), remove(), etc. builtins which we often use as variable names. Signed-off-by: Dan McGee <dan@archlinux.org>
* pacman/util.c: support terminals with unknown widthDave Reisner2011-06-20
| | | | | | | | | | Add detection for stdout being attached to a tty device. When this check fails, return a default width of 0, which callers interpret to mean "don't wrap". Conversely, when our term ioctl suceeds but returns 0, we interpret this to mean a tty with an unknown width (e.g., a serial console), in which case we default to a sane value of 80. Signed-off-by: Dave Reisner <d@falconindy.com>
* Require handle argument to alpm_logaction()Dan McGee2011-06-09
| | | | | | | 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>
* Remove incorrect output with download only and IgnorePkgAllan McRae2011-06-08
| | | | | | | | | | | | | | When only downloading a package that is in IgnorePkg, pacman incorrectly asks about installing. e.g. with <pkg> in IgnorePkg in pacman.conf: > pacman -Sddw <pkg> :: <pkg> is in IgnorePkg/IgnoreGroup. Install anyway? [Y/n] This output is now silenced when downloading only. Signed-off-by: Allan McRae <allan@archlinux.org>
* Merge branch 'maint'Dan McGee2011-06-02
|\ | | | | | | | | Conflicts: src/pacman/callback.c
| * Ensure list_display works on outputs of unknown widthDan McGee2011-06-01
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | syntax: if/while statements should have no trailing spaceDan McGee2011-04-20
| | | | | | | | | | | | | | | | | | | | | | 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>
* | style cleanup: cast as (type *) not (type*)Dave Reisner2011-04-20
| | | | | | | | | | Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Add a utility function to humanize sizesJakob Gruber2011-04-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Style change: return(x) --> return xDan McGee2011-03-20
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fix value of ngettext() count parameter in callbackDan McGee2011-03-07
| | | | | | I was awesome and ran alpm_list_count() on an empty list. Fail. Signed-off-by: Dan McGee <dan@archlinux.org>
* Mark log callback format string constDan McGee2011-02-24
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Call count() once in callbackDan McGee2011-01-29
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* pacman: improve select-questionXavier Chantry2011-01-29
| | | | | | | Make use of parseindex like in multiselect, and loop until we get a valid answer like in multiselect. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
* Add interactive provider selectionXavier Chantry2011-01-29
| | | | | | | | | | | | | | | | | | | | | | | | If there are multiple providers in one db, pacman used to just stop at the first one (both during dependency resolution or for pacman -S 'provision' which uses the same code). This adds a new conversation callback so that the user can choose which provider to install. By default (user press enter or --noconfirm), the first provider is still chosen, so for example the behavior of sync402 and 403 is preserved. But at least the user now has the possibility to make the right choice in a manual run. If one of the provider is already installed, it is picked for reinstall/upgrade, so that provision 002/003 pactest now pass. $ pacman -S community/smtp-server :: There are 3 providers available for smtp-server: 1) courier-mta 2) esmtp 3) exim Which one do you want to install? Enter a number (default=1): Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
* Add a progressbar for package integrity checkingDan McGee2011-01-11
| | | | | | | This can take a while too, and it is really easy to add the necessary callback stuff for adding a progressbar. 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* Strip extension off all package compression typesDan McGee2010-03-18
| | | | | | | | | Since we were searching for '.pkg.tar.gz' before, we now have started to show extensions during the download when we have a '.pkg.tar.xz' package. Just look for '.pkg.tar.' (or '.db.tar.') instead and suppress anything found from that point on. Signed-off-by: Dan McGee <dan@archlinux.org>
* Bump copyright dates to 2010Dan McGee2010-03-14
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* fix a few warnings reported by clangXavier Chantry2010-03-14
| | | | | | | | | - remove unused variables - some more sanity checks - safer printf Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* callback: use variable length for progressbar textXavier Chantry2010-03-14
| | | | | | | | | | | | | | | | This fixes FS#17523 We always used a fixed value of 50 for textlen, which is often not enough for download progress bar. At least we can use a bigger width on large terminal (e.g. 60% of width) and keep 50 as minimum. before: nautilus-2.28.4-1-x... 5.7M 789.2K/s 00:00:07 [####################################] 100% after: nautilus-2.28.4-1-x86_64 5.7M 770.7K/s 00:00:08 [##############################] 100% Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* callback.c : less magic progress barsXavier Chantry2010-03-14
| | | | | | | | | | | | | | 1 - Explain magic numbers 2 - There was a weird off by 1 mess in the progress bar. The code supposedly shared the width between 50 chars for text (textlen) and the rest for the progress bar (proglen = getcols() - textlen). But the code actually used textlen + 1 for the text and proglen - 1 for the progress bar (with haslen=1, the progress bar was actually empty), which was a bit confusing so I changed it. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Merge branch 'maint'Dan McGee2009-10-11
|\
| * callback.c : fallback to normal download with bogus sizeXavier Chantry2009-10-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using totaldownload, we might get into some weird situations where xfered>total because of bogus CSIZE database entries. This code adds a sanity check and fallbacks to normal download progress if needed. Here is an example using totaldownload on a database with wrong CSIZE, for a total download of ~26 MB. Before : gnome-desktop-2.28.... 1144,3K 678,3K/s 00:00:02 [#################] 4% gnome-panel-2.28.0-... 4,2M 887,7K/s 00:00:05 [#################] 16% gnome-applets-2.28.... 13,6M 1083,0K/s 00:00:13 [#################] 52% gnome-backgrounds-2... 22,9M 964,0K/s 00:00:24 [#################] 87% gnome-settings-daem... 23,6M 938,5K/s 00:00:26 [#################] 90% gnome-control-cente... 26,1M 946,1K/s 00:00:28 [#################] 100% gnome-icon-theme-2.... 27,7M 1465,0K/s 1193046:28:15 [#######----------] gnome-icon-theme-2.... 28,0M 1502,2K/s 1193046:28:15 [########---------] gnome-icon-theme-2.... 28,4M 1582,2K/s 1193046:28:15 [##########-------] gnome-icon-theme-2.... 28,7M 1603,4K/s 1193046:28:15 [############-----] gnome-icon-theme-2.... 29,0M 1604,5K/s 1193046:28:15 [##############---] gnome-icon-theme-2.... 29,3M 1621,0K/s 1193046:28:14 [################-] gnome-icon-theme-2.... 29,6M 1434,8K/s 1193046:28:14 [#################] gnome-icon-theme-2.... 29,6M 974,2K/s 00:00:31 [#################] 113% After : gnome-desktop-2.28.... 1144,3K 1038,7K/s 00:00:01 [#################] 4% gnome-panel-2.28.0-... 4,2M 988,4K/s 00:00:04 [#################] 16% gnome-applets-2.28.... 13,6M 1190,4K/s 00:00:12 [#################] 52% gnome-backgrounds-2... 22,9M 1242,9K/s 00:00:19 [#################] 87% gnome-settings-daem... 23,6M 1193,9K/s 00:00:20 [#################] 90% gnome-control-cente... 2,5M 1347,4K/s 00:00:02 [#################] 100% gnome-icon-theme-2.... 3,5M 1205,4K/s 00:00:03 [#################] 100% Note that gnome-control-center resetted to normal progress mode (2,5M is the package size, not the total size) Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Do not remove conflict by defaultNagy Gabor2009-09-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a conflict is detected, pacman asks if the user wants to remove the conflicting package. In many cases this is a bad idea. e.g. udev conflicts with initscripts (initscripts<2009.07). Remove initscripts [Y/n] This changes the query to [y/N]. The --noconfirm behavior has been also changed, because it chooses the default answer. Since the yes answer is more interesting in our pactests dealing with conflicts, I inserted '--ask=4' to all of them with one exception: sync042.py tests the no answer. (I also fixed a typo in sync043.py) Original-work-by: Allan McRae <allan@archlinux.org> Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
* | Re-add the non-user friendly --ask optionXavier Chantry2009-09-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This re-implements the --ask option which was removed in commit 1ff8e7f364a9f640ada7526384646d510ac29967. This option does not have to be exposed to the user (help,doc,etc), but is very very useful for pactest if we want to have more coverage there. This was rewritten in a smarter way, without code duplication. And with a different behavior : this option is now only used to inverse default behavior to questions. We still use bit operations based on the following struct : /* Transaction Conversations (ie, questions) */ typedef enum _pmtransconv_t { PM_TRANS_CONV_INSTALL_IGNOREPKG = 0x01, PM_TRANS_CONV_REPLACE_PKG = 0x02, PM_TRANS_CONV_CONFLICT_PKG = 0x04, PM_TRANS_CONV_CORRUPTED_PKG = 0x08, PM_TRANS_CONV_LOCAL_NEWER = 0x10, PM_TRANS_CONV_REMOVE_PKGS = 0x20, } pmtransconv_t; for each conv matched, the default answer is inversed. --ask 0 : all default answers are preserved --ask 4 : only conflict question is inversed --ask 63 : all questions are inversed (63 == 1+2+4+8+16+32) Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Add a new reason field to pmconflict_t structNagy Gabor2009-09-08
| | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes "foo conflicts with bar" information is not enough, see this thread: http://bbs.archlinux.org/viewtopic.php?id=77647. That's why I added a new reason field to our pmconflict_t struct that stores the packager- defined conflict that induced the fact that package1 conflicts with package2. I modified the front-end (in callback.c, sync.c, upgrade.c) to print this new information as well. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
* | Change Y/n to y/N with REMOVE_PKGS (remove_unresolvable) callbackNagy Gabor2009-09-08
|/ | | | | | | | | | | | | | | The main reason for this change is that scripts could not catch the removed targets with -S --noconfirm (the return value was 0). So the effect of a pacman command may have differed from the expected one. Moreover, for my taste the default no answer is better (I wanted to install the specified targets, not a subset of them). I had to change some pactest files as well, because now the default behavior is not to remove unresolvable targets. In fact, the only pactest file that tested this feature was ignore005.py. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix an untranslated message in src/callback.cNagy Gabor2009-07-28
| | | | | Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
* Update copyright headers and messagesDan McGee2009-07-01
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Don't prompt the user for unignore of IgnorePkg/IgnoreGroup packagesBryan Ischo2009-02-23
| | | | | | | | | | Don't prompt the user for unignore of IgnorePkg/IgnoreGroup packages, except for packages explicitly listed for sync by the user. This eliminates many unnecessary prompts when IgnorePkg/IgnoreGroup is used. Signed-off-by: Bryan Ischo <bryan@ischo.com> Signed-off-by: Dan McGee <dan@archlinux.org>