summaryrefslogtreecommitdiffstats
path: root/src/pacman/callback.c
AgeCommit message (Collapse)AuthorFilesLines
2008-04-08Add check for swprintf() and a workaround when it is missingDan McGee1-0/+10
We use this function once in our codebase, but fortunately the workaround is relatively easy. swprintf() is not available on Cygwin so the compile failed there, but we can do a series of mbstowcs() calls that produce the same end result as the swprintf() call. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-24Add some NULL checks into recently modified output functionsDan McGee1-1/+1
After a merge with master where some strings we print (such as descriptions) could be NULL, a few segfaults popped up due to strlen() calls on null pointers. Fix this by doing some preemptive checks and returning from functions early if the string was null. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-23Fix wide character output for add/remove/upgrade/conflict progressDan McGee1-16/+33
Due to the addition of the Chinese translation, our column widths were all messed up as mentioned in the download progress commit fixing this same problem there. This is a port of the code and ideas from that fix to the installation progress bars. Once again, a handful of examples were tested to ensure we work in all locales and with varying byte and char widths. English (before & after): (1/1) checking for file conflicts [-----------------] 100% (1/1) upgrading man-pages [-----------------] 100% German (before & after): (1/1) Prüfe auf Dateikonflikte [-----------------] 100% (1/1) Aktualisiere man-pages [-----------------] 100% Chinese (before): (1/1) 正在检查文件冲突 [-----------------] 100% (1/1) 生在升级 man-pages [c o o o o o ] (1/1) 生在升级 man-pages [----------C o o ] (1/1) 生在升级 man-pages [-----------------] 100% Chinese (after): (1/1) 正在检查文件冲突 [-----------------] 100% (1/1) 生在升级 man-pages [-----------------] 100% Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-23Fix wide character output for download progressDan McGee1-6/+33
Now that we have a Chinese translation, all of the problems with new character sets crop up. Assumptions were made in the past that all characters occupied one column, which is not true with a Chinese character set. In addition, the download code even failed on such things as 'ö', which is two bytes wide but only 1 column. This code will need to also be ported to the add/remove/upgrade/conflicts progress printouts. Note that the tests below try to incorporate a number of things: 1. download filenames too long to fit 2. download filenames cut off in the middle of a multibyte sequence 3. download filenames incorporating multicolumn chars 4. download filenames incorporating multibyte, single-column chars 5. 'plain' download filenames that have always worked Before: :: 正在同步软件包数据库…… 正在解决倚赖��... 0.0K 199.8K/s 00:00:00 [-----------------] 100% 错误:无法升级正在解决倚赖关系junköëjunköëjunköëäää (未预计的系统错误) 正在解决倚赖��... 0.0K 308.4K/s 00:00:00 [-----------------] 100% 错误:无法升级正在解决倚赖关系 (未预计的系统错误) junköëä 0.0K 390.6K/s 00:00:00 [-----------------] 100% 错误:无法升级junköëä (未预计的系统错误) pacman-git 0.5K 4.3M/s 00:00:00 [-----------------] 100% 本地数据库已是最新的 After: :: 正在同步软件包数据库…… 正在解决倚赖关系jun... 0.0K 89.7K/s 00:00:00 [-----------------] 100% 错误:无法升级正在解决倚赖关系junköëjunköëjunköëäää (未预计的系统错误) 正在解决倚赖关系 0.0K 147.7K/s 00:00:00 [-----------------] 100% 错误:无法升级正在解决倚赖关系 (未预计的系统错误) junköëä 0.0K 156.9K/s 00:00:00 [-----------------] 100% 错误:无法升级junköëä (未预计的系统错误) pacman-git 0.5K 1515.9K/s 00:00:00 [-----------------] 100% 本地数据库已是最新的 Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-18Fix conflict progress bar with UTF-8 charsChantry Xavier1-24/+8
This fixes FS#6437. Dan already explained the problem in that bug report. Instead of letting printf deal with the length of utf8 strings, we can handle it more explicitly in the case of conflict progress bar, just like we do for add/remove progress bars. We compute the remaining space left for displaying the pkgname in case of add/remove, and an empty string in case of conflict. Before : (1/1) Prüfe auf Dateikonflikte [###################] 100% (1/1) Aktualisiere rxvt-unicode [###################] 100% After : (1/1) Prüfe auf Dateikonflikte [###################] 100% (1/1) Aktualisiere rxvt-unicode [###################] 100% Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-20two string fixes.Chantry Xavier1-1/+1
* added a newline to a conflict message in add.c * removed the trailing dot in a replace message in callback.c. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-01-13Notify of package replacements when using noconfirmAllan McRae1-5/+13
Fixes FS#5179. Prints a notification of package replacements when updating the packages using the --noconfirm flag. Signed-off-by: Allan McRae <mcrae_allan@hotmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-11Update GNU GPL boilerplate and copyright datesDan McGee1-3/+1
Update the GPL boilerplate to direct people to the GNU website for a copy of the license, as well as bump all of Judd's copyrights to 2007. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-09src/pacman/: use the FREELIST macro when possible.Chantry Xavier1-3/+1
Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-04Delay output during progress barChantry Xavier1-3/+29
This fixes the output issue related to the progress bar by delaying the output. We can decide later (post-release) if we like this method or we want to switch to something else. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> [Dan: just some minor cleanups] Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-02Remove "done" messages from frontend callback functionDan McGee1-31/+16
This should simplify our output a bit when it comes to determining whether or not we need a newline in our output. A "done" message was almost always immediately followed by another start message anyway (or some other output), so it really isn't necessary. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-02Add new --needed option for -S.Chantry Xavier1-11/+0
During a pacman operation such as a group install, pacman can ask several questions such as "local version is up to date. Upgrade anyway?". They are usually all answered either by yes or by no: * yes when you want to reinstall all the targets. * no when you only want to install the missing ones (either because you are installing a group, or because you are copying a pacman -S line from wiki or whatever). So instead of asking this question for each target, it is now now configured with a flag. Yes will be the default -S behavior, No will be achieved with the --needed flag. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-17War on whitespaceDan McGee1-5/+5
Run the kernel's cleanfile script on all of our source files. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11Implement TotalDownload option.Nathan Jones1-20/+44
Setting this option will change the download progress to show the amount downloaded, download rate, ETA, and download percent of the entire download list rather than per each individual file. The progress bar is still based on the completion of the current file regardless if the TotalDownload option is set. This closes FS#7205. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11Implement IgnoreGroup.Nathan Jones1-2/+2
This option acts as if IgnorePkg was set on each package in the group. This closes FS#1592. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-09Simplify callback DONE event handlingDan McGee1-15/+11
Move them all to a single fallthrough case statement since they all print "done". Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-05Remove the newline automatically added by alpm_logaction.Chantry Xavier1-3/+3
This way, _alpm_logaction behaves like _alpm_log, and gives more control. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-11-04Clean up usage of extern variablesDan McGee1-2/+0
Instead of declaring the extern variable in every *.c file, include it in the header file that makes sense. This means handle.h for the handle, and conf.h for the pacman side config object. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-04Readd scriptlet logging that got lost in an earlier commitDan McGee1-0/+3
I broke scriptlet logging with ad691001e20272b794d2ed574b556f520e3555c0. Readd more or less what was there before, although it still needs a lot of work including hopefully rewriting it to a new event subsystem and having it log to a seperate file. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-04Remove final use of the math library from pacmanDan McGee1-2/+1
To round a value, we don't need floorf- we can just cast to an int. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-30When printing size_t, use %zdDan McGee1-1/+2
%d was used, which worked for Linux and FreeBSD. Not so for Darwin. The warning was probably spat out when compiling on x68_64 as well, but no developers use this architecture as their primary one. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-20Download delta files if UseDelta is set.Nathan Jones1-1/+22
Delta files will be used if the size is smaller than a percent (MAX_DELTA_RATIO) of the package size. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-09Remove the non-user friendly --ask optionDan McGee1-88/+35
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28Update comments dealing with pkgext/dbext strippingDan McGee1-2/+1
pacman/callback.c already did the work I set out to do with this commit, so update the comments accordingly in the frontend and backend. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-16Fix some errors spit out by -WextraDan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-14Code cleanupDan McGee1-1/+0
Remove the commented desc_localized stuff, we can find it later in version control. Also remove some unnecessary includes of the stat header and use -fstack-protector-all which is a bit more broad. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-09Remove gettext from any alpm_logaction callsDan McGee1-3/+3
We shouldn't translate log messages to pacman.log so it is consistant and can be parsed by other tools. Remove all gettext _() around these strings. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-28Remove scriptlet START and DONE commands that we don't useDan McGee1-14/+0
The scriptlet calling had some unneeded complexity for the time being which we aren't using here. Let's get rid of it until we find a good way to implement it correctly. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-09Remove logmask stuff from backend; switch logging callback to new pm_printfDan McGee1-44/+3
Remove the logmask functionality from the backend as it has been moved to the frontend, and change the logging callback function to use pm_printf. In addition, make much better use of va_list- use the args list instead of a arbitrarily chosen string to print to in the logging functions. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-05Rip alpm_parse_config out of libalpmDan McGee1-2/+1
Switch over to the new frontend parseconfig. * Fix a few issues in parseconfig * Remove unused callback upon database registration * Remove conf file related errors from error.c/alpm.h Signed-off-by: Dan McGee <dan@archlinux.org>
2007-05-31Move DB and cache dirs away from there dependence on ROOTDIRDan McGee1-1/+1
This change allows us to use all autoconf specified paths, most notably $(localstatedir). It is quite a change and touches a lot of files, as all references to the DB and cache were done with the ROOTDIR as a prefix. * add --lock command-line option to pacman to specify the location of the lockfile (this can now be specified at configure time by setting the $localstatedir path). * Rip quite a few settings out of configure.ac as they are now picked by setting the paths during configure or make. * Fix bug with /tmp fallback for sync downloads not working correctly (related to root location, now the system tmp dir is used). * Simplified the parameters to some libalpm functions, and added get/set for the new lockfile option. * Renamed several of the DEFS to names without the PM_ prefix. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-05-14Remove unnecessary casts on malloc and elsewhereDan McGee1-7/+7
We had many unnecessary casts, most of them dealing with malloc and other memory allocations. The variable type should take care of it; no need to do it explicitly. In addition, I caught a const error while removing the casts. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-29Remove 'removes' array from libalpmDan McGee1-4/+0
We don't use this functionality for now, so get rid of it and the functions associated with it. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-27Remove output.c and output.hDan McGee1-1/+0
One function was left in this set of files after the earlier cleansing, so I moved yesno to util.c. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-27Start of the newline fixes after switching over the outputDan McGee1-7/+39
* A few quick newline fixes, mostly related to sync operations. * Moved get_update_timediff to callback.c as it is not used outside of that file. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-27Set the correct type on the log callback functionDan McGee1-1/+1
Somehow missed this earlier when changing everything to types. unsigned short -> pmloglevel_t wherever necessary. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-26Add -pedantic flag to pacman (frontend) CFLAGSDan McGee1-2/+9
Now that we got rid of the ERR and WARN macros, compilation with -pedantic turned on works with only minor changes. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-26Remove MSG output macro (#define and in code)Dan McGee1-43/+29
This is the first step of converting output to standard functions such as printf, and eventually allowing compiliation with the -pedantic flag as is done on the libalpm side. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-26Move log.c/h -> output.c/h to properly reflect what is containedDan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-26Pacman side code consolidation- unify callback functions to one fileDan McGee1-0/+627
Some more major code reorginization here. The download progress callback function has been renamed and moved to callback.c, which is the former trans.c with the download and log callbacks added. In addition, this allows util.c to be cleaned up as fill_progress can now be static in callback.c. We've also cut two more source files out. Signed-off-by: Dan McGee <dan@archlinux.org>