mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-12 23:51:08 +00:00
83 lines
2.3 KiB
Python
Executable File
83 lines
2.3 KiB
Python
Executable File
#!/usr/bin/python
|
|
# -*- coding: utf-8 -*-
|
|
#
|
|
# Copyright 2007, Canonical, Daniel Holbach
|
|
# License: GPLv3
|
|
#
|
|
# Builds a source package from the source tree you're currently in,
|
|
# uploads it to PPA and follow up on a bug report, subscribe the right
|
|
# sponsors and sets the right status - if you pass "-n" it will file a
|
|
# bug report and add "(LP: #....)" and to the changelog.
|
|
|
|
import os
|
|
import sys
|
|
from optparse import OptionParser
|
|
|
|
try:
|
|
import ppaput
|
|
except ImportError:
|
|
print 'You need python-ubuntu-utils installed to use ppaput.'
|
|
sys.exit(1)
|
|
|
|
USAGE = \
|
|
"""Usage: ppaput [-n] [<location>] [<debuild options>]
|
|
|
|
See debuild(1) for more information on debuild options."""
|
|
parser = OptionParser(usage=USAGE)
|
|
|
|
parser.add_option('-n', action='store_true', dest='new_bug', help='File a new bug on Launchpad', default=False)
|
|
parser.disable_interspersed_args()
|
|
(options, args) = parser.parse_args()
|
|
|
|
def check_arguments():
|
|
location = 'default'
|
|
debuild_args = []
|
|
|
|
try:
|
|
if args[0].startswith("-"):
|
|
debuild_args = args
|
|
else:
|
|
location = args[0]
|
|
debuild_args = args[1:]
|
|
except IndexError:
|
|
print "No location or arguments given, using defaults"
|
|
|
|
return (location, debuild_args)
|
|
|
|
def main():
|
|
|
|
(location, debuild_args) = check_arguments()
|
|
print location
|
|
print debuild_args
|
|
|
|
(sourcepackage, version, \
|
|
section, release) = ppaput.get_name_version_section_and_release()
|
|
|
|
if options.new_bug:
|
|
bugnumber = ppaput.file_bug(sourcepackage, version)
|
|
os.system("dch -a 'Fixes (LP: #%s)'" % bugnumber)
|
|
if not ppaput.call_debuild(debuild_args):
|
|
sys.exit(1)
|
|
|
|
changesfile = "../%s_%s_source.changes" % (sourcepackage, version)
|
|
if not os.path.exists(os.path.expanduser(changesfile)):
|
|
print >> sys.stderr, "%s does not exist." % \
|
|
os.path.expanduser(changesfile)
|
|
sys.exit(1)
|
|
|
|
host = ppaput.lookup_dput_host(location)
|
|
(dput_res, incoming) = ppaput.call_dput(location, changesfile)
|
|
if not dput_res:
|
|
print >> sys.stderr, "%s was not uploaded." % changesfile
|
|
sys.exit(1)
|
|
|
|
fixed_lp_bugs = ppaput.find_fixed_launchpad_bug(changesfile)
|
|
if fixed_lp_bugs:
|
|
deal_with_bugreport(fixed_lp_bugs, host, section, incoming,
|
|
sourcepackage, version, release)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|
|
|