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