public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 1/3] eutils.eclass: Remove check_license function.
  2017-11-24 12:34 [gentoo-dev] [PATCH 0/3] Further cleanup of eutils.eclass Ulrich Müller
@ 2017-11-23 23:30 ` Ulrich Müller
  2017-11-23 23:38 ` [gentoo-dev] [PATCH 2/3] eutils.eclass: Remove validate_desktop_entries function Ulrich Müller
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Ulrich Müller @ 2017-11-23 23:30 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 476 bytes --]

This is an inoperative stub since 2011, and no longer used in the tree.
---
 eclass/eutils.eclass | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
index f35fa5980d7a..7fd4b847a649 100644
--- a/eclass/eutils.eclass
+++ b/eclass/eutils.eclass
@@ -869,10 +869,6 @@ optfeature() {
 	fi
 }
 
-check_license() {
-	die "you no longer need this as portage supports ACCEPT_LICENSE itself"
-}
-
 case ${EAPI:-0} in
 0|1|2)
 
-- 
2.15.0

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-dev] [PATCH 2/3] eutils.eclass: Remove validate_desktop_entries function.
  2017-11-24 12:34 [gentoo-dev] [PATCH 0/3] Further cleanup of eutils.eclass Ulrich Müller
  2017-11-23 23:30 ` [gentoo-dev] [PATCH 1/3] eutils.eclass: Remove check_license function Ulrich Müller
@ 2017-11-23 23:38 ` Ulrich Müller
  2017-11-23 23:39 ` [gentoo-dev] [PATCH 3/3] desktop.eclass: Split off desktop, menu, and icon functions from eutils Ulrich Müller
  2017-11-30 19:11 ` [gentoo-dev] [PATCH 0/3] Further cleanup of eutils.eclass Ulrich Mueller
  3 siblings, 0 replies; 5+ messages in thread
From: Ulrich Müller @ 2017-11-23 23:38 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1712 bytes --]

This function is no longer used in the tree. It was deprecated more
than 8 months ago in commit 650a1ebe8f63d3750908142e2117b24a8efc9403.
---
 eclass/eutils.eclass | 30 ------------------------------
 1 file changed, 30 deletions(-)

diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
index 7fd4b847a649..972a2138aad7 100644
--- a/eclass/eutils.eclass
+++ b/eclass/eutils.eclass
@@ -314,36 +314,6 @@ _eutils_eprefix_init() {
 	has "${EAPI:-0}" 0 1 2 && : ${ED:=${D}} ${EPREFIX:=} ${EROOT:=${ROOT}}
 }
 
-# @FUNCTION: validate_desktop_entries
-# @USAGE: [directories]
-# @DESCRIPTION:
-# Validate desktop entries using desktop-file-utils
-validate_desktop_entries() {
-	eqawarn "validate_desktop_entries is deprecated and should be not be used."
-	eqawarn ".desktop file validation is done implicitly by Portage now."
-
-	_eutils_eprefix_init
-	if [[ -x "${EPREFIX}"/usr/bin/desktop-file-validate ]] ; then
-		einfo "Checking desktop entry validity"
-		local directories=""
-		for d in /usr/share/applications $@ ; do
-			[[ -d ${ED}${d} ]] && directories="${directories} ${ED}${d}"
-		done
-		if [[ -n ${directories} ]] ; then
-			for FILE in $(find ${directories} -name "*\.desktop" \
-							-not -path '*.hidden*' | sort -u 2>/dev/null)
-			do
-				local temp=$(desktop-file-validate ${FILE} | grep -v "warning:" | \
-								sed -e "s|error: ||" -e "s|${FILE}:|--|g" )
-				[[ -n $temp ]] && elog ${temp/--/${FILE/${ED}/}:}
-			done
-		fi
-		echo ""
-	else
-		einfo "Passing desktop entry validity check. Install dev-util/desktop-file-utils, if you want to help to improve Gentoo."
-	fi
-}
-
 # @FUNCTION: make_session_desktop
 # @USAGE: <title> <command> [command args...]
 # @DESCRIPTION:
-- 
2.15.0

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-dev] [PATCH 3/3] desktop.eclass: Split off desktop, menu, and icon functions from eutils.
  2017-11-24 12:34 [gentoo-dev] [PATCH 0/3] Further cleanup of eutils.eclass Ulrich Müller
  2017-11-23 23:30 ` [gentoo-dev] [PATCH 1/3] eutils.eclass: Remove check_license function Ulrich Müller
  2017-11-23 23:38 ` [gentoo-dev] [PATCH 2/3] eutils.eclass: Remove validate_desktop_entries function Ulrich Müller
@ 2017-11-23 23:39 ` Ulrich Müller
  2017-11-30 19:11 ` [gentoo-dev] [PATCH 0/3] Further cleanup of eutils.eclass Ulrich Mueller
  3 siblings, 0 replies; 5+ messages in thread
From: Ulrich Müller @ 2017-11-23 23:39 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 21428 bytes --]

Split off functions make_desktop_entry, make_session_desktop, domenu,
newmenu, doicon, and newicon from eutils.eclass into a dedicated
desktop.eclass. These functions are independent of the rest of eutils,
therefore moving them into their own eclass will help clarifying
eclass inheritance in ebuilds.

For backwards compatibility, eutils inherits the new eclass in
existing EAPIs.
---
 eclass/desktop.eclass | 395 +++++++++++++++++++++++++++++++++++++++++++++++++
 eclass/eutils.eclass  | 401 ++------------------------------------------------
 2 files changed, 404 insertions(+), 392 deletions(-)
 create mode 100644 eclass/desktop.eclass

diff --git a/eclass/desktop.eclass b/eclass/desktop.eclass
new file mode 100644
index 000000000000..d65b0d0bf074
--- /dev/null
+++ b/eclass/desktop.eclass
@@ -0,0 +1,395 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: desktop.eclass
+# @MAINTAINER:
+# base-system@gentoo.org
+# @BLURB: support for desktop files, menus, and icons
+
+if [[ -z ${_DESKTOP_ECLASS} ]]; then
+_DESKTOP_ECLASS=1
+
+# @FUNCTION: make_desktop_entry
+# @USAGE: make_desktop_entry(<command>, [name], [icon], [type], [fields])
+# @DESCRIPTION:
+# Make a .desktop file.
+#
+# @CODE
+# binary:   what command does the app run with ?
+# name:     the name that will show up in the menu
+# icon:     the icon to use in the menu entry
+#           this can be relative (to /usr/share/pixmaps) or
+#           a full path to an icon
+# type:     what kind of application is this?
+#           for categories:
+#           https://specifications.freedesktop.org/menu-spec/latest/apa.html
+#           if unset, function tries to guess from package's category
+# fields:	extra fields to append to the desktop file; a printf string
+# @CODE
+make_desktop_entry() {
+	[[ -z $1 ]] && die "make_desktop_entry: You must specify the executable"
+
+	local exec=${1}
+	local name=${2:-${PN}}
+	local icon=${3:-${PN}}
+	local type=${4}
+	local fields=${5}
+
+	if [[ -z ${type} ]] ; then
+		local catmaj=${CATEGORY%%-*}
+		local catmin=${CATEGORY##*-}
+		case ${catmaj} in
+			app)
+				case ${catmin} in
+					accessibility) type="Utility;Accessibility";;
+					admin)         type=System;;
+					antivirus)     type=System;;
+					arch)          type="Utility;Archiving";;
+					backup)        type="Utility;Archiving";;
+					cdr)           type="AudioVideo;DiscBurning";;
+					dicts)         type="Office;Dictionary";;
+					doc)           type=Documentation;;
+					editors)       type="Utility;TextEditor";;
+					emacs)         type="Development;TextEditor";;
+					emulation)     type="System;Emulator";;
+					laptop)        type="Settings;HardwareSettings";;
+					office)        type=Office;;
+					pda)           type="Office;PDA";;
+					vim)           type="Development;TextEditor";;
+					xemacs)        type="Development;TextEditor";;
+				esac
+				;;
+
+			dev)
+				type="Development"
+				;;
+
+			games)
+				case ${catmin} in
+					action|fps) type=ActionGame;;
+					arcade)     type=ArcadeGame;;
+					board)      type=BoardGame;;
+					emulation)  type=Emulator;;
+					kids)       type=KidsGame;;
+					puzzle)     type=LogicGame;;
+					roguelike)  type=RolePlaying;;
+					rpg)        type=RolePlaying;;
+					simulation) type=Simulation;;
+					sports)     type=SportsGame;;
+					strategy)   type=StrategyGame;;
+				esac
+				type="Game;${type}"
+				;;
+
+			gnome)
+				type="Gnome;GTK"
+				;;
+
+			kde)
+				type="KDE;Qt"
+				;;
+
+			mail)
+				type="Network;Email"
+				;;
+
+			media)
+				case ${catmin} in
+					gfx)
+						type=Graphics
+						;;
+					*)
+						case ${catmin} in
+							radio) type=Tuner;;
+							sound) type=Audio;;
+							tv)    type=TV;;
+							video) type=Video;;
+						esac
+						type="AudioVideo;${type}"
+						;;
+				esac
+				;;
+
+			net)
+				case ${catmin} in
+					dialup) type=Dialup;;
+					ftp)    type=FileTransfer;;
+					im)     type=InstantMessaging;;
+					irc)    type=IRCClient;;
+					mail)   type=Email;;
+					news)   type=News;;
+					nntp)   type=News;;
+					p2p)    type=FileTransfer;;
+					voip)   type=Telephony;;
+				esac
+				type="Network;${type}"
+				;;
+
+			sci)
+				case ${catmin} in
+					astro*)  type=Astronomy;;
+					bio*)    type=Biology;;
+					calc*)   type=Calculator;;
+					chem*)   type=Chemistry;;
+					elec*)   type=Electronics;;
+					geo*)    type=Geology;;
+					math*)   type=Math;;
+					physics) type=Physics;;
+					visual*) type=DataVisualization;;
+				esac
+				type="Education;Science;${type}"
+				;;
+
+			sys)
+				type="System"
+				;;
+
+			www)
+				case ${catmin} in
+					client) type=WebBrowser;;
+				esac
+				type="Network;${type}"
+				;;
+
+			*)
+				type=
+				;;
+		esac
+	fi
+	local slot=${SLOT%/*}
+	if [[ ${slot} == "0" ]] ; then
+		local desktop_name="${PN}"
+	else
+		local desktop_name="${PN}-${slot}"
+	fi
+	local desktop="${T}/$(echo ${exec} | sed 's:[[:space:]/:]:_:g')-${desktop_name}.desktop"
+	#local desktop=${T}/${exec%% *:-${desktop_name}}.desktop
+
+	# Don't append another ";" when a valid category value is provided.
+	type=${type%;}${type:+;}
+
+	if [[ -n ${icon} && ${icon} != /* ]] && [[ ${icon} == *.xpm || ${icon} == *.png || ${icon} == *.svg ]]; then
+		ewarn "As described in the Icon Theme Specification, icon file extensions are not"
+		ewarn "allowed in .desktop files if the value is not an absolute path."
+		icon=${icon%.*}
+	fi
+
+	cat <<-EOF > "${desktop}"
+	[Desktop Entry]
+	Name=${name}
+	Type=Application
+	Comment=${DESCRIPTION}
+	Exec=${exec}
+	TryExec=${exec%% *}
+	Icon=${icon}
+	Categories=${type}
+	EOF
+
+	if [[ ${fields:-=} != *=* ]] ; then
+		# 5th arg used to be value to Path=
+		ewarn "make_desktop_entry: update your 5th arg to read Path=${fields}"
+		fields="Path=${fields}"
+	fi
+	[[ -n ${fields} ]] && printf '%b\n' "${fields}" >> "${desktop}"
+
+	(
+		# wrap the env here so that the 'insinto' call
+		# doesn't corrupt the env of the caller
+		insinto /usr/share/applications
+		doins "${desktop}"
+	) || die "installing desktop file failed"
+}
+
+# @FUNCTION: make_session_desktop
+# @USAGE: <title> <command> [command args...]
+# @DESCRIPTION:
+# Make a GDM/KDM Session file.  The title is the file to execute to start the
+# Window Manager.  The command is the name of the Window Manager.
+#
+# You can set the name of the file via the ${wm} variable.
+make_session_desktop() {
+	[[ -z $1 ]] && eerror "$0: You must specify the title" && return 1
+	[[ -z $2 ]] && eerror "$0: You must specify the command" && return 1
+
+	local title=$1
+	local command=$2
+	local desktop=${T}/${wm:-${PN}}.desktop
+	shift 2
+
+	cat <<-EOF > "${desktop}"
+	[Desktop Entry]
+	Name=${title}
+	Comment=This session logs you into ${title}
+	Exec=${command} $*
+	TryExec=${command}
+	Type=XSession
+	EOF
+
+	(
+	# wrap the env here so that the 'insinto' call
+	# doesn't corrupt the env of the caller
+	insinto /usr/share/xsessions
+	doins "${desktop}"
+	)
+}
+
+# @FUNCTION: domenu
+# @USAGE: <menus>
+# @DESCRIPTION:
+# Install the list of .desktop menu files into the appropriate directory
+# (/usr/share/applications).
+domenu() {
+	(
+	# wrap the env here so that the 'insinto' call
+	# doesn't corrupt the env of the caller
+	local i j ret=0
+	insinto /usr/share/applications
+	for i in "$@" ; do
+		if [[ -f ${i} ]] ; then
+			doins "${i}"
+			((ret+=$?))
+		elif [[ -d ${i} ]] ; then
+			for j in "${i}"/*.desktop ; do
+				doins "${j}"
+				((ret+=$?))
+			done
+		else
+			((++ret))
+		fi
+	done
+	exit ${ret}
+	)
+}
+
+# @FUNCTION: newmenu
+# @USAGE: <menu> <newname>
+# @DESCRIPTION:
+# Like all other new* functions, install the specified menu as newname.
+newmenu() {
+	(
+	# wrap the env here so that the 'insinto' call
+	# doesn't corrupt the env of the caller
+	insinto /usr/share/applications
+	newins "$@"
+	)
+}
+
+# @FUNCTION: _iconins
+# @INTERNAL
+# @DESCRIPTION:
+# function for use in doicon and newicon
+_iconins() {
+	(
+	# wrap the env here so that the 'insinto' call
+	# doesn't corrupt the env of the caller
+	local funcname=$1; shift
+	local size dir
+	local context=apps
+	local theme=hicolor
+
+	while [[ $# -gt 0 ]] ; do
+		case $1 in
+		-s|--size)
+			if [[ ${2%%x*}x${2%%x*} == "$2" ]] ; then
+				size=${2%%x*}
+			else
+				size=${2}
+			fi
+			case ${size} in
+			16|22|24|32|36|48|64|72|96|128|192|256|512)
+				size=${size}x${size};;
+			scalable)
+				;;
+			*)
+				eerror "${size} is an unsupported icon size!"
+				exit 1;;
+			esac
+			shift 2;;
+		-t|--theme)
+			theme=${2}
+			shift 2;;
+		-c|--context)
+			context=${2}
+			shift 2;;
+		*)
+			if [[ -z ${size} ]] ; then
+				insinto /usr/share/pixmaps
+			else
+				insinto /usr/share/icons/${theme}/${size}/${context}
+			fi
+
+			if [[ ${funcname} == doicon ]] ; then
+				if [[ -f $1 ]] ; then
+					doins "${1}"
+				elif [[ -d $1 ]] ; then
+					shopt -s nullglob
+					doins "${1}"/*.{png,svg}
+					shopt -u nullglob
+				else
+					eerror "${1} is not a valid file/directory!"
+					exit 1
+				fi
+			else
+				break
+			fi
+			shift 1;;
+		esac
+	done
+	if [[ ${funcname} == newicon ]] ; then
+		newins "$@"
+	fi
+	) || die
+}
+
+# @FUNCTION: doicon
+# @USAGE: [options] <icons>
+# @DESCRIPTION:
+# Install icon into the icon directory /usr/share/icons or into
+# /usr/share/pixmaps if "--size" is not set.
+# This is useful in conjunction with creating desktop/menu files.
+#
+# @CODE
+#  options:
+#  -s, --size
+#    !!! must specify to install into /usr/share/icons/... !!!
+#    size of the icon, like 48 or 48x48
+#    supported icon sizes are:
+#    16 22 24 32 36 48 64 72 96 128 192 256 512 scalable
+#  -c, --context
+#    defaults to "apps"
+#  -t, --theme
+#    defaults to "hicolor"
+#
+# icons: list of icons
+#
+# example 1: doicon foobar.png fuqbar.svg suckbar.png
+# results in: insinto /usr/share/pixmaps
+#             doins foobar.png fuqbar.svg suckbar.png
+#
+# example 2: doicon -s 48 foobar.png fuqbar.png blobbar.png
+# results in: insinto /usr/share/icons/hicolor/48x48/apps
+#             doins foobar.png fuqbar.png blobbar.png
+# @CODE
+doicon() {
+	_iconins ${FUNCNAME} "$@"
+}
+
+# @FUNCTION: newicon
+# @USAGE: [options] <icon> <newname>
+# @DESCRIPTION:
+# Like doicon, install the specified icon as newname.
+#
+# @CODE
+# example 1: newicon foobar.png NEWNAME.png
+# results in: insinto /usr/share/pixmaps
+#             newins foobar.png NEWNAME.png
+#
+# example 2: newicon -s 48 foobar.png NEWNAME.png
+# results in: insinto /usr/share/icons/hicolor/48x48/apps
+#             newins foobar.png NEWNAME.png
+# @CODE
+newicon() {
+	_iconins ${FUNCNAME} "$@"
+}
+
+fi
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
index 972a2138aad7..7d4193e76b51 100644
--- a/eclass/eutils.eclass
+++ b/eclass/eutils.eclass
@@ -20,7 +20,7 @@ _EUTILS_ECLASS=1
 # implicitly inherited (now split) eclasses
 case ${EAPI:-0} in
 0|1|2|3|4|5|6)
-	inherit epatch estack ltprune multilib toolchain-funcs
+	inherit desktop epatch estack ltprune multilib toolchain-funcs
 	;;
 esac
 
@@ -115,397 +115,6 @@ edos2unix() {
 	sed -i 's/\r$//' -- "$@" || die
 }
 
-# @FUNCTION: make_desktop_entry
-# @USAGE: make_desktop_entry(<command>, [name], [icon], [type], [fields])
-# @DESCRIPTION:
-# Make a .desktop file.
-#
-# @CODE
-# binary:   what command does the app run with ?
-# name:     the name that will show up in the menu
-# icon:     the icon to use in the menu entry
-#           this can be relative (to /usr/share/pixmaps) or
-#           a full path to an icon
-# type:     what kind of application is this?
-#           for categories:
-#           https://specifications.freedesktop.org/menu-spec/latest/apa.html
-#           if unset, function tries to guess from package's category
-# fields:	extra fields to append to the desktop file; a printf string
-# @CODE
-make_desktop_entry() {
-	[[ -z $1 ]] && die "make_desktop_entry: You must specify the executable"
-
-	local exec=${1}
-	local name=${2:-${PN}}
-	local icon=${3:-${PN}}
-	local type=${4}
-	local fields=${5}
-
-	if [[ -z ${type} ]] ; then
-		local catmaj=${CATEGORY%%-*}
-		local catmin=${CATEGORY##*-}
-		case ${catmaj} in
-			app)
-				case ${catmin} in
-					accessibility) type="Utility;Accessibility";;
-					admin)         type=System;;
-					antivirus)     type=System;;
-					arch)          type="Utility;Archiving";;
-					backup)        type="Utility;Archiving";;
-					cdr)           type="AudioVideo;DiscBurning";;
-					dicts)         type="Office;Dictionary";;
-					doc)           type=Documentation;;
-					editors)       type="Utility;TextEditor";;
-					emacs)         type="Development;TextEditor";;
-					emulation)     type="System;Emulator";;
-					laptop)        type="Settings;HardwareSettings";;
-					office)        type=Office;;
-					pda)           type="Office;PDA";;
-					vim)           type="Development;TextEditor";;
-					xemacs)        type="Development;TextEditor";;
-				esac
-				;;
-
-			dev)
-				type="Development"
-				;;
-
-			games)
-				case ${catmin} in
-					action|fps) type=ActionGame;;
-					arcade)     type=ArcadeGame;;
-					board)      type=BoardGame;;
-					emulation)  type=Emulator;;
-					kids)       type=KidsGame;;
-					puzzle)     type=LogicGame;;
-					roguelike)  type=RolePlaying;;
-					rpg)        type=RolePlaying;;
-					simulation) type=Simulation;;
-					sports)     type=SportsGame;;
-					strategy)   type=StrategyGame;;
-				esac
-				type="Game;${type}"
-				;;
-
-			gnome)
-				type="Gnome;GTK"
-				;;
-
-			kde)
-				type="KDE;Qt"
-				;;
-
-			mail)
-				type="Network;Email"
-				;;
-
-			media)
-				case ${catmin} in
-					gfx)
-						type=Graphics
-						;;
-					*)
-						case ${catmin} in
-							radio) type=Tuner;;
-							sound) type=Audio;;
-							tv)    type=TV;;
-							video) type=Video;;
-						esac
-						type="AudioVideo;${type}"
-						;;
-				esac
-				;;
-
-			net)
-				case ${catmin} in
-					dialup) type=Dialup;;
-					ftp)    type=FileTransfer;;
-					im)     type=InstantMessaging;;
-					irc)    type=IRCClient;;
-					mail)   type=Email;;
-					news)   type=News;;
-					nntp)   type=News;;
-					p2p)    type=FileTransfer;;
-					voip)   type=Telephony;;
-				esac
-				type="Network;${type}"
-				;;
-
-			sci)
-				case ${catmin} in
-					astro*)  type=Astronomy;;
-					bio*)    type=Biology;;
-					calc*)   type=Calculator;;
-					chem*)   type=Chemistry;;
-					elec*)   type=Electronics;;
-					geo*)    type=Geology;;
-					math*)   type=Math;;
-					physics) type=Physics;;
-					visual*) type=DataVisualization;;
-				esac
-				type="Education;Science;${type}"
-				;;
-
-			sys)
-				type="System"
-				;;
-
-			www)
-				case ${catmin} in
-					client) type=WebBrowser;;
-				esac
-				type="Network;${type}"
-				;;
-
-			*)
-				type=
-				;;
-		esac
-	fi
-	local slot=${SLOT%/*}
-	if [[ ${slot} == "0" ]] ; then
-		local desktop_name="${PN}"
-	else
-		local desktop_name="${PN}-${slot}"
-	fi
-	local desktop="${T}/$(echo ${exec} | sed 's:[[:space:]/:]:_:g')-${desktop_name}.desktop"
-	#local desktop=${T}/${exec%% *:-${desktop_name}}.desktop
-
-	# Don't append another ";" when a valid category value is provided.
-	type=${type%;}${type:+;}
-
-	if [[ -n ${icon} && ${icon} != /* ]] && [[ ${icon} == *.xpm || ${icon} == *.png || ${icon} == *.svg ]]; then
-		ewarn "As described in the Icon Theme Specification, icon file extensions are not"
-		ewarn "allowed in .desktop files if the value is not an absolute path."
-		icon=${icon%.*}
-	fi
-
-	cat <<-EOF > "${desktop}"
-	[Desktop Entry]
-	Name=${name}
-	Type=Application
-	Comment=${DESCRIPTION}
-	Exec=${exec}
-	TryExec=${exec%% *}
-	Icon=${icon}
-	Categories=${type}
-	EOF
-
-	if [[ ${fields:-=} != *=* ]] ; then
-		# 5th arg used to be value to Path=
-		ewarn "make_desktop_entry: update your 5th arg to read Path=${fields}"
-		fields="Path=${fields}"
-	fi
-	[[ -n ${fields} ]] && printf '%b\n' "${fields}" >> "${desktop}"
-
-	(
-		# wrap the env here so that the 'insinto' call
-		# doesn't corrupt the env of the caller
-		insinto /usr/share/applications
-		doins "${desktop}"
-	) || die "installing desktop file failed"
-}
-
-# @FUNCTION: _eutils_eprefix_init
-# @INTERNAL
-# @DESCRIPTION:
-# Initialized prefix variables for EAPI<3.
-_eutils_eprefix_init() {
-	has "${EAPI:-0}" 0 1 2 && : ${ED:=${D}} ${EPREFIX:=} ${EROOT:=${ROOT}}
-}
-
-# @FUNCTION: make_session_desktop
-# @USAGE: <title> <command> [command args...]
-# @DESCRIPTION:
-# Make a GDM/KDM Session file.  The title is the file to execute to start the
-# Window Manager.  The command is the name of the Window Manager.
-#
-# You can set the name of the file via the ${wm} variable.
-make_session_desktop() {
-	[[ -z $1 ]] && eerror "$0: You must specify the title" && return 1
-	[[ -z $2 ]] && eerror "$0: You must specify the command" && return 1
-
-	local title=$1
-	local command=$2
-	local desktop=${T}/${wm:-${PN}}.desktop
-	shift 2
-
-	cat <<-EOF > "${desktop}"
-	[Desktop Entry]
-	Name=${title}
-	Comment=This session logs you into ${title}
-	Exec=${command} $*
-	TryExec=${command}
-	Type=XSession
-	EOF
-
-	(
-	# wrap the env here so that the 'insinto' call
-	# doesn't corrupt the env of the caller
-	insinto /usr/share/xsessions
-	doins "${desktop}"
-	)
-}
-
-# @FUNCTION: domenu
-# @USAGE: <menus>
-# @DESCRIPTION:
-# Install the list of .desktop menu files into the appropriate directory
-# (/usr/share/applications).
-domenu() {
-	(
-	# wrap the env here so that the 'insinto' call
-	# doesn't corrupt the env of the caller
-	local i j ret=0
-	insinto /usr/share/applications
-	for i in "$@" ; do
-		if [[ -f ${i} ]] ; then
-			doins "${i}"
-			((ret+=$?))
-		elif [[ -d ${i} ]] ; then
-			for j in "${i}"/*.desktop ; do
-				doins "${j}"
-				((ret+=$?))
-			done
-		else
-			((++ret))
-		fi
-	done
-	exit ${ret}
-	)
-}
-
-# @FUNCTION: newmenu
-# @USAGE: <menu> <newname>
-# @DESCRIPTION:
-# Like all other new* functions, install the specified menu as newname.
-newmenu() {
-	(
-	# wrap the env here so that the 'insinto' call
-	# doesn't corrupt the env of the caller
-	insinto /usr/share/applications
-	newins "$@"
-	)
-}
-
-# @FUNCTION: _iconins
-# @INTERNAL
-# @DESCRIPTION:
-# function for use in doicon and newicon
-_iconins() {
-	(
-	# wrap the env here so that the 'insinto' call
-	# doesn't corrupt the env of the caller
-	local funcname=$1; shift
-	local size dir
-	local context=apps
-	local theme=hicolor
-
-	while [[ $# -gt 0 ]] ; do
-		case $1 in
-		-s|--size)
-			if [[ ${2%%x*}x${2%%x*} == "$2" ]] ; then
-				size=${2%%x*}
-			else
-				size=${2}
-			fi
-			case ${size} in
-			16|22|24|32|36|48|64|72|96|128|192|256|512)
-				size=${size}x${size};;
-			scalable)
-				;;
-			*)
-				eerror "${size} is an unsupported icon size!"
-				exit 1;;
-			esac
-			shift 2;;
-		-t|--theme)
-			theme=${2}
-			shift 2;;
-		-c|--context)
-			context=${2}
-			shift 2;;
-		*)
-			if [[ -z ${size} ]] ; then
-				insinto /usr/share/pixmaps
-			else
-				insinto /usr/share/icons/${theme}/${size}/${context}
-			fi
-
-			if [[ ${funcname} == doicon ]] ; then
-				if [[ -f $1 ]] ; then
-					doins "${1}"
-				elif [[ -d $1 ]] ; then
-					shopt -s nullglob
-					doins "${1}"/*.{png,svg}
-					shopt -u nullglob
-				else
-					eerror "${1} is not a valid file/directory!"
-					exit 1
-				fi
-			else
-				break
-			fi
-			shift 1;;
-		esac
-	done
-	if [[ ${funcname} == newicon ]] ; then
-		newins "$@"
-	fi
-	) || die
-}
-
-# @FUNCTION: doicon
-# @USAGE: [options] <icons>
-# @DESCRIPTION:
-# Install icon into the icon directory /usr/share/icons or into
-# /usr/share/pixmaps if "--size" is not set.
-# This is useful in conjunction with creating desktop/menu files.
-#
-# @CODE
-#  options:
-#  -s, --size
-#    !!! must specify to install into /usr/share/icons/... !!!
-#    size of the icon, like 48 or 48x48
-#    supported icon sizes are:
-#    16 22 24 32 36 48 64 72 96 128 192 256 512 scalable
-#  -c, --context
-#    defaults to "apps"
-#  -t, --theme
-#    defaults to "hicolor"
-#
-# icons: list of icons
-#
-# example 1: doicon foobar.png fuqbar.svg suckbar.png
-# results in: insinto /usr/share/pixmaps
-#             doins foobar.png fuqbar.svg suckbar.png
-#
-# example 2: doicon -s 48 foobar.png fuqbar.png blobbar.png
-# results in: insinto /usr/share/icons/hicolor/48x48/apps
-#             doins foobar.png fuqbar.png blobbar.png
-# @CODE
-doicon() {
-	_iconins ${FUNCNAME} "$@"
-}
-
-# @FUNCTION: newicon
-# @USAGE: [options] <icon> <newname>
-# @DESCRIPTION:
-# Like doicon, install the specified icon as newname.
-#
-# @CODE
-# example 1: newicon foobar.png NEWNAME.png
-# results in: insinto /usr/share/pixmaps
-#             newins foobar.png NEWNAME.png
-#
-# example 2: newicon -s 48 foobar.png NEWNAME.png
-# results in: insinto /usr/share/icons/hicolor/48x48/apps
-#             newins foobar.png NEWNAME.png
-# @CODE
-newicon() {
-	_iconins ${FUNCNAME} "$@"
-}
-
 # @FUNCTION: strip-linguas
 # @USAGE: [<allow LINGUAS>|<-i|-u> <directories of .po files>]
 # @DESCRIPTION:
@@ -555,6 +164,14 @@ strip-linguas() {
 	export LINGUAS=${newls:1}
 }
 
+# @FUNCTION: _eutils_eprefix_init
+# @INTERNAL
+# @DESCRIPTION:
+# Initialized prefix variables for EAPI<3.
+_eutils_eprefix_init() {
+	has "${EAPI:-0}" 0 1 2 && : ${ED:=${D}} ${EPREFIX:=} ${EROOT:=${ROOT}}
+}
+
 # @FUNCTION: preserve_old_lib
 # @USAGE: <libs to preserve> [more libs]
 # @DESCRIPTION:
-- 
2.15.0

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-dev] [PATCH 0/3] Further cleanup of eutils.eclass
@ 2017-11-24 12:34 Ulrich Müller
  2017-11-23 23:30 ` [gentoo-dev] [PATCH 1/3] eutils.eclass: Remove check_license function Ulrich Müller
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ulrich Müller @ 2017-11-24 12:34 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 982 bytes --]

We already had a first round of cleanup in March of this year, where
some of the functions (epatch being the most prominent of them) were
moved to their own dedicated eclasses.

The following series of patches removes two deprecated functions, and
splits others off into their own dedicated eclass. Other than that,
there are no code changes.

For existing EAPIs, the split-off eclass will still be inherited by
eutils. The plan would be to drop that inherit in EAPI 7.

Please review.

Ulrich Müller (3):
  eutils.eclass: Remove check_license function.
  eutils.eclass: Remove validate_desktop_entries function.
  desktop.eclass: Split off desktop, menu, and icon functions from
    eutils.

 eclass/desktop.eclass | 395 +++++++++++++++++++++++++++++++++++++++++++++
 eclass/eutils.eclass  | 435 ++------------------------------------------------
 2 files changed, 404 insertions(+), 426 deletions(-)
 create mode 100644 eclass/desktop.eclass

-- 
2.15.0

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-dev] [PATCH 0/3] Further cleanup of eutils.eclass
  2017-11-24 12:34 [gentoo-dev] [PATCH 0/3] Further cleanup of eutils.eclass Ulrich Müller
                   ` (2 preceding siblings ...)
  2017-11-23 23:39 ` [gentoo-dev] [PATCH 3/3] desktop.eclass: Split off desktop, menu, and icon functions from eutils Ulrich Müller
@ 2017-11-30 19:11 ` Ulrich Mueller
  3 siblings, 0 replies; 5+ messages in thread
From: Ulrich Mueller @ 2017-11-30 19:11 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 578 bytes --]

>>>>> On Fri, 24 Nov 2017, Ulrich Müller wrote:

> We already had a first round of cleanup in March of this year, where
> some of the functions (epatch being the most prominent of them) were
> moved to their own dedicated eclasses.

> The following series of patches removes two deprecated functions, and
> splits others off into their own dedicated eclass. Other than that,
> there are no code changes.

> For existing EAPIs, the split-off eclass will still be inherited by
> eutils. The plan would be to drop that inherit in EAPI 7.

Pushed to master.

Ulrich

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-11-30 19:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-24 12:34 [gentoo-dev] [PATCH 0/3] Further cleanup of eutils.eclass Ulrich Müller
2017-11-23 23:30 ` [gentoo-dev] [PATCH 1/3] eutils.eclass: Remove check_license function Ulrich Müller
2017-11-23 23:38 ` [gentoo-dev] [PATCH 2/3] eutils.eclass: Remove validate_desktop_entries function Ulrich Müller
2017-11-23 23:39 ` [gentoo-dev] [PATCH 3/3] desktop.eclass: Split off desktop, menu, and icon functions from eutils Ulrich Müller
2017-11-30 19:11 ` [gentoo-dev] [PATCH 0/3] Further cleanup of eutils.eclass Ulrich Mueller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox