mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-05-18 12:21:28 +00:00
- parse the incoming directory, when using dput
- prepare usage of 'bzr bd' (not ready yet) - the bug comment includes the proper location of the .dsc file - component gets stripped - adding of appropriate sponsorship subscribers works
This commit is contained in:
parent
ddc0f52f4a
commit
7797672bdd
76
revuput
76
revuput
@ -46,7 +46,20 @@ def find_fixed_launchpad_bug(changesfile):
|
|||||||
|
|
||||||
def call_dput(location, changes):
|
def call_dput(location, changes):
|
||||||
dput_check()
|
dput_check()
|
||||||
return os.system("dput %s %s" % (location, changes)) == 0
|
|
||||||
|
incoming = ""
|
||||||
|
res = False
|
||||||
|
|
||||||
|
(dummy, output, dummy) = os.popen3("dput --debug %s %s" % (location, changes))
|
||||||
|
text = output.readlines()
|
||||||
|
for line in text:
|
||||||
|
if line.startswith("D: Incoming: "):
|
||||||
|
incoming = line.split("D: Incoming: ")[1].strip()
|
||||||
|
if incoming[-1] == "/":
|
||||||
|
incoming = incoming[:-1]
|
||||||
|
if line.startswith("Successfully uploaded packages."):
|
||||||
|
res = True
|
||||||
|
return (res, incoming)
|
||||||
|
|
||||||
|
|
||||||
def lookup_dput_host(host):
|
def lookup_dput_host(host):
|
||||||
@ -59,6 +72,13 @@ def lookup_dput_host(host):
|
|||||||
|
|
||||||
|
|
||||||
def call_debuild(options):
|
def call_debuild(options):
|
||||||
|
# FIXME: this requires magic, that figures out when to use --native --working,
|
||||||
|
# etc.
|
||||||
|
# if os.path.exists(".bzr") and os.path.exists("/usr/bin/bzr-buildpackage"):
|
||||||
|
# return os.system("bzr bd -S --builder='-k%s %s'" % \
|
||||||
|
# (os.getenv("DEBEMAIL"), \
|
||||||
|
# string.join(options, " "))) == 0
|
||||||
|
# else:
|
||||||
return os.system("debuild -S -k%s %s" % \
|
return os.system("debuild -S -k%s %s" % \
|
||||||
(os.getenv("DEBEMAIL"), \
|
(os.getenv("DEBEMAIL"), \
|
||||||
string.join(options, " "))) == 0
|
string.join(options, " "))) == 0
|
||||||
@ -73,16 +93,25 @@ def get_name_and_version():
|
|||||||
return re.findall(r'^(.*)\ \((.*)\).*', head)
|
return re.findall(r'^(.*)\ \((.*)\).*', head)
|
||||||
|
|
||||||
|
|
||||||
def assemble_bug_comment_text(host, sourcepackage, version):
|
def assemble_bug_comment_text(host, incoming, sourcepackage, version):
|
||||||
|
if host == "ppa.launchpad.net":
|
||||||
|
dsc_file_location = "http://%s/%s/pool/main/%s/%s/%s_%s.dsc" % \
|
||||||
|
(host, incoming[1:], sourcepackage[0], sourcepackage, \
|
||||||
|
sourcepackage, version)
|
||||||
|
else:
|
||||||
|
# FIXME: this needs to be much much cleverer at some stage
|
||||||
|
dsc_file_location = "http://%s/%s/pool/main/%s/%s/%s_%s.dsc" % \
|
||||||
|
(host, incoming, sourcepackage[0], sourcepackage, version)
|
||||||
|
"http://ppa.launchpad.net/dholbach/ubuntu/pool/main/h/hello/hello_2.2-2~ppa1.dsc"
|
||||||
return """A new version of %s was uploaded to fix this bug.
|
return """A new version of %s was uploaded to fix this bug.
|
||||||
|
|
||||||
To review the current version, please run
|
To review the current version, please run
|
||||||
|
|
||||||
dget -x http://%s/%s_%s.dsc
|
dget -x %s
|
||||||
""" % (sourcepackage, host, sourcepackage, version)
|
""" % (sourcepackage, dsc_file_location)
|
||||||
|
|
||||||
|
|
||||||
def deal_with_bugreport(bugnumbers, host, sourcepackage, version):
|
def deal_with_bugreport(bugnumbers, host, incoming, sourcepackage, version):
|
||||||
if not os.path.exists(os.path.expanduser("~/.lpcookie")):
|
if not os.path.exists(os.path.expanduser("~/.lpcookie")):
|
||||||
print >> sys.stderr, \
|
print >> sys.stderr, \
|
||||||
"You need your Launchpad Cookie to be stored in ~/.lpcookie"
|
"You need your Launchpad Cookie to be stored in ~/.lpcookie"
|
||||||
@ -92,25 +121,27 @@ def deal_with_bugreport(bugnumbers, host, sourcepackage, version):
|
|||||||
(dummy, output, dummy) = os.popen3(
|
(dummy, output, dummy) = os.popen3(
|
||||||
"apt-cache showsrc %s | grep Directory | cut -d' ' -f2 | cut -d'/' -f2" % \
|
"apt-cache showsrc %s | grep Directory | cut -d' ' -f2 | cut -d'/' -f2" % \
|
||||||
sourcepackage)
|
sourcepackage)
|
||||||
component = output.read()
|
component = output.read().strip()
|
||||||
|
|
||||||
Bug = Connector.ConnectBug()
|
Bug = Connector.ConnectBug()
|
||||||
Bug.authentication = os.path.expanduser("~/.lpcookie")
|
Bug.authentication = os.path.expanduser("~/.lpcookie")
|
||||||
|
|
||||||
for bugnumber in bugnumbers:
|
for bugnumber in bugnumbers:
|
||||||
bug = Bug(int(bugnumber))
|
bug = Bug(int(bugnumber))
|
||||||
# FIXME: should really be subscribers
|
if component in ["main", "restricted"] and \
|
||||||
# if component in ["main", "restricted"] and \
|
'ubuntu-main-sponsors' not in [str(s) for s in bug.subscribers]:
|
||||||
# bug.assignee != 'ubuntu-main-sponsors':
|
bug.subscribers.add('ubuntu-main-sponsors')
|
||||||
# bug.assignee = 'ubuntu-main-sponsors'
|
if component in ["universe", "multiverse"] and \
|
||||||
# if component in ["universe", "multiverse"] and \
|
'ubuntu-universe-sponsors' not in [str(s) for s in bug.subscribers]:
|
||||||
# bug.assignee != 'ubuntu-universe-sponsors':
|
bug.subscribers.add('ubuntu-universe-sponsors')
|
||||||
# bug.assignee = 'ubuntu-universe-sponsors'
|
|
||||||
|
|
||||||
# FIXME: does not work yet
|
comment = Bug.NewComment(text=assemble_bug_comment_text(host, incoming,
|
||||||
# comment = Bug.NewComment(text=assemble_bug_comment_text(host,
|
sourcepackage, version),
|
||||||
# sourcepackage, version))
|
subject="Fix in %s (%s)" % \
|
||||||
# bug.comments.add(comment)
|
(sourcepackage, version))
|
||||||
|
bug.comments.add(comment)
|
||||||
|
|
||||||
|
if bug.status != "Fix Committed":
|
||||||
bug.status = "Fix Committed"
|
bug.status = "Fix Committed"
|
||||||
bug.commit()
|
bug.commit()
|
||||||
|
|
||||||
@ -138,14 +169,15 @@ def main():
|
|||||||
os.path.expanduser(changesfile)
|
os.path.expanduser(changesfile)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
fixed_lp_bugs = find_fixed_launchpad_bug(changesfile)
|
|
||||||
host = lookup_dput_host(location)
|
host = lookup_dput_host(location)
|
||||||
|
(dput_res, incoming) = call_dput(location, changesfile)
|
||||||
|
if not dput_res:
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
fixed_lp_bugs = find_fixed_launchpad_bug(changesfile)
|
||||||
if(fixed_lp_bugs):
|
if(fixed_lp_bugs):
|
||||||
deal_with_bugreport(fixed_lp_bugs, host, sourcepackage, version)
|
deal_with_bugreport(fixed_lp_bugs, host, incoming, sourcepackage,
|
||||||
#if not call_dput(location, changesfile):
|
version)
|
||||||
# sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user