Github messages for voidlinux
 help / color / mirror / Atom feed
From: 0x5c <0x5c@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] Fix xbps-src colours in CI
Date: Sat, 06 Jan 2024 00:51:46 +0100	[thread overview]
Message-ID: <20240105235146.xoxM0TcDB7hBX-Cy4xHeCEUPDyBQZKZa9tdXRCiW2tk@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-37283@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 1329 bytes --]

There is an updated pull request by 0x5c against master on the void-packages repository

https://github.com/0x5c/void-packages ci-colours
https://github.com/void-linux/void-packages/pull/37283

Fix xbps-src colours in CI
~~This PR adds a new config variable `XBPS_FORCE_COLORS`, which overrides the "is this not a tty" and `NO_COLOR` checks, and adds it to config entries for CI.~~
**EDIT** Github has changed the way CI is run; xbps-src now thinks it is running in a terminal and prints with colour. This part of the PR has been removed.

The `msg_normal()` colour is changed from "bold" (`1`) to "bright white, bold" (`97`, `1`) since Github workflows render `1` as bold letters of the current colour. This should have no effect on the vast majority of terminals setups, as `1` is already rendered as bright white with or without bolded font.

![image](https://user-images.githubusercontent.com/5877043/170177533-b0be695f-a9c0-42d5-9ea9-e2f0657b3b68.png)
![image](https://user-images.githubusercontent.com/5877043/170177592-a3c5de00-8bb2-48a9-8b62-65035889d84c.png)

I also setup [a demo](https://github.com/0x5c/void-packages/pull/4/checks) on my fork.

#### Testing the changes
- I tested the changes in this PR: **YES**


A patch file from https://github.com/void-linux/void-packages/pull/37283.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-ci-colours-37283.patch --]
[-- Type: text/x-diff, Size: 4155 bytes --]

From 363957f2623aa60e3ef7f6976515f1a259043f00 Mon Sep 17 00:00:00 2001
From: 0x5c <dev@0x5c.io>
Date: Sun, 19 Feb 2023 22:44:09 -0500
Subject: [PATCH 1/3] common/xbps-src/shutils/build_dependencies.sh: convert to
 msg_normal

There remained two locations where the functionality of msg_normal was manually
implemented.
---
 common/xbps-src/shutils/build_dependencies.sh | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/common/xbps-src/shutils/build_dependencies.sh b/common/xbps-src/shutils/build_dependencies.sh
index 20f61528d14c2..57ef45a7d5dd4 100644
--- a/common/xbps-src/shutils/build_dependencies.sh
+++ b/common/xbps-src/shutils/build_dependencies.sh
@@ -410,22 +410,12 @@ install_pkg_deps() {
     done
 
     if [[ ${host_binpkg_deps} ]]; then
-        if [ -z "$XBPS_QUIET" ]; then
-            # normal messages in bold
-            [[ $NOCOLORS ]] || printf "\033[1m"
-            echo "=> $pkgver: installing host dependencies: ${host_binpkg_deps[@]} ..."
-            [[ $NOCOLORS ]] || printf "\033[m"
-        fi
+        msg_normal "$pkgver: installing host dependencies: ${host_binpkg_deps[*]} ...\n"
         install_pkg_from_repos "" host "${host_binpkg_deps[@]}"
     fi
 
     if [[ ${binpkg_deps} ]]; then
-        if [ -z "$XBPS_QUIET" ]; then
-            # normal messages in bold
-            [[ $NOCOLORS ]] || printf "\033[1m"
-            echo "=> $pkgver: installing target dependencies: ${binpkg_deps[@]} ..."
-            [[ $NOCOLORS ]] || printf "\033[m"
-        fi
+        msg_normal "$pkgver: installing target dependencies: ${binpkg_deps[*]} ...\n"
         install_pkg_from_repos "$cross" target "${binpkg_deps[@]}"
     fi
 

From 8526dc9777241e27164238139a4daaddfae7e469 Mon Sep 17 00:00:00 2001
From: 0x5c <dev@0x5c.io>
Date: Sun, 19 Feb 2023 22:02:40 -0500
Subject: [PATCH 2/3] common/xbps-src/shutils/common.sh: ensure white text in
 msg_normal

Most terminals see '1m' as being a "bright colour" modifier, but others
consider it to be the "bold font" modifier, like the GitHub Actions log.

'97m' is a standalone "bright white" that is supported in most terminals,
including GitHub Actions, and is ignored where not supported.
---
 common/xbps-src/shutils/common.sh | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/common/xbps-src/shutils/common.sh b/common/xbps-src/shutils/common.sh
index 04247942decf2..4083e08ee084f 100644
--- a/common/xbps-src/shutils/common.sh
+++ b/common/xbps-src/shutils/common.sh
@@ -176,8 +176,13 @@ msg_warn_nochroot() {
 
 msg_normal() {
     if [ -z "$XBPS_QUIET" ]; then
-        # normal messages in bold
-        [ -n "$NOCOLORS" ] || printf "\033[1m"
+        # normal messages in bright bold white
+        if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then
+            # Github CI considers '1m' to be just a font bold
+            [ -n "$NOCOLORS" ] || printf "\033[97m\033[1m"
+        else
+            [ -n "$NOCOLORS" ] || printf "\033[1m"
+        fi
         printf "=> $@"
         [ -n "$NOCOLORS" ] || printf "\033[m"
     fi
@@ -201,7 +206,12 @@ report_broken() {
 }
 
 msg_normal_append() {
-    [ -n "$NOCOLORS" ] || printf "\033[1m"
+    if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then
+        # Github CI considers '1m' to be just a font bold
+        [ -n "$NOCOLORS" ] || printf "\033[97m\033[1m"
+    else
+        [ -n "$NOCOLORS" ] || printf "\033[1m"
+    fi
     printf "$@"
     [ -n "$NOCOLORS" ] || printf "\033[m"
 }

From 8dced7fbc8721440f9209a79dfeb85d0fee7d909 Mon Sep 17 00:00:00 2001
From: 0x5c <dev@0x5c.io>
Date: Fri, 5 Jan 2024 18:51:27 -0500
Subject: [PATCH 3/3] demo bump

---
 srcpkgs/ircdog/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ircdog/template b/srcpkgs/ircdog/template
index b8d22e9b7c927..e8802627566dc 100644
--- a/srcpkgs/ircdog/template
+++ b/srcpkgs/ircdog/template
@@ -1,7 +1,7 @@
 # Template file for 'ircdog'
 pkgname=ircdog
 version=0.5.1
-revision=2
+revision=3
 build_style=go
 go_import_path="github.com/ergochat/ircdog"
 short_desc="Simple wrapper over the raw IRC protocol"

  parent reply	other threads:[~2024-01-05 23:51 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-25  4:09 [PR PATCH] Enable " 0x5c
2022-05-25  4:17 ` [PR REVIEW] " 0x5c
2022-05-25  6:22 ` classabbyamp
2022-05-25  6:33 ` 0x5c
2022-05-25 12:25 ` ahesford
2022-05-25 20:55 ` 0x5c
2022-05-30 19:25 ` [PR PATCH] [Updated] " 0x5c
2022-06-07  0:37 ` 0x5c
2022-06-12  1:28 ` 0x5c
2022-06-12  1:43 ` 0x5c
2022-06-13 16:38 ` [PR REVIEW] " ericonr
2022-06-14  4:34 ` 0x5c
2022-06-14  4:57 ` 0x5c
2022-09-13  2:14 ` github-actions
2022-09-26  2:37 ` [PR PATCH] [Updated] " 0x5c
2022-12-31  1:55 ` github-actions
2023-01-13  3:12 ` [PR PATCH] [Updated] " 0x5c
2023-02-20  2:08 ` 0x5c
2023-02-20  3:50 ` 0x5c
2023-02-20  3:51 ` [PR REVIEW] " 0x5c
2023-02-20  3:52 ` 0x5c
2023-02-20  3:59 ` Fix " 0x5c
2023-05-22  1:57 ` github-actions
2023-05-25  0:34 ` [PR PATCH] [Updated] " 0x5c
2023-09-23  1:44 ` github-actions
2023-09-28 23:12 ` [PR PATCH] [Updated] " 0x5c
2023-12-28  1:45 ` github-actions
2024-01-05 23:47 ` [PR PATCH] [Updated] " 0x5c
2024-01-05 23:50 ` 0x5c
2024-01-05 23:51 ` 0x5c [this message]
2024-01-06  0:02 ` [PR PATCH] [Updated] " 0x5c
2024-01-06  0:13 ` 0x5c
2024-01-06  0:17 ` 0x5c
2024-01-06  0:18 ` [PR PATCH] [Merged]: " classabbyamp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240105235146.xoxM0TcDB7hBX-Cy4xHeCEUPDyBQZKZa9tdXRCiW2tk@z \
    --to=0x5c@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).