[RFC] A trivial change for DESKTOP_ENTRIES (take 2)
Jung-uk Kim
jkim at FreeBSD.org
Wed Jul 13 22:57:44 UTC 2011
On Tuesday 12 July 2011 06:25 pm, Jung-uk Kim wrote:
> After I updated x11-wm/compiz, GNOME was not able to start the
> window manager. Basically, it complained that compiz-manager was
> not found. Then, I realized compiz-manager.desktop was
> automagically replaced by compizmanager.desktop. Now I tracked it
> down to this commit:
>
> Sat Nov 27 17:42:46 2010 UTC (7 months, 2 weeks ago) by pav
>
> - DESKTOP_ENTRIES: commandline is used to name installed .desktop
> file, this can lead to files containing whitespace and funny
> characters; thus strip all non-alphanumeric characters
>
> http://www.freebsd.org/cgi/cvsweb.cgi/ports/Mk/bsd.port.mk.diff?r1=
>1.656;r2=1.657
>
> To me, it looks far too restrictive. At least, I'd like to allow
> '-' and '_'. Please see the attached patch.
Please review the revised patches.
bsd.port.mk.diff:
- Allow '-' and '_' in desktop file names for DESKTOP_ENTRIES.
- Apply basename(1) on Exec to remove directory structure when desktop
file names are made.
- Add a comment about Exec limitations.
links.diff, metalink-editor.diff, tome.diff:
- Add static desktop files to work around DESKTOP_ENTRIES limitations.
Ultimately, we may have to consider adding an additional field in
DESKTOP_ENTRIES for its file name.
These patches are also available from here:
http://people.freebsd.org/~jkim/bsd.port.mk.diff
http://people.freebsd.org/~jkim/links.diff
http://people.freebsd.org/~jkim/metalink-editor.diff
http://people.freebsd.org/~jkim/tome.diff
Thanks,
Jung-uk Kim
-------------- next part --------------
Index: Mk/bsd.port.mk
===================================================================
RCS file: /home/pcvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.687
diff -u -r1.687 bsd.port.mk
--- Mk/bsd.port.mk 3 Jul 2011 15:51:18 -0000 1.687
+++ Mk/bsd.port.mk 13 Jul 2011 22:33:56 -0000
@@ -1064,7 +1064,9 @@
# If the deduction fails, you will have to set Categories
# manually. You should check the generated value using
# "make desktop-categories", and override it if necessary.
-# * Exec will also be used to name the .desktop file.
+# * Exec will also be used to name the .desktop file. Only
+# alphanumeric characters, "-", and "_" are allowed after
+# basename(1) is executed on it.
# * The files will be automatically added to ${PLIST}.
# Example:
# "X Window Information" \
@@ -6389,6 +6391,11 @@
if [ -z "$$4" ]; then \
${ECHO_MSG} "${PKGNAME}: Makefile error: in desktop entry $$entry: field 4 (Exec) is empty"; \
exit 1; \
+ else \
+ if [ -n "`${BASENAME} "$$4" | ${TR} -d '[:alnum:]-_'`" ]; then \
+ ${ECHO_CMD} "${PKGNAME}: Makefile error: in desktop entry $$entry: field 4 (Exec) has a disallowed character"; \
+ exit 1; \
+ fi; \
fi; \
if [ -n "$$5" ]; then \
for c in `${ECHO_CMD} "$$5" | ${TR} ';' ' '`; do \
@@ -6432,7 +6439,7 @@
${ECHO_CMD} "@cwd ${DESKTOPDIR}" >> ${TMPPLIST}; \
fi; \
while [ $$# -gt 6 ]; do \
- filename="`${ECHO_CMD} "$$4" | ${TR} -cd [:alnum:]`.desktop"; \
+ filename="`${BASENAME} "$$4"`.desktop"; \
pathname="${DESKTOPDIR}/$$filename"; \
categories="$$5"; \
if [ -z "$$categories" ]; then \
-------------- next part --------------
Index: games/tome/Makefile
===================================================================
RCS file: /home/pcvs/ports/games/tome/Makefile,v
retrieving revision 1.21
diff -u -r1.21 Makefile
--- games/tome/Makefile 25 Jan 2010 22:49:44 -0000 1.21
+++ games/tome/Makefile 13 Jul 2011 22:33:56 -0000
@@ -7,7 +7,7 @@
PORTNAME= tome
PORTVERSION= 2.3.5
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= games
MASTER_SITES= http://t-o-m-e.net/dl/src/
DISTNAME= tome-235-src
@@ -15,7 +15,7 @@
MAINTAINER= ports at FreeBSD.org
COMMENT= Roguelike dungeon exploration game based on JRR Tolkien's works
-SUB_FILES= pkg-deinstall
+SUB_FILES= pkg-deinstall tome.desktop
ALL_TARGET= # empty
MAKEFILE= makefile.bsd
@@ -24,10 +24,6 @@
WRKSRC= ${WRKDIR}/${DISTNAME}/src
OPTIONS= X11 "Turn on support for X" on
-DESKTOP_ENTRIES= "ToME" "Roguelike game based on JRR Tolkien's work" \
- "${DATADIR}/xtra/graf/tome-128.png" \
- "tome -v -g" "Application;Game;RolePlaying;" \
- false
.include <bsd.port.pre.mk>
@@ -43,4 +39,8 @@
${REINPLACE_CMD} -e 's at -I$$(LOCALBASE)/include@@g' ${WRKSRC}/${MAKEFILE}
.endif
+post-install:
+ ${MKDIR} ${DESKTOPDIR}
+ ${INSTALL_DATA} ${WRKDIR}/tome.desktop ${DESKTOPDIR}
+
.include <bsd.port.post.mk>
Index: games/tome/pkg-plist
===================================================================
RCS file: /home/pcvs/ports/games/tome/pkg-plist,v
retrieving revision 1.11
diff -u -r1.11 pkg-plist
--- games/tome/pkg-plist 5 Jul 2008 02:49:58 -0000 1.11
+++ games/tome/pkg-plist 13 Jul 2011 22:33:56 -0000
@@ -1,6 +1,7 @@
bin/tome
@exec chown root:games %F
@exec chmod 2755 %F
+share/applications/tome.desktop
%%DATADIR%%/apex/.cvsignore
%%DATADIR%%/apex/delete.me
%%DATADIR%%/apex/scores.raw
Index: games/tome/files/tome.desktop.in
===================================================================
RCS file: games/tome/files/tome.desktop.in
diff -N games/tome/files/tome.desktop.in
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ games/tome/files/tome.desktop.in 13 Jul 2011 22:33:56 -0000
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Type=Application
+Version=0.9.4
+Encoding=UTF-8
+Name=ToME
+Comment=Roguelike game based on JRR Tolkien's work
+Icon=%%DATADIR%%/xtra/graf/tome-128.png
+Exec=tome -v -g
+Categories=Application;Game;RolePlaying;
+StartupNotify=false
-------------- next part --------------
Index: misc/metalink-editor/Makefile
===================================================================
RCS file: /home/pcvs/ports/misc/metalink-editor/Makefile,v
retrieving revision 1.6
diff -u -r1.6 Makefile
--- misc/metalink-editor/Makefile 13 Jun 2010 12:41:31 -0000 1.6
+++ misc/metalink-editor/Makefile 13 Jul 2011 22:33:56 -0000
@@ -7,7 +7,7 @@
PORTNAME= metalink
PORTVERSION= 1.2.0
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= misc
MASTER_SITES= SF/${PORTNAME}s/Metalink%20Editor/${PORTVERSION}
PKGNAMESUFFIX?= -editor
@@ -31,12 +31,11 @@
DATADIR= ${PREFIX}/share/${PORTNAME}${PKGNAMESUFFIX}
-DESKTOP_ENTRIES= "Metalink editor" \
- "GUI editor to create and edit metalinks" \
- "${DATADIR}/metalink.png" \
- "metalink_editor.py" \
- "Network;FileTransfer;" \
- true
+#
+# Desktop files to install
+#
+SUB_FILES= \
+ metalink-editor.desktop
#
# Documents to install
@@ -69,6 +68,9 @@
> ${WRKSRC}/${PYSETUP}
post-install:
+# desktop
+ @${MKDIR} ${DESKTOPDIR}
+ @${INSTALL_DATA} ${WRKDIR}/metalink-editor.desktop ${DESKTOPDIR}
# docs
.ifndef(NOPORTDOCS)
@${MKDIR} ${DOCSDIR}
Index: misc/metalink-editor/pkg-plist
===================================================================
RCS file: /home/pcvs/ports/misc/metalink-editor/pkg-plist,v
retrieving revision 1.1
diff -u -r1.1 pkg-plist
--- misc/metalink-editor/pkg-plist 11 Aug 2008 03:31:15 -0000 1.1
+++ misc/metalink-editor/pkg-plist 13 Jul 2011 22:33:56 -0000
@@ -1,4 +1,5 @@
bin/metalink_editor.py
+share/applications/metalink-editor.desktop
%%PYTHON_SITELIBDIR%%/Metalink_editor/__init__.py
%%PYTHON_SITELIBDIR%%/Metalink_editor/__init__.pyc
%%PYTHON_SITELIBDIR%%/Metalink_editor/__init__.pyo
Index: misc/metalink-editor/files/metalink-editor.desktop.in
===================================================================
RCS file: misc/metalink-editor/files/metalink-editor.desktop.in
diff -N misc/metalink-editor/files/metalink-editor.desktop.in
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ misc/metalink-editor/files/metalink-editor.desktop.in 13 Jul 2011 22:33:56 -0000
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Type=Application
+Version=0.9.4
+Encoding=UTF-8
+Name=Metalink editor
+Comment=GUI editor to create and edit metalinks
+Icon=%%DATADIR%%/metalink.png
+Exec=metalink_editor.py
+Categories=Network;FileTransfer;
+StartupNotify=true
-------------- next part --------------
Index: www/links/Makefile
===================================================================
RCS file: /home/pcvs/ports/www/links/Makefile,v
retrieving revision 1.69
diff -u -r1.69 Makefile
--- www/links/Makefile 8 Dec 2010 14:47:34 -0000 1.69
+++ www/links/Makefile 13 Jul 2011 22:33:56 -0000
@@ -7,7 +7,7 @@
PORTNAME= links
DISTVERSION= 2.2
-PORTREVISION= 7
+PORTREVISION= 8
PORTEPOCH= 1
CATEGORIES?= www
MASTER_SITES= http://links.twibright.com/download/
@@ -72,13 +72,8 @@
.if !defined(WITHOUT_X11)
USE_XORG= x11 xproto
CONFIGURE_ARGS+= --with-x
-DESKTOP_ENTRIES="links" \
- "Lynx-like text WWW browser" \
- "links" \
- "links -g" \
- "Application;Network;WebBrowser;" \
- false
-PLIST_FILES+= share/pixmaps/links.xpm
+SUB_FILES+= links.desktop
+PLIST_FILES+= share/applications/links.desktop share/pixmaps/links.xpm
.else
CONFIGURE_ARGS+= --without-x
.endif
@@ -101,6 +96,8 @@
.if !defined(WITHOUT_X11)
post-install:
+ @${MKDIR} ${DESKTOPDIR}
+ @${INSTALL_DATA} ${WRKDIR}/links.desktop ${DESKTOPDIR}
@${INSTALL_DATA} ${WRKSRC}/graphics/links.xpm ${PREFIX}/share/pixmaps/links.xpm
.endif
Index: www/links/files/links.desktop.in
===================================================================
RCS file: www/links/files/links.desktop.in
diff -N www/links/files/links.desktop.in
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ www/links/files/links.desktop.in 13 Jul 2011 22:33:56 -0000
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Type=Application
+Version=0.9.4
+Encoding=UTF-8
+Name=links
+Comment=Lynx-like text WWW browser
+Icon=links
+Exec=links -g
+Categories=Application;Network;WebBrowser;
+StartupNotify=false
More information about the freebsd-ports
mailing list