mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-05-28 09:11:38 +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
|
import sys
|
||||||
from optparse import OptionGroup
|
from optparse import OptionGroup
|
||||||
from optparse import OptionParser
|
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.lp.lpapicache import Distribution, PersonTeam
|
||||||
|
from ubuntutools.misc import splitReleasePocket
|
||||||
|
|
||||||
# Usage.
|
# Usage.
|
||||||
usage = "%prog <srcpackage> <release> <operation>\n\n"
|
usage = "%prog <srcpackage> <release> <operation>\n\n"
|
||||||
@ -114,13 +116,10 @@ if not options.batch:
|
|||||||
oneArch = False
|
oneArch = False
|
||||||
|
|
||||||
# split release and pocket
|
# split release and pocket
|
||||||
if '-' in release:
|
try:
|
||||||
(release, pocket) = release.split('-')
|
(release, pocket) = splitReleasePocket(release)
|
||||||
else:
|
except PocketDoesNotExistError, e:
|
||||||
pocket = 'Release'
|
print 'E: %s' % e
|
||||||
pocket = pocket.capitalize()
|
|
||||||
if pocket not in ('Release', 'Security', 'Updates', 'Proposed', 'Backports'):
|
|
||||||
print 'Unknown pocket: %s' % pocket
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Get the ubuntu archive
|
# Get the ubuntu archive
|
||||||
@ -205,15 +204,11 @@ else:
|
|||||||
archs.intersection_update(valid_archs)
|
archs.intersection_update(valid_archs)
|
||||||
|
|
||||||
release = options.series or Distribution('ubuntu').getDevelopmentSeries().name
|
release = options.series or Distribution('ubuntu').getDevelopmentSeries().name
|
||||||
pocket = 'Release'
|
try:
|
||||||
if release and '-' in release:
|
(release, pocket) = splitReleasePocket(release)
|
||||||
# split release and pocket
|
except PocketDoesNotExistError, e:
|
||||||
(release, pocket) = options.series.split('-')
|
print 'E: %s' % e
|
||||||
pocket = pocket.capitalize()
|
sys.exit(1)
|
||||||
|
|
||||||
if pocket not in ('Release', 'Security', 'Updates', 'Proposed', 'Backports'):
|
|
||||||
print 'Unknown pocket: %s' % pocket
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
ubuntu_archive = Distribution('ubuntu').getArchive()
|
ubuntu_archive = Distribution('ubuntu').getArchive()
|
||||||
try:
|
try:
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
# Modules.
|
# Modules.
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from ubuntutools.lp.udtexceptions import PocketDoesNotExistError
|
||||||
|
|
||||||
def system_distribution():
|
def system_distribution():
|
||||||
""" system_distro() -> string
|
""" system_distro() -> string
|
||||||
|
|
||||||
@ -90,3 +92,26 @@ def readlist(filename, uniq=True):
|
|||||||
items = list(set(items))
|
items = list(set(items))
|
||||||
|
|
||||||
return 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