The release for 0.2 contains a single script, I will post it below as well since it is fairly short. This release has been a bit difficult. I have not completed everything that was expected in my guidelines, but I am very very close. What I have not had a chance to complete yet is the output for the database, I have all the data, but it must be formatted in a way that it will be ready to be placed inside the database. The update for 0.1 release is a bunch of small revisions and clean ups of the 0.1 release scripts, no functional changes have been made.
What does query-koji.py do?
The 0.2 release will check koji for tasks and output what kind of task it is(or method of task), if the task was successful, and the file name used(only if it was built).
How does query-koji.py work?
You must give query-koji.py task id from koji. Using the task id given, it will query every single task from that task id until the most recent task has been checked, then it will exit. I chose this method as I could not find a way to query for a package name and I still wanted it to be versatile enough to check all koji tasks and just some tasks. I also added a argument called –arch, this is used to specify which server to build on koji. When you use –arch=arm it will use http://arm.koji.fedoraproject.org/koji/. This is done by appending the value given in arch to the beginning of the link. Maybe this isn’t the best way to do this?
What is left to do?
Get some feedback from people and new ideas and add the function to make the csv file for the database.
Usage: query-koji.py [options] task_id Options: -h, --help show this help message and exit --arch=ARCH Arch to use for koji server
Currently it shows all types of tasks from koji, this is only for debugging at the moment and not necessary.
Sample output of the script below:
[acoatley-willis@Andrew-SBR koji-tests]$ ./query-koji.py --arch=arm 1266609 Task: 1266609 Status: Successful Method: buildNotification ['email@example.com', 'firstname.lastname@example.org'] Task: 1266610 Status: Successful Method: newRepo SHADOWBUILD-f18-build Task: 1266611 Status: Successful Method: createrepo 193462 Task: 1266612 Status: Successful Method: createrepo 193462 Task: 1266613 Status: Not completed Method: build koji-shadow/1353913504.496623.bmzgqjPz/rubygem-ffi-1.0.9-5.fc18.src.rpm Task: 1266614 Status: Not completed Method: buildArch koji-shadow/1353913504.496623.bmzgqjPz/rubygem-ffi-1.0.9-5.fc18.src.rpm Task: 1266615 Status: Not completed Method: buildArch koji-shadow/1353913504.496623.bmzgqjPz/rubygem-ffi-1.0.9-5.fc18.src.rpm -----[ No more tasks left to check ]----- Exiting...
I will be releasing a script called query-koji. What it will do is query koji for the latest builds of packages or if chosen all packages from koji.
Purpose: This script is to be used with the 0.1 release scripts. I would be used to generate a table of failed and working builds on different architectures for all packages in fedora 17.
The script query-koji.py:
#!/usr/bin/env python # The script is run with a single argument which is a task id from koji. The script will them scan from that task id until the most recent build done in koji. It will query each task id and output the data. import koji import optparse usage = 'usage: %prog [options] task_id' parser = optparse.OptionParser(usage=usage) parser.add_option('--arch', action='append', dest='arch', metavar='ARCH', default=, help='Arch to use for koji server') (options, args) = parser.parse_args() if len(args) > 1 or len(args) < 1: parser.error('Provide a single task_id') if options.arch: session = koji.ClientSession("http://" + "".join(options.arch) + ".koji.fedoraproject.org/kojihub") else: session = koji.ClientSession("http://koji.fedoraproject.org/kojihub") task_id = int("".join(args)) while True: # Try to create the task object, if this fails then you are probably using a task id that doesn't exist try: task = session.getTaskInfo(task_id, request=True) task_state = task['state'] task_request = task['request'] task_method = task['method'] except: print "\n-----[ No more tasks left to check ]-----" print "\nExiting..." exit() # If FREE or OPEN is true then the package has not finished building on koji if task_state in (koji.TASK_STATES['FREE'], koji.TASK_STATES['OPEN']): print "\nTask: " + str(task_id) + "\nStatus: Not completed" # If CLOSED is true then the package finished building successfully elif task_state == koji.TASK_STATES['CLOSED']: print "\nTask: " + str(task_id) + "\nStatus: Successful" # If CANCELED is true then the package was cancelled before it was completed elif task_state == koji.TASK_STATES['CANCELED']: print "\nTask: " + str(task_id) + "\nStatus: Cancelled" # If FAILED is true then the package failed the build before it was completed elif task_state == koji.TASK_STATES['FAILED']: print "\nTask: " + str(task_id) + "\nStatus: Failed" else: print "\nTask: " + str(task_id) + "\nStatus: Other" # Only really care about build and buildArch, as these will be building the rpm files if task_method == "build" or task_method == "buildArch": print "Method: " + task_method print str(task_request) task_id +=1