From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1SWfAD-0002WA-0f for garchives@archives.gentoo.org; Tue, 22 May 2012 02:49:33 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6C905E096D; Tue, 22 May 2012 02:49:19 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 4DFCAE0A8C for ; Tue, 22 May 2012 02:48:40 +0000 (UTC) Received: from vapier.localnet (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id BE27E1B4028 for ; Tue, 22 May 2012 02:48:39 +0000 (UTC) From: Mike Frysinger Organization: wh0rd.org To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] enhancement for doicon/newicon in eutils.eclass Date: Mon, 21 May 2012 22:49:40 -0400 User-Agent: KMail/1.13.7 (Linux/3.4.0-rc6; KDE/4.6.5; x86_64; ; ) References: <4FB97D1D.9070004@gentoo.org> In-Reply-To: <4FB97D1D.9070004@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1827313.EbWopfDFA2"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201205212249.40692.vapier@gentoo.org> X-Archives-Salt: 134eb233-ced8-4911-8760-5e8110d6cd41 X-Archives-Hash: 44c2c2c8fe3b1c98541e9952ce0b2399 --nextPart1827313.EbWopfDFA2 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Sunday 20 May 2012 19:24:13 hasufell wrote: > case ${2} in please use $1/$2/etc... with positional variables when possible > 16|22|24|32|36|48|64|72|96|128|192|256) > size=3D${2}x${2};; > 16x16|22x22|24x24|32x32|36x36|48x48|64x64|72x72|96x96|128x128| 192x192|256x256) > size=3D${2};; > scalable) > size=3Dscalable;; > *) > eqawarn "${2} is an unsupported icon size!" > ((++ret));; > esac you can write this w/out having to duplicate two lists: size=3D if [[ $2 =3D=3D "scalable" ]] ; then size=3D$2 elif [[ ${2:0:2}x${2:0:2} =3D=3D "$2" ]] ; then size=3D${2:0:2} case ${size} in 16|22|24|32|36|48|64|72|96|128|192|256) ;; *) size=3D ;; esac fi if [[ -z ${size} ]] ; then eqawarn "${2} is an unsupported icon size!" ((++ret)) fi shift 2 shift 2;; -t|--theme) theme=3D${2} shift 2;; -c|--context) context=3D${2} shift 2;; *) > if [[ -z ${size} ]] ; then > dir=3D/usr/share/pixmaps > else > dir=3D/usr/share/icons/${theme}/${size}/${context} > fi > =09 > insinto "${dir}" considering you only use $dir once, you could just call `insinto` directly = on=20 the path rather than using the dir variable at all > elif [[ -d ${1} ]] ; then > for i in "${1}"/*.{png,svg} ; do > doins "${i}" > ((ret+=3D$?)) > done why loop ? `doins "${1}"/*.{png,svg}` works just as well you probably want to enable nullglobbing here, otherwise this will cause=20 problems if you try to doicon on a dir that contains just svg. also, what about other file types ? people install xpm, svgz, gif, and oth= er=20 file types ... > exit ${ret} bash masks error codes to [0..255], so all the ret updates should probably = be=20 changed to just: ret=3D1 after all, i doubt anyone cares how many errors there were, just that one=20 occurred. and while you're here, might want to make it auto die on failure= =20 like we've done with all our other helpers. =2Dmike --nextPart1827313.EbWopfDFA2 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) iQIcBAABAgAGBQJPuv7EAAoJEEFjO5/oN/WBKnoQANjKzpp77rgSZZA9HfJkbOK9 9bu68QtguBIY4zOZsO8uLqkNMNqJ/XVKRyl4vvJAzxKQDLAQ3VXsJW0ZWZaPvj6J qkSV346SiQ/cZ1Qdsf7w2LQq+P/rOcPBCAJGL+cV8yY+XFtM3QB5SUmlAbtkOnQK jh5OvqN9eGxmMh5e/xKcpfA8ZwvpaG+/IXZ6HqyAs9j8qCvvwm9F3SkK4MeeID+W pK1ydlRxc9xuW6aEFgGsRNKNOhm69JBfa6lSwVSK4zKZI6SDa6jDABPG/5/JHbng QrlOXA/+Blg/Qg1u4LV8GEgvK5aWPa6MPlSwkJlKK5DcK/S3KRQCTBLSaJ41M+iA jIxg90lFCiuhHKbjCU684GzIiAU20yy9QBVJ7ZAwzWMlcK7DSsVgkcuxRg6vUpNp eUWEZihI/61h8nvYxQAdgqXbQAX7RucVBtWYGOGCXyWf+KvcD6Yb+5M8EybA6pfa Ls5RvCRQpLvnlUhoZxZtPITT3ILKdB8a/mTzD3RtGuDCbV8gFV4dW/PvFJPDvy0N ZVIHChKPWKM1cQ3WOWTe4VEfZeqOfOdoefvWib9h+rEySkPyd1CebczDa3SVvyok eUq1o5PzM8M6XpuJu0dPnjVOKDO5Fmmg2ys+XS1Txpt75FwjlUMRTe90eMN4O5dL z6doYxHzdBK42FD2Ecpc =jFQf -----END PGP SIGNATURE----- --nextPart1827313.EbWopfDFA2--