update status of forwared bugs for github
I created a python script to check the status of forwarded bugs to github for
a given source package and sets the "fixed-upstream" tag. My plan is, that
this script will be available also for other devs and or maybe part of an
automatic sync. I only checked it for two packages (owncloud and owncloud-
client). Do you know a package where it can be fits in?
PS: I'm not subscribed to the debian-qa list
# -*- coding: utf-8 -*-
# Script to check the status of forwared bugs to github
# Copyright 2014 Sandro Knauß <email@example.com>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
checks the status of all to github forwared bugs of a src package.
usage: githubUpdate.py <src>
needs python-debianbts to be installed
Copyright: 2014 Sandro Knauß <firstname.lastname@example.org>
License: GPL v2+
from urllib.request import urlopen
from urllib import urlopen
"""test if the url is a valid github url"""
return reGithubIssue.match(url) != None
"""returns a github issue for a issue url
the dict is described here: https://developer.github.com/v3/issues/
m = reGithubIssue.match(url)
repo = m.group("repo")
issue = int(m.group("issue"))
url = "https://api.github.com/repos/%s/issues/%i"%(repo,issue)
issue = json.loads(urlopen(url).read())
"""checks the upstream status of forwareded github bugs for a src package
set fixed-upstream bug, if upstream bug is closed after asking the user.
bug_nums = debianbts.get_bugs('src', src,'status', 'forwarded')
print("found %i forwarded bugs for %s" %(len(bug_nums), src))
bugs = debianbts.get_status(bug_nums)
for bug in bugs:
if not bug.done \
and "fixed-upstream" not in bug.tags \
and "wontfix" not in bug.tags \
issue = githubIssue(bug.forwarded)
if issue['state'] == 'closed':
print("%i is closed upstream (%s)" %(bug.bug_num,bug.forwarded))
i = input('should fixed-upstream tag been set to %s[Y/n]: '%(bug.bug_num))
if i.strip().lower() == 'y' or i == "":
ret = subprocess.call(['bts','tags',bug.bug_num, '+fixed-upstream'])
if ret == 0:
print("set fixed-upstream for %i"%(bug.bug_num))