I remember doing doing something like this awhile ago:
echo $password | gpg [...] 

there was also this article I saw recently which may be of some help:
http://www.osnews.com/story.php?news_id=10929

On 6/23/05, James M. Greene <hitokiri at acm.cs.umn.edu> wrote:
> Hey there.
> 
> I am a Linux user for the past four years, but I have just recently got
> into truly tinkering and such. I have recently (i.e. today) begun playing
> around with GPG signing. Now... I want to GPG sign a Linux RPM package
> that I am rebuilding with my GPG signature. However, I am trying to
> automate the process. The problem? Passphrase prompting. I have tried to
> incorporate the redirection of stdin from a password file in my BASH
> script that is executing the rpmbuild process, but it appears that adding
> the --sign option actually implements gpg to prompt for the passphrase
> instead of directly from rpmbuild. Is there anyway to kill this passphrase
> prompting without giving the key a NULL password?
> 
> Please let me know. Thanks in advance.
> 
> 
> Sincerely,
>    James Greene
> 
> *********************************************
> * James M. Greene - hitokiri at acm.cs.umn.edu *
> *                                           *
> * Association for Computing Machinery (ACM) *
> * Vice President, EE/CSci Bldg., Room 2-204 *
> * University of Minnesota - Student Chapter *
> *********************************************
> 
> 
> _______________________________________________
> TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
> tclug-list at mn-linux.org
> http://mailman.mn-linux.org/mailman/listinfo/tclug-list
>