mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01:09 +00:00
Little changes in update-maintainer; add a manpage for it. Merge with Andrew Hunter's branch.
This commit is contained in:
commit
90be92d8d5
16
debian/changelog
vendored
16
debian/changelog
vendored
@ -12,7 +12,21 @@ ubuntu-dev-tools (0.26) UNRELEASED; urgency=low
|
|||||||
(LP: #190351)
|
(LP: #190351)
|
||||||
* Exit, if versions in Ubuntu and Debian are the same already.
|
* Exit, if versions in Ubuntu and Debian are the same already.
|
||||||
|
|
||||||
-- Daniel Hahler <ubuntu@thequod.de> Sat, 09 Feb 2008 02:23:44 +0100
|
[ Andrew Hunter ]
|
||||||
|
* Use install files as we have multiple binaries now.
|
||||||
|
* ppaput:
|
||||||
|
* Separated ppaput script from backend python modules (shipped in
|
||||||
|
python-ppaput). (LP: #192184)
|
||||||
|
* Switched from homegrown option parseing to Optparse, much more
|
||||||
|
robust and less code duplication.
|
||||||
|
|
||||||
|
[ Siegfried-Angel Gevatter Pujals (RainCT) ]
|
||||||
|
* Add a manpage for update-maintainer.
|
||||||
|
* Let update-maintainer also accept --no-changelog (in addition to
|
||||||
|
the current --nochangelog), improve its error messages and change
|
||||||
|
the default section to universe.
|
||||||
|
|
||||||
|
-- Siegfried-Angel Gevatter Pujals (RainCT) <rainct@ubuntu.com> Sun, 17 Feb 2008 17:36:11 +0100
|
||||||
|
|
||||||
ubuntu-dev-tools (0.25) hardy; urgency=low
|
ubuntu-dev-tools (0.25) hardy; urgency=low
|
||||||
|
|
||||||
|
11
debian/control
vendored
11
debian/control
vendored
@ -13,7 +13,7 @@ Standards-Version: 3.7.3
|
|||||||
Package: ubuntu-dev-tools
|
Package: ubuntu-dev-tools
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Section: devel
|
Section: devel
|
||||||
Depends: ${python:Depends}, ${misc:Depends}, binutils, devscripts, sudo, python-launchpad-bugs (>= 0.2.25), reportbug (>= 3.39ubuntu1), python-debian, dctrl-tools, lsb-release
|
Depends: ${python:Depends}, ${misc:Depends}, binutils, devscripts, sudo, python-launchpad-bugs (>= 0.2.25), reportbug (>= 3.39ubuntu1), python-debian, dctrl-tools, lsb-release, python-ppaput
|
||||||
Recommends: bzr, pbuilder
|
Recommends: bzr, pbuilder
|
||||||
Conflicts: devscripts (<< 2.10.7ubuntu5)
|
Conflicts: devscripts (<< 2.10.7ubuntu5)
|
||||||
Replaces: devscripts (<< 2.10.7ubuntu5)
|
Replaces: devscripts (<< 2.10.7ubuntu5)
|
||||||
@ -22,3 +22,12 @@ Description: useful tools for Ubuntu developers
|
|||||||
This is a collection of useful tools that Ubuntu developers use to
|
This is a collection of useful tools that Ubuntu developers use to
|
||||||
make their packaging work a lot easier. Such tools can include bug
|
make their packaging work a lot easier. Such tools can include bug
|
||||||
filing, packaging preparation, package analysis, etc.
|
filing, packaging preparation, package analysis, etc.
|
||||||
|
|
||||||
|
Package: python-ppaput
|
||||||
|
Architecture: all
|
||||||
|
Section: python
|
||||||
|
Depends: ${python:Depends}
|
||||||
|
XB-Python-Version: ${python:Versions}
|
||||||
|
Description: python module for uploading to PPAs.
|
||||||
|
python-ppaput is a python module that abstracts the process of creating and
|
||||||
|
uploading Debian source packages to Personal Package Archives.
|
||||||
|
1
debian/python-ppaput.install
vendored
Normal file
1
debian/python-ppaput.install
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
debian/tmp/usr/lib/python2.5/site-packages/ppaput.py
|
17
debian/ubuntu-dev-tools.install
vendored
Normal file
17
debian/ubuntu-dev-tools.install
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
debian/tmp/usr/bin/404main
|
||||||
|
debian/tmp/usr/bin/check-symbols
|
||||||
|
debian/tmp/usr/bin/dch-repeat
|
||||||
|
debian/tmp/usr/bin/dgetlp
|
||||||
|
debian/tmp/usr/bin/get-branches
|
||||||
|
debian/tmp/usr/bin/get-build-deps
|
||||||
|
debian/tmp/usr/bin/hugdaylist
|
||||||
|
debian/tmp/usr/bin/massfile
|
||||||
|
debian/tmp/usr/bin/mk-sbuild-lv
|
||||||
|
debian/tmp/usr/bin/pbuilder-dist
|
||||||
|
debian/tmp/usr/bin/ppaput
|
||||||
|
debian/tmp/usr/bin/pull-debian-debdiff
|
||||||
|
debian/tmp/usr/bin/requestsync
|
||||||
|
debian/tmp/usr/bin/submittodebian
|
||||||
|
debian/tmp/usr/bin/suspicious-source
|
||||||
|
debian/tmp/usr/bin/update-maintainer
|
||||||
|
debian/tmp/usr/bin/what-patch
|
@ -1,7 +1,3 @@
|
|||||||
.\" Title: get-build-deps
|
|
||||||
.\" Author: Siegfried-Angel Gevatter Pujals
|
|
||||||
.\" Contact details: rainct@ubuntu.com
|
|
||||||
|
|
||||||
.TH GET\-BUILD\-DEPS 1 "October 27, 2007" "ubuntu-dev-tools"
|
.TH GET\-BUILD\-DEPS 1 "October 27, 2007" "ubuntu-dev-tools"
|
||||||
|
|
||||||
.SH NAME
|
.SH NAME
|
||||||
@ -55,8 +51,8 @@ the indicated versions, but just installs the newest one available in the reposi
|
|||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR dpkg-checkbuilddeps (1),
|
.BR dpkg-checkbuilddeps (1),
|
||||||
.BR apt-get (8)
|
.BR apt-get (8)
|
||||||
.SH AUTHORS
|
|
||||||
|
|
||||||
|
.SH AUTHORS
|
||||||
\fBget\-build\-deps\fP and this manual page have been written by Siegfried-Angel
|
\fBget\-build\-deps\fP and this manual page have been written by Siegfried-Angel
|
||||||
Gevatter Pujals <rainct@ubuntu.com>.
|
Gevatter Pujals <rainct@ubuntu.com>.
|
||||||
They are released under the GNU General Public License, version 3 or later.
|
They are released under the GNU General Public License, version 3 or later.
|
||||||
|
@ -26,7 +26,7 @@ then
|
|||||||
cd ..
|
cd ..
|
||||||
elif [ ! -f ./debian/control ]; then
|
elif [ ! -f ./debian/control ]; then
|
||||||
echo "\
|
echo "\
|
||||||
Couldn't find the file debian/control. You have to be inside the \
|
Couldn't find file debian/control. You have to be inside the \
|
||||||
source directory of a Debian package or pass the name of the \
|
source directory of a Debian package or pass the name of the \
|
||||||
package(s) whose build dependencies you want to install in order \
|
package(s) whose build dependencies you want to install in order \
|
||||||
to use this script."
|
to use this script."
|
||||||
|
273
ppaput
273
ppaput
@ -1,258 +1,48 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Copyright 2007, Canonical, Daniel Holbach
|
|
||||||
#
|
|
||||||
# GPL 3
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# 11:57:27 < dholbach> but what it does is: build a source package of
|
|
||||||
# the current source tree you're in, upload it to PPA
|
|
||||||
# and follow up on a bug report, subscribe the right
|
|
||||||
# sponsors, set the right status - if you pass "-n"
|
|
||||||
# it will file a bug report, add a (LP: #....) to
|
|
||||||
# the changelog also
|
|
||||||
# 11:57:37 < dholbach> I thought it'd help with our sponsoring process
|
|
||||||
#
|
|
||||||
|
|
||||||
import re
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import string
|
import ppaput
|
||||||
|
from optparse import OptionParser
|
||||||
try:
|
|
||||||
import launchpadbugs.connector as Connector
|
|
||||||
except:
|
|
||||||
print >> sys.stderr, \
|
|
||||||
"You need python-launchpad-bugs (>= 0.2.14) installed to use ppaput."
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
#try:
|
|
||||||
# import apt
|
|
||||||
#except:
|
|
||||||
# print >> sys.stderr, "You need python-apt installed to use ppaput."
|
|
||||||
# sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
USAGE = \
|
USAGE = \
|
||||||
"""Usage: ppaput [-n] [<location>] [<debuild options>]
|
"""Usage: ppaput [-n] [<location>] [<debuild options>]
|
||||||
|
|
||||||
-n to file a new bug
|
See debuild(1) for more information on debuild options."""
|
||||||
<location> dput alias
|
parser = OptionParser(usage=USAGE)
|
||||||
<debuild options> options that are passed to debuild(1)
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
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 dput_check():
|
def check_arguments():
|
||||||
if not os.path.exists("/usr/bin/dput"):
|
|
||||||
print >> sys.stderr, "You need to install the dput package."
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
def find_fixed_launchpad_bug(changesfile):
|
|
||||||
changes = open(changesfile).readlines()
|
|
||||||
for line in changes:
|
|
||||||
if line.startswith("Launchpad-Bugs-Fixed"):
|
|
||||||
return line.split(":")[1].split()
|
|
||||||
return []
|
|
||||||
|
|
||||||
|
|
||||||
def call_dput(location, changes):
|
|
||||||
dput_check()
|
|
||||||
|
|
||||||
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):
|
|
||||||
dput_check()
|
|
||||||
(dummy, output, dummy) = os.popen3("dput -H | grep ^%s" % host)
|
|
||||||
text = output.read()
|
|
||||||
if text:
|
|
||||||
return text.split()[2]
|
|
||||||
return ""
|
|
||||||
|
|
||||||
|
|
||||||
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" % \
|
|
||||||
(os.getenv("DEBEMAIL"), \
|
|
||||||
string.join(options, " "))) == 0
|
|
||||||
|
|
||||||
def get_name_version_section_and_release():
|
|
||||||
changelogfile = "debian/changelog"
|
|
||||||
if not os.path.exists(changelogfile):
|
|
||||||
print >> sys.stderr, "%s not found." % changelogfile
|
|
||||||
sys.exit(1)
|
|
||||||
controlfile = "debian/control"
|
|
||||||
if not os.path.exists(controlfile):
|
|
||||||
print >> sys.stderr, "%s not found." % controlfile
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
head = open(changelogfile).readline()
|
|
||||||
(name, \
|
|
||||||
version, \
|
|
||||||
release) = re.findall(r'^(.*)\ \((.*)\)\ (.*?)\;\ .*', head)[0]
|
|
||||||
section = "main"
|
|
||||||
|
|
||||||
for line in open(controlfile).readlines():
|
|
||||||
if line.startswith("Section"):
|
|
||||||
if line.split("Section: ")[1].count("/")>0:
|
|
||||||
section = line.split("Section: ")[1].split("/")[0].strip()
|
|
||||||
return (name, version, section)
|
|
||||||
|
|
||||||
return (name, version, section, release)
|
|
||||||
|
|
||||||
def assemble_bug_comment_text(host, incoming, section, sourcepackage, version,
|
|
||||||
release):
|
|
||||||
if host == "ppa.launchpad.net":
|
|
||||||
dsc_file_location = "http://%s/%s/pool/%s/%s/%s/%s_%s.dsc" % \
|
|
||||||
(host, incoming[1:], section, sourcepackage[0], sourcepackage, \
|
|
||||||
sourcepackage, version)
|
|
||||||
else:
|
|
||||||
# FIXME: this needs to be much much cleverer at some stage
|
|
||||||
dsc_file_location = "http://%s/%s/pool/%s/%s/%s/%s_%s.dsc" % \
|
|
||||||
(host, incoming, section, sourcepackage[0], sourcepackage, version)
|
|
||||||
return """A new version of %s was uploaded to fix this bug.
|
|
||||||
|
|
||||||
To review the source the current version, please run
|
|
||||||
|
|
||||||
dget -x %s
|
|
||||||
|
|
||||||
|
|
||||||
The package will get built by Launchpad in a while. If you want to test it,
|
|
||||||
please run the following commands:
|
|
||||||
|
|
||||||
sudo -s
|
|
||||||
echo >> /etc/apt/sources.list
|
|
||||||
echo "deb http://%s/%s %s main universe multiverse restricted" >> /etc/apt/sources.list
|
|
||||||
apt-get update
|
|
||||||
apt-get install <package>
|
|
||||||
""" % (sourcepackage, dsc_file_location, host, incoming[1:], release)
|
|
||||||
|
|
||||||
|
|
||||||
def deal_with_bugreport(bugnumbers, host, section, incoming, sourcepackage,
|
|
||||||
version, release):
|
|
||||||
if not os.path.exists(os.path.expanduser("~/.lpcookie")):
|
|
||||||
print >> sys.stderr, \
|
|
||||||
"You need your Launchpad Cookie to be stored in ~/.lpcookie"
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
#print apt.Cache()[sourcepackage].section.split("/")[0].count("verse")
|
|
||||||
(dummy, output, dummy) = os.popen3(
|
|
||||||
"apt-cache showsrc %s | grep Directory | cut -d' ' -f2 | cut -d'/' -f2" % \
|
|
||||||
sourcepackage)
|
|
||||||
component = output.read().strip()
|
|
||||||
|
|
||||||
Bug = Connector.ConnectBug()
|
|
||||||
Bug.authentication = os.path.expanduser("~/.lpcookie")
|
|
||||||
|
|
||||||
for bugnumber in bugnumbers:
|
|
||||||
bug = Bug(int(bugnumber))
|
|
||||||
if component in ["main", "restricted"] and \
|
|
||||||
'ubuntu-main-sponsors' not in [str(s) for s in bug.subscribers]:
|
|
||||||
bug.subscribers.add('ubuntu-main-sponsors')
|
|
||||||
if component in ["universe", "multiverse"] and \
|
|
||||||
'ubuntu-universe-sponsors' not in [str(s) for s in bug.subscribers]:
|
|
||||||
bug.subscribers.add('ubuntu-universe-sponsors')
|
|
||||||
if not component:
|
|
||||||
bug.tags.append("needs-packaging")
|
|
||||||
|
|
||||||
comment = Bug.NewComment(text=assemble_bug_comment_text(host, incoming,
|
|
||||||
section,
|
|
||||||
sourcepackage,
|
|
||||||
version,
|
|
||||||
release),
|
|
||||||
subject="Fix in %s (%s)" % \
|
|
||||||
(sourcepackage, version))
|
|
||||||
bug.comments.add(comment)
|
|
||||||
|
|
||||||
if bug.status != "Fix Committed":
|
|
||||||
bug.status = "Fix Committed"
|
|
||||||
bug.commit()
|
|
||||||
|
|
||||||
|
|
||||||
def check_arguments(args):
|
|
||||||
new_bug = False
|
|
||||||
location = 'default'
|
location = 'default'
|
||||||
debuild_args = list()
|
debuild_args = []
|
||||||
|
|
||||||
if len(sys.argv) == 2 and sys.argv[1] in ["--help", "-H"]:
|
|
||||||
print USAGE
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
if len(sys.argv) == 1:
|
|
||||||
return (new_bug, location, debuild_args)
|
|
||||||
|
|
||||||
if sys.argv[1] == "-n":
|
|
||||||
new_bug = True
|
|
||||||
if len(sys.argv)>2:
|
|
||||||
if sys.argv[2].startswith("-"):
|
|
||||||
debuild_args = sys.argv[2:]
|
|
||||||
else:
|
|
||||||
location = sys.argv[2]
|
|
||||||
if len(sys.argv)>3:
|
|
||||||
debuild_args = sys.argv[3:]
|
|
||||||
else:
|
|
||||||
if sys.argv[1].startswith("-"):
|
|
||||||
debuild_args.append(sys.argv[1:])
|
|
||||||
else:
|
|
||||||
location = sys.argv[1]
|
|
||||||
if len(sys.argv)>2:
|
|
||||||
debuild_args = sys.argv[2:]
|
|
||||||
|
|
||||||
return (new_bug, location, debuild_args)
|
|
||||||
|
|
||||||
|
|
||||||
def file_bug(sourcepackage, version):
|
|
||||||
Bug = Connector.ConnectBug()
|
|
||||||
Bug.authentication = os.path.expanduser("~/.lpcookie")
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
bug = Bug.New(product={"name": sourcepackage, "target": "ubuntu"},
|
if args[0].startswith("-"):
|
||||||
summary="Please sponsor %s %s" % \
|
debuild_args = args
|
||||||
(sourcepackage, version),
|
else:
|
||||||
description=\
|
location = args[0]
|
||||||
"The new package will be uploaded to PPA shortly.")
|
debuild_args = args[1:]
|
||||||
except:
|
except IndexError:
|
||||||
bug = Bug.New(product={"name": "ubuntu"},
|
print "No location or arguments given, using defaults"
|
||||||
summary="Please sponsor %s %s" % \
|
|
||||||
(sourcepackage, version),
|
|
||||||
description=\
|
|
||||||
"The new package will be uploaded to PPA shortly.")
|
|
||||||
|
|
||||||
print "Successfully filed bug %s: http://launchpad.net/bugs/%s" % \
|
|
||||||
(bug.bugnumber, bug.bugnumber)
|
|
||||||
|
|
||||||
return bug.bugnumber
|
|
||||||
|
|
||||||
|
return (location, debuild_args)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
(new_bug, location, debuild_args) = check_arguments(sys.argv)
|
|
||||||
(sourcepackage, version, \
|
|
||||||
section, release) = get_name_version_section_and_release()
|
|
||||||
|
|
||||||
if new_bug:
|
(location, debuild_args) = check_arguments()
|
||||||
bugnumber = file_bug(sourcepackage, version)
|
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)
|
os.system("dch -a 'Fixes (LP: #%s)'" % bugnumber)
|
||||||
if not call_debuild(debuild_args):
|
if not ppaput.call_debuild(debuild_args):
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
changesfile = "../%s_%s_source.changes" % (sourcepackage, version)
|
changesfile = "../%s_%s_source.changes" % (sourcepackage, version)
|
||||||
@ -261,17 +51,18 @@ def main():
|
|||||||
os.path.expanduser(changesfile)
|
os.path.expanduser(changesfile)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
host = lookup_dput_host(location)
|
host = ppaput.lookup_dput_host(location)
|
||||||
(dput_res, incoming) = call_dput(location, changesfile)
|
(dput_res, incoming) = ppaput.call_dput(location, changesfile)
|
||||||
if not dput_res:
|
if not dput_res:
|
||||||
print >> sys.stderr, "%s was not uploaded." % changesfile
|
print >> sys.stderr, "%s was not uploaded." % changesfile
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
fixed_lp_bugs = find_fixed_launchpad_bug(changesfile)
|
fixed_lp_bugs = ppaput.find_fixed_launchpad_bug(changesfile)
|
||||||
if(fixed_lp_bugs):
|
if fixed_lp_bugs:
|
||||||
deal_with_bugreport(fixed_lp_bugs, host, section, incoming,
|
deal_with_bugreport(fixed_lp_bugs, host, section, incoming,
|
||||||
sourcepackage, version, release)
|
sourcepackage, version, release)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
206
ppaput.py
Executable file
206
ppaput.py
Executable file
@ -0,0 +1,206 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# Copyright 2007, Canonical, Daniel Holbach
|
||||||
|
#
|
||||||
|
# GPL 3
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# 11:57:27 < dholbach> but what it does is: build a source package of
|
||||||
|
# the current source tree you're in, upload it to PPA
|
||||||
|
# and follow up on a bug report, subscribe the right
|
||||||
|
# sponsors, set the right status - if you pass "-n"
|
||||||
|
# it will file a bug report, add a (LP: #....) to
|
||||||
|
# the changelog also
|
||||||
|
# 11:57:37 < dholbach> I thought it'd help with our sponsoring process
|
||||||
|
#
|
||||||
|
|
||||||
|
import re
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import string
|
||||||
|
|
||||||
|
try:
|
||||||
|
import launchpadbugs.connector as Connector
|
||||||
|
except:
|
||||||
|
print >> sys.stderr, \
|
||||||
|
"You need python-launchpad-bugs (>= 0.2.14) installed to use ppaput."
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
#try:
|
||||||
|
# import apt
|
||||||
|
#except:
|
||||||
|
# print >> sys.stderr, "You need python-apt installed to use ppaput."
|
||||||
|
# sys.exit(1)
|
||||||
|
|
||||||
|
def dput_check():
|
||||||
|
if not os.path.exists("/usr/bin/dput"):
|
||||||
|
print >> sys.stderr, "You need to install the dput package."
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
def find_fixed_launchpad_bug(changesfile):
|
||||||
|
changes = open(changesfile).readlines()
|
||||||
|
for line in changes:
|
||||||
|
if line.startswith("Launchpad-Bugs-Fixed"):
|
||||||
|
return line.split(":")[1].split()
|
||||||
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
def call_dput(location, changes):
|
||||||
|
dput_check()
|
||||||
|
|
||||||
|
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):
|
||||||
|
dput_check()
|
||||||
|
(dummy, output, dummy) = os.popen3("dput -H | grep ^%s" % host)
|
||||||
|
text = output.read()
|
||||||
|
if text:
|
||||||
|
return text.split()[2]
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
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" % \
|
||||||
|
(os.getenv("DEBEMAIL"), \
|
||||||
|
string.join(options, " "))) == 0
|
||||||
|
|
||||||
|
def get_name_version_section_and_release():
|
||||||
|
changelogfile = "debian/changelog"
|
||||||
|
if not os.path.exists(changelogfile):
|
||||||
|
print >> sys.stderr, "%s not found." % changelogfile
|
||||||
|
sys.exit(1)
|
||||||
|
controlfile = "debian/control"
|
||||||
|
if not os.path.exists(controlfile):
|
||||||
|
print >> sys.stderr, "%s not found." % controlfile
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
head = open(changelogfile).readline()
|
||||||
|
(name, \
|
||||||
|
version, \
|
||||||
|
release) = re.findall(r'^(.*)\ \((.*)\)\ (.*?)\;\ .*', head)[0]
|
||||||
|
section = "main"
|
||||||
|
|
||||||
|
#
|
||||||
|
#Is this nessicary? All ppa install to main now.
|
||||||
|
#
|
||||||
|
|
||||||
|
# for line in open(controlfile).readlines():
|
||||||
|
# if line.startswith("Section"):
|
||||||
|
# if line.split("Section: ")[1].count("/")>0:
|
||||||
|
# section = line.split("Section: ")[1].split("/")[0].strip()
|
||||||
|
# return (name, version, section)
|
||||||
|
|
||||||
|
return (name, version, section, release)
|
||||||
|
|
||||||
|
def assemble_bug_comment_text(host, incoming, section, sourcepackage, version,
|
||||||
|
release):
|
||||||
|
if host == "ppa.launchpad.net":
|
||||||
|
dsc_file_location = "http://%s/%s/pool/%s/%s/%s/%s_%s.dsc" % \
|
||||||
|
(host, incoming[1:], section, sourcepackage[0], sourcepackage, \
|
||||||
|
sourcepackage, version)
|
||||||
|
else:
|
||||||
|
# FIXME: this needs to be much much cleverer at some stage
|
||||||
|
dsc_file_location = "http://%s/%s/pool/%s/%s/%s/%s_%s.dsc" % \
|
||||||
|
(host, incoming, section, sourcepackage[0], sourcepackage, version)
|
||||||
|
return """A new version of %s was uploaded to fix this bug.
|
||||||
|
|
||||||
|
To review the source the current version, please run
|
||||||
|
|
||||||
|
dget -x %s
|
||||||
|
|
||||||
|
|
||||||
|
The package will get built by Launchpad in a while. If you want to test it,
|
||||||
|
please run the following commands:
|
||||||
|
|
||||||
|
sudo -s
|
||||||
|
echo >> /etc/apt/sources.list
|
||||||
|
echo "deb http://%s/%s %s main universe multiverse restricted" >> /etc/apt/sources.list
|
||||||
|
apt-get update
|
||||||
|
apt-get install <package>
|
||||||
|
""" % (sourcepackage, dsc_file_location, host, incoming[1:], release)
|
||||||
|
|
||||||
|
|
||||||
|
def deal_with_bugreport(bugnumbers, host, section, incoming, sourcepackage,
|
||||||
|
version, release):
|
||||||
|
if not os.path.exists(os.path.expanduser("~/.lpcookie")):
|
||||||
|
print >> sys.stderr, \
|
||||||
|
"You need your Launchpad Cookie to be stored in ~/.lpcookie"
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
#print apt.Cache()[sourcepackage].section.split("/")[0].count("verse")
|
||||||
|
(dummy, output, dummy) = os.popen3(
|
||||||
|
"apt-cache showsrc %s | grep Directory | cut -d' ' -f2 | cut -d'/' -f2" % \
|
||||||
|
sourcepackage)
|
||||||
|
component = output.read().strip()
|
||||||
|
|
||||||
|
Bug = Connector.ConnectBug()
|
||||||
|
Bug.authentication = os.path.expanduser("~/.lpcookie")
|
||||||
|
|
||||||
|
for bugnumber in bugnumbers:
|
||||||
|
bug = Bug(int(bugnumber))
|
||||||
|
if component in ["main", "restricted"] and \
|
||||||
|
'ubuntu-main-sponsors' not in [str(s) for s in bug.subscribers]:
|
||||||
|
bug.subscribers.add('ubuntu-main-sponsors')
|
||||||
|
if component in ["universe", "multiverse"] and \
|
||||||
|
'ubuntu-universe-sponsors' not in [str(s) for s in bug.subscribers]:
|
||||||
|
bug.subscribers.add('ubuntu-universe-sponsors')
|
||||||
|
if not component:
|
||||||
|
bug.tags.append("needs-packaging")
|
||||||
|
|
||||||
|
comment = Bug.NewComment(text=assemble_bug_comment_text(host, incoming,
|
||||||
|
section,
|
||||||
|
sourcepackage,
|
||||||
|
version,
|
||||||
|
release),
|
||||||
|
subject="Fix in %s (%s)" % \
|
||||||
|
(sourcepackage, version))
|
||||||
|
bug.comments.add(comment)
|
||||||
|
|
||||||
|
if bug.status != "Fix Committed":
|
||||||
|
bug.status = "Fix Committed"
|
||||||
|
bug.commit()
|
||||||
|
|
||||||
|
|
||||||
|
def file_bug(sourcepackage, version):
|
||||||
|
Bug = Connector.ConnectBug()
|
||||||
|
Bug.authentication = os.path.expanduser("~/.lpcookie")
|
||||||
|
|
||||||
|
try:
|
||||||
|
bug = Bug.New(product={"name": sourcepackage, "target": "ubuntu"},
|
||||||
|
summary="Please sponsor %s %s" % \
|
||||||
|
(sourcepackage, version),
|
||||||
|
description=\
|
||||||
|
"The new package will be uploaded to PPA shortly.")
|
||||||
|
except:
|
||||||
|
bug = Bug.New(product={"name": "ubuntu"},
|
||||||
|
summary="Please sponsor %s %s" % \
|
||||||
|
(sourcepackage, version),
|
||||||
|
description=\
|
||||||
|
"The new package will be uploaded to PPA shortly.")
|
||||||
|
|
||||||
|
print "Successfully filed bug %s: http://launchpad.net/bugs/%s" % \
|
||||||
|
(bug.bugnumber, bug.bugnumber)
|
||||||
|
|
||||||
|
return bug.bugnumber
|
1
setup.py
1
setup.py
@ -33,4 +33,5 @@ setup(name='ubuntu-dev-tools',
|
|||||||
'get-build-deps',
|
'get-build-deps',
|
||||||
'dgetlp'
|
'dgetlp'
|
||||||
],
|
],
|
||||||
|
py_modules=['ppaput'],
|
||||||
)
|
)
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
# Copyright 2007 (C) Albin Tonnerre (Lutin) <lut1n.tne@gmail.com>
|
# Copyright 2007 (C) Albin Tonnerre (Lutin) <lut1n.tne@gmail.com>
|
||||||
# License: GPLv2
|
# License: GPLv2
|
||||||
#
|
#
|
||||||
# This script is used to update the maintainer field of an Ubuntu package
|
# This script is used to update the Maintainer field of an Ubuntu package
|
||||||
# to match the DebianMaintainerField specification.
|
# to match the DebianMaintainerField specification.
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Usage: $0 [--path=PATH] [--section=SECTION] [--nochangelog]
|
Usage: $0 [--path=PATH] [--section=SECTION] [--nochangelog]
|
||||||
--path=PATH specify the path of the source folder
|
--path=PATH Specify the path of the source directory.
|
||||||
--section=SECTION specify the section of the package (if the package is
|
--section=SECTION Specify the section of the package (if the package is
|
||||||
not yet in the archive.
|
not yet in the archive.
|
||||||
--nochangelog Do not add to the changelog, only alter debian/control.
|
--nochangelog Do not add to the changelog, only alter debian/control.
|
||||||
EOF
|
EOF
|
||||||
@ -29,7 +29,7 @@ for argv in "$@"; do
|
|||||||
[ "$value" != "multiverse" ] && echo "Invalid section. Valid sections: main restricted universe multiverse" >&2 && exit 1
|
[ "$value" != "multiverse" ] && echo "Invalid section. Valid sections: main restricted universe multiverse" >&2 && exit 1
|
||||||
section=$value
|
section=$value
|
||||||
;;
|
;;
|
||||||
"--nochangelog")
|
"--nochangelog"|"--no-changelog")
|
||||||
nochangelog=1
|
nochangelog=1
|
||||||
;;
|
;;
|
||||||
"--help")
|
"--help")
|
||||||
@ -55,10 +55,17 @@ else
|
|||||||
echo "Please execute «$0» in the source folder." >&2 && exit 1
|
echo "Please execute «$0» in the source folder." >&2 && exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -n "$(head -1 $DEBIANDIR/changelog | grep -E '\(*ubuntu.*\)')" ] &&
|
if [ -z "$(head -1 $DEBIANDIR/changelog | grep -E '\(*ubuntu.*\)')" ]
|
||||||
! grep -E "^Maintainer: .*@.*ubuntu.*>" $DEBIANDIR/control >/dev/null || \
|
then
|
||||||
{ echo "Not an Ubuntu package or already maintained by the Ubuntu team." >&2; \
|
echo "Latest changelog entry has no Ubuntu version number." >&2
|
||||||
exit 1; }
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep -E "^Maintainer: .*@.*ubuntu.*>" $DEBIANDIR/control >/dev/null
|
||||||
|
then
|
||||||
|
echo "Package already maintained by the Ubuntu team." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$section" ]; then
|
if [ -z "$section" ]; then
|
||||||
DISTRO=$(sed -r '1!d;s/.*\) (.*);.*/\1/' $DEBIANDIR/changelog | cut -d'-' -f1)
|
DISTRO=$(sed -r '1!d;s/.*\) (.*);.*/\1/' $DEBIANDIR/changelog | cut -d'-' -f1)
|
||||||
@ -68,8 +75,9 @@ if [ -z "$section" ]; then
|
|||||||
echo "--section argument. Run $0 --help for more information." >&2
|
echo "--section argument. Run $0 --help for more information." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
section=$(echo $pkgline | grep -Eo "main|universe|multiverse|restricted") || section=main
|
section=$(echo $pkgline | grep -Eo "main|universe|multiverse|restricted") || section=universe
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case $section in
|
case $section in
|
||||||
"main"|"restricted") email="Ubuntu Core Developers <ubuntu-devel-discuss@lists.ubuntu.com>" ;;
|
"main"|"restricted") email="Ubuntu Core Developers <ubuntu-devel-discuss@lists.ubuntu.com>" ;;
|
||||||
"universe"|"multiverse") email="Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com>" ;;
|
"universe"|"multiverse") email="Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com>" ;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user