Package Details: ventoy-bin 1.1.05-1

Git Clone URL: https://aur.archlinux.org/ventoy-bin.git (read-only, click to copy)
Package Base: ventoy-bin
Description: A new bootable USB solution
Upstream URL: http://www.ventoy.net
Keywords: boot image iso multiboot usb
Licenses: GPL-3.0-or-later
Conflicts: ventoy
Provides: ventoy
Submitter: DuckSoft
Maintainer: DuckSoft (KokaKiwi, yochananmarqos, Kr1ss)
Last Packager: yochananmarqos
Votes: 380
Popularity: 8.63
First Submitted: 2020-05-19 06:14 (UTC)
Last Updated: 2025-02-24 18:30 (UTC)

Pinned Comments

Latest Comments

« First ‹ Previous 1 .. 4 5 6 7 8 9 10 11 12 13 14 .. 18 Next › Last »

Kr1ss commented on 2021-09-01 16:51 (UTC)

Thank you @ron2138 !

The first idea I had earlier (to check if output goes to a tty or not), was a bit too quick. It wouldn't prevent colored lines in the log, because makepkg redirects the data stream to the log file outside of the PKGBUILD's functions, and thus after that condition would be tested.

I figured it would make much more sense anyways, to let the user switch off color explicitely via the -m/--nocolor flag which you mentioned. The only (sensible) way to check if that flag is set or not, that I could come up with, is querying a variable that depends on it.

You're correct in that USE_COLOR is a variable defined by makepkg itself. That doesn't offend the recommendation in the packaging etiquette though, in my opinion, since it's not a subroutine.

As I understand that wiki clause, internal makepkg functions should not be used because the build script could break when those functions are changed at some point. This is not the case when a variable is queried though. Building would still work after a change.

In case that I'm getting something completely wrong please let me know. Also @yochananmarqos and/or @DuckSoft, do you have any strong opinions about this ? Would it make more sense to just remove the color codes ?

ron2138 commented on 2021-08-31 21:08 (UTC) (edited on 2021-09-01 12:19 (UTC) by ron2138)

Replying @Kr1ss's comment at 2021-08-31 20:31:

Under a quick test, it solves my issue.

Does $USE_COLOR an internal variable of makepkg? If yes, doesn't https://wiki.archlinux.org/title/Arch_package_guidelines#Package_etiquette apply to it too? See comment at 2021-08-28 20:18. For the reference, Kr1ss suggests

--- a/PKGBUILD
+++ b/PKGBUILD
@@ -23,7 +23,10 @@ sha256sums=('81ae02a06b132b5965dd09c9b64e000a6dafa1d57e03d8564feefda14ef1ee02'
         '00dec31721a052d5e6c928e3b38b870959bdb42188f34717898d99c0cef950df'
         '1555f65997e6d92ca29a774b45052e97a3358430fa5869f521a4fe7818427a1f')

-_msg2() { printf "\e[1;34m  ->\e[0;1m %s\e[0m\n" "$1"; }
+_msg2() {
+  if [ "$USE_COLOR" = n ]; then printf "  -> %s\n" "$1"
+  else printf "\e[1;34m  ->\e[0;1m %s\e[0m\n" "$1"; fi
+}

 prepare() {
   _msg2 "Decompress tools..."

Kr1ss commented on 2021-08-31 20:31 (UTC)

Oh, the latest pkgrel update (to 1.0.51-2) should actually have solved your issue @ron2138. Hasn't it ?

ron2138 commented on 2021-08-31 20:27 (UTC) (edited on 2021-09-01 02:17 (UTC) by ron2138)

Replying @Kr1ss's comment at 2021-08-30 16:15

Do you mean

diff --git a/PKGBUILD b/PKGBUILD
index c802de3..dec468a 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -23,7 +23,10 @@ sha256sums=('81ae02a06b132b5965dd09c9b64e000a6dafa1d57e03d8564feefda14ef1ee02'
             '00dec31721a052d5e6c928e3b38b870959bdb42188f34717898d99c0cef950df'
             '1555f65997e6d92ca29a774b45052e97a3358430fa5869f521a4fe7818427a1f')

-_msg2() { printf "\e[1;34m  ->\e[0;1m %s\e[0m\n" "$1"; }
+_msg2() { if tty --silent; then
+            printf "\e[1;34m  ->\e[0;1m %s\e[0m\n" "$1"
+          else
+            printf "  -> %s\n" "$1"
+          fi
+}

 prepare() {
   _msg2 "Decompress tools..."

?

Not tested.

Kr1ss commented on 2021-08-30 16:15 (UTC) (edited on 2021-08-30 16:17 (UTC) by Kr1ss)

@ron2138 :

Yes, that's correct, the colored output you're referring to is caused by a logging function in PKGBUILD.

It should be possible though to detect if output goes to a terminal and only then include the ANSI color codes, so that when printing to a log file only raw text is outputted.

Will check that when I'm home tonight.

ron2138 commented on 2021-08-30 16:05 (UTC) (edited on 2021-08-30 16:12 (UTC) by ron2138)

While extracting, I got messages that had colors within. Defeating --nocolor option of makepkg, which is nice to its --log. I believe these colors are created by the arch's maintainer. Am I right? Can that be improved?

thiagowfx commented on 2021-08-28 20:22 (UTC)

Oh I am sorry, I just updated ventoy-bin and saw _msg2. Didn't realize it is wrapping printf, and completely forgot I suggested this before - I've been doing it to a couple of packages lately. Apologies and thanks for making the package better!

yochananmarqos commented on 2021-08-28 20:21 (UTC)

@thiagowfx: That was actually already done awhile ago.

Kr1ss commented on 2021-08-28 20:20 (UTC)

@thiagowfx - We do use printf since you made that suggestion the first time.

thiagowfx commented on 2021-08-28 20:18 (UTC)

https://wiki.archlinux.org/title/Arch_package_guidelines#Package_etiquette:

Do not use makepkg subroutines (e.g. error, msg, msg2, plain, warning) as they might change at any time. To print data, use printf or echo.