mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-04-16 21:01:10 +00:00
pbuilder-dist, pull-debian-source, pull-lp-source, requestsync,
reverse-depends, submittodebian, syncpackage: Handle outdated distro-info data. Fall back to sane defaults where possible.
This commit is contained in:
parent
4dbde5f886
commit
343ac49b39
4
debian/changelog
vendored
4
debian/changelog
vendored
@ -10,6 +10,10 @@ ubuntu-dev-tools (0.142) UNRELEASED; urgency=low
|
||||
(LP: #979117)
|
||||
* pbuilder-dist: Don't try to enable -updates for Debian testing
|
||||
(LP: #993006)
|
||||
* pbuilder-dist, pull-debian-source, pull-lp-source, requestsync,
|
||||
reverse-depends, submittodebian, syncpackage:
|
||||
Handle outdated distro-info data. Fall back to sane defaults where
|
||||
possible.
|
||||
|
||||
-- Stefano Rivera <stefanor@debian.org> Wed, 25 Apr 2012 17:38:58 +0200
|
||||
|
||||
|
@ -33,7 +33,7 @@ import os
|
||||
import sys
|
||||
|
||||
from devscripts.logger import Logger
|
||||
from distro_info import DebianDistroInfo, UbuntuDistroInfo
|
||||
from distro_info import DebianDistroInfo, UbuntuDistroInfo, DistroDataOutdated
|
||||
|
||||
import ubuntutools.misc
|
||||
from ubuntutools.config import UDTConfig
|
||||
@ -266,8 +266,11 @@ class PbuilderDist:
|
||||
othermirrors = []
|
||||
if self.target_distro in self._debian_distros:
|
||||
debian_info = DebianDistroInfo()
|
||||
codename = debian_info.codename(self.target_distro,
|
||||
default=self.target_distro)
|
||||
try:
|
||||
codename = debian_info.codename(self.target_distro,
|
||||
default=self.target_distro)
|
||||
except DistroDataOutdated, e:
|
||||
Logger.warn(e)
|
||||
if codename in (debian_info.devel(), 'experimental'):
|
||||
self.enable_security = False
|
||||
self.enable_updates = False
|
||||
@ -286,7 +289,13 @@ class PbuilderDist:
|
||||
othermirrors.append('deb %s %s-proposed-updates %s'
|
||||
% (mirror, self.target_distro, components))
|
||||
else:
|
||||
if self.target_distro == UbuntuDistroInfo().devel():
|
||||
try:
|
||||
dev_release = self.target_distro == UbuntuDistroInfo().devel()
|
||||
except DistroDataOutdated, e:
|
||||
Logger.warn(e)
|
||||
dev_release = True
|
||||
|
||||
if dev_release:
|
||||
self.enable_security = False
|
||||
self.enable_updates = False
|
||||
self.enable_proposed = False
|
||||
|
@ -22,7 +22,7 @@ import sys
|
||||
import urllib2
|
||||
|
||||
from devscripts.logger import Logger
|
||||
from distro_info import DebianDistroInfo
|
||||
from distro_info import DebianDistroInfo, DistroDataOutdated
|
||||
|
||||
from ubuntutools.archive import DebianSourcePackage, DownloadError, rmadison
|
||||
from ubuntutools.config import UDTConfig
|
||||
@ -52,7 +52,10 @@ def is_suite(version):
|
||||
|
||||
def source_package_for(binary, release):
|
||||
"""Query DDE to find the source package for a particular binary"""
|
||||
release = DebianDistroInfo().codename(release, default=release)
|
||||
try:
|
||||
release = DebianDistroInfo().codename(release, default=release)
|
||||
except DistroDataOutdated, e:
|
||||
Logger.warn(e)
|
||||
url = ('http://dde.debian.net/dde/q/udd/dist/d:debian/r:%s/p:%s/?t=json'
|
||||
% (release, binary))
|
||||
try:
|
||||
|
@ -30,7 +30,7 @@ import urllib2
|
||||
from optparse import OptionParser
|
||||
|
||||
from devscripts.logger import Logger
|
||||
from distro_info import UbuntuDistroInfo
|
||||
from distro_info import UbuntuDistroInfo, DistroDataOutdated
|
||||
|
||||
from ubuntutools.archive import UbuntuSourcePackage, DownloadError
|
||||
from ubuntutools.config import UDTConfig
|
||||
@ -89,7 +89,11 @@ def main():
|
||||
if len(args) > 1: # Custom distribution specified.
|
||||
version = str(args[1])
|
||||
else:
|
||||
version = os.getenv('DIST') or ubuntu_info.devel()
|
||||
try:
|
||||
version = os.getenv('DIST') or ubuntu_info.devel()
|
||||
except DistroDataOutdated, e:
|
||||
Logger.warn("%s\nOr specify a distribution.", e)
|
||||
sys.exit(1)
|
||||
component = None
|
||||
|
||||
# Release, not package version number:
|
||||
|
@ -31,7 +31,7 @@ import os
|
||||
import sys
|
||||
|
||||
from debian.changelog import Version
|
||||
from distro_info import UbuntuDistroInfo
|
||||
from distro_info import UbuntuDistroInfo, DistroDataOutdated
|
||||
|
||||
from ubuntutools.config import UDTConfig, ubu_email
|
||||
from ubuntutools.lp import udtexceptions
|
||||
@ -45,8 +45,11 @@ from ubuntutools.question import confirmation_prompt, EditBugReport
|
||||
def main():
|
||||
ubu_info = UbuntuDistroInfo()
|
||||
DEFAULT_SOURCE = 'unstable'
|
||||
if ubu_info.is_lts(ubu_info.devel()):
|
||||
DEFAULT_SOURCE = 'testing'
|
||||
try:
|
||||
if ubu_info.is_lts(ubu_info.devel()):
|
||||
DEFAULT_SOURCE = 'testing'
|
||||
except DistroDataOutdated, e:
|
||||
print >> sys.stderr, str(e)
|
||||
|
||||
# Our usage options.
|
||||
usage = ('Usage: %prog [options] '
|
||||
|
@ -18,6 +18,7 @@ import optparse
|
||||
import sys
|
||||
|
||||
from devscripts.logger import Logger
|
||||
from distro_info import DistroDataOutdated
|
||||
|
||||
from ubuntutools.misc import (system_distribution, vendor_to_distroinfo,
|
||||
codename_to_distribution)
|
||||
@ -26,15 +27,21 @@ from ubuntutools.rdepends import query_rdepends, RDependsException
|
||||
|
||||
def main():
|
||||
system_distro_info = vendor_to_distroinfo(system_distribution())()
|
||||
try:
|
||||
default_release = system_distro_info.devel()
|
||||
except DistroDataOutdated, e:
|
||||
Logger.warn(e)
|
||||
default_release = 'unstable'
|
||||
|
||||
parser = optparse.OptionParser('%prog [options] package',
|
||||
description="List reverse-dependencies of package. "
|
||||
"If the package name is prefixed with src: then the "
|
||||
"reverse-dependencies of all the binary packages that "
|
||||
"the specified source package builds will be listed.")
|
||||
parser.add_option('-r', '--release', metavar='RELEASE',
|
||||
default=system_distro_info.devel(),
|
||||
default=default_release,
|
||||
help='Query dependencies in RELEASE. '
|
||||
'Default: %s' % system_distro_info.devel())
|
||||
'Default: %s' % default_release)
|
||||
parser.add_option('-R', '--without-recommends',
|
||||
action='store_false', dest='recommends', default=True,
|
||||
help='Only consider Depends relationships, '
|
||||
@ -76,8 +83,12 @@ def main():
|
||||
if not distribution:
|
||||
parser.error('Unknown release codename %s' % options.release)
|
||||
distro_info = vendor_to_distroinfo(distribution)()
|
||||
options.release = distro_info.codename(options.release,
|
||||
default=options.release)
|
||||
try:
|
||||
options.release = distro_info.codename(options.release,
|
||||
default=options.release)
|
||||
except DistroDataOutdated:
|
||||
# We already printed a warning
|
||||
pass
|
||||
|
||||
try:
|
||||
data = query_rdepends(package, options.release, options.arch, **opts)
|
||||
|
@ -29,7 +29,7 @@ import shutil
|
||||
import sys
|
||||
from tempfile import mkdtemp
|
||||
|
||||
from distro_info import UbuntuDistroInfo
|
||||
from distro_info import UbuntuDistroInfo, DistroDataOutdated
|
||||
|
||||
from ubuntutools.config import ubu_email
|
||||
from ubuntutools.question import YesNoQuestion, EditFile
|
||||
@ -119,7 +119,11 @@ def check_file(fname, critical = True):
|
||||
sys.exit(1)
|
||||
|
||||
def submit_bugreport(body, debdiff, deb_version, changelog):
|
||||
devel = UbuntuDistroInfo().devel()
|
||||
try:
|
||||
devel = UbuntuDistroInfo().devel()
|
||||
except DistroDataOutdated, e:
|
||||
print str(e)
|
||||
devel = ''
|
||||
|
||||
if os.path.dirname(sys.argv[0]).startswith('/usr/bin'):
|
||||
editor_path = '/usr/share/ubuntu-dev-tools'
|
||||
|
12
syncpackage
12
syncpackage
@ -31,7 +31,7 @@ import urllib
|
||||
|
||||
import debian.debian_support
|
||||
from devscripts.logger import Logger
|
||||
from distro_info import UbuntuDistroInfo
|
||||
from distro_info import UbuntuDistroInfo, DistroDataOutdated
|
||||
from lazr.restfulclient.errors import HTTPError
|
||||
|
||||
from ubuntutools.archive import (DebianSourcePackage, UbuntuSourcePackage,
|
||||
@ -294,7 +294,15 @@ def fetch_source_pkg(package, dist, version, component, ubuntu_release,
|
||||
|
||||
if dist is None:
|
||||
ubu_info = UbuntuDistroInfo()
|
||||
dist = 'testing' if ubu_info.is_lts(ubu_info.devel()) else 'unstable'
|
||||
try:
|
||||
if ubu_info.is_lts(ubu_info.devel()):
|
||||
dist = 'testing'
|
||||
else:
|
||||
dist = 'unstable'
|
||||
except DistroDataOutdated, e:
|
||||
Logger.warn(e)
|
||||
dist = 'unstable'
|
||||
|
||||
requested_version = version
|
||||
if type(version) == str:
|
||||
version = Version(version)
|
||||
|
@ -24,7 +24,7 @@ import re
|
||||
|
||||
from debian.deb822 import Changes
|
||||
from devscripts.logger import Logger
|
||||
from distro_info import DebianDistroInfo
|
||||
from distro_info import DebianDistroInfo, DistroDataOutdated
|
||||
from httplib2 import Http, HttpLib2Error
|
||||
|
||||
from ubuntutools.lp.lpapicache import (Launchpad, Distribution, PersonTeam,
|
||||
@ -35,7 +35,10 @@ def get_debian_srcpkg(name, release):
|
||||
debian = Distribution('debian')
|
||||
debian_archive = debian.getArchive()
|
||||
|
||||
release = DebianDistroInfo().codename(release, None, release)
|
||||
try:
|
||||
release = DebianDistroInfo().codename(release, None, release)
|
||||
except DistroDataOutdated, e:
|
||||
Logger.warn(e)
|
||||
|
||||
return debian_archive.getSourcePackage(name, release)
|
||||
|
||||
|
@ -29,7 +29,7 @@ import tempfile
|
||||
|
||||
from debian.changelog import Changelog, Version
|
||||
from devscripts.logger import Logger
|
||||
from distro_info import DebianDistroInfo
|
||||
from distro_info import DebianDistroInfo, DistroDataOutdated
|
||||
|
||||
from ubuntutools.archive import rmadison, FakeSPPH
|
||||
from ubuntutools.question import confirmation_prompt, YesNoQuestion
|
||||
@ -49,7 +49,10 @@ def _get_srcpkg(distro, name, release):
|
||||
if distro == 'debian':
|
||||
# Canonicalise release:
|
||||
debian_info = DebianDistroInfo()
|
||||
release = debian_info.codename(release, default=release)
|
||||
try:
|
||||
release = debian_info.codename(release, default=release)
|
||||
except DistroDataOutdated, e:
|
||||
Logger.warn(e)
|
||||
|
||||
lines = list(rmadison(distro, name, suite=release, arch='source'))
|
||||
if not lines:
|
||||
|
Loading…
x
Reference in New Issue
Block a user