Bug 153622 - [patch] sysutils/jfbterm: improve TERMCAP option
Summary: [patch] sysutils/jfbterm: improve TERMCAP option
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Chris Rees
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-02 13:20 UTC by swell.k
Modified: 2011-06-19 12:00 UTC (History)
0 users

See Also:


Attachments
a.diff (2.63 KB, patch)
2011-01-02 13:20 UTC, swell.k
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description swell.k 2011-01-02 13:20:05 UTC
- remove automatically added termcap record upon deinstall
- use %D instead of PREFIX in plist fixing `pkg_add -p' usage
- hide behind !NOPORTDATA in post-install like it's done for plist
- bump PORTREVISION to regen package

How-To-Repeat: $ make install
$ pkg_create -xb jfbterm
$ make deinstall
$ pkg_add -f -p /blah jfbterm-0.6.1_2.tbz
cat: /usr/local/share/jfbterm/termcap.jfbterm: No such file or directory
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2011-01-02 13:20:47 UTC
Class Changed
From-To: change-request->maintainer-update

Fix category (submitter is maintainer) (via the GNATS Auto Assign Tool)
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2011-01-02 13:20:51 UTC
Responsible Changed
From-To: freebsd-ports-bugs->pgollucci

pgollucci@ wants his PRs (via the GNATS Auto Assign Tool)
Comment 3 swell.k 2011-01-02 13:30:52 UTC
Anonymous <swell.k@gmail.com> writes:

> +	if ${GREP} -Fxq '\# begin of jfbterm.termcap' ${TERMCAP_FILE}; then \
> +		${REINPLACE_CMD} '/^\# begin of jfbterm\.termcap/, \
> +			/^\# end of jfbterm\.termcap/d' ${TERMCAP_FILE}; \

oops, long lines + forgot mention
- create .bak file before modifying termcap file

--- a.diff begins here ---
Index: sysutils/jfbterm/Makefile
===================================================================
RCS file: /a/.cvsup/ports/sysutils/jfbterm/Makefile,v
retrieving revision 1.14
diff -u -p -r1.14 Makefile
--- sysutils/jfbterm/Makefile	22 Sep 2010 05:44:08 -0000	1.14
+++ sysutils/jfbterm/Makefile	2 Jan 2011 13:24:51 -0000
@@ -7,7 +7,7 @@
 PORTNAME=	jfbterm
 PORTVERSION=	0.6.1
 DISTVERSIONPREFIX=${OPSYS}-
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	sysutils
 MASTER_SITES=	http://www.ac.auone-net.jp/~baba/${PORTNAME}/ \
 		http://chirashi-no-ura.net/files/
@@ -24,7 +24,8 @@ ONLY_FOR_ARCHS_REASON=	requires VESA sup
 MAKE_JOBS_SAFE=	yes
 MAKEFILE=	${FILESDIR}/BSDmakefile
 MAKE_ENV+=	VERSION=${PORTVERSION} GUNZIP=${GUNZIP_CMD:N-*}
-PLIST_SUB+=	TERMCAP_ADD_RECORD="@exec ${TERMCAP_ADD_RECORD}"
+PLIST_SUB+=	TERMCAP_ADD_RECORD="@exec ${TERMCAP_ADD_RECORD:S,^${PREFIX},%D,}" \
+		TERMCAP_DEL_RECORD="@unexec ${TERMCAP_DEL_RECORD}"
 
 CAP_MKDB?=	/usr/bin/cap_mkdb
 
@@ -83,14 +84,30 @@ MAKE_ENV+=	WITHOUT_PNG=
 .if !defined(WITHOUT_TERMCAP)
 TERMCAP_ADD_RECORD=	\
 	if ${GREP} -q '^jfbterm|' ${TERMCAP_FILE}; then else \
+		${CP} ${TERMCAP_FILE} ${TERMCAP_FILE}.bak; \
+		${ECHO_CMD} '\# begin of jfbterm.termcap' \
+			>>${TERMCAP_FILE}; \
 		${CAT} ${PREFIX}/share/jfbterm/termcap.jfbterm \
 			>>${TERMCAP_FILE}; \
+		${ECHO_CMD} '\# end of jfbterm.termcap' \
+			>>${TERMCAP_FILE}; \
+		if [ -f ${TERMCAP_FILE}.db ]; then \
+			${CAP_MKDB} ${TERMCAP_FILE}; \
+		fi \
+	fi
+TERMCAP_DEL_RECORD=	\
+	if ${GREP} -Fxq '\# begin of jfbterm.termcap' \
+			${TERMCAP_FILE}; then \
+		${REINPLACE_CMD} '/^\# begin of jfbterm\.termcap/, \
+			/^\# end of jfbterm\.termcap/d' \
+			${TERMCAP_FILE}; \
 		if [ -f ${TERMCAP_FILE}.db ]; then \
 			${CAP_MKDB} ${TERMCAP_FILE}; \
 		fi \
 	fi
 .else
 TERMCAP_ADD_RECORD=	${DO_NADA}
+TERMCAP_DEL_RECORD=	${DO_NADA}
 .endif
 
 .if !defined(WITHOUT_UNIFONT)
@@ -124,9 +141,9 @@ do-install:
 	${INSTALL_DATA} ${WRKSRC}/termcap.jfbterm ${DATADIR}
 	${INSTALL_DATA} ${WRKSRC}/terminfo.jfbterm ${DATADIR}
 	${INSTALL_DATA} ${WRKSRC}/fonts/*.pcf.gz ${DATADIR}/fonts
-.endif
-.if !defined(WITHOUT_TERMCAP)
+. if !defined(WITHOUT_TERMCAP)
 	${TERMCAP_ADD_RECORD}
+. endif
 .endif
 
 .include <bsd.port.post.mk>
Index: sysutils/jfbterm/pkg-plist
===================================================================
RCS file: /a/.cvsup/ports/sysutils/jfbterm/pkg-plist,v
retrieving revision 1.2
diff -u -p -r1.2 pkg-plist
--- sysutils/jfbterm/pkg-plist	22 Sep 2010 05:40:20 -0000	1.2
+++ sysutils/jfbterm/pkg-plist	2 Jan 2011 12:13:43 -0000
@@ -8,3 +8,4 @@ etc/jfbterm.conf.sample
 %%PORTDATA%%@dirrm %%DATADIR%%/fonts
 %%PORTDATA%%@dirrm %%DATADIR%%
 %%PORTDATA%%%%TERMCAP_ADD_RECORD%%
+%%PORTDATA%%%%TERMCAP_DEL_RECORD%%
--- a.diff ends here ---
Comment 4 swell.k 2011-01-02 16:40:02 UTC
While here, fix a typo.

--- a.diff begins here ---
Index: sysutils/jfbterm/Makefile
===================================================================
RCS file: /a/.cvsup/ports/sysutils/jfbterm/Makefile,v
retrieving revision 1.14
diff -u -p -r1.14 Makefile
--- sysutils/jfbterm/Makefile	22 Sep 2010 05:44:08 -0000	1.14
+++ sysutils/jfbterm/Makefile	2 Jan 2011 16:36:00 -0000
@@ -117,7 +117,7 @@ do-install:
 	fi
 .if !defined(NO_INSTALL_MANPAGES)
 	${INSTALL_MAN} ${WRKSRC}/${MAN1} ${MAN1PREFIX}/man/man1
-	${INSTALL_MAN} ${WRKSRC}/${MAN5} ${MAN1PREFIX}/man/man5
+	${INSTALL_MAN} ${WRKSRC}/${MAN5} ${MAN5PREFIX}/man/man5
 .endif
 .if !defined(NOPORTDATA)
 	${MKDIR} ${DATADIR}/fonts
--- a.diff ends here ---
Comment 5 Philip M. Gollucci freebsd_committer freebsd_triage 2011-01-12 00:59:36 UTC
Responsible Changed
From-To: pgollucci->freebsd-ports-bugs

E-NO-TIME right now, back to pool
Comment 6 Beat Gaetzi freebsd_committer freebsd_triage 2011-01-26 15:05:49 UTC
State Changed
From-To: open->feedback

Hi, 

The backup file is left behind on deinstall: /usr/share/misc/termcap.bak 

Should we delete this file after working on termcap? 

Thanks, Beat
Comment 7 swell.k 2011-01-26 15:40:19 UTC
beat@FreeBSD.org writes:

> The backup file is left behind on deinstall: /usr/share/misc/termcap.bak
>
> Should we delete this file after working on termcap?

Not sure. It's a backup for system termcap file and has a value for debugging.
But just like with use.perl script after install+deinstall the traces of
original file are forever lost because backup files are not versioned.

TERMCAP is optional as jfbterm works with `xterm' termcap record just fine.

--- a.diff begins here ---
Index: sysutils/jfbterm/Makefile
===================================================================
RCS file: /a/.cvsup/ports/sysutils/jfbterm/Makefile,v
retrieving revision 1.14
diff -u -p -r1.14 Makefile
--- sysutils/jfbterm/Makefile	22 Sep 2010 05:44:08 -0000	1.14
+++ sysutils/jfbterm/Makefile	26 Jan 2011 15:34:54 -0000
@@ -107,6 +124,10 @@ post-extract:	.SILENT
 post-patch:	.SILENT
 	${REINPLACE_CMD} 's|/usr/local|${PREFIX}|g' \
 		${WRKSRC}/*.[0-9] ${WRKSRC}/*.conf.sample
+.if defined(WITHOUT_TERMCAP)
+	${REINPLACE_CMD} '/^term/s/:.*/: xterm/' \
+		${WRKSRC}/*.conf.sample
+.endif
 
 do-install:
 	${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${PREFIX}/bin
--- a.diff ends here ---
Comment 8 swell.k 2011-01-27 05:40:48 UTC
I've removed .bak files. They're not substitute for normal backups and
update operation is not atomic. In the odd case it fails in the middle
of operation the worst thing it can do is leave garbage at the end of
termcap file, e.g. `# begin of jfbterm.termcap' or unused `jfbterm|...'.

Here is a cumulative diff, it includes a few more changes
- respect hier(7), move files from DATADIR to share/misc,
  this makes @exec happy in devel/ncurses* port
- remove redundant GREP check in TERMCAP_(ADD|DEL)_RECORD
- update terminfo upon install

--- a.diff begins here ---
Index: sysutils/jfbterm/Makefile
===================================================================
RCS file: /a/.cvsup/ports/sysutils/jfbterm/Makefile,v
retrieving revision 1.14
diff -u -p -r1.14 Makefile
--- sysutils/jfbterm/Makefile	22 Sep 2010 05:44:08 -0000	1.14
+++ sysutils/jfbterm/Makefile	27 Jan 2011 05:29:39 -0000
@@ -7,7 +7,7 @@
 PORTNAME=	jfbterm
 PORTVERSION=	0.6.1
 DISTVERSIONPREFIX=${OPSYS}-
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	sysutils
 MASTER_SITES=	http://www.ac.auone-net.jp/~baba/${PORTNAME}/ \
 		http://chirashi-no-ura.net/files/
@@ -24,9 +24,13 @@ ONLY_FOR_ARCHS_REASON=	requires VESA sup
 MAKE_JOBS_SAFE=	yes
 MAKEFILE=	${FILESDIR}/BSDmakefile
 MAKE_ENV+=	VERSION=${PORTVERSION} GUNZIP=${GUNZIP_CMD:N-*}
-PLIST_SUB+=	TERMCAP_ADD_RECORD="@exec ${TERMCAP_ADD_RECORD}"
+PLIST_SUB+=	TERMCAP_ADD_RECORD="@exec ${TERMCAP_ADD_RECORD:S,^${PREFIX},%D,}" \
+		TERMCAP_DEL_RECORD="@unexec ${TERMCAP_DEL_RECORD}" \
+		TIC="@exec ${TIC} ${TERMINFO_FILE:S,^${PREFIX},%D,} 2>/dev/null || ${TRUE}"
 
 CAP_MKDB?=	/usr/bin/cap_mkdb
+TIC?=		${LOCALBASE}/bin/tic
+TERMINFO_FILE?=	${PREFIX}/share/misc/${PORTNAME}.terminfo
 
 OPTIONS=	ICONV	"encodings support"		On \
 		PNG	"splash .png support"		On \
@@ -82,15 +86,25 @@ MAKE_ENV+=	WITHOUT_PNG=
 
 .if !defined(WITHOUT_TERMCAP)
 TERMCAP_ADD_RECORD=	\
-	if ${GREP} -q '^jfbterm|' ${TERMCAP_FILE}; then else \
-		${CAT} ${PREFIX}/share/jfbterm/termcap.jfbterm \
-			>>${TERMCAP_FILE}; \
-		if [ -f ${TERMCAP_FILE}.db ]; then \
-			${CAP_MKDB} ${TERMCAP_FILE}; \
-		fi \
+	${ECHO_CMD} '\# begin of ${PORTNAME}.termcap' \
+		>>${TERMCAP_FILE}; \
+	${CAT} ${PREFIX}/share/misc/${PORTNAME}.termcap \
+		>>${TERMCAP_FILE}; \
+	${ECHO_CMD} '\# end of ${PORTNAME}.termcap' \
+		>>${TERMCAP_FILE}; \
+	if [ -f ${TERMCAP_FILE}.db ]; then \
+		${CAP_MKDB} ${TERMCAP_FILE}; \
+	fi
+TERMCAP_DEL_RECORD=	\
+	${REINPLACE_CMD} -i '' '/^\# begin of ${PORTNAME}\.termcap/, \
+		/^\# end of ${PORTNAME}\.termcap/d' \
+		${TERMCAP_FILE}; \
+	if [ -f ${TERMCAP_FILE}.db ]; then \
+		${CAP_MKDB} ${TERMCAP_FILE}; \
 	fi
 .else
 TERMCAP_ADD_RECORD=	${DO_NADA}
+TERMCAP_DEL_RECORD=	${DO_NADA}
 .endif
 
 .if !defined(WITHOUT_UNIFONT)
@@ -105,8 +119,13 @@ post-extract:	.SILENT
 		${WRKSRC}/${PORTNAME}.conf.sample
 
 post-patch:	.SILENT
-	${REINPLACE_CMD} 's|/usr/local|${PREFIX}|g' \
+	${REINPLACE_CMD} -e 's|/usr/local|${PREFIX}|g' \
+		-e 's|\(share\)/${PORTNAME}/\(fonts\)|\1/misc/\2|' \
 		${WRKSRC}/*.[0-9] ${WRKSRC}/*.conf.sample
+.if defined(WITHOUT_TERMCAP)
+	${REINPLACE_CMD} '/^term/s/:.*/: xterm/' \
+		${WRKSRC}/${PORTNAME}.conf.sample
+.endif
 
 do-install:
 	${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${PREFIX}/bin
@@ -117,16 +136,17 @@ do-install:
 	fi
 .if !defined(NO_INSTALL_MANPAGES)
 	${INSTALL_MAN} ${WRKSRC}/${MAN1} ${MAN1PREFIX}/man/man1
-	${INSTALL_MAN} ${WRKSRC}/${MAN5} ${MAN1PREFIX}/man/man5
+	${INSTALL_MAN} ${WRKSRC}/${MAN5} ${MAN5PREFIX}/man/man5
 .endif
 .if !defined(NOPORTDATA)
-	${MKDIR} ${DATADIR}/fonts
-	${INSTALL_DATA} ${WRKSRC}/termcap.jfbterm ${DATADIR}
-	${INSTALL_DATA} ${WRKSRC}/terminfo.jfbterm ${DATADIR}
-	${INSTALL_DATA} ${WRKSRC}/fonts/*.pcf.gz ${DATADIR}/fonts
-.endif
-.if !defined(WITHOUT_TERMCAP)
+	${INSTALL_DATA} ${WRKSRC}/termcap.${PORTNAME} ${PREFIX}/share/misc/${PORTNAME}.termcap
+	${INSTALL_DATA} ${WRKSRC}/terminfo.${PORTNAME} ${PREFIX}/share/misc/${PORTNAME}.terminfo
+	${MKDIR} ${PREFIX}/share/misc/fonts
+	${INSTALL_DATA} ${WRKSRC}/fonts/*.pcf.gz ${PREFIX}/share/misc/fonts
+. if !defined(WITHOUT_TERMCAP)
 	${TERMCAP_ADD_RECORD}
+. endif
+	-${TIC} ${TERMINFO_FILE} 2>/dev/null
 .endif
 
 .include <bsd.port.post.mk>
Index: sysutils/jfbterm/pkg-plist
===================================================================
RCS file: /a/.cvsup/ports/sysutils/jfbterm/pkg-plist,v
retrieving revision 1.2
diff -u -p -r1.2 pkg-plist
--- sysutils/jfbterm/pkg-plist	22 Sep 2010 05:40:20 -0000	1.2
+++ sysutils/jfbterm/pkg-plist	27 Jan 2011 05:01:22 -0000
@@ -2,9 +2,10 @@ bin/jfbterm
 @unexec if cmp -s %D/etc/jfbterm.conf.sample %D/etc/jfbterm.conf; then rm -f %D/etc/jfbterm.conf; fi
 etc/jfbterm.conf.sample
 @exec if [ ! -f %D/etc/jfbterm.conf ]; then cp -p %D/%F %B/jfbterm.conf; fi
-%%PORTDATA%%%%DATADIR%%/fonts/vt100-graphics.pcf.gz
-%%PORTDATA%%%%DATADIR%%/termcap.jfbterm
-%%PORTDATA%%%%DATADIR%%/terminfo.jfbterm
-%%PORTDATA%%@dirrm %%DATADIR%%/fonts
-%%PORTDATA%%@dirrm %%DATADIR%%
+%%PORTDATA%%share/misc/fonts/vt100-graphics.pcf.gz
+%%PORTDATA%%share/misc/jfbterm.termcap
+%%PORTDATA%%share/misc/jfbterm.terminfo
+%%PORTDATA%%@dirrmtry share/misc/fonts
 %%PORTDATA%%%%TERMCAP_ADD_RECORD%%
+%%PORTDATA%%%%TERMCAP_DEL_RECORD%%
+%%PORTDATA%%%%TIC%%
--- a.diff ends here ---
Comment 9 Chris Rees freebsd_committer freebsd_triage 2011-06-18 15:08:31 UTC
State Changed
From-To: feedback->open

New patch from maintainer 


Comment 10 Chris Rees freebsd_committer freebsd_triage 2011-06-18 15:08:31 UTC
Responsible Changed
From-To: freebsd-ports-bugs->crees

I'll take it
Comment 11 dfilter service freebsd_committer freebsd_triage 2011-06-19 11:56:18 UTC
crees       2011-06-19 10:56:09 UTC

  FreeBSD ports repository

  Modified files:
    sysutils/jfbterm     Makefile pkg-plist 
  Log:
  - Remove termcap record on deinstall
  - Use %D in plist
  - Respect NOPORTDATA
  
  PR:             ports/153622
  Submitted by:   Anonymous (swell.k@gmail.com) (maintainer)
  Approved by:    rene (mentor)
  
  Revision  Changes    Path
  1.15      +36 -16    ports/sysutils/jfbterm/Makefile
  1.3       +6 -5      ports/sysutils/jfbterm/pkg-plist
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 12 Chris Rees freebsd_committer freebsd_triage 2011-06-19 11:56:28 UTC
State Changed
From-To: open->closed

Committed. Thanks!