mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-04-15 04:11:07 +00:00
Factor our the spliting of the release name and the pocket name into its
own function.
This commit is contained in:
parent
5babcfe869
commit
cc8ec956b0
29
ubuntu-build
29
ubuntu-build
@ -26,8 +26,10 @@
|
||||
import sys
|
||||
from optparse import OptionGroup
|
||||
from optparse import OptionParser
|
||||
from ubuntutools.lp.udtexceptions import SeriesNotFoundException, PackageNotFoundException
|
||||
from ubuntutools.lp.udtexceptions import (SeriesNotFoundException,
|
||||
PackageNotFoundException, PocketDoesNotExistError,)
|
||||
from ubuntutools.lp.lpapicache import Distribution, PersonTeam
|
||||
from ubuntutools.misc import splitReleasePocket
|
||||
|
||||
# Usage.
|
||||
usage = "%prog <srcpackage> <release> <operation>\n\n"
|
||||
@ -114,13 +116,10 @@ if not options.batch:
|
||||
oneArch = False
|
||||
|
||||
# split release and pocket
|
||||
if '-' in release:
|
||||
(release, pocket) = release.split('-')
|
||||
else:
|
||||
pocket = 'Release'
|
||||
pocket = pocket.capitalize()
|
||||
if pocket not in ('Release', 'Security', 'Updates', 'Proposed', 'Backports'):
|
||||
print 'Unknown pocket: %s' % pocket
|
||||
try:
|
||||
(release, pocket) = splitReleasePocket(release)
|
||||
except PocketDoesNotExistError, e:
|
||||
print 'E: %s' % e
|
||||
sys.exit(1)
|
||||
|
||||
# Get the ubuntu archive
|
||||
@ -205,15 +204,11 @@ else:
|
||||
archs.intersection_update(valid_archs)
|
||||
|
||||
release = options.series or Distribution('ubuntu').getDevelopmentSeries().name
|
||||
pocket = 'Release'
|
||||
if release and '-' in release:
|
||||
# split release and pocket
|
||||
(release, pocket) = options.series.split('-')
|
||||
pocket = pocket.capitalize()
|
||||
|
||||
if pocket not in ('Release', 'Security', 'Updates', 'Proposed', 'Backports'):
|
||||
print 'Unknown pocket: %s' % pocket
|
||||
sys.exit(1)
|
||||
try:
|
||||
(release, pocket) = splitReleasePocket(release)
|
||||
except PocketDoesNotExistError, e:
|
||||
print 'E: %s' % e
|
||||
sys.exit(1)
|
||||
|
||||
ubuntu_archive = Distribution('ubuntu').getArchive()
|
||||
try:
|
||||
|
@ -23,6 +23,8 @@
|
||||
# Modules.
|
||||
import os
|
||||
|
||||
from ubuntutools.lp.udtexceptions import PocketDoesNotExistError
|
||||
|
||||
def system_distribution():
|
||||
""" system_distro() -> string
|
||||
|
||||
@ -90,3 +92,26 @@ def readlist(filename, uniq=True):
|
||||
items = list(set(items))
|
||||
|
||||
return items
|
||||
|
||||
def splitReleasePocket(release):
|
||||
'''Splits the release and pocket name.
|
||||
|
||||
If the argument doesn't contain a pocket name then the 'Release' pocket
|
||||
is assumed.
|
||||
|
||||
Returns the release and pocket name.
|
||||
'''
|
||||
pocket = 'Release'
|
||||
|
||||
if release is None:
|
||||
raise ValueError('No release name specified')
|
||||
|
||||
if '-' in release:
|
||||
(release, pocket) = release.split('-')
|
||||
pocket = pocket.capitalize()
|
||||
|
||||
if pocket not in ('Release', 'Security', 'Updates', 'Proposed',
|
||||
'Backports'):
|
||||
raise PocketDoesNotExistError("Pocket '%s' does not exist." % pocket)
|
||||
|
||||
return (release, pocket)
|
||||
|
Loading…
x
Reference in New Issue
Block a user