From owner-freebsd-ports-bugs@FreeBSD.ORG Mon Apr 10 21:00:29 2006 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 541BA16A407 for ; Mon, 10 Apr 2006 21:00:29 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id A89C143D46 for ; Mon, 10 Apr 2006 21:00:28 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k3AL0S36070911 for ; Mon, 10 Apr 2006 21:00:28 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k3AL0SKG070910; Mon, 10 Apr 2006 21:00:28 GMT (envelope-from gnats) Resent-Date: Mon, 10 Apr 2006 21:00:28 GMT Resent-Message-Id: <200604102100.k3AL0SKG070910@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Jean-Yves Lefort Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 519F616A401 for ; Mon, 10 Apr 2006 20:53:15 +0000 (UTC) (envelope-from jylefort@brutele.be) Received: from mirapoint3.brutele.be (mirapoint3.brutele.be [212.68.199.148]) by mx1.FreeBSD.org (Postfix) with ESMTP id 67AC743D45 for ; Mon, 10 Apr 2006 20:53:14 +0000 (GMT) (envelope-from jylefort@brutele.be) Received: from host-212-68-244-243.brutele.be (host-212-68-244-243.brutele.be [212.68.244.243]) by mirapoint3.brutele.be (MOS 3.7.3-GA) with ESMTP id AFE30865; Mon, 10 Apr 2006 22:53:11 +0200 (CEST) Received: from jsite.lefort.net (jsite.lefort.net [192.168.1.2]) by gateway.lefort.net (Postfix) with ESMTP id C991054C1 for ; Mon, 10 Apr 2006 22:53:10 +0200 (CEST) Received: by jsite.lefort.net (Postfix, from userid 1000) id 93FF2C148; Mon, 10 Apr 2006 22:53:10 +0200 (CEST) Message-Id: <20060410205310.93FF2C148@jsite.lefort.net> Date: Mon, 10 Apr 2006 22:53:10 +0200 (CEST) From: Jean-Yves Lefort To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: ports/95603: bsd.port.mk: DESKTOP_ENTRIES-related improvements X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Jean-Yves Lefort List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Apr 2006 21:00:29 -0000 >Number: 95603 >Category: ports >Synopsis: bsd.port.mk: DESKTOP_ENTRIES-related improvements >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Mon Apr 10 21:00:27 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Jean-Yves Lefort >Release: FreeBSD 6.0-RELEASE i386 >Organization: >Environment: System: FreeBSD jsite.lefort.net 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Wed Mar 22 19:35:20 CET 2006 jylefort@jsite.lefort.net:/usr/obj/usr/src/sys/JSITE i386 >Description: - Enforce sanity of DESKTOP_ENTRIES - If the Categories field is omitted, try to map ports categories to their freedesktop.org counterpart >How-To-Repeat: >Fix: --- /usr/ports/Mk/bsd.port.mk Thu Feb 23 16:37:20 2006 +++ bsd.port.mk Mon Apr 10 22:40:07 2006 @@ -865,8 +865,14 @@ # variable permits, write it yourself and install it # in ${DESKTOPDIR}. # Notes: -# * Comment and Icon may be empty strings (""). The other -# fields are mandatory. +# * Comment and Icon may be empty strings (""). Categories +# may be an empty string in some cases (see below). The +# other fields are mandatory. +# * If Categories is an empty string, bsd.port.mk will try +# to deduce a default value using the CATEGORIES variable. +# 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. # * The files will be automatically added to ${PLIST}. # Example: @@ -3753,8 +3759,9 @@ # should not be modified. _SANITY_SEQ= pre-everything check-makefile check-categories \ - check-makevars check-depends check-deprecated \ - check-vulnerable buildanyway-message options-message + check-makevars check-desktop-entries check-depends \ + check-deprecated check-vulnerable buildanyway-message \ + options-message _FETCH_DEP= check-sanity _FETCH_SEQ= fetch-depends pre-fetch pre-fetch-script \ do-fetch post-fetch post-fetch-script @@ -5358,6 +5365,150 @@ done .endif +desktop-categories: + @categories=""; \ + for native_category in ${CATEGORIES}; do \ + c=""; \ + case $$native_category in \ + accessibility) c="Accessibility Utility" ;; \ + archivers) c="Archiving" ;; \ + astro) c="Astronomy Science Education" ;; \ + audio) c="Audio AudioVideo" ;; \ + benchmarks) c="System" ;; \ + biology) c="Biology Science Education" ;; \ + cad) c="Engineering" ;; \ + databases) c="Database" ;; \ + deskutils) c="Utility" ;; \ + devel) c="Development" ;; \ + dns) c="Network" ;; \ + elisp) c="Development" ;; \ + emulators) c="Emulator" ;; \ + finance) c="Finance Office" ;; \ + ftp) c="FileTransfer Network" ;; \ + games) c="Game" ;; \ + gnome) c="GNOME GTK" ;; \ + graphics) c="Graphics" ;; \ + hamradio) c="HamRadio" ;; \ + haskell) c="Development" ;; \ + ipv6) c="Network" ;; \ + irc) c="IRCClient Network" ;; \ + java) c="Java Development" ;; \ + kde) c="KDE QT" ;; \ + lang) c="Development" ;; \ + lisp) c="Development" ;; \ + mail) c="Email Office Network" ;; \ + mbone) c="Network AudioVideo" ;; \ + multimedia) c="AudioVideo" ;; \ + net) c="Network" ;; \ + net-im) c="InstantMessaging Network" ;; \ + net-mgmt) c="Network" ;; \ + net-p2p) c="P2P Network" ;; \ + news) c="News" ;; \ + pear) c="WebDevelopment Development" ;; \ + perl5) c="Development" ;; \ + python) c="Development" ;; \ + ruby) c="Development" ;; \ + rubygems) c="Development" ;; \ + scheme) c="Development" ;; \ + science) c="Science Education" ;; \ + security) c="Security System" ;; \ + shells) c="Shell" ;; \ + sysutils) c="System Utility" ;; \ + tcl*|tk*) c="Development" ;; \ + www) c="Network" ;; \ + x11-clocks) c="Clock Utility" ;; \ + x11-fm) c="FileManager" ;; \ + xfce) c="GTK" ;; \ + zope) c="WebDevelopment Development" ;; \ + esac; \ + if [ -n "$$c" ]; then \ + categories="$$categories $$c"; \ + fi; \ + done; \ + if [ -n "$$categories" ]; then \ + for c in Application $$categories; do ${ECHO_MSG} "$$c"; done \ + | ${SORT} -u | ${TR} '\n' ';'; \ + ${ECHO_MSG}; \ + fi + +VALID_DESKTOP_CATEGORIES+= Application Core Development Building Debugger IDE \ + GUIDesigner Profiling RevisionControl Translation Office Calendar \ + ContactManagement Database Dictionary Chart Email Finance FlowChart PDA \ + ProjectManagement Presentation Spreadsheet WordProcessor Graphics \ + 2DGraphics VectorGraphics RasterGraphics 3DGraphics Scanning OCR \ + Photography Viewer Settings DesktopSettings HardwareSettings \ + PackageManager Network Dialup InstantMessaging IRCClient FileTransfer \ + HamRadio News P2P RemoteAccess Telephony WebBrowser WebDevelopment \ + AudioVideo Audio Midi Mixer Sequencer Tuner Video TV AudioVideoEditing \ + Player Recorder DiscBurning Game ActionGame AdventureGame ArcadeGame \ + BoardGame BlocksGame CardGame KidsGame LogicGame RolePlaying Simulation \ + SportsGame StrategyGame Education Art Construction Music Languages \ + Science Astronomy Biology Chemistry Geology Math MedicalSoftware Physics \ + Teaching Amusement Applet Archiving Electronics Emulator Engineering \ + FileManager Shell Screensaver TerminalEmulator TrayIcon System Filesystem \ + Monitor Security Utility Accessibility Calculator Clock TextEditor KDE \ + GNOME GTK Qt Motif Java ConsoleOnly + +check-desktop-entries: +.if defined(DESKTOP_ENTRIES) + @set ${DESKTOP_ENTRIES} XXX; \ + if [ $$((($$# - 1) % 6)) -ne 0 ]; then \ + ${ECHO_CMD} "${PKGNAME}: Makefile error: the DESKTOP_ENTRIES list must contain one or more groups of 6 elements"; \ + exit 1; \ + fi; \ + num=1; \ + while [ $$# -gt 6 ]; do \ + entry="#$$num"; \ + if [ -n "$$4" ]; then \ + entry="$$entry ($$4)"; \ + elif [ -n "$$1" ]; then \ + entry="$$entry ($$1)"; \ + fi; \ + if [ -z "$$1" ]; then \ + ${ECHO_CMD} "${PKGNAME}: Makefile error: in desktop entry $$entry: field 1 (Name) is empty"; \ + exit 1; \ + fi; \ + iconext=`${EXPR} "$$3" : '.*\.\(.*\)$$'` || ${TRUE}; \ + if [ -n "$$iconext" ] && [ "x$$iconext" != "xpng" ] && [ "x$$iconext" != "xxpm" ]; then \ + ${ECHO_CMD} "${PKGNAME}: Makefile error: in desktop entry $$entry: the specified icon ($$3) is not a .png or .xpm file"; \ + exit 1; \ + fi; \ + if [ -z "$$4" ]; then \ + ${ECHO_CMD} "${PKGNAME}: Makefile error: in desktop entry $$entry: field 4 (Exec) is empty"; \ + exit 1; \ + fi; \ + if [ -n "$$5" ]; then \ + for c in `${ECHO_CMD} "$$5" | ${TR} ';' ' '`; do \ + if ! ${ECHO_CMD} ${VALID_DESKTOP_CATEGORIES} | ${GREP} -wq $$c; then \ + ${ECHO_CMD} "${PKGNAME}: Makefile error: in desktop entry $$entry: category $$c is not a valid desktop category"; \ + exit 1; \ + fi; \ + done; \ + if ! ${ECHO_CMD} "$$5" | ${GREP} -q ';$$'; then \ + ${ECHO_CMD} "${PKGNAME}: Makefile error: in desktop entry $$entry: field 5 (Categories) does not end with a semicolon"; \ + exit 1; \ + fi; \ + else \ + if [ -z "`cd ${.CURDIR} && ${MAKE} ${__softMAKEFLAGS} desktop-categories`" ]; then \ + ${ECHO_CMD} "${PKGNAME}: Makefile error: in desktop entry $$entry: field 5 (Categories) is empty and could not be deduced from the CATEGORIES variable"; \ + exit 1; \ + fi; \ + fi; \ + if [ -z "$$6" ]; then \ + ${ECHO_CMD} "${PKGNAME}: Makefile error: in desktop entry $$entry: field 6 (StartupNotify) is empty"; \ + exit 1; \ + fi; \ + if [ "x$$6" != "xtrue" ] && [ "x$$6" != "xfalse" ]; then \ + ${ECHO_CMD} "${PKGNAME}: Makefile error: in desktop entry $$entry: field 6 (StartupNotify) is not \"true\" or \"false\""; \ + exit 1; \ + fi; \ + shift 6; \ + num=$$((num + 1)); \ + done +.else + @${DO_NADA} +.endif + .if !target(install-desktop-entries) install-desktop-entries: .if defined(DESKTOP_ENTRIES) @@ -5370,6 +5521,10 @@ while [ $$# -gt 6 ]; do \ filename="$$4.desktop"; \ pathname="${DESKTOPDIR}/$$filename"; \ + categories="$$5"; \ + if [ -z "$$categories" ]; then \ + categories="`cd ${.CURDIR} && ${MAKE} ${__softMAKEFLAGS} desktop-categories`"; \ + fi; \ ${ECHO_CMD} "${_DESKTOPDIR_REL}$$filename" >> ${TMPPLIST}; \ ${ECHO_CMD} "[Desktop Entry]" > $$pathname; \ ${ECHO_CMD} "Type=Application" >> $$pathname; \ @@ -5383,7 +5538,7 @@ ${ECHO_CMD} "Icon=$$3" >> $$pathname; \ fi; \ ${ECHO_CMD} "Exec=$$4" >> $$pathname; \ - ${ECHO_CMD} "Categories=$$5" >> $$pathname; \ + ${ECHO_CMD} "Categories=$$categories" >> $$pathname; \ ${ECHO_CMD} "StartupNotify=$$6" >> $$pathname; \ shift 6; \ done; \ >Release-Note: >Audit-Trail: >Unformatted: