summaryrefslogtreecommitdiffstats
path: root/src/pacman/package.c
AgeCommit message (Collapse)AuthorFilesLines
2017-01-04Update copyright yearsAllan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-22Represent bitfields as ints, not enumsIvy Foster1-1/+1
Many bitfield variables are declared to be enums, because they are generated using bitwise operations on enums such. However, their actual values aren't necessary members of their parent enum, so declaring them 'int' is more accurate. Signed-off-by: Ivy Foster <ivy.foster@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-20dump_pkg_info: fix wide character title alignmentAndrew Gregory1-5/+12
The padding added to the end of the title was based on the return value of mbstowcs which is the number of characters. This caused alignment issues for languages with characters that span multiple columns. Instead, base the padding on the number of columns needed by the translated string as returned by wcswidth. Fixes #47980 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-25Remove spacing when outputting package sizesAllan McRae1-3/+3
This spacing appears to have been added to align sizes. It sometimes worked... $ pacman -Si glibc | grep Size Download Size : 8.03 MiB Installed Size : 35.08 MiB And it sometimes failed... $ pacman -Si pacman | grep Size Download Size : 662.82 KiB Installed Size : 4045.00 KiB Remove the spaces for a consistent output. Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-04Update copyright years for 2016Allan McRae1-1/+1
make update-copyright OLD=2015 NEW=2016 Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-03package.c: Fix incorrect buffersize and constant-foldingPierre Neidhardt1-4/+3
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27Align titles automatically in information displayPierre Neidhardt1-32/+141
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18package.c: Comment stylePierre Neidhardt1-1/+1
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18package.c: Remove obsolete param from docPierre Neidhardt1-1/+0
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-06-20Match providers when showing optdep install statusLukas Fleischer1-1/+2
Use alpm_find_satisfier() instead of alpm_db_get_pkg() when retrieving the install status of a package to make sure we spot providers as well. Fixes FS#36412 Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03Fix memory leaks in dump_pkg_fullAllan McRae1-0/+5
Leaks when using -Sii with package signatures Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-01Update copyright notices for 2015Allan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-06-29cache terminal size, add SIGWINCH handler to resetDave Reisner1-2/+2
Refactoring getcols, yet again. We do the following: 1) Introduce a static global in src/pacman/util.c 2) getcols always prefers this cached value, but will derive it from the COLUMNS environment var, the characteristics of stdout, or a sane default (in that order). 3) Introduce a SIGWINCH signal handler to reset the cached value, meaning we only call ioctl when we don't know the value. On my machine, pacman -Syy goes from ~4300 ioctl calls to 3.
2014-01-30dump_pkg_full: fix optionalfor memory leakAndrew Gregory1-0/+1
alpm_pkg_compute_optional returns a generated list that needs to be free'd. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-28Remove ts and sw from vim modeline when noet is setFlorian Pritz1-1/+1
Forcing vim users to view files with a tabstop of 2 seems really unnecessary when noet is set. I find it much easier to read code with ts=4 and I dislike having to override the modeline by hand. Command run: find . -type f -exec sed -i '/vim.* noet/s# ts=2 sw=2##' {} + Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06Update copyright years for 2014Allan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-15Fix whitespace and other formatting issuesJason St. John1-2/+2
This commit: -- replaces space-based indents with tabs per the coding standards -- removes extraneous whitespace (e.g. extra spaces between function args) -- adds missing braces for a one-line if statement Signed-off-by: Jason St. John <jstjohn@purdue.edu>
2013-10-31pacman -Si/-Qi: Autodetect best fitting file size unitFlorian Pritz1-2/+5
I've tracked this back to e223366 and it looks like this just forces KiB because back then humanize_size didn't exist, but the size was just divided by 1024 to keep it somewhat readable. When humanize_size got introduced in 3c8a448 this was just carried over. The unit detected for "Download Size" is reused for "Installed Size" to make it easier to read. Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31List signiture keyids in -Sii outputAllan McRae1-2/+13
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-22Fix typoAllan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07colourize -Sl/-QlSimon Gomizelj1-5/+2
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07colourize -Ss/-QsSimon Gomizelj1-6/+10
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07colourize the output of -Qi/SiSimon Gomizelj1-4/+8
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07refactor common code in query_search/sync_searchSimon Gomizelj1-0/+88
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-03Update copyright year for 2013Allan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14Print package name before changelog entry with -QcSimon Gomizelj1-0/+1
Fixes FS#32362 Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14Add "Optional for" to package information outputAllan McRae1-1/+3
Much like packages that require a give package are displayed in the "Required by" field of its information output, alos display packages that optionally require the package. Inspired-by: Benedikt Morbach <benedikt.morbach@googlemail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14Display optdep install status in package query outputAllan McRae1-6/+14
Indicate which optional dependencies are installed when viewing local package information (-Qi). Signed-off-by: Allan McRae <allan@archlinux.org>
2012-09-18Fix typo in documentationAllan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-08Move important information up in -Si outputAllan McRae1-3/+2
Currently, the package description is printed at the end of the -Si output. This is probably one of the more important pieces of information so should be nearer the top. Also move the package architecture up. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-30pacman/package.c: show checksums with -SiiDave Reisner1-1/+8
These were removed entirely by f34864cc9e, but some people (myself included) still find them useful. Revive these details, but "demote" them, so that they're only displayed when extra sync data is requested. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07Prefix alpm_pkgfrom_t members with ALPM_Allan McRae1-9/+9
Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-16Reduce calls to getcolsDan McGee1-33/+34
This dramatically improves upon a much older attempt in 2008 in commit ce3d70aa99ab86. We don't need to call it once per line we print unless there is a reasonable expectation of being able to resize the terminal mid-operation; this is really only the case during our callback progress bars. Some before and after numbers of ioctl() calls, gleaned from strace of the following operations (no targets to any of them to maximize the amount of output): pacman -Qii : 37768 -> 2616 (93.1% decrease) pacman -Qs : 2616 -> 4 (99.8%) pacman -Sii : 133036 -> 10926 (91.8%) pacman -Ss : 10926 -> 14 (99.9%) Obviously the search results are astounding; we only call getcols() once in the case of -Qs, and once per repo in the case of -Ss. For -Qii and -Sii we are still calling it once per package, but this is much better than once per line of info output. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-09Simplify package validation info output for sync packagesAllan McRae1-26/+18
Unify the output for local and sync packages by only printing a list of possible validation types for sync packages. This also has the advantage of not printing the very long sha256 checksum which line wrapped on a standard width terminal. Signed-off-by: Allan McRae <allan@archlinux.org>
2012-03-09Add information on how an installed package was validatedAllan McRae1-0/+26
When installing a package, store information on which validation method was used and output this on "pacman -Qi" operations. e.g. Validated By : SHA256 Sum Possible values are Unknown, None, MD5 Sum, SHA256 Sum, Signature. Dan: just a few very minor tweaks. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-09Hook new optdepend structures upBenedikt Morbach1-2/+16
No new behaviour introduced, everything should work exactly as before. Dan: refactored to use the single alpm_depend_t structure. Signed-off-by: Benedikt Morbach <benedikt.morbach@googlemail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-20Update copyright yearsAllan McRae1-1/+1
Add 2012 to the copyright range for all libalpm and pacman source files. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-06Merge branch 'maint'Dan McGee1-2/+2
Conflicts: lib/libalpm/alpm_list.c
2012-02-03Fix FS#27924: don't display negative zeroesThomas Dziedzic1-2/+2
Dan: don't compute lower bound unless needed, flip argument order so out values are last, add param Doxygen documentation. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-22include config.h via MakefilesDave Reisner1-2/+0
Ensures that config.h is always ordered correctly (first) in the includes. Also means that new source files get this for free without having to remember to add it. We opt for -imacros over -include as its more portable, and the added constraint by -imacros doesn't bother us for config.h. This also touches the HACKING file to remove the explicit mention of config.h as part of the includes. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-22Merge branch 'maint'Dan McGee1-2/+2
Conflicts: src/pacman/package.c Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-21Remove remaining usages of fprintf() from frontendDan McGee1-2/+2
These can either be replaced with pm_printf() if they are error related, or in the fprintf(stdout, ...) case a bare printf() will do. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-21Remove pm_fprintf() in favor of pm_printf()Dan McGee1-2/+2
Now that pm_printf() always prints to stderr, we don't need this second function that was always used with stderr as the first argument. Thus, this patch removes the function and makes the following sed replacement: sed -i -e 's#pm_fprintf(stderr, #pm_printf(#g' src/pacman/*.c Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-14Use puts() instead of no-op printf() where applicableDan McGee1-5/+10
This replaces several printf calls of the following styles: printf("%s", ...); printf("some fixed string"); printf("x"); We can use either fputs() or putchar() here to do the same thing without incurring the overhead of the printf format parser. The biggest gain here comes when we are calling the print function in a loop repeatedly; notably when printing local package files. $ /usr/bin/time ./pacman-before -Ql | md5sum 0.25user 0.04system 0:00.30elapsed 98%CPU $ /usr/bin/time ./pacman-after -Ql | md5sum 0.17user 0.06system 0:00.25elapsed 94%CPU $ /usr/bin/time ./pacman-before -Qlq | md5sum 0.20user 0.05system 0:00.26elapsed 98%CPU $ /usr/bin/time ./pacman-after -Qlq | md5sum 0.15user 0.05system 0:00.23elapsed 93%CPU So '-Ql' shows a 17% improvement while '-Qlq' shows a 13% improvement on 382456 total files. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12Remove alpm_list_getdata wrapper functionDan McGee1-2/+2
This one is pretty darn useless. Just derefence the ->data attribute since the type is public anyway and save yourself the function call. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12Introduce alpm_time_t typeDan McGee1-2/+3
This will always be a 64-bit signed integer rather than the variable length time_t type. Dates beyond 2038 should be fully supported in the library; the frontend still lags behind because 32-bit platforms provide no localtime64() or equivalent function to convert from an epoch value to a broken down time structure. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-08Remove unnecessary castDan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-29Allow access to package origin dataDan McGee1-4/+3
Add new alpm_pkg_get_origin() method, use it in the front end now that the enum constants are publicly available. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-29Removed multiple definitions of pkgfrom_tDiogo Sousa1-1/+1
libalpm now exports type alpm_pkgfrom_t in alpm.h, which may be used by frontends. Pacman now uses alpm_pkgfrom_t instead of replicating that type (pkg_from as was in src/pacman/package.h) Updated API change in README. Signed-off-by: Diogo Sousa <diogogsousa@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-29Refactor signature result return formatDan McGee1-4/+4
I was trying to take a shortcut and not introduce a wrapper struct for the signature results, so packed it all into alpm_sigresult_t in the first iteration. However, this is painful when one wants to add new fields or only return information regarding a single signature. Refactor the type into a few components which are exposed to the end user, and will allow a lot more future flexibility. This also exposes more information regarding the key to the frontend than was previously available. The "private" void *data pointer is used by the library to store the actual key object returned by gpgme; it is typed this way so the frontend has no expectations of what is there, and so we don't have any hard gpgme requirement in our public API. Signed-off-by: Dan McGee <dan@archlinux.org>