arguments for koji api "createEmptyBuild"

Mike McLean mikem at redhat.com
Wed Apr 6 15:21:56 UTC 2011


On 04/05/2011 10:12 PM, Eric Zhong wrote:
> Version be treated as a integer!!!
> How to give a integer to koji as string ???
> Is it a bug of koji ???
> Thanks.
>
> [zhongwenjia at build ~]$ koji call createEmptyBuild nvidia 1 1.3 None
> Fault:<Fault 1: "<class 'pg.DatabaseError'>: error 'ERROR:  operator does
> not exist: text = integer\nLINE 2:     WHERE pkg_id=9170 AND version=1 AND
> release='1.3'\n                                         ^\nHINT:  No
> operator matches the given name and argument type(s). You might need to add
> explicit type casts.\n' in 'SELECT id,state,task_id FROM build\n    WHERE
> pkg_id=9170 AND version=1 AND release='1.3'\n    FOR UPDATE'">
>
> [zhongwenjia at build ~]$ koji call createEmptyBuild nvidia 1.0 1.3 None
> 18340

The call command in the cli isn't perfect. It's really more of a 
debugging tool. Unfortunately there's no way for it to know whether you 
mean the string "1" or the integer 1. If you're running a sufficiently 
new python, you can use the --python option to have the arguments 
interpreted as python expressions. E.g.

# koji call --python createEmptyBuild '"nvidia"' '"1"' '"1.3"' None

Otherwise you'll need to make the xmlrpc call more directly. Something like:
# python
 >>> import koji
 >>> session = koji.ClientSession('SERVER_URL')
 >>> # if using krb auth, use the following:
 >>> session.krb_login()
 >>> # otherwise use one of the other login methods defined in ClientSession
 >>> session.createEmptyBuild('nvidia', '1', '1.3', None)


More information about the buildsys mailing list