mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-12 23:51:08 +00:00
* common.py: New function: packageComponent() - returns which component a package
in Ubuntu is in. * buildd: Check which component the package is in.
This commit is contained in:
parent
3c25fca142
commit
ea5b154129
13
buildd
13
buildd
@ -123,14 +123,19 @@ if op == 'status':
|
||||
# Leaving operations may only be done by Ubuntu developers (retry) or buildd
|
||||
# admins (rescore). Check if the proper permissions are in place.
|
||||
if op == "rescore": teamNeeded = "launchpad-buildd-admins"
|
||||
if op == "retry": teamNeeded = "ubuntu-dev"
|
||||
if op == "retry":
|
||||
component = common.packageComponent(package, release)
|
||||
|
||||
if component == "main": teamNeeded = "ubuntu-core-dev"
|
||||
else: teamNeeded = "ubuntu-dev"
|
||||
|
||||
necessaryPrivs = common.isLPTeamMember(teamNeeded)
|
||||
|
||||
if not necessaryPrivs:
|
||||
print >> sys.stderr, "You cannot perform the %s operation as you are not " \
|
||||
"a member of the '%s' team on Launchpad." % (op, teamNeeded)
|
||||
print "If this is incorrect, please log in to Launchpad using Firefox, " \
|
||||
print >> sys.stderr, "You cannot perform the %s operation on a %s package " \
|
||||
"as you are not member of the '%s' team on Launchpad." % (op, component,
|
||||
teamNeeded)
|
||||
print "Should this is incorrect, please log in to Launchpad using Firefox, " \
|
||||
"delete the ~/.lpcookie.txt file and rerun this script."
|
||||
sys.exit(1)
|
||||
|
||||
|
17
common.py
17
common.py
@ -28,6 +28,7 @@ import cookielib
|
||||
import glob
|
||||
import os.path
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import urllib2
|
||||
|
||||
@ -95,7 +96,7 @@ def checkSourceExists(package, release):
|
||||
"exist in Ubuntu." % package
|
||||
else: # Other error code, probably Launchpad malfunction.
|
||||
print >> sys.stderr, "Error when checking Launchpad for package: " \
|
||||
"%s." % error
|
||||
"%s." % error.code
|
||||
|
||||
sys.exit(1) # Exit. Error encountered.
|
||||
|
||||
@ -233,3 +234,17 @@ def isLPTeamMember(team):
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def packageComponent(package, release):
|
||||
madison = subprocess.Popen(['rmadison', '-u', 'ubuntu', '-a', 'source', \
|
||||
'-s', release, package], stdout = subprocess.PIPE)
|
||||
out = madison.communicate()[0]
|
||||
assert (madison.returncode == 0)
|
||||
|
||||
for l in out.splitlines():
|
||||
(pkg, version, rel, builds) = l.split('|')
|
||||
component = 'main'
|
||||
if rel.find('/') != -1:
|
||||
component = rel.split('/')[1]
|
||||
|
||||
return component.strip()
|
||||
|
6
debian/changelog
vendored
6
debian/changelog
vendored
@ -6,11 +6,15 @@ ubuntu-dev-tools (0.43ubuntu1) intrepid; urgency=low
|
||||
- Improve cookie file writing.
|
||||
- New function: isLPTeamMember() - checks if the user is a member of the
|
||||
Launchpad team using cookies for authentication.
|
||||
- New function: packageComponent() - returns which component a package in
|
||||
Ubuntu is in.
|
||||
* requestsync:
|
||||
- Return an error when the script is unable to connect to
|
||||
packages.debian.org (LP: #261916).
|
||||
- Adapt team checking with the function above.
|
||||
* buildd: Adapt privilege checking code to the new function above.
|
||||
* buildd:
|
||||
- Adapt privilege checking code to the new function above.
|
||||
- Check which component the package is in.
|
||||
|
||||
[ Ryan Kavanagh ]
|
||||
* dgetlp.1: New manpage
|
||||
|
Loading…
x
Reference in New Issue
Block a user