454
by Michael Vogt
* do-release-upgrade: |
1 |
#!/usr/bin/python
|
2 |
||
3 |
import warnings |
|
4 |
warnings.filterwarnings("ignore", "apt API not stable yet", FutureWarning) |
|
5 |
import apt |
|
6 |
||
455
by Michael Vogt
* split the package into update-manager and update-manager-core |
7 |
from UpdateManager.Core.MetaRelease import MetaReleaseCore |
8 |
from UpdateManager.Core.DistUpgradeFetcherCore import DistUpgradeFetcherCore |
|
454
by Michael Vogt
* do-release-upgrade: |
9 |
from optparse import OptionParser |
10 |
from gettext import gettext as _ |
|
11 |
import time |
|
12 |
import sys |
|
1009
by Michael Vogt
* do-release-upgrade: |
13 |
import urllib2 |
14 |
from DistUpgrade.utils import init_proxy |
|
454
by Michael Vogt
* do-release-upgrade: |
15 |
|
16 |
if __name__ == "__main__": |
|
17 |
||
1009
by Michael Vogt
* do-release-upgrade: |
18 |
init_proxy() |
19 |
||
454
by Michael Vogt
* do-release-upgrade: |
20 |
parser = OptionParser() |
21 |
parser.add_option ("-d", "--devel-release", action="store_true", |
|
22 |
dest="devel_release", default=False, |
|
23 |
help=_("Check if upgrading to the latest devel release " |
|
24 |
"is possible")) |
|
805
by Michael Vogt
* add --proposed to the options for do-release-upgrade |
25 |
parser.add_option ("-p", "--proposed", action="store_true", |
26 |
dest="proposed_release", default=False, |
|
27 |
help=_("Try upgrading to the latest release using " |
|
28 |
"the upgrader from $distro-proposed")) |
|
29 |
parser.add_option ("-m", "--mode", default="server", |
|
30 |
dest="mode", |
|
31 |
help=_("Run in a special upgrade mode.\n" |
|
32 |
"Currently 'desktop' for regular upgrades of "
|
|
33 |
"a desktop system and 'server' for server "
|
|
34 |
"systems are supported.")) |
|
507
by Michael Vogt
* do-release-upgrade: |
35 |
parser.add_option ("-f", "--frontend", default="DistUpgradeViewText", |
36 |
dest="frontend", |
|
37 |
help=_("Run the specified frontend")) |
|
38 |
||
454
by Michael Vogt
* do-release-upgrade: |
39 |
(options, args) = parser.parse_args() |
40 |
||
41 |
print _("Checking for a new ubuntu release") |
|
805
by Michael Vogt
* add --proposed to the options for do-release-upgrade |
42 |
m = MetaReleaseCore(useDevelopmentRelease=options.devel_release, |
43 |
useProposed=options.proposed_release) |
|
454
by Michael Vogt
* do-release-upgrade: |
44 |
# this will timeout eventually
|
45 |
while m.downloading: |
|
46 |
time.sleep(0.5) |
|
47 |
if m.new_dist is None: |
|
48 |
print _("No new release found") |
|
49 |
sys.exit(1) |
|
50 |
# we have a new dist
|
|
51 |
progress = apt.progress.TextFetchProgress() |
|
52 |
fetcher = DistUpgradeFetcherCore(new_dist=m.new_dist, |
|
455
by Michael Vogt
* split the package into update-manager and update-manager-core |
53 |
progress=progress) |
510
by Michael Vogt
- added option --frontend, --mode |
54 |
fetcher.run_options += ["--mode=%s" % options.mode, |
507
by Michael Vogt
* do-release-upgrade: |
55 |
"--frontend=%s" % options.frontend, |
455
by Michael Vogt
* split the package into update-manager and update-manager-core |
56 |
]
|
454
by Michael Vogt
* do-release-upgrade: |
57 |
fetcher.run() |