Page MenuHomeFreeBSD

Add keyword for terminfo.db handling
ClosedPublic

Authored by AMDmi3 on Sep 30 2015, 1:45 PM.

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
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

AMDmi3 updated this revision to Diff 8979.EditedSep 30 2015, 1:45 PM
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

AMDmi3 updated this revision to Diff 8981.Sep 30 2015, 4:33 PM
  • Add USES for terminfo handling
  • Add qa.sh check
AMDmi3 updated this object.EditedSep 30 2015, 4:33 PM
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 accepted this revision.Sep 30 2015, 7:19 PM
pgollucci added a reviewer: pgollucci.
pgollucci added inline comments.
devel/ncurses/Makefile
131 ↗(On Diff #8981)

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
AMDmi3 added inline comments.Sep 30 2015, 7:26 PM
devel/ncurses/Makefile
131 ↗(On Diff #8981)

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 a subscriber: mat.Oct 1 2015, 10:57 AM
mat added inline comments.
Keywords/terminfo.ucl
8 ↗(On Diff #8981)

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}".

11 ↗(On Diff #8981)

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
16–17 ↗(On Diff #8981)

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

AMDmi3 marked 3 inline comments as done.Oct 1 2015, 12:40 PM
AMDmi3 added inline comments.
Keywords/terminfo.ucl
11 ↗(On Diff #8981)

No, tic can only take one argument

x11/rxvt-unicode/Makefile
16–17 ↗(On Diff #8981)

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

AMDmi3 updated this revision to Diff 9002.Oct 1 2015, 12:41 PM
AMDmi3 edited edge metadata.
  • Implemented mat@'s suggestions
This revision now requires review to proceed.Oct 1 2015, 12:41 PM
mat accepted this revision.Oct 1 2015, 12:52 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
AMDmi3 added a comment.Oct 1 2015, 2:17 PM

Thanks! Now waiting for a word from bapt.

bapt accepted this revision.Oct 8 2015, 12:36 PM
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
12 ↗(On Diff #9002)

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

24 ↗(On Diff #9002)

Same here about the which tic

mat added inline comments.Oct 8 2015, 12:47 PM
Keywords/terminfo.ucl
12 ↗(On Diff #9002)

To silence what ?

# which tic
/usr/local/bin/tic
# which tac
#
bapt added inline comments.Oct 8 2015, 12:49 PM
Keywords/terminfo.ucl
12 ↗(On Diff #9002)

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

bapt added inline comments.Oct 8 2015, 12:52 PM
Keywords/terminfo.ucl
12 ↗(On Diff #9002)

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

This revision was automatically updated to reflect the committed changes.