Merge lp:~jelmer/bzr-builddeb/opt-distro-info into lp:bzr-builddeb

Proposed by Jelmer Vernooij
Status: Merged
Merged at revision: 712
Proposed branch: lp:~jelmer/bzr-builddeb/opt-distro-info
Merge into: lp:bzr-builddeb
Diff against target: 111 lines (+39/-14)
3 files modified
debian/changelog (+3/-1)
debian/control (+2/-2)
util.py (+34/-11)
To merge this branch: bzr merge lp:~jelmer/bzr-builddeb/opt-distro-info
Reviewer Review Type Date Requested Status
Bzr-builddeb-hackers Pending
Review via email: mp+91063@code.launchpad.net

Description of the change

Drop python-distro-info from a hard dependency to a recommendation.

This makes porting a bit easier, since distro-info isn't available on e.g. lucid.

This change also defers the import, so that most operations that involved bzr-builddeb don't have to import distro_info and parse the relevant files.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2012-01-30 13:38:04 +0000
+++ debian/changelog 2012-02-01 12:38:21 +0000
@@ -1,8 +1,10 @@
1bzr-builddeb (2.8.3) UNRELEASED; urgency=low1bzr-builddeb (2.8.3) UNRELEASED; urgency=low
22
3 * Fix patch unapplying from DirStateRevisionTrees. LP: #9236883 * Fix patch unapplying from DirStateRevisionTrees. LP: #923688
4 * Bump distro-info dependency back to a recommends, to ease
5 backporting.
46
5 -- Jelmer Vernooij <jelmer@debian.org> Mon, 30 Jan 2012 14:37:51 +01007 -- Jelmer Vernooij <jelmer@debian.org> Wed, 01 Feb 2012 13:20:49 +0100
68
7bzr-builddeb (2.8.2) unstable; urgency=low9bzr-builddeb (2.8.2) unstable; urgency=low
810
911
=== modified file 'debian/control'
--- debian/control 2012-01-16 02:08:24 +0000
+++ debian/control 2012-02-01 12:38:21 +0000
@@ -12,8 +12,8 @@
1212
13Package: bzr-builddeb13Package: bzr-builddeb
14Architecture: all14Architecture: all
15Depends: bzr (>= 2.1~), python-debian (>= 0.1.11), python-apt, ${python:Depends}, dpkg-dev, fakeroot, devscripts (>= 2.10.59), patchutils, pristine-tar, ${misc:Depends}, python-distro-info15Depends: bzr (>= 2.1~), python-debian (>= 0.1.11), python-apt, ${python:Depends}, dpkg-dev, fakeroot, devscripts (>= 2.10.59), patchutils, pristine-tar, ${misc:Depends}
16Recommends: python-launchpadlib, libalgorithm-merge-perl16Recommends: python-launchpadlib, libalgorithm-merge-perl, python-distro-info
17Suggests: bzr-svn (>= 0.4.10), python-lzma17Suggests: bzr-svn (>= 0.4.10), python-lzma
18Provides: bzr-buildpackage18Provides: bzr-buildpackage
19Description: bzr plugin for Debian package management19Description: bzr plugin for Debian package management
2020
=== modified file 'util.py'
--- util.py 2012-01-05 16:09:21 +0000
+++ util.py 2012-02-01 12:38:21 +0000
@@ -29,8 +29,6 @@
29import os29import os
30import re30import re
3131
32from distro_info import DebianDistroInfo, UbuntuDistroInfo
33
34from bzrlib.trace import mutter32from bzrlib.trace import mutter
3533
36try:34try:
@@ -76,11 +74,36 @@
76 UnparseableChangelog,74 UnparseableChangelog,
77 )75 )
7876
7977_DEBIAN_RELEASES = None
80DEBIAN_RELEASES = DebianDistroInfo().all78_UBUNTU_RELEASES = None
81DEBIAN_RELEASES.extend(['stable', 'testing', 'unstable', 'frozen'])79
80def _get_release_names():
81 try:
82 from distro_info import DebianDistroInfo, UbuntuDistroInfo
83 except ImportError:
84 warning("distro_info not available. Unable to retrieve current "
85 "list of releases.")
86 _DEBIAN_RELEASES = []
87 _UBUNTU_RELEASES = []
88 else:
89 # distro info is not available
90 _DEBIAN_RELEASES = DebianDistroInfo().all
91 _UBUNTU_RELEASES = UbuntuDistroInfo().all
92
93 _DEBIAN_RELEASES.extend(['stable', 'testing', 'unstable', 'frozen'])
94
95
96def debian_releases():
97 if _DEBIAN_RELEASES is None:
98 _get_release_names()
99 return _DEBIAN_RELEASES
100
101def ubuntu_releases():
102 if _UBUNTU_RELEASES is None:
103 _get_release_names()
104 return _UBUNTU_RELEASES
105
82DEBIAN_POCKETS = ('', '-security', '-proposed-updates', '-backports')106DEBIAN_POCKETS = ('', '-security', '-proposed-updates', '-backports')
83UBUNTU_RELEASES = UbuntuDistroInfo().all
84UBUNTU_POCKETS = ('', '-proposed', '-updates', '-security', '-backports')107UBUNTU_POCKETS = ('', '-proposed', '-updates', '-security', '-backports')
85108
86109
@@ -246,8 +269,8 @@
246 :return: "debian", "ubuntu", or None if the distribution couldn't be269 :return: "debian", "ubuntu", or None if the distribution couldn't be
247 inferred.270 inferred.
248 """271 """
249 all_debian = [r + t for r in DEBIAN_RELEASES for t in DEBIAN_POCKETS]272 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_ubuntu = [r + t for r in ubuntu_releases() for t in UBUNTU_POCKETS]
251 if suite in all_debian:274 if suite in all_debian:
252 return "debian"275 return "debian"
253 if suite in all_ubuntu:276 if suite in all_ubuntu:
@@ -616,12 +639,12 @@
616 :raise NoPreviousUpload: Raised when there is no previous upload639 :raise NoPreviousUpload: Raised when there is no previous upload
617 """640 """
618 current_target = find_last_distribution(cl)641 current_target = find_last_distribution(cl)
619 all_debian = [r + t for r in DEBIAN_RELEASES for t in DEBIAN_POCKETS]642 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_ubuntu = [r + t for r in ubuntu_releases() for t in UBUNTU_POCKETS]
621 if current_target in all_debian:644 if current_target in all_debian:
622 match_targets = (current_target,)645 match_targets = (current_target,)
623 elif current_target in all_ubuntu:646 elif current_target in all_ubuntu:
624 match_targets = UBUNTU_RELEASES647 match_targets = ubuntu_releases()
625 if "-" in current_target:648 if "-" in current_target:
626 match_targets += tuple([current_target.split("-", 1)[0]649 match_targets += tuple([current_target.split("-", 1)[0]
627 + t for t in UBUNTU_POCKETS])650 + t for t in UBUNTU_POCKETS])

Subscribers

People subscribed via source and target branches