Github messages for voidlinux
 help / color / mirror / Atom feed
From: jbenden <jbenden@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] Add vterminfo template function
Date: Wed, 22 Feb 2023 16:57:06 +0100	[thread overview]
Message-ID: <20230222155706.uOYtJuOia9_BjvyfzxnDUeRoRxCD6NwscsG3H7K4CMg@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-40168@inbox.vuxu.org>

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

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

https://github.com/jbenden/void-packages vterminfo
https://github.com/void-linux/void-packages/pull/40168

Add vterminfo template function
#### Testing the changes
- I tested the changes in this PR: **YES**

#### Local build testing
- I built this PR locally for my native architecture, (`x86_64`-`glibc`)

#### Notes
During development of the `wezterm` package, it became apparent that no helpers exists to assist in the creation of terminfo compilation databases and multiple packages did their own "thing"(tm). This patch aims to resolve this situation.

This patch *includes* changes from another PR. It must **NOT** be merged until #36903.

@classabbyamp  

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

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

From c564a9e8d41f8aec6ddccfbb7693cfa209bb1105 Mon Sep 17 00:00:00 2001
From: Joseph Benden <joe@benden.us>
Date: Wed, 26 Oct 2022 09:39:06 -0700
Subject: [PATCH] common/environment/setup/install.sh: add vterminfo

Signed-off-by: Joseph Benden <joe@benden.us>
---
 Manual.md                           |  9 +++++++-
 common/environment/setup/install.sh | 32 ++++++++++++++++++++++++++++-
 srcpkgs/alacritty/template          |  3 +--
 srcpkgs/mtm/template                |  3 +--
 srcpkgs/ncurses/template            |  1 +
 srcpkgs/wezterm/template            |  3 +--
 6 files changed, 43 insertions(+), 8 deletions(-)

diff --git a/Manual.md b/Manual.md
index 0b6b5ab645fc..c48b517397bf 100644
--- a/Manual.md
+++ b/Manual.md
@@ -328,13 +328,20 @@ The following functions are defined by `xbps-src` and can be used on any templat
 	Note that vsed will call the sed command for every regex specified against
 	every file specified, in the order that they are given.
 
-- *vcompletion()* `<file> <shell> [<command>]`
+- *vcompletion()* `vcompletion <file> <shell> [<command>]`
 
 	Installs shell completion from `file` for `command`, in the correct location
 	and with the appropriate filename for `shell`. If `command` isn't specified,
 	it will default to `pkgname`. The `shell` argument can be one of `bash`,
 	`fish` or `zsh`.
 
+- *vterminfo()* `vterminfo <file> [entries]`
+
+	Processes `file` document via `tic(1)` to generate a terminfo database entry,
+	optionally for each of the specified `entries` terminfo entries. The produced
+	terminfo file is written to `masterdir/destdir` ready for package inclusion,
+	using say `vmove usr/share/terminfo`.
+
 > Shell wildcards must be properly quoted, Example: `vmove "usr/lib/*.a"`.
 
 <a id="global_vars"></a>
diff --git a/common/environment/setup/install.sh b/common/environment/setup/install.sh
index b0c5b22f4c2a..7eaf7cbb1b04 100644
--- a/common/environment/setup/install.sh
+++ b/common/environment/setup/install.sh
@@ -13,7 +13,7 @@ _noglob_helper() {
 }
 
 # Apply _noglob to v* commands
-for cmd in vinstall vcopy vcompletion vmove vmkdir vbin vman vdoc vconf vsconf vlicense vsv; do
+for cmd in vinstall vcopy vcompletion vmove vmkdir vbin vman vdoc vconf vsconf vlicense vsv vterminfo; do
        alias ${cmd}="set -f; _noglob_helper _${cmd}"
 done
 
@@ -274,3 +274,33 @@ _vcompletion() {
 			;;
 	esac
 }
+
+_vterminfo() {
+	local file="$1" entries="$2"
+	local _terminfo_dir=usr/share/terminfo
+	local _args=
+
+	if [ $# -lt 1 ]; then
+		msg_red "$pkgver: vterminfo: at least 1 argument expected: <file> [entries]\n"
+		return 1
+	elif ! [ -f "$file" ]; then
+		msg_red "$pkgver: vterminfo: file '$file' does not exist.\n"
+		return 1
+	elif ! [ -r "$file" ]; then
+		msg_red "$pkgver: vterminfo: file '$file' is not readable.\n"
+		return 1
+	elif  [ -z "$PKGDESTDIR" ]; then
+		msg_red "$pkgver: vterminfo: PKGDESTDIR unset, can't continue...\n"
+		return 1
+	elif ! [ -x /usr/bin/tic ]; then
+		msg_red "$pkgver: vterminfo: 'tic' binary is missing, can't continue...\n"
+		return 1
+	fi
+
+	if [ -n "$entries" ]; then
+		_args="-e ${entries}"
+	fi
+
+	vmkdir "${_terminfo_dir}"
+	/usr/bin/tic -sx ${_args} -o "${PKGDESTDIR}/${_terminfo_dir}" "$file"
+}
diff --git a/srcpkgs/alacritty/template b/srcpkgs/alacritty/template
index 57873e263b55..b993f7a6927b 100644
--- a/srcpkgs/alacritty/template
+++ b/srcpkgs/alacritty/template
@@ -30,8 +30,7 @@ post_install() {
 	vinstall extra/logo/alacritty-term.svg 644 usr/share/icons/hicolor/scalable/apps Alacritty.svg
 	vman extra/alacritty.man alacritty.1
 	vsconf alacritty.yml
-
-	tic -o ${DESTDIR}/usr/share/terminfo -xe alacritty,alacritty-direct extra/alacritty.info
+	vterminfo extra/alacritty.info alacritty,alacritty-direct
 }
 
 alacritty-terminfo_package() {
diff --git a/srcpkgs/mtm/template b/srcpkgs/mtm/template
index 94376fdb8ca7..05ea7003602a 100644
--- a/srcpkgs/mtm/template
+++ b/srcpkgs/mtm/template
@@ -17,8 +17,7 @@ do_build() {
 
 do_install() {
 	vbin mtm
-	mkdir -p ${DESTDIR}/usr/share/terminfo
-	tic -sx -o ${DESTDIR}/usr/share/terminfo mtm.ti
+	vterminfo mtm.ti mtm,mtm-256color,mtm-noutf
 	vman mtm.1
 }
 
diff --git a/srcpkgs/ncurses/template b/srcpkgs/ncurses/template
index 7a56c537bf2e..f6e0c8d471cd 100644
--- a/srcpkgs/ncurses/template
+++ b/srcpkgs/ncurses/template
@@ -103,6 +103,7 @@ post_install() {
 	rm ${DESTDIR}/usr/share/terminfo/d/dvtm{,-256color}
 	rm ${DESTDIR}/usr/share/terminfo/s/st{,-256color}
 	rm ${DESTDIR}/usr/share/terminfo/f/foot{,-direct,+base}
+	rm -f ${DESTDIR}/usr/share/terminfo/w/wezterm
 }
 
 ncurses-libs_package() {
diff --git a/srcpkgs/wezterm/template b/srcpkgs/wezterm/template
index 8c075920877c..a684223e7534 100644
--- a/srcpkgs/wezterm/template
+++ b/srcpkgs/wezterm/template
@@ -48,8 +48,7 @@ do_install() {
 	vcompletion assets/shell-completion/fish fish
 	vcompletion assets/shell-completion/zsh zsh
 
-	vmkdir usr/share/terminfo
-	tic -sx -o ${DESTDIR}/usr/share/terminfo termwiz/data/wezterm.terminfo
+	vterminfo termwiz/data/wezterm.terminfo
 
 	vdoc README.md
 	vlicense LICENSE.md

  parent reply	other threads:[~2023-02-22 15:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26 16:47 [PR PATCH] " jbenden
2022-10-26 16:52 ` [PR PATCH] [Updated] " jbenden
2022-10-26 17:06 ` jbenden
2022-10-28  1:12 ` jbenden
2022-10-28  2:03 ` jbenden
2022-10-28  2:35 ` [PR REVIEW] " sgn
2022-10-28 15:18 ` [PR PATCH] [Updated] " jbenden
2022-10-28 15:18 ` [PR REVIEW] " jbenden
2022-11-10 17:19 ` [PR PATCH] [Updated] " jbenden
2022-11-23 17:28 ` jbenden
2023-02-22  2:01 ` github-actions
2023-02-22 15:57 ` jbenden [this message]
2023-02-22 17:33 ` jbenden
2023-05-25  1:53 ` github-actions
2023-05-25 17:06 ` jbenden
2023-08-25  1:44 ` github-actions
2023-09-08  1:45 ` [PR PATCH] [Closed]: " github-actions

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=20230222155706.uOYtJuOia9_BjvyfzxnDUeRoRxCD6NwscsG3H7K4CMg@z \
    --to=jbenden@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).