* 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:
Jonathan Patrick Davies 2008-08-29 07:44:58 +01:00
parent 3c25fca142
commit ea5b154129
3 changed files with 30 additions and 6 deletions

13
buildd
View File

@ -123,14 +123,19 @@ if op == 'status':
# Leaving operations may only be done by Ubuntu developers (retry) or buildd # Leaving operations may only be done by Ubuntu developers (retry) or buildd
# admins (rescore). Check if the proper permissions are in place. # admins (rescore). Check if the proper permissions are in place.
if op == "rescore": teamNeeded = "launchpad-buildd-admins" 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) necessaryPrivs = common.isLPTeamMember(teamNeeded)
if not necessaryPrivs: if not necessaryPrivs:
print >> sys.stderr, "You cannot perform the %s operation as you are not " \ print >> sys.stderr, "You cannot perform the %s operation on a %s package " \
"a member of the '%s' team on Launchpad." % (op, teamNeeded) "as you are not member of the '%s' team on Launchpad." % (op, component,
print "If this is incorrect, please log in to Launchpad using Firefox, " \ teamNeeded)
print "Should this is incorrect, please log in to Launchpad using Firefox, " \
"delete the ~/.lpcookie.txt file and rerun this script." "delete the ~/.lpcookie.txt file and rerun this script."
sys.exit(1) sys.exit(1)

View File

@ -28,6 +28,7 @@ import cookielib
import glob import glob
import os.path import os.path
import re import re
import subprocess
import sys import sys
import urllib2 import urllib2
@ -95,7 +96,7 @@ def checkSourceExists(package, release):
"exist in Ubuntu." % package "exist in Ubuntu." % package
else: # Other error code, probably Launchpad malfunction. else: # Other error code, probably Launchpad malfunction.
print >> sys.stderr, "Error when checking Launchpad for package: " \ print >> sys.stderr, "Error when checking Launchpad for package: " \
"%s." % error "%s." % error.code
sys.exit(1) # Exit. Error encountered. sys.exit(1) # Exit. Error encountered.
@ -233,3 +234,17 @@ def isLPTeamMember(team):
return False return False
return True 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
View File

@ -6,11 +6,15 @@ ubuntu-dev-tools (0.43ubuntu1) intrepid; urgency=low
- Improve cookie file writing. - Improve cookie file writing.
- New function: isLPTeamMember() - checks if the user is a member of the - New function: isLPTeamMember() - checks if the user is a member of the
Launchpad team using cookies for authentication. Launchpad team using cookies for authentication.
- New function: packageComponent() - returns which component a package in
Ubuntu is in.
* requestsync: * requestsync:
- Return an error when the script is unable to connect to - Return an error when the script is unable to connect to
packages.debian.org (LP: #261916). packages.debian.org (LP: #261916).
- Adapt team checking with the function above. - 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 ] [ Ryan Kavanagh ]
* dgetlp.1: New manpage * dgetlp.1: New manpage