~ubuntu-branches/ubuntu/utopic/bzr-builddeb/utopic

« back to all changes in this revision

Viewing changes to util.py

  • Committer: Package Import Robot
  • Author(s): Jelmer Vernooij
  • Date: 2012-03-03 20:47:07 UTC
  • Revision ID: package-import@ubuntu.com-20120303204707-1whi10434eiscaey
Tags: 2.8.3
* Fix patch unapplying from DirStateRevisionTrees. LP: #923688
* Bump distro-info dependency back to a recommends, to ease
  backporting.
* Cope with the deprecation of Tree.inventory in bzr/2.6. LP: #934247
* Generate xz files with the 'xz' utility rather than the Python
  'lzma' module, as the latter uses options not supported by pristine-
  xz. Closes: #660721
* Merge fix from Joel Pickett to fix typo in orig-dir option help
  description. LP: #945413
* Bump standards version to 3.9.3 (no changes).

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
import os
30
30
import re
31
31
 
32
 
from distro_info import DebianDistroInfo, UbuntuDistroInfo
33
 
 
34
32
from bzrlib.trace import mutter
35
33
 
36
34
try:
76
74
    UnparseableChangelog,
77
75
    )
78
76
 
79
 
 
80
 
DEBIAN_RELEASES = DebianDistroInfo().all
81
 
DEBIAN_RELEASES.extend(['stable', 'testing', 'unstable', 'frozen'])
 
77
_DEBIAN_RELEASES = None
 
78
_UBUNTU_RELEASES = None
 
79
 
 
80
def _get_release_names():
 
81
    global _DEBIAN_RELEASES, _UBUNTU_RELEASES
 
82
    try:
 
83
        from distro_info import DebianDistroInfo, UbuntuDistroInfo
 
84
    except ImportError:
 
85
        warning("distro_info not available. Unable to retrieve current "
 
86
            "list of releases.")
 
87
        _DEBIAN_RELEASES = []
 
88
        _UBUNTU_RELEASES = []
 
89
    else:
 
90
        # distro info is not available
 
91
        _DEBIAN_RELEASES = DebianDistroInfo().all
 
92
        _UBUNTU_RELEASES = UbuntuDistroInfo().all
 
93
 
 
94
    _DEBIAN_RELEASES.extend(['stable', 'testing', 'unstable', 'frozen'])
 
95
 
 
96
 
 
97
def debian_releases():
 
98
    if _DEBIAN_RELEASES is None:
 
99
        _get_release_names()
 
100
    return _DEBIAN_RELEASES
 
101
 
 
102
def ubuntu_releases():
 
103
    if _UBUNTU_RELEASES is None:
 
104
        _get_release_names()
 
105
    return _UBUNTU_RELEASES
 
106
 
82
107
DEBIAN_POCKETS = ('', '-security', '-proposed-updates', '-backports')
83
 
UBUNTU_RELEASES = UbuntuDistroInfo().all
84
108
UBUNTU_POCKETS = ('', '-proposed', '-updates', '-security', '-backports')
85
109
 
86
110
 
246
270
    :return: "debian", "ubuntu", or None if the distribution couldn't be
247
271
        inferred.
248
272
    """
249
 
    all_debian = [r + t for r in DEBIAN_RELEASES for t in DEBIAN_POCKETS]
250
 
    all_ubuntu = [r + t for r in UBUNTU_RELEASES for t in UBUNTU_POCKETS]
 
273
    all_debian = [r + t for r in debian_releases() for t in DEBIAN_POCKETS]
 
274
    all_ubuntu = [r + t for r in ubuntu_releases() for t in UBUNTU_POCKETS]
251
275
    if suite in all_debian:
252
276
        return "debian"
253
277
    if suite in all_ubuntu:
616
640
    :raise NoPreviousUpload: Raised when there is no previous upload
617
641
    """
618
642
    current_target = find_last_distribution(cl)
619
 
    all_debian = [r + t for r in DEBIAN_RELEASES for t in DEBIAN_POCKETS]
620
 
    all_ubuntu = [r + t for r in UBUNTU_RELEASES for t in UBUNTU_POCKETS]
 
643
    all_debian = [r + t for r in debian_releases() for t in DEBIAN_POCKETS]
 
644
    all_ubuntu = [r + t for r in ubuntu_releases() for t in UBUNTU_POCKETS]
621
645
    if current_target in all_debian:
622
646
        match_targets = (current_target,)
623
647
    elif current_target in all_ubuntu:
624
 
        match_targets = UBUNTU_RELEASES
 
648
        match_targets = ubuntu_releases()
625
649
        if "-" in current_target:
626
650
            match_targets += tuple([current_target.split("-", 1)[0]
627
651
                + t for t in UBUNTU_POCKETS])