mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-04-22 07:41:08 +00:00
Use new ubuntutools.distro_info in various scripts.
This commit is contained in:
parent
3b97f4f3e5
commit
1a8951e82d
3
debian/changelog
vendored
3
debian/changelog
vendored
@ -1,8 +1,9 @@
|
||||
ubuntu-dev-tools (0.113) UNRELEASED; urgency=low
|
||||
|
||||
* debian-distro-info, distro-info, ubuntu-distro-info: New tools.
|
||||
* Use new ubuntutools.distro_info in various scripts.
|
||||
|
||||
-- Benjamin Drung <bdrung@debian.org> Fri, 21 Jan 2011 18:22:23 +0100
|
||||
-- Benjamin Drung <bdrung@debian.org> Fri, 21 Jan 2011 19:19:01 +0100
|
||||
|
||||
ubuntu-dev-tools (0.112) unstable; urgency=low
|
||||
|
||||
|
@ -33,11 +33,9 @@ import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from ubuntutools.distro_info import DebianDistroInfo
|
||||
import ubuntutools.misc
|
||||
|
||||
DEBIAN_DISTROS = ['etch', 'lenny', 'squeeze', 'sid', 'stable', 'testing',
|
||||
'unstable', 'experimental']
|
||||
|
||||
class PbuilderDist:
|
||||
def __init__(self, builder):
|
||||
# Base directory where pbuilder will put all the files it creates.
|
||||
@ -76,6 +74,10 @@ class PbuilderDist:
|
||||
# Builder
|
||||
self.builder = builder
|
||||
|
||||
self._debian_distros = DebianDistroInfo().all + \
|
||||
['stable', 'testing', 'unstable', 'experimental']
|
||||
|
||||
|
||||
# Ensure that the used builder is installed
|
||||
paths = set(os.environ['PATH'].split(':'))
|
||||
paths |= set(('/sbin', '/usr/sbin', '/usr/local/sbin'))
|
||||
@ -133,7 +135,7 @@ class PbuilderDist:
|
||||
if os.path.isdir('/usr/share/debootstrap/scripts/'):
|
||||
# Debian experimental doesn't have a debootstrap file but
|
||||
# should work nevertheless.
|
||||
if distro not in DEBIAN_DISTROS:
|
||||
if distro not in self._debian_distros:
|
||||
answer = ask(('Warning: Unknown distribution "%s". Do you '
|
||||
'want to continue [y/N]? ') % distro)
|
||||
if answer not in ('y', 'Y'):
|
||||
@ -235,7 +237,7 @@ class PbuilderDist:
|
||||
'deb file:///var/cache/archive/ %s/' % self.target_distro,
|
||||
]
|
||||
|
||||
if self.target_distro in DEBIAN_DISTROS:
|
||||
if self.target_distro in self._debian_distros:
|
||||
arguments += ['--mirror', 'http://ftp.debian.org/debian']
|
||||
components = 'main'
|
||||
if self.extra_components:
|
||||
@ -255,7 +257,7 @@ class PbuilderDist:
|
||||
|
||||
# Work around LP:#599695
|
||||
if (ubuntutools.misc.system_distribution() == 'Debian'
|
||||
and self.target_distro not in DEBIAN_DISTROS):
|
||||
and self.target_distro not in self._debian_distros):
|
||||
if not os.path.exists(
|
||||
'/usr/share/keyrings/ubuntu-archive-keyring.gpg'):
|
||||
print >> sys.stderr, 'Error: ubuntu-keyring not installed'
|
||||
@ -265,7 +267,7 @@ class PbuilderDist:
|
||||
'--keyring=/usr/share/keyrings/ubuntu-archive-keyring.gpg',
|
||||
]
|
||||
elif (ubuntutools.misc.system_distribution() == 'Ubuntu'
|
||||
and self.target_distro in DEBIAN_DISTROS):
|
||||
and self.target_distro in self._debian_distros):
|
||||
if not os.path.exists(
|
||||
'/usr/share/keyrings/debian-archive-keyring.gpg'):
|
||||
print >> sys.stderr, ('Error: debian-archive-keyring not '
|
||||
|
@ -33,6 +33,7 @@ import sys
|
||||
from debian.changelog import Version
|
||||
|
||||
from ubuntutools.config import UDTConfig, ubu_email
|
||||
from ubuntutools.distro_info import UbuntuDistroInfo
|
||||
from ubuntutools.lp import udtexceptions
|
||||
from ubuntutools.requestsync.common import (edit_report, getDebianChangelog,
|
||||
raw_input_exit_on_ctrlc)
|
||||
@ -145,7 +146,7 @@ def main():
|
||||
if lpapi:
|
||||
release = Distribution('ubuntu').getDevelopmentSeries().name
|
||||
else:
|
||||
release = 'natty'
|
||||
release = UbuntuDistroInfo().devel()
|
||||
print >> sys.stderr, 'W: Target release missing - assuming %s' % release
|
||||
elif len(args) == 2:
|
||||
release = args[1]
|
||||
|
@ -25,6 +25,8 @@
|
||||
import re, os, sys
|
||||
from tempfile import mkstemp
|
||||
|
||||
from ubuntutools.distro_info import UbuntuDistroInfo
|
||||
|
||||
try:
|
||||
from debian.changelog import Changelog
|
||||
except ImportError:
|
||||
@ -106,9 +108,10 @@ def edit_debdiff(debdiff):
|
||||
|
||||
def submit_bugreport(body, debdiff, deb_version, changelog):
|
||||
cmd = ('reportbug -P "User: ubuntu-devel@lists.ubuntu.com" '
|
||||
'-P "Usertags: origin-ubuntu natty ubuntu-patch" -T patch -A %s '
|
||||
'-P "Usertags: origin-ubuntu %s ubuntu-patch" -T patch -A %s '
|
||||
'-B debian -i %s -V %s %s') % \
|
||||
(debdiff, body, deb_version, changelog.package)
|
||||
(UbuntuDistroInfo().devel(), debdiff, body, deb_version,
|
||||
changelog.package)
|
||||
run_cmd(cmd)
|
||||
|
||||
def run_cmd(cmd):
|
||||
|
@ -113,6 +113,20 @@ class DebianDistroInfo(DistroInfo):
|
||||
def __init__(self):
|
||||
super(DebianDistroInfo, self).__init__("debian")
|
||||
|
||||
def codename(self, release, date=None, default=None):
|
||||
"""Map 'unstable', 'testing', etc. to their codenames."""
|
||||
if release == "unstable":
|
||||
codename = self.devel(date)
|
||||
elif release == "testing":
|
||||
codename = self.testing(date)
|
||||
elif release == "stable":
|
||||
codename = self.stable(date)
|
||||
elif release == "old":
|
||||
codename = self.old(date)
|
||||
else:
|
||||
codename = default
|
||||
return codename
|
||||
|
||||
def old(self, date=None):
|
||||
"""Get old (stable) Debian distribution based on the given date."""
|
||||
if date is None:
|
||||
|
@ -20,6 +20,7 @@
|
||||
# Please see the /usr/share/common-licenses/GPL-2 file for the full text
|
||||
# of the GNU General Public License license.
|
||||
|
||||
from ubuntutools.distro_info import DebianDistroInfo
|
||||
from ubuntutools.requestsync.common import raw_input_exit_on_ctrlc
|
||||
from ubuntutools.lp.lpapicache import (Launchpad, Distribution, PersonTeam,
|
||||
DistributionSourcePackage)
|
||||
@ -29,12 +30,7 @@ def getDebianSrcPkg(name, release):
|
||||
debian = Distribution('debian')
|
||||
debian_archive = debian.getArchive()
|
||||
|
||||
# Map 'unstable' and 'testing' to their codenames as LP knows only them
|
||||
codenames = {
|
||||
'unstable': 'sid',
|
||||
'testing': 'squeeze', # Needs updating after each Debian release
|
||||
}
|
||||
release = codenames.get(release, release)
|
||||
release = DebianDistroInfo().codenames(release, None, release)
|
||||
|
||||
return debian_archive.getSourcePackage(name, release)
|
||||
|
||||
|
@ -21,6 +21,7 @@ import urllib
|
||||
|
||||
import debian.debian_support
|
||||
|
||||
from ubuntutools.distro_info import DebianDistroInfo
|
||||
from ubuntutools.logger import Logger
|
||||
|
||||
class BugTask(object):
|
||||
@ -96,10 +97,9 @@ class BugTask(object):
|
||||
if "experimental" in title:
|
||||
series = "experimental"
|
||||
elif "testing" in title:
|
||||
# TODO: Do not hard code series!
|
||||
series = "squeeze"
|
||||
series = DebianDistroInfo().testing()
|
||||
else:
|
||||
series = "sid"
|
||||
series = DebianDistroInfo().devel()
|
||||
status = "Pending"
|
||||
else:
|
||||
project = self.project
|
||||
|
Loading…
x
Reference in New Issue
Block a user