-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 06/02/2012 06:48 AM, Mike Frysinger wrote:
> On Friday 01 June 2012 22:50:10 hasufell wrote:
>> On 06/02/2012 12:49 AM, Mike Frysinger wrote:
>>> On Wednesday 23 May 2012 21:04:42 hasufell wrote:
>>>> # @FUNCTION: _iconins # @DESCRIPTION: # function for use in
>>>> doicon and newicon
>>>
>>> mark it @INTERNAL
>
> what i meant here was: # @FUNCTION: _iconins # @INTERNAL #
> @DESCRIPTION: # function for use in doicon and newicon
>
> you can run
> /usr/portage/app-portage/eclass-manpages/files/eclass-to-manpage.sh
> and the eclass to see if the style is valid -mike
K, fixed it. Manpage seems ok with this version.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJPyikKAAoJEFpvPKfnPDWz0S8IALS+uqaXMt8rOQUXPFjy09nZ
3gK+qJB2m453X21HprWcHEVL4/Exk77wWIWe0uZlFxuRN83+CF39PBIv6Bvr82qe
k1jb1+tr2GIK6undHVJXvWOgNzQ1LWIcKL1LOC6gwXlpBXstD5KgyeLpp6Igu7tw
GEalfgf5AmZ0v9QFKfR404ucvDs5uzXY1YRaFq6ygEvPRFHSzg7r2cnYdufwqz/R
s6R3UpFSEkXh/8J5cvMvk5N70SytB7bPVYUtbRi8N1bA+J8M6Iz4kre2ubn5w3i5
9YcuBxeW89JcBQOpex6UqAGL6BH/l2OVyDZ5+JpToTZXVrcPih5Pc5ilw4wOw7M=
=wky2
-----END PGP SIGNATURE-----
# @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)
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 scalable
# -c, --context
# defaults to "apps"
# -t, --theme
# defaults to "hicolor"
#
# icons: list of icons
#
# example 1: doicon foobar.png fuqbar.svg
# results in: insinto /usr/share/pixmaps
# doins foobar.png fuqbar.svg
#
# example 2: doicon -s 48 foobar.png fuqbar.png
# results in: insinto /usr/share/icons/hicolor/48x48/apps
# doins foobar.png fuqbar.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} "$@"
}
--- eutils.eclass
+++ eutils.eclass
@@ -944,45 +944,122 @@
)
}
-# @FUNCTION: doicon
-# @USAGE: <list of icons>
-# @DESCRIPTION:
-# Install the list of icons into the icon directory (/usr/share/pixmaps).
-# This is useful in conjunction with creating desktop/menu files.
-doicon() {
+# @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 i j ret
- insinto /usr/share/pixmaps
- for i in "$@" ; do
- if [[ -f ${i} ]] ; then
- doins "${i}"
- ((ret+=$?))
- elif [[ -d ${i} ]] ; then
- for j in "${i}"/*.png ; do
- doins "${j}"
- ((ret+=$?))
- done
- else
- ((++ret))
- fi
+ 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)
+ 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
- exit ${ret}
- )
+ 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 scalable
+# -c, --context
+# defaults to "apps"
+# -t, --theme
+# defaults to "hicolor"
+#
+# icons: list of icons
+#
+# example 1: doicon foobar.png fuqbar.svg
+# results in: insinto /usr/share/pixmaps
+# doins foobar.png fuqbar.svg
+#
+# example 2: doicon -s 48 foobar.png fuqbar.png
+# results in: insinto /usr/share/icons/hicolor/48x48/apps
+# doins foobar.png fuqbar.png
+# @CODE
+doicon() {
+ _iconins ${FUNCNAME} "$@"
}
# @FUNCTION: newicon
-# @USAGE: <icon> <newname>
-# @DESCRIPTION:
-# Like all other new* functions, install the specified icon as newname.
+# @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() {
- (
- # wrap the env here so that the 'insinto' call
- # doesn't corrupt the env of the caller
- insinto /usr/share/pixmaps
- newins "$@"
- )
+ _iconins ${FUNCNAME} "$@"
}
# @FUNCTION: strip-linguas