4
4
warnings.filterwarnings("ignore", "apt API not stable yet", FutureWarning)
7
from DistUpgrade.DistUpgradeVersion import VERSION
7
9
from UpdateManager.Core.MetaRelease import MetaReleaseCore
8
10
from UpdateManager.Core.DistUpgradeFetcherCore import DistUpgradeFetcherCore
9
11
from optparse import OptionParser
10
12
from gettext import gettext as _
14
18
from DistUpgrade.utils import init_proxy
21
NO_RELEASE_AVAILABLE=1
16
23
if __name__ == "__main__":
27
# when run as "check-new-release" we go into "check only" mode
28
check_only = sys.argv[0].endswith("check-new-release")
20
30
parser = OptionParser()
31
parser.add_option ("-V", "--version", action="store_true",
32
dest="show_version", default=False,
33
help=_("Show version and exit"))
21
34
parser.add_option ("-d", "--devel-release", action="store_true",
22
35
dest="devel_release", default=False,
23
36
help=_("Check if upgrading to the latest devel release "
37
50
help=_("Run the specified frontend"))
38
51
parser.add_option ("-s","--sandbox", action="store_true", default=False,
39
52
help=_("Test upgrade with a sandbox aufs overlay"))
53
parser.add_option ("-c", "--check-dist-upgrade-only", action="store_true",
55
help=_("Check only if a new distribution release is "
56
"available and report the result via the "
58
parser.add_option ("-q", "--quiet", default=False, action="store_true",
41
61
(options, args) = parser.parse_args()
43
print _("Checking for a new ubuntu release")
64
if options.show_version:
65
print "%s: version %s" % (os.path.basename(sys.argv[0]), VERSION)
69
print _("Checking for a new ubuntu release")
44
71
m = MetaReleaseCore(useDevelopmentRelease=options.devel_release,
45
72
useProposed=options.proposed_release)
46
73
# this will timeout eventually
47
74
while m.downloading:
49
77
if m.new_dist is None:
50
print _("No new release found")
79
print _("No new release found")
80
sys.exit(NO_RELEASE_AVAILABLE)
52
82
# we have a new dist
83
if options.check_dist_upgrade_only:
85
print _("New release '%s' available.") % m.new_dist.name
86
print _("Run 'do-release-upgrade' to upgrade to it.")
87
sys.exit(RELEASE_AVAILABLE)
53
89
progress = apt.progress.TextFetchProgress()
54
90
fetcher = DistUpgradeFetcherCore(new_dist=m.new_dist,