diff options
author | Timo Teräs <timo.teras@iki.fi> | 2013-10-11 14:55:32 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2013-10-11 14:55:32 +0300 |
commit | dc6f406066b464b6afa5ccc8f4dab92c802a1cfb (patch) | |
tree | 6f49a1f837a8a592dc5505580444ec13274eeff2 /main | |
parent | 75c1c7f76b00614d9003a732a690592670d2c5c9 (diff) | |
download | aports-dc6f406066b464b6afa5ccc8f4dab92c802a1cfb.tar.bz2 aports-dc6f406066b464b6afa5ccc8f4dab92c802a1cfb.tar.xz |
main/apk-tools: fix progress bar in musl builds
Diffstat (limited to 'main')
-rw-r--r-- | main/apk-tools/0002-print-use-stdout-instead-of-stderr-for-logging-and-p.patch | 77 | ||||
-rw-r--r-- | main/apk-tools/APKBUILD | 12 |
2 files changed, 85 insertions, 4 deletions
diff --git a/main/apk-tools/0002-print-use-stdout-instead-of-stderr-for-logging-and-p.patch b/main/apk-tools/0002-print-use-stdout-instead-of-stderr-for-logging-and-p.patch new file mode 100644 index 0000000000..82d7b13479 --- /dev/null +++ b/main/apk-tools/0002-print-use-stdout-instead-of-stderr-for-logging-and-p.patch @@ -0,0 +1,77 @@ +From 517378721855280d2e23d25d7529e6b9cbae9136 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi> +Date: Fri, 11 Oct 2013 14:52:34 +0300 +Subject: [PATCH] print: use stdout instead of stderr for logging and progress + +stdout is the proper place for it. this also fixes the progress +bar in musl, which seems to not support using line buffering for +stderr. +--- + src/apk.c | 1 - + src/print.c | 20 ++++++++++---------- + 2 files changed, 10 insertions(+), 11 deletions(-) + +diff --git a/src/apk.c b/src/apk.c +index 8744de6..8a3c7ef 100644 +--- a/src/apk.c ++++ b/src/apk.c +@@ -266,7 +266,6 @@ static void on_sigwinch(int s) + + static void setup_terminal(void) + { +- setvbuf(stderr, NULL, _IOLBF, BUFSIZ); + signal(SIGWINCH, on_sigwinch); + signal(SIGPIPE, SIG_IGN); + } +diff --git a/src/print.c b/src/print.c +index 6d00064..aafe2ef 100644 +--- a/src/print.c ++++ b/src/print.c +@@ -35,7 +35,7 @@ int apk_get_screen_width(void) + + if (apk_screen_width == 0) { + apk_screen_width = 50; +- if (ioctl(STDERR_FILENO, TIOCGWINSZ, &w) == 0 && ++ if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) == 0 && + w.ws_col > 50) + apk_screen_width = w.ws_col; + } +@@ -77,14 +77,14 @@ void apk_print_progress(size_t done, size_t total) + last_percent = percent; + apk_progress_force = 0; + +- fprintf(stderr, "\e7%3i%% [", percent); ++ fprintf(stdout, "\e7%3i%% [", percent); + for (i = 0; i < bar; i++) +- fputc('#', stderr); ++ fputc('#', stdout); + for (; i < bar_width; i++) +- fputc(' ', stderr); +- fputc(']', stderr); +- fflush(stderr); +- fputs("\e8\e[0K", stderr); ++ fputc(' ', stdout); ++ fputc(']', stdout); ++ fflush(stdout); ++ fputs("\e8\e[0K", stdout); + } + + int apk_print_indented(struct apk_indent *i, apk_blob_t blob) +@@ -144,11 +144,11 @@ void apk_log(const char *prefix, const char *format, ...) + va_list va; + + if (prefix != NULL) +- fprintf(stderr, "%s", prefix); ++ fprintf(stdout, "%s", prefix); + va_start(va, format); +- vfprintf(stderr, format, va); ++ vfprintf(stdout, format, va); + va_end(va); +- fprintf(stderr, "\n"); ++ fprintf(stdout, "\n"); + apk_progress_force = 1; + } + +-- +1.8.4 + diff --git a/main/apk-tools/APKBUILD b/main/apk-tools/APKBUILD index a38f01de9e..15e21c47a1 100644 --- a/main/apk-tools/APKBUILD +++ b/main/apk-tools/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=apk-tools pkgver=2.4.0 -pkgrel=1 +pkgrel=2 pkgdesc="Alpine Package Keeper - package manager for alpine" subpackages="$pkgname-static" depends= @@ -14,6 +14,7 @@ if [ "$CBUILD" == "$CHOST" ]; then fi source="http://dev.alpinelinux.org/archive/$pkgname/$pkgname-$pkgver.tar.xz 0001-db-allow-using-cached-packages-with-no-network.patch + 0002-print-use-stdout-instead-of-stderr-for-logging-and-p.patch " url="http://git.alpinelinux.org/cgit/apk-tools/" @@ -84,8 +85,11 @@ luaapk() { } md5sums="8446c69882d26c8bba38500b6e5577eb apk-tools-2.4.0.tar.xz -55768a1d97b570eec8940e89f0c0aca3 0001-db-allow-using-cached-packages-with-no-network.patch" +55768a1d97b570eec8940e89f0c0aca3 0001-db-allow-using-cached-packages-with-no-network.patch +c302063148f3db288394e03c3f75a48b 0002-print-use-stdout-instead-of-stderr-for-logging-and-p.patch" sha256sums="ac717df2c512c43e6ea3dd103fcea725ee9135936fe6a177de5021c36735a578 apk-tools-2.4.0.tar.xz -562f7d5c13ac18500e8e46b3fcae51ca801c34e7565aef712974258b12f2f693 0001-db-allow-using-cached-packages-with-no-network.patch" +562f7d5c13ac18500e8e46b3fcae51ca801c34e7565aef712974258b12f2f693 0001-db-allow-using-cached-packages-with-no-network.patch +8bd1084af5fa8b7257810c896bb93013f660d00db5bf7979fc341de3e627a98b 0002-print-use-stdout-instead-of-stderr-for-logging-and-p.patch" sha512sums="97dae73ed34e56349be5027d73720bdb8cf136b6bf0ede6f9fd5199386977d6c718f3593ea0f566aef0c5cdaf59e078f22a4bb1a22132b00dae82dc5927a8279 apk-tools-2.4.0.tar.xz -9569bdb62447807377a78408aaf47a351e37fbde2f19cf96cc8fe2c1e11520d4e0713309512825f8c08e4f28e68854880e7fa88ba2cb2c39a2fd16044136a876 0001-db-allow-using-cached-packages-with-no-network.patch" +9569bdb62447807377a78408aaf47a351e37fbde2f19cf96cc8fe2c1e11520d4e0713309512825f8c08e4f28e68854880e7fa88ba2cb2c39a2fd16044136a876 0001-db-allow-using-cached-packages-with-no-network.patch +4ea6964e2734e81f80e1e644eb9db5cc4baa0ba3a55e46830bfe33d48c2fef06bf74b1c91b80326b36e8ef1f9013023b4b68f5ed9c0e73a056cef1b6100877f4 0002-print-use-stdout-instead-of-stderr-for-logging-and-p.patch" |