mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01:09 +00:00
* common.py: Removed print "Using cookie file" line.
* requestsync: - Using the Launchpad cookie file, validate that the user is a member the ubuntu-dev team on Launchpad. Thus, checking if the user needs sponsership or not (LP: #130648). * doc/requestsync.1: Removed mention of -s flag. Obsoleted by the above.
This commit is contained in:
parent
4a493b0c7a
commit
05c55bfbe2
@ -89,8 +89,6 @@ def prepareLaunchpadCookie():
|
|||||||
|
|
||||||
launchpad_cookiefile = "%s/.lpcookie.txt" % os.environ.get('HOME')
|
launchpad_cookiefile = "%s/.lpcookie.txt" % os.environ.get('HOME')
|
||||||
|
|
||||||
print "Using cookie file at: %s." % launchpad_cookiefile
|
|
||||||
|
|
||||||
# Return the Launchpad cookie.
|
# Return the Launchpad cookie.
|
||||||
return launchpad_cookiefile
|
return launchpad_cookiefile
|
||||||
|
|
||||||
|
9
debian/changelog
vendored
9
debian/changelog
vendored
@ -16,8 +16,13 @@ ubuntu-dev-tools (0.37ubuntu1) intrepid; urgency=low
|
|||||||
to authenticate with Launchpad.
|
to authenticate with Launchpad.
|
||||||
* debian/ubuntu-dev-tools.install: Added line to install common.py above to
|
* debian/ubuntu-dev-tools.install: Added line to install common.py above to
|
||||||
the correct location.
|
the correct location.
|
||||||
* requestsync: Use the functions in the common.py file above to authenticate
|
* requestsync:
|
||||||
with Launchpad.
|
- Use the functions in the common.py file above to authenticate with
|
||||||
|
Launchpad.
|
||||||
|
- Using the Launchpad cookie file, validate that the user is a member of
|
||||||
|
the ubuntu-dev team on Launchpad. Thus, checking if the user needs
|
||||||
|
sponsership or not (LP: #130648).
|
||||||
|
* doc/requestsync.1: Removed mention of -s flag. Obsoleted by the above.
|
||||||
* debian/control: Changed XS-Python-Version to >= 2.5.
|
* debian/control: Changed XS-Python-Version to >= 2.5.
|
||||||
|
|
||||||
[ Siegfried-Angel Gevatter Pujals ]
|
[ Siegfried-Angel Gevatter Pujals ]
|
||||||
|
@ -29,11 +29,6 @@ Display a help message and exit.
|
|||||||
Specifies that the package is a new package, and requestsync should not
|
Specifies that the package is a new package, and requestsync should not
|
||||||
attempt to look it up in Ubuntu since it will not exist.
|
attempt to look it up in Ubuntu since it will not exist.
|
||||||
.TP
|
.TP
|
||||||
.B \-s
|
|
||||||
Specifies that you require sponsorship.
|
|
||||||
You need this option if you are not a member of ubuntu-dev for universe or
|
|
||||||
multiverse, or ubuntu-core-dev for main or restricted.
|
|
||||||
.TP
|
|
||||||
.B \-k \fI<keyid>\fR
|
.B \-k \fI<keyid>\fR
|
||||||
Specifies your GPG key.
|
Specifies your GPG key.
|
||||||
Can also be set with the line `\fIexport GPGKEY=<keyid>\fR' in your shell's
|
Can also be set with the line `\fIexport GPGKEY=<keyid>\fR' in your shell's
|
||||||
|
59
requestsync
59
requestsync
@ -8,6 +8,7 @@
|
|||||||
# Michael Bienia <geser@ubuntu.com> (python-launchpad-bugs support)
|
# Michael Bienia <geser@ubuntu.com> (python-launchpad-bugs support)
|
||||||
# Daniel Hahler <ubuntu@thequod.de>
|
# Daniel Hahler <ubuntu@thequod.de>
|
||||||
# Iain Lane <iain@orangesquash.org.uk>
|
# Iain Lane <iain@orangesquash.org.uk>
|
||||||
|
# Jonathan Patrick Davies <jpds@ubuntu.com>
|
||||||
#
|
#
|
||||||
# ##################################################################
|
# ##################################################################
|
||||||
#
|
#
|
||||||
@ -24,17 +25,45 @@
|
|||||||
#
|
#
|
||||||
# ##################################################################
|
# ##################################################################
|
||||||
|
|
||||||
import os, sys, urllib, subprocess, getopt
|
import getopt
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import urllib
|
||||||
from debian_bundle.changelog import Version
|
from debian_bundle.changelog import Version
|
||||||
|
|
||||||
# Set this to the path of your Launchpad cookie file, when using
|
# Use functions from ubuntu-dev-tools to create Launchpad cookie file.
|
||||||
# python-launchpad-bugs support (--lp).
|
sys.path.append('/usr/share/ubuntu-dev-tools/')
|
||||||
# The following will be tried automatically, if unset (first match gets used):
|
import common
|
||||||
# 1. ~/.lpcookie.txt
|
|
||||||
# 2. ~/.mozilla/*/*/cookies.sqlite
|
launchpad_cookiefile = common.prepareLaunchpadCookie()
|
||||||
# 3. ~/.mozilla/*/*/cookies.txt
|
|
||||||
launchpad_cookiefile = None
|
|
||||||
|
|
||||||
|
def checkNeedsSponsorship():
|
||||||
|
"""
|
||||||
|
Check that the user has the appropriate permissions by checking what
|
||||||
|
Launchpad returns while authenticating with their cookie.
|
||||||
|
|
||||||
|
If they are an indirect or direct member of the ~ubuntu-dev team on
|
||||||
|
Launchpad - sponsorship is not required.
|
||||||
|
|
||||||
|
The prepareLaunchpadCookie function above shall ensure that a cookie
|
||||||
|
file exists first.
|
||||||
|
"""
|
||||||
|
urlopener = common.setupLaunchpadUrlOpener(launchpad_cookiefile)
|
||||||
|
|
||||||
|
ubuntuDevLPPage = urlopener.open('https://launchpad.net/~ubuntu-dev').read()
|
||||||
|
|
||||||
|
if 'You are not a member of this team:' in ubuntuDevLPPage:
|
||||||
|
print "You are not a member (direct or indirect) of the ~ubuntu-dev " \
|
||||||
|
"team on Launchpad."
|
||||||
|
print "Your sync request shall require an approval by a member of " \
|
||||||
|
"either the ubuntu-main-sponsors or the ubuntu-universe-sponsors " \
|
||||||
|
"team,"
|
||||||
|
print "before it is processed by a member of the Ubuntu Archive admins."
|
||||||
|
return True # Sponsorship required.
|
||||||
|
else:
|
||||||
|
return False # Sponsorship not required.
|
||||||
|
|
||||||
def cur_version_component(sourcepkg, release):
|
def cur_version_component(sourcepkg, release):
|
||||||
'''Determine current package version in ubuntu.'''
|
'''Determine current package version in ubuntu.'''
|
||||||
@ -247,7 +276,6 @@ def post_bug(source_package, subscribe, status, bugtitle, bugtext):
|
|||||||
Return True if successfully posted, otherwise False.'''
|
Return True if successfully posted, otherwise False.'''
|
||||||
|
|
||||||
import glob, os.path
|
import glob, os.path
|
||||||
global launchpad_cookiefile
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import launchpadbugs.connector
|
import launchpadbugs.connector
|
||||||
@ -255,11 +283,7 @@ def post_bug(source_package, subscribe, status, bugtitle, bugtext):
|
|||||||
print >> sys.stderr, 'Importing launchpadbugs failed. Is python-launchpad-bugs installed?'
|
print >> sys.stderr, 'Importing launchpadbugs failed. Is python-launchpad-bugs installed?'
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Use functions from ubuntu-dev-tools to create Launchpad cookie file.
|
print "Using cookie file at", launchpad_cookiefile
|
||||||
sys.path.append('/usr/share/ubuntu-dev-tools/')
|
|
||||||
import common
|
|
||||||
|
|
||||||
launchpad_cookiefile = common.prepareLaunchpadCookie()
|
|
||||||
|
|
||||||
if source_package:
|
if source_package:
|
||||||
product = {'name': source_package, 'target': 'ubuntu'}
|
product = {'name': source_package, 'target': 'ubuntu'}
|
||||||
@ -311,7 +335,7 @@ def edit_report(subject, body, changes_required=False):
|
|||||||
program exits.
|
program exits.
|
||||||
Returns (new_subject, new_body).
|
Returns (new_subject, new_body).
|
||||||
"""
|
"""
|
||||||
import re, string
|
import string
|
||||||
|
|
||||||
report = "Summary (one line):\n%s\n\nDescription:\n%s" % (subject, body)
|
report = "Summary (one line):\n%s\n\nDescription:\n%s" % (subject, body)
|
||||||
|
|
||||||
@ -361,16 +385,17 @@ if __name__ == '__main__':
|
|||||||
need_interaction = False
|
need_interaction = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
opts, args = getopt.gnu_getopt(sys.argv[1:], 'hnsk:', ('lp'))
|
opts, args = getopt.gnu_getopt(sys.argv[1:], 'hnk:', ('lp'))
|
||||||
except getopt.GetoptError:
|
except getopt.GetoptError:
|
||||||
usage()
|
usage()
|
||||||
for o, a in opts:
|
for o, a in opts:
|
||||||
if o == '-h': usage()
|
if o == '-h': usage()
|
||||||
if o == '-n': newsource = True
|
if o == '-n': newsource = True
|
||||||
if o == '-s': sponsorship = True
|
|
||||||
if o == '-k': keyid = a
|
if o == '-k': keyid = a
|
||||||
if o == '--lp': use_lp_bugs = True
|
if o == '--lp': use_lp_bugs = True
|
||||||
|
|
||||||
|
sponsorship = checkNeedsSponsorship()
|
||||||
|
|
||||||
if len(args) not in (2, 3):
|
if len(args) not in (2, 3):
|
||||||
usage()
|
usage()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user