Batch-cancel pending builds in PPA

Asked by Jasem Mutlaq on 2018-01-21

Even since the problems with the Launchpad build farm started, many packages are queued to be built. There are over 1000+ now and they're already obsoleted. It is quite inpractical to go and cancel each individually, therefore, I'd like all of them to be cancelled here: https://launchpad.net/~mutlaqja/+archive/ubuntu/ppa/+builds?build_state=pending

Question information

Language:
English Edit question
Status:
Solved
For:
Launchpad itself Edit question
Assignee:
No assignee Edit question
Solved by:
Colin Watson
Solved:
2018-01-21
Last query:
2018-01-21
Last reply:
2018-01-21
Best Colin Watson (cjwatson) said : #1

You can use the Launchpad API for that: https://help.launchpad.net/API/launchpadlib

If you install the lptools package, it should be something like this:

  for build in lp.load('/~mutlaqja/+archive/ubuntu/ppa').getBuildRecords(build_state='Needs building'):
      if build.can_be_cancelled:
          build.cancel()

Colin Watson (cjwatson) said : #2

Oops, sorry, forgot a bit in those instructions. That code can be entered in the interactive shell you get from "lp-tools production devel".

Colin Watson (cjwatson) said : #3

lp-shell production devel

Apparently I'm not entirely with it today!

Jasem Mutlaq (mutlaqja) said : #4

Thanks Colin Watson, that solved my question.

Jasem Mutlaq (mutlaqja) said : #5

I had to run the same command several times to get all the queue to clear up, but it's finally cleared thanks!!