Page MenuHomeFreeBSD

Add keyword for terminfo.db handling
ClosedPublic

Authored by AMDmi3 on Sep 30 2015, 1:45 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 18 2024, 11:55 AM
Unknown Object (File)
Jan 19 2024, 5:05 PM
Unknown Object (File)
Jan 19 2024, 4:53 PM
Unknown Object (File)
Jan 4 2024, 7:08 PM
Unknown Object (File)
Dec 20 2023, 4:48 AM
Unknown Object (File)
Nov 14 2023, 8:21 AM
Unknown Object (File)
Nov 12 2023, 8:18 AM
Unknown Object (File)
Nov 10 2023, 8:14 AM
Subscribers

Details

Summary

ncurses uses compiled database of terminfo entries at share/misc/terminfo.db.
Ports which install terminfo entries (currently, onlt rxvt-unicodea and jfbterm) update this database via @exec's, but implementation of this has several drawbacks.

I propose improved infrastructure support for this, which works as follows:

  • ncurses install terminfo.db.default instead of terminfo.db
  • ncurses and every port which installs terminfo file uses @terminfo keyword
  • terminfo keyword recreates terminfo database from terminfo.db.default and all terminfo files found in share/misc/terminfo on both install and deinstall

This provedes the following benefits:

  • terminfo.db is always up to date
  • clean deinstallation: terminfo.db after deinstallation on e.g. rxvt-unicode would be equal to terminfo.db before its installation
  • absence of ncurses port is properly handled (e.g. no terminfo.db is generated as it's not needed without ncurses port)
  • no extra dependency on ncurses is needed for any port which installs .terminfo files
  • installation of ncurses AFTER ports which install .terminfo files works as intended, all .terminfo files are accounted
  • reinstallation of either ncurses or any port installing .terminfo file also works fine

This is preliminary version, not yet fully tested. Topics for discussion/improvement:

  • share/misc is hardcoded as .terminfo files and terminfo.db location. There don't seem to be usecases where other locations would be used, or am I wrong?
  • %D/bin/tic is used, while %D is PREFIX and not a LOCALBASE, whild the former should be used. I don't know how to reference LOCALBASE from Keywords yet.

Diff Detail

Repository
rP FreeBSD ports repository
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 637
Build 637: arc lint + arc unit

Event Timeline

AMDmi3 updated this revision to Diff 8980.
AMDmi3 retitled this revision from to Add keyword for terminfo.db handling.
AMDmi3 updated this object.
AMDmi3 edited the test plan for this revision. (Show Details)

Add missing rxvt-unicode patch which makes it build w/o tic

  • Add USES for terminfo handling
  • Add qa.sh check
AMDmi3 added a reviewer: bapt.

Added bapt as explicit reviewer for he's ncurses maintainer.

Also note that this includes minor cleanup for touched ports.

And now I've tested this properly.

pgollucci added a reviewer: pgollucci.
pgollucci added inline comments.
devel/ncurses/Makefile
131

you probably want to leave the opsys != FreeBSD for dragonfly ?

This revision is now accepted and ready to land.Sep 30 2015, 7:19 PM
devel/ncurses/Makefile
131

No, the condition is not needed here. The condition translates to, essentially, "DragonFly or FreeBSD > 9.x" which, since 8.x is no more supported, is equal to "Dragonfly or FreeBSD" which is currently equal to true.

mat added inline comments.
Keywords/terminfo.ucl
9

There's no %something that will output LOCALBASE, but, LOCALBASE/bin is in the PATH, so you may change this to tic=which tic and then do -n "${tic}".

12

If tic can take more than one file at a time, you may want to use -exec tic {} +.

Mk/Scripts/qa.sh
299 ↗(On Diff #8981)

You should leave found unset and check -n "${found}" / -z "${found}" later.

Mk/Uses/terminfo.mk
16 ↗(On Diff #8981)

You don't need quotes around it, there are no spaces or stuff to escape ?

x11/rxvt-unicode/Makefile
15–17

I assume rxvt-unicode will work without ncurses installed, right ?

AMDmi3 added inline comments.
Keywords/terminfo.ucl
12

No, tic can only take one argument

x11/rxvt-unicode/Makefile
15–17

Of course. I've hacked the port to remove this dependency for ages.

AMDmi3 edited edge metadata.
  • Implemented mat@'s suggestions
This revision now requires review to proceed.Oct 1 2015, 12:41 PM
mat added a reviewer: mat.

Looks good to me, would be nice if someone who understood the curses thing (pun intended) had a look at it.

This revision is now accepted and ready to land.Oct 1 2015, 12:52 PM

Thanks! Now waiting for a word from bapt.

bapt edited edge metadata.

Beside the note of the which -s (to prevent noise in case of failure looks good to me

Keywords/terminfo.ucl
13

I would probably turn the test into

if [ -e ${terminfodb}.default ] && which -s tic; then
    cp ${terminfodb}.default ${terminfodb}
    find -s ${terminfodir} -name "*.terminfo" -exec tic {} \; 
fi

So silence the absence of tic in path (not that which -s is a builtin of /bin/sh so safe

25

Same here about the which tic

Keywords/terminfo.ucl
13

To silence what ?

# which tic
/usr/local/bin/tic
# which tac
#
Keywords/terminfo.ucl
13

Oups sorry it is no silent the error, but to silence the success so you do not have to keep a tic variable for nothing :) and rely on PATH anyway

Keywords/terminfo.ucl
13

btw this is not a builtin at all
/me looks for his brain lost somewhere