summaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2021-05-20Pull translations from TransifexAllan McRae43-6074/+5780
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-05-17Use attribute to declare case statement fallthroughsAllan McRae2-2/+4
Clang does not recognise the comment style notification of expected case statement fallthrough. Signed-off-by: Allan McRae <allan@archlinux.org>
2021-05-17Silence new warning with gcc-11Allan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-05-09libalpm: fix download rates becoming negativemorganamilo1-0/+30
When a download fails on one mirror a new download is started on the next mirror. This causes the ammount downloaded to reset, confusing the rate math and making it display a negative rate. This is further complicated by the fact that a download may be resumed from where it is or started over. To account for this we alert the frontend that the download was restarted. Pacman then starts the progress bar over. Signed-off-by: Allan McRae <allan@archlinux.org>
2021-05-09Match initial download message with progress messagemorganamilo1-2/+2
When initially downloading a package, pacman will display a message like: wine-6.6-1-x86_64.pkg.tar.zst downloading... Then when the download progresses the message will change to: wine-6.6-1-x86_64.pkg.tar.zst So instead lets match the progress message so there's no sudden change. Signed-off-by: Allan McRae <allan@archlinux.org>
2021-05-01call download progress callback for signaturesAndrew Gregory1-0/+12
pacman may not care about them, but other front-ends do. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2021-05-01add front-end provided context to callbacksAndrew Gregory4-24/+33
Our callbacks require front-ends to maintain state in order to provide reasonable output. The new download callback in particular requires much more complex state information to be saved. Without the ability to provide context, state must be saved globally, which may not be possible for all front-ends. Scripting language bindings in particular have no way to register per-handle callbacks without some form of context. Implements: FS#12721 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2021-04-23Prepare translations for next releaseAllan McRae44-11621/+15366
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-04-23Only enable total progress when downloads > 1morganamilo1-1/+1
Otherwise the total progress will just match the one package and be pretty useless.
2021-04-23Always enable TotalDownloadmorganamilo4-10/+2
Previously TotalDownload would switch the % download from per package to overall. Meaning you had a choice of which information to dispplay. Now with parallel downloads TotalDownload adds an extra progress bar. There's no reason to have this an off by default feature. Let's just make it always on. Signed-off-by: Allan McRae <allan@archlinux.org>
2021-04-23pacman: fix total bar leakingmorganamilo1-2/+3
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-04-21Add support for multiple 'Architecture' valuesDan McGee4-17/+26
This allows architecture to be multivalued. On x86-64 machines, this could be something like: Architecture = x86-64-v3 x86-64 We use the first specified Architecture value in mirrorlist $arch variable replacement, as this is backwards-compatible and sane. Original-patch-by: Dan McGee <dan@archlinux.org> Patch-updated-by: Allan McRae <allan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2021-04-19pacman: stop eta timer breaking allignmentmorganamilo1-8/+4
When the download estimate is over an hour the format displayed changes from mm:ss to hh:mm:ss. This causes everything to be out of alignment due to the extra characters. So instead lets just go back to --:-- when the download => 100 minutes. Signed-off-by: Allan McRae <allan@archlinux.org>
2021-04-19Add an include for signal.h when neededMark Weiman1-0/+1
On Linux, signal.h is not required to have access to the signal constants. On FreeBSD, this is not the case and requires signal.h to be explicitly included. This patch adds an include for signal.h in any source file that uses it. Signed-off-by: Mark Weiman <mark.weiman@markzz.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2021-03-25Remove "total download" callback in favor of generic event callbackAnatol Pomozov3-13/+2
Total download callback called right before packages start downloaded. But we already have an event for such event (ALPM_EVENT_PKG_RETRIEVE_START) and it is naturally to use the event to pass information about expected download size. Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2021-03-01Update copyright yearAllan McRae28-29/+29
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-21pacman: add -w to -UAndrew Gregory1-7/+7
Mostly for testing. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-21pacman: correct length of ".files.sig" stringPascal Ernster1-1/+1
Running "pacman -Sc" deletes /var/lib/pacman/sync/*.files.sig due to a wrong string length being used when checking filename suffixes in that directory. In turn, these missing signature files cause both the corresponding "*.files" files and their signatures being forcibly re-downloaded again when "pacman -Sy" is executed. Since official Arch Linux repos don't use signed database files yet, this only affects people who use custom repos with signed database files, for which they have set the "SigLevel" directive to "Required" or "DatabaseRequired" in /etc/pacman.conf. Fixes FS#66472 Signed-off-by: Pascal Ernster <pacman-dev@hardfalcon.net> Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-19sighandler: initialize sigaction fieldsAndrew Gregory1-0/+1
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-19pacman-conf: free rootdir before replacingAndrew Gregory1-0/+1
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-19pacman: indicate --overwrite takes a globAndrew Gregory1-1/+1
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-11Read targets from stdin before chrootingmorganamilo1-6/+6
Operations involving --sysroot and reading targets from stdin were failing due to attempting to read targets after chrooting. Move the chroot to happen after targets are read. Fixes FS#68630 Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-11pacman: add file checksum validation against mtreeEmil Velikov1-7/+67
With libarchive v3.5.0 we have API to fetch the digest from the mtree. Use that to validate if the installed files are modified or not. As always, a modified backup file will trigger a warning but will not result in an actual failure. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-08pacman: total download show how many packages have been downloadmorganamilo1-4/+21
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-08libalpm: pass the number of packages being downloaded in totaldlcbmorganamilo2-2/+3
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-08pacman: clean filename for downlaodsmorganamilo1-12/+26
The progress bar already did this. But the init event and up to date message printed the full file name. Unify these for consistency. Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-29Move hex_representation() to src/commonEmil Velikov2-0/+27
We'll reuse the function in pacman with a later commit. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-09Implement TotalDownload functionalityAnatol Pomozov1-42/+104
With the recent 'multibar' interface changes TotalDownload has been disabled. Now we have a new UI and we need to find another way to display this information. When 'TotalDownload' config option is enabled we are going to have an extra progress bar at the bottom of the screen that shows how much of the entire download has been completed. Closes FS#68202 Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-03Restore usage line for -Fhv6.0.0alpha1Colin Woodbury1-0/+2
Unlike the other main commands, -F was missing its top-level usage line in its help output. Signed-off-by: Colin Woodbury <colin@fosskers.ca> Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-03Modify "pacman -h" output for files operationsAllan McRae1-1/+1
pacman -F can take both a file(s) or a package(s) as arguments. Passing a file is more common, so adjust to show that in the help. Signed-off-by: Allan McRae <allan@archlinux.org>
2020-11-26Move cursor to the end of the screen at the SIGINTAnatol Pomozov3-13/+15
It requires exposing 'move cursor to the end' function in a pacman header file. We use it as a chance to make naming of the cursor management functions more consistent. Note that there is still possibility of a race condition in the cursor update logic. 'update cursor index variable' and 'send ASCII control symbols to console' is not an atomic operation. So if an SIGINT is received between these two action then cursor position is going to be screwed. Fixes FS#67973 Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2020-11-26Go to the end of screen if 'printonly' mode enabledAnatol Pomozov1-0/+1
At the end of download operation our code makes sure the cursor is moved to the end of the drawing area. But 'printonly' mode has its own if() branch that skips this cursor alignment. Add cursor_goto_end() to the 'printonly' codepath to make sure it does not clobber previous output. Fixes FS#68355 Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2020-09-23util.c: table_print_line: properly align texts involving CJKChih-Hsuan Yen1-1/+3
For printf in C, width is counted as bytes rather than Unicode width. [1] > If the precision is specified, no more than that many bytes are written. [1] Section 7.21.6, N2176, final draft for ISO/IEC 9899:2017 (C18) Thanks Andrew Gregory for suggesting a simpler approach. Fixes FS#59229 Signed-off-by: Chih-Hsuan Yen <yan12125@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2020-06-26Convert '-U pkg1 pkg2' codepath to parallel downloadAnatol Pomozov1-54/+48
Installing remote packages using its URL is an interesting case for ALPM API. Unlike package sync ('pacman -S pkg1 pkg2') '-U' does not deal with server mirror list. Thus _alpm_multi_download() should be able to handle file download for payloads that either have 'fileurl' field or pair of fields ('servers' and 'filepath') set. Signature for alpm_fetch_pkgurl() has changed and it accepts an output list that is populated with filepaths to fetched packages. Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
2020-06-01Avoid depending on side effects in assert(...) expressionsDave Reisner1-2/+6
When building with -DNDEBUG, assert statements are compiled out to no-ops. Thus, we can't depend on assignments or other computations occurring inside the assert(). Signed-off-by: Allan McRae <allan@archlinux.org>
2020-06-01Remove autotools supportAllan McRae3-99/+0
This removes support for autotools in favour of meson.
2020-05-11Log invalid conf settings as an errorEli Schwartz1-4/+4
This is not a warning, _parse_options() returns failure without even parsing further lines and the attempted pacman/pacman-conf program execution immediately aborts. Warnings are for when e.g. later on if we don't recognize a setting at all, we skip over it and have enough confidence in this to continue executing the program. The current implementation results in pacman-conf aborting with: warning: config file /etc/pacman.conf, line 60: invalid value for 'ParallelDownloads' : '2.5' error parsing '/etc/pacman.conf' or pacman -Syu aborting with the entirely more cryptic: warning: config file /etc/pacman.conf, line 59: invalid value for 'ParallelDownloads' : '2.5' and this isn't just a problem for the newly added ParallelDownloads setting, either, you could get the same problem if you specified a broken XferCommand, but that's harder as it's more accepting of input and you probably don't hit this except with unbalanced quotes. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-11pacman-conf: fix incomplete support for ILoveCandyEli Schwartz1-0/+2
This was only partially implemented in the original implementation. `pacman-conf | grep ILoveCandy` would tell you if it was set, but querying directly by name would not. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-11pacman-conf: add support for new ParallelDownloads config optionEli Schwartz1-0/+13
This was forgotten in the initial implementation, so it was impossible to figure out the value from a script, or correctly roundtrip the config file. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-09Swap alpm_db_update() implementation to multiplexed versionAnatol Pomozov1-1/+1
Now when all callers of the old alpm_db_update() function are gone we can remove this implementation. And then rename alpm_dbs_update() function to alpm_db_update(). Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-09Convert downloading databases to the new multiplexed APIAnatol Pomozov1-18/+9
Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-09Convert download packages logic to multiplexed APIAnatol Pomozov1-4/+0
Create a list of dload_payloads and pass it to the new _alpm_multi_* interface. Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-09Implement multibar UIAnatol Pomozov5-129/+286
Multiplexed download requires ability to draw UI for multiple active progress bars. To implement it we use ANSI codes to move cursor up/down and then redraw the required progress bar. `pacman_multibar_ui.active_downloads` field represents the list of active downloads that correspond to progress bars. `struct pacman_progress_bar` is a data structure for a progress bar. In some cases (e.g. database downloads) we want to keep progress bars in order. In some other cases (package downloads) we want to move completed items to the top of the screen. Function `multibar_move_completed_up` allows to configure such behavior. Per discussion in the maillist we do not want to show download progress for signature files. Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-09Extend download callback interface with start/complete eventsAnatol Pomozov3-3/+12
With the previous download interface the callback uses the first progress event as 'download has started' signal. Unfortunately it does not work with up-to-date files that never receive 'download progress' events. Up-to-date database messages are currently handled in sync_syncdbs() after the sequential download is completed and a result from ALPM is received. But this is not going to work with multiplexed download interface that returns the result only after all files are completed. Another problem with 'first progress event is the beginning of the download' is that such events time are unpredictable. Thus the UI progress bar order might differ from what has been passed by client to alpm_dbs_update() function. We actually want to keep the dbs progress bars in a strict order. To help to solve the given problems extend the download callback to allow 2 more events - download started and completed. 'Download started' events appear in the same order as in the list given by a client. Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-09Introduce event types for start/end database list downloadAnatol Pomozov1-3/+12
Multiplexed database/files downloads will use multiple progress bars. The UI logic is quite complicated and printing error messages while handling multiple progress bars is going to be challenging. Instead we are going to save all ALPM error messages to a list and flush it at the end of the download process. Use on_progress variable that blocks error messages printing. Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-09Add config option to specify amount of parallel download streamsAnatol Pomozov2-0/+58
It includes pacman.conf new 'ParallelDownloads' option that specifies how many concurrent downloads cURL starts in parallel. Add alpm_option_set_parallel_downloads() ALPM function that allows to set this config option programmatically. Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2020-04-29Add NoProgressbar to pacman.conf optionsIvy Foster2-0/+5
This is useful for dumb terminals that do not support escape sequences. Signed-off-by: Ivy Foster <escondida@iff.ink> Signed-off-by: Allan McRae <allan@archlinux.org>
2020-04-29Constify some input pointersRikard Falkeborn1-1/+1
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2020-04-15Dull version colour numbers in summaryCarson Black3-12/+39
Version colour numbers are dulled in the non-verbose transaction summary when colours are enabled. To prevent a regression, this patch also adds handling of strings with ANSI codes to string_length as to not break the transaction summary's output functions when colour codes are in the package name strings. Signed-off-by: Carson Black <uhhadd@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2020-04-13Use noextract with pacman-conf NoExtractEarnestly1-1/+1
Current code accidently uses noupgrade for the NoExtract directive. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>