From: Donnie Berkholz <dberkholz@gentoo.org>
To: gentoo-dev@lists.gentoo.org, voyageur@gentoo.org
Subject: [gentoo-dev] Re: [gentoo-commits] gentoo-x86 commit in eclass: gnustep-base.eclass
Date: Fri, 5 Oct 2007 11:03:56 -0700 [thread overview]
Message-ID: <20071005180356.GK29572@supernova> (raw)
In-Reply-To: <E1Idkm9-0003dm-4y@stork.gentoo.org>
On 10:51 Fri 05 Oct , Bernard Cafarelli (voyageur) wrote:
> 1.4 eclass/gnustep-base.eclass
>
> file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/gnustep-base.eclass?rev=1.4&view=markup
> plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/gnustep-base.eclass?rev=1.4&content-type=text/plain
> diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/gnustep-base.eclass?r1=1.3&r2=1.4
> @@ -166,8 +166,43 @@
>
> local cfile=config-${PN}.sh
>
> - echo '#!/usr/bin/env bash' > "${T}"/${cfile}
> - echo "echo Applying ${P} default configuration ..." >> "${T}"/${cfile}
> + cat << EOF > "${T}"/${cfile}
> +#!/usr/bin/env bash
> +gnustep_append_default() {
> + if [[ -z \$1 || -z \$2 || -z \$3 ]]; then
> + echo "warning: invalid script invocation"
> + return
> + fi
> + dom=\$1
> + key=\$2
> + val=\$3
> + cur=\$(defaults read \${dom} \${key}) 2> /dev/null
> + if [[ -z \$cur ]] ; then
> + echo " * setting \${dom} \${key}"
> + defaults write \${dom} \${key} "( \${val} )"
> + elif [[ \${cur} != *\${val}* ]] ; then
> + echo " * adding \${val} to \${dom} \${key}"
> + echo "\${cur%)\'}, \"\${val}\" )'" | defaults write
> + else
> + echo " * \${val} already present in \${dom} \${key}"
> + fi
> +}
> +
> +gnustep_set_default() {
> + if [[ -z \$1 || -z \$2 || -z \$3 ]]; then
> + echo "warning: invalid script invocation"
> + return
> + fi
> + dom=\$1
> + key=\$2
> + val=\$3
> + echo " * setting \${dom} \${key}"
> + defaults write \${dom} \${key} \${val}
> +}
> +
> +echo "Applying ${P} default configuration ..."
> +EOF
> +
There's gotta be a better way of doing this. All those escapes really
start to obfuscate the code. Anyone got a better idea?
Thanks,
Donnie
--
gentoo-dev@gentoo.org mailing list
next parent reply other threads:[~2007-10-05 18:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <E1Idkm9-0003dm-4y@stork.gentoo.org>
2007-10-05 18:03 ` Donnie Berkholz [this message]
2007-10-05 18:12 ` [gentoo-dev] Re: [gentoo-commits] gentoo-x86 commit in eclass: gnustep-base.eclass Fabian Groffen
2007-10-05 18:50 ` George Shapovalov
2007-10-05 19:47 ` Roy Marples
2007-10-05 23:31 ` Ryan Hill
2007-10-06 0:08 ` Donnie Berkholz
2007-10-07 22:43 ` Bernard Cafarelli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071005180356.GK29572@supernova \
--to=dberkholz@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
--cc=voyageur@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox