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