Merge lp:~ubuntu-core-dev/ubuntu-release-upgrader/split into lp:ubuntu-release-upgrader
- split
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 2509 |
Proposed branch: | lp:~ubuntu-core-dev/ubuntu-release-upgrader/split |
Merge into: | lp:ubuntu-release-upgrader |
Diff against target: |
257419 lines (+61554/-117564) 254 files modified
BUGS (+0/-5) ChangeLog (+0/-62) DistUpgrade/DistUpgradeApport.py (+4/-4) DistUpgrade/DistUpgradeCache.py (+3/-3) DistUpgrade/DistUpgradeConfigParser.py (+1/-1) DistUpgrade/DistUpgradeController.py (+19/-19) DistUpgrade/DistUpgradeFetcherCore.py (+3/-3) DistUpgrade/DistUpgradeQuirks.py (+1/-1) DistUpgrade/DistUpgradeView.py (+1/-1) DistUpgrade/DistUpgradeViewGtk.py (+3/-3) DistUpgrade/DistUpgradeViewGtk3.py (+3/-3) DistUpgrade/DistUpgradeViewKDE.py (+7/-7) DistUpgrade/DistUpgradeViewText.py (+4/-4) DistUpgrade/SimpleGtk3builderApp.py (+61/-0) DistUpgrade/SimpleGtkbuilderApp.py (+61/-0) DistUpgrade/TODO (+2/-2) DistUpgrade/build-tarball.sh (+2/-2) DistUpgrade/crashdialog.ui (+1/-1) DistUpgrade/removal_blacklist.cfg (+2/-1) DistUpgrade/xorg_fix_proprietary.py (+4/-4) LGPL (+0/-510) README (+0/-18) TODO (+0/-22) UpdateManager/ChangelogViewer.py (+0/-283) UpdateManager/Core/AlertWatcher.py (+0/-96) UpdateManager/Core/DistUpgradeFetcherCore.py (+0/-313) UpdateManager/Core/MetaRelease.py (+0/-350) UpdateManager/Core/MyCache.py (+0/-366) UpdateManager/Core/UpdateList.py (+0/-102) UpdateManager/Core/roam.py (+0/-205) UpdateManager/Core/utils.py (+0/-510) UpdateManager/Dialogs.py (+0/-235) UpdateManager/DistUpgradeFetcher.py (+0/-143) UpdateManager/DistUpgradeFetcherKDE.py (+0/-188) UpdateManager/GtkProgress.py (+0/-89) UpdateManager/HelpViewer.py (+0/-33) UpdateManager/InstallProgress.py (+0/-93) UpdateManager/MetaReleaseGObject.py (+0/-57) UpdateManager/ReleaseNotesViewer.py (+0/-186) UpdateManager/ReleaseNotesViewerWebkit.py (+0/-54) UpdateManager/SimpleGtk3builderApp.py (+0/-61) UpdateManager/SimpleGtkbuilderApp.py (+0/-61) UpdateManager/UnitySupport.py (+0/-94) UpdateManager/UpdateManager.py (+0/-335) UpdateManager/UpdateProgress.py (+0/-80) UpdateManager/UpdatesAvailable.py (+0/-713) UpdateManager/__init__.py (+0/-1) UpdateManager/backend/InstallBackendAptdaemon.py (+0/-230) UpdateManager/backend/InstallBackendSynaptic.py (+0/-73) UpdateManager/backend/__init__.py (+0/-63) UpdateManager/check-meta-release.py (+0/-32) UpdateManager/dialog_release_notes.ui (+0/-70) UpdateManager/fetch-progress.ui (+0/-106) UpdateManagerText/UpdateManagerText.py (+0/-191) check-new-release-gtk (+6/-6) data/Makefile (+1/-1) data/com.ubuntu.update-manager.gschema.xml.in (+0/-54) data/gtkbuilder/UpdateManager.ui (+0/-504) data/icons/scalable/apps/system-software-update.svg (+0/-1519) data/update-manager.8 (+0/-78) data/update-manager.convert (+0/-9) data/update-manager.desktop.in (+0/-10) debian/91-release-upgrade (+2/-2) debian/changelog (+6/-0) debian/compat (+1/-1) debian/control (+42/-78) debian/copyright (+25/-22) debian/python-update-manager.install (+0/-6) debian/python3-dist-upgrade.install (+1/-0) debian/python3-update-manager.install (+0/-6) debian/release-upgrade-motd (+3/-3) debian/rules (+1/-2) debian/source/format (+1/-0) debian/source_ubuntu-release-upgrader.py (+20/-33) debian/ubuntu-release-upgrader-core.dirs (+1/-1) debian/ubuntu-release-upgrader-core.install (+3/-4) debian/ubuntu-release-upgrader-core.links (+1/-1) debian/ubuntu-release-upgrader-core.postinst (+1/-1) debian/ubuntu-release-upgrader-core.preinst (+1/-1) debian/ubuntu-release-upgrader-gtk.install (+2/-0) debian/ubuntu-release-upgrader-qt.install (+1/-0) debian/update-manager-kde.install (+0/-4) debian/update-manager-text.install (+0/-2) debian/update-manager.install (+0/-19) debian/update-manager.manpages (+0/-1) do-release-upgrade (+3/-3) help/C/Makefile.am (+0/-7) help/C/fdl-appendix.xml (+0/-655) help/C/legal.xml (+0/-76) help/C/update-manager-C.omf (+0/-18) help/C/update-manager.xml (+0/-1023) janitor/__init__.py (+0/-24) janitor/plugincore/NEWS.rst (+0/-7) janitor/plugincore/__init__.py (+0/-17) janitor/plugincore/core/file_cruft.py (+0/-53) janitor/plugincore/core/missing_package_cruft.py (+0/-52) janitor/plugincore/core/package_cruft.py (+0/-61) janitor/plugincore/cruft.py (+0/-159) janitor/plugincore/docs/README.rst (+0/-201) janitor/plugincore/exceptions.py (+0/-42) janitor/plugincore/i18n.py (+0/-34) janitor/plugincore/manager.py (+0/-185) janitor/plugincore/plugin.py (+0/-81) janitor/plugincore/plugins/deb_plugin.py (+0/-42) janitor/plugincore/plugins/dpkg_status_plugin.py (+0/-80) janitor/plugincore/plugins/kdelibs4to5_plugin.py (+0/-51) janitor/plugincore/plugins/langpack_manual_plugin.py (+0/-76) janitor/plugincore/plugins/remove_lilo_plugin.py (+0/-54) janitor/plugincore/testing/helpers.py (+0/-68) janitor/plugincore/tests/data/alpha_plugin.py (+0/-48) janitor/plugincore/tests/data/bravo_plugin.py (+0/-48) janitor/plugincore/tests/data/charlie_plugin.py (+0/-48) janitor/plugincore/tests/test_deb_plugin.py (+0/-44) janitor/plugincore/tests/test_documentation.py (+0/-93) janitor/plugincore/tests/test_dpkg_status_plugin.py (+0/-45) janitor/plugincore/tests/test_file_cruft.py (+0/-81) janitor/plugincore/tests/test_manager.py (+0/-171) janitor/plugincore/tests/test_missing_package_cruft.py (+0/-62) janitor/plugincore/tests/test_package_cruft.py (+0/-62) po/Makefile (+1/-1) po/POTFILES.in (+0/-53) po/af.po (+362/-876) po/am.po (+436/-878) po/an.po (+217/-865) po/ar.po (+774/-942) po/ast.po (+786/-952) po/az.po (+312/-868) po/be.po (+722/-947) po/bg.po (+712/-947) po/bn.po (+802/-970) po/bo.po (+618/-923) po/br.po (+590/-935) po/bs.po (+794/-951) po/ca.po (+796/-958) po/ca@valencia.po (+721/-956) po/ceb.po (+215/-866) po/ckb.po (+215/-866) po/crh.po (+686/-988) po/cs.po (+794/-961) po/csb.po (+505/-893) po/cv.po (+252/-866) po/cy.po (+618/-933) po/da.po (+794/-955) po/de.po (+819/-982) po/dv.po (+242/-865) po/el.po (+806/-966) po/en_AU.po (+823/-988) po/en_CA.po (+651/-980) po/en_GB.po (+818/-982) po/eo.po (+785/-949) po/es.po (+797/-961) po/et.po (+695/-935) po/eu.po (+712/-944) po/fa.po (+215/-865) po/fi.po (+780/-947) po/fil.po (+437/-882) po/fo.po (+215/-866) po/fr.po (+811/-972) po/fur.po (+291/-870) po/fy.po (+226/-868) po/ga.po (+215/-867) po/gd.po (+811/-969) po/gl.po (+795/-959) po/gu.po (+215/-866) po/gv.po (+215/-867) po/he.po (+774/-940) po/hi.po (+685/-927) po/hr.po (+796/-955) po/hu.po (+780/-946) po/hy.po (+215/-865) po/id.po (+707/-947) po/is.po (+583/-912) po/it.po (+798/-962) po/ja.po (+788/-953) po/jv.po (+215/-866) po/ka.po (+405/-883) po/kk.po (+708/-944) po/km.po (+764/-931) po/kn.po (+215/-866) po/ko.po (+775/-940) po/ku.po (+366/-876) po/ky.po (+215/-865) po/lb.po (+215/-866) po/lo.po (+215/-865) po/lt.po (+798/-961) po/lv.po (+795/-958) po/mk.po (+378/-881) po/ml.po (+233/-865) po/mn.po (+215/-865) po/mr.po (+328/-878) po/ms.po (+788/-955) po/mus.po (+215/-866) po/my.po (+225/-864) po/nb.po (+758/-951) po/nds.po (+253/-871) po/ne.po (+232/-865) po/nl.po (+805/-966) po/nn.po (+709/-948) po/oc.po (+808/-970) po/pa.po (+410/-872) po/pl.po (+758/-961) po/ps.po (+215/-866) po/pt.po (+721/-957) po/pt_BR.po (+796/-958) po/qu.po (+215/-866) po/ro.po (+808/-971) po/ru.po (+786/-949) po/rw.po (+229/-865) po/sc.po (+215/-866) po/sco.po (+215/-866) po/sd.po (+215/-866) po/shn.po (+215/-866) po/si.po (+215/-866) po/sk.po (+800/-962) po/sl.po (+794/-959) po/sq.po (+802/-967) po/sr.po (+786/-955) po/sv.po (+785/-948) po/ta.po (+218/-866) po/ta_LK.po (+218/-866) po/te.po (+435/-874) po/th.po (+633/-910) po/tl.po (+488/-889) po/tr.po (+788/-953) po/ubuntu-release-upgrader.pot (+216/-867) po/ug.po (+785/-947) po/uk.po (+798/-960) po/ur.po (+215/-866) po/uz.po (+215/-865) po/vi.po (+776/-941) po/xh.po (+215/-866) po/zh_CN.po (+750/-918) po/zh_HK.po (+680/-919) po/zh_TW.po (+747/-916) po/zu.po (+220/-865) setup.cfg (+1/-6) setup.py (+6/-30) tests/aptroot-update-origin/etc/apt/sources.list (+0/-5) tests/interactive_fetch_release_upgrader.py (+0/-89) tests/patchdir/pycompile_orig (+1/-1) tests/test_cache.py (+0/-37) tests/test_changelog.py (+0/-66) tests/test_country_mirror.py (+1/-1) tests/test_dist_upgrade_fetcher_core.py (+1/-1) tests/test_end_of_life.py (+6/-1) tests/test_meta_release_core.py (+0/-144) tests/test_proxy.py (+0/-30) tests/test_quirks.py (+1/-1) tests/test_update_origin.py (+0/-124) tests/test_utils.py (+0/-65) tests/test_xorg_fix_intrepid.py (+1/-1) ubuntu-support-status (+0/-185) update-manager (+0/-131) update-manager-text (+0/-71) |
To merge this branch: | bzr merge lp:~ubuntu-core-dev/ubuntu-release-upgrader/split |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ken VanDine | Approve | ||
Barry Warsaw (community) | Needs Fixing | ||
Michael Vogt | Pending | ||
Review via email: mp+109209@code.launchpad.net |
Commit message
Description of the change
As discussed at UDS, we wanted to split out the release upgrade code from update-manager to its own source package.
This is my attempt at doing so. I'm not *super* familiar with the code, so I may have made a mistake but for the most part it was straightforward.
Some notes:
* This still uses some UpdateManager imports, so we hard-dep on update-manager.
* This still uses a couple keys from update-manager's gsettings schema. It didn't seem worth the pain of transitioning.
* This still uses the same /etc/update-manager location that update-manager did (although all files under that directory are really owned by this package now). I used appropriate Breaks/Replaces lines, but didn't bother renaming the directory. It didn't seem worth the effort, especially since we'd also have to migrate user files in /etc/update-
* I re-enabled some tests that had been dormant (chmod +x)
* A couple apport-oriented Python bits pretend to be /usr/bin/
* I split packages into core/gtk/qt, matching what they were in update-manager, although the frontend packages are real tiny.
- 2457. By Michael Terry
-
merge from lp:update-manager
- 2458. By Michael Terry
-
split package into python-* modules too
- 2459. By Michael Terry
-
drop python2 module and have the core depend on the python3 module
- 2460. By Michael Terry
-
bump version of update-manager to Break because they just released a new one
- 2461. By Michael Terry
-
merge from trunk again
- 2462. By Michael Terry
-
merge from trunk
Michael Terry (mterry) wrote : | # |
Updated to match latest update-manager trunk again.
Ken VanDine (ken-vandine) wrote : | # |
The symlinks to files included in python-
- 2463. By Michael Terry
-
drop some added files from UpdateManager merge
- 2464. By Michael Terry
-
drop any symlink dependencies on UpdateManager and make them real imports; copy a couple tiny classes from the UI part of UpdateManager here
Ken VanDine (ken-vandine) wrote : | # |
Tests are still failing, it looks like some of the update manager specific tests are still there and probably just need to be removed.
./test_
Traceback (most recent call last):
File "./test_
from DistUpgrade.
ImportError: No module named MetaRelease
- 2465. By Michael Terry
-
more import fixes
Ken VanDine (ken-vandine) wrote : | # |
All tests that are expected to pass are passing. Looks good now that the symlinks are fixed up.
- 2466. By Michael Terry
-
fix versions of update-manager that we Break, the other branch got merged earlier than I expected
Preview Diff
1 | === removed file 'BUGS' |
2 | --- BUGS 2006-09-11 08:13:06 +0000 |
3 | +++ BUGS 1970-01-01 00:00:00 +0000 |
4 | @@ -1,5 +0,0 @@ |
5 | -* aptsources.py: |
6 | -- when turning off a new sources.list entry for the runing distro |
7 | - (e.g. multiverse in a full edgy) and it is turned on again, the |
8 | - source code checkbox becomes only half-checked |
9 | -- when turning off/on a entry the comments become disordered |
10 | |
11 | === removed file 'ChangeLog' |
12 | --- ChangeLog 2005-11-15 13:18:07 +0000 |
13 | +++ ChangeLog 1970-01-01 00:00:00 +0000 |
14 | @@ -1,62 +0,0 @@ |
15 | -2005-04-04 Michael Vogt <mvo@debian.org> |
16 | - |
17 | - * configure.in: Added "xh" to ALL_LINGUAS. |
18 | - |
19 | -2005-04-01 Steve Murphy <murf@e-tools.com> |
20 | - |
21 | - * configure.in: Added "rw" to ALL_LINGUAS. |
22 | - |
23 | -2005-03-29 Raphael Higino <raphaelh@cvs.gnome.org> |
24 | - |
25 | - * configure.in: Added pt_BR to ALL_LINGUAS. |
26 | - |
27 | -2005-03-29 Zygmunt Krynicki <zyga@www.suxx.pl> |
28 | - |
29 | - * src/dialog_apt_key.py.in: Enabled translation of known keys |
30 | - |
31 | -2005-03-24 Michiel Sikkes <michiel@eyesopened.nl> |
32 | - |
33 | - * data/update-manager.glade: Added help button. Put package count next |
34 | - to reload button above updatelist. |
35 | - * src/update-manager.in: Implemented help button. |
36 | - * configure.in: Added ja to ALL_LINGUAS. |
37 | - |
38 | -2005-03-21 Adam Weinberger <adamw@gnome.org> |
39 | - |
40 | - * configure.in: Added en_CA to ALL_LINGUAS. |
41 | - |
42 | -2005-03-21 Christian Rose <menthos@menthos.com> |
43 | - |
44 | - * configure.in: Added "sv" to ALL_LINGUAS. |
45 | - Also sorted the language entries in the ALL_LINGUAS line, |
46 | - so that it will be possible to spot duplicates or omissions. |
47 | - |
48 | -2005-03-11 Michiel Sikkes <michiel@eyesopened.nl> |
49 | - |
50 | - * configure.in: Added el (Greek) to ALL_LINGUAS. |
51 | - |
52 | -2005-03-03 Dan Damian <dand@gnome.ro> |
53 | - |
54 | - * configure.in: Added ro (Romanian) to ALL_LINGUAS. |
55 | - |
56 | -2005-03-10 Zygmunt Krynicki <zyga@www.suxx.pl> |
57 | - |
58 | - * Improved translation support |
59 | - |
60 | -2005-02-18 Michiel Sikkes <michiel@eyesopened.nl> |
61 | - |
62 | - * Added window title to the synaptic gtk socket window. |
63 | - |
64 | -2005-02-18 Michiel Sikkes <michiel@eyesopened.nl> |
65 | - |
66 | - * Updated strings to have more consistent messages and it's not a pain |
67 | - in the ass to translate ;). |
68 | - * Merge from branches/release-37-2. |
69 | - |
70 | -2005-01-27 Martin Willemoes Hansen <mwh@sysrq.dk> |
71 | - |
72 | - * da.po: Added Danish translation. |
73 | - |
74 | -2004-10-25 Michiel Sikkes <michiel@eyesopened.nl> |
75 | - |
76 | - * Initial release. |
77 | |
78 | === modified file 'DistUpgrade/DistUpgradeApport.py' |
79 | --- DistUpgrade/DistUpgradeApport.py 2012-06-18 18:41:13 +0000 |
80 | +++ DistUpgrade/DistUpgradeApport.py 2012-06-27 19:25:24 +0000 |
81 | @@ -15,11 +15,11 @@ |
82 | except ImportError as e: |
83 | logging.error("failed to import apport python module, can't report bug: %s" % e) |
84 | return False |
85 | - # we pretend we are update-manager |
86 | - sys.argv[0] = "/usr/bin/update-manager" |
87 | + # we pretend we are do-release-upgrade |
88 | + sys.argv[0] = "/usr/bin/do-release-upgrade" |
89 | apport_excepthook(type, value, tb) |
90 | # now add the files in /var/log/dist-upgrade/* |
91 | - if os.path.exists('/var/crash/_usr_bin_update-manager.0.crash'): |
92 | + if os.path.exists('/var/crash/_usr_bin_do-release-upgrade.0.crash'): |
93 | report = Report() |
94 | report.setdefault('Tags', 'dist-upgrade') |
95 | report['Tags'] += ' dist-upgrade' |
96 | @@ -28,7 +28,7 @@ |
97 | if not os.path.isfile(f) or os.path.getsize(f) == 0: |
98 | continue |
99 | report[f.replace(".", "").replace("-", "")] = (open(f), ) |
100 | - report.add_to_existing('/var/crash/_usr_bin_update-manager.0.crash') |
101 | + report.add_to_existing('/var/crash/_usr_bin_do-release-upgrade.0.crash') |
102 | return True |
103 | |
104 | |
105 | |
106 | === modified file 'DistUpgrade/DistUpgradeCache.py' |
107 | --- DistUpgrade/DistUpgradeCache.py 2012-06-13 12:45:49 +0000 |
108 | +++ DistUpgrade/DistUpgradeCache.py 2012-06-27 19:25:24 +0000 |
109 | @@ -40,7 +40,7 @@ |
110 | from .DistUpgradeGettext import gettext as _ |
111 | from .DistUpgradeGettext import ngettext |
112 | |
113 | -from .utils import inside_chroot, estimate_kernel_size_in_boot |
114 | +from UpdateManager.Core.utils import inside_chroot, estimate_kernel_size_in_boot |
115 | |
116 | class CacheException(Exception): |
117 | pass |
118 | @@ -704,7 +704,7 @@ |
119 | "please try again later.") |
120 | else: |
121 | details += _("If none of this applies, then please report this bug using " |
122 | - "the command 'ubuntu-bug update-manager' in a terminal.") |
123 | + "the command 'ubuntu-bug ubuntu-release-upgrader-core' in a terminal.") |
124 | # make the error text available again on stdout for the |
125 | # text frontend |
126 | self._stopAptResolverLog() |
127 | @@ -915,7 +915,7 @@ |
128 | _("It was impossible to install a " |
129 | "required package. Please report " |
130 | "this as a bug using " |
131 | - "'ubuntu-bug update-manager' in " |
132 | + "'ubuntu-bug ubuntu-release-upgrader-core' in " |
133 | "a terminal.")) |
134 | return False |
135 | logging.debug("marked_install: '%s' -> '%s'" % (key, self[key].marked_install)) |
136 | |
137 | === modified file 'DistUpgrade/DistUpgradeConfigParser.py' |
138 | --- DistUpgrade/DistUpgradeConfigParser.py 2012-06-11 10:46:56 +0000 |
139 | +++ DistUpgrade/DistUpgradeConfigParser.py 2012-06-27 19:25:24 +0000 |
140 | @@ -16,7 +16,7 @@ |
141 | import logging |
142 | import glob |
143 | |
144 | -CONFIG_OVERRIDE_DIR = "/etc/update-manager/release-upgrades.d" |
145 | +CONFIG_OVERRIDE_DIR = "/etc/ubuntu-release-upgrader/release-upgrades.d" |
146 | |
147 | class DistUpgradeConfig(SafeConfigParser): |
148 | def __init__(self, datadir, name="DistUpgrade.cfg", |
149 | |
150 | === modified file 'DistUpgrade/DistUpgradeController.py' |
151 | --- DistUpgrade/DistUpgradeController.py 2012-06-11 12:09:52 +0000 |
152 | +++ DistUpgrade/DistUpgradeController.py 2012-06-27 19:25:24 +0000 |
153 | @@ -45,14 +45,14 @@ |
154 | except ImportError: |
155 | # < 3.0 |
156 | from ConfigParser import SafeConfigParser, NoOptionError |
157 | -from .utils import (country_mirror, |
158 | - url_downloadable, |
159 | - check_and_fix_xbit, |
160 | - get_arch, |
161 | - iptables_active, |
162 | - inside_chroot, |
163 | - get_string_with_no_auth_from_source_entry, |
164 | - is_child_of_process_name) |
165 | +from UpdateManager.Core.utils import (country_mirror, |
166 | + url_downloadable, |
167 | + check_and_fix_xbit, |
168 | + get_arch, |
169 | + iptables_active, |
170 | + inside_chroot, |
171 | + get_string_with_no_auth_from_source_entry, |
172 | + is_child_of_process_name) |
173 | from string import Template |
174 | try: |
175 | from urllib.parse import urlsplit |
176 | @@ -105,8 +105,8 @@ |
177 | self.options = options |
178 | |
179 | # init gettext |
180 | - gettext.bindtextdomain("update-manager",localedir) |
181 | - gettext.textdomain("update-manager") |
182 | + gettext.bindtextdomain("ubuntu-release-upgrader",localedir) |
183 | + gettext.textdomain("ubuntu-release-upgrader") |
184 | |
185 | # setup the view |
186 | logging.debug("Using '%s' view" % distUpgradeView.__class__.__name__) |
187 | @@ -305,7 +305,7 @@ |
188 | and we have network - we will then try to fetch a update |
189 | of ourself |
190 | """ |
191 | - from .MetaRelease import MetaReleaseCore |
192 | + from UpdateManager.Core.MetaRelease import MetaReleaseCore |
193 | from .DistUpgradeFetcherSelf import DistUpgradeFetcherSelf |
194 | # check if we run from a LTS |
195 | forceLTS=False |
196 | @@ -534,7 +534,7 @@ |
197 | # we replace the sources.list with a single |
198 | # line to ubuntu-main |
199 | logging.warning('get_distro().enable_component("man") failed, overwriting sources.list instead as last resort') |
200 | - s = "# auto generated by update-manager" |
201 | + s = "# auto generated by ubuntu-release-upgrader" |
202 | s += "deb http://archive.ubuntu.com/ubuntu %s main restricted" % self.toDist |
203 | s += "deb http://archive.ubuntu.com/ubuntu %s-updates main restricted" % self.toDist |
204 | s += "deb http://security.ubuntu.com/ubuntu %s-security main restricted" % self.toDist |
205 | @@ -771,7 +771,7 @@ |
206 | _("Upgrading the repository information " |
207 | "resulted in a invalid file so a bug " |
208 | "reporting process is being started.")) |
209 | - subprocess.Popen(["apport-bug", "update-manager"]) |
210 | + subprocess.Popen(["apport-bug", "ubuntu-release-upgrader"]) |
211 | return False |
212 | |
213 | if self.sources_disabled: |
214 | @@ -1083,8 +1083,8 @@ |
215 | # if its a ordering bug we can cleanly revert to |
216 | # the previous release, no packages have been installed |
217 | # yet (LP: #328655, #356781) |
218 | - if os.path.exists("/var/run/update-manager-apt-exception"): |
219 | - e = open("/var/run/update-manager-apt-exception").read() |
220 | + if os.path.exists("/var/run/ubuntu-release-upgrader-apt-exception"): |
221 | + e = open("/var/run/ubuntu-release-upgrader-apt-exception").read() |
222 | logging.error("found exception: '%s'" % e) |
223 | # if its a ordering bug we can cleanly revert but we need to write |
224 | # a marker for the parent process to know its this kind of error |
225 | @@ -1111,7 +1111,7 @@ |
226 | if not self._partialUpgrade: |
227 | if not run_apport(): |
228 | msg += _("\n\nPlease report this bug in a browser at " |
229 | - "http://bugs.launchpad.net/ubuntu/+source/update-manager/+filebug " |
230 | + "http://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+filebug " |
231 | "and attach the files in /var/log/dist-upgrade/ " |
232 | "to the bug report.\n" |
233 | "%s" % e) |
234 | @@ -1594,7 +1594,7 @@ |
235 | _("Preparing the system for the upgrade " |
236 | "failed so a bug reporting process is " |
237 | "being started.")) |
238 | - subprocess.Popen(["apport-bug", "update-manager"]) |
239 | + subprocess.Popen(["apport-bug", "ubuntu-release-upgrader"]) |
240 | sys.exit(1) |
241 | |
242 | # mvo: commented out for now, see #54234, this needs to be |
243 | @@ -1613,7 +1613,7 @@ |
244 | "\n" |
245 | "Additionally, a bug reporting process is " |
246 | "being started.")) |
247 | - subprocess.Popen(["apport-bug", "update-manager"]) |
248 | + subprocess.Popen(["apport-bug", "ubuntu-release-upgrader"]) |
249 | self.abort() |
250 | |
251 | # run a "apt-get update" now, its ok to ignore errors, |
252 | @@ -1684,7 +1684,7 @@ |
253 | "In the case of an overloaded mirror, you " |
254 | "may want to try the upgrade again later.") |
255 | % pkg) |
256 | - subprocess.Popen(["apport-bug", "update-manager"]) |
257 | + subprocess.Popen(["apport-bug", "ubuntu-release-upgrader"]) |
258 | self.abort() |
259 | |
260 | # calc the dist-upgrade and see if the removals are ok/expected |
261 | |
262 | === modified file 'DistUpgrade/DistUpgradeFetcherCore.py' |
263 | --- DistUpgrade/DistUpgradeFetcherCore.py 2012-05-28 10:20:51 +0000 |
264 | +++ DistUpgrade/DistUpgradeFetcherCore.py 2012-06-27 19:25:24 +0000 |
265 | @@ -33,7 +33,7 @@ |
266 | from gettext import gettext as _ |
267 | from aptsources.sourceslist import SourcesList |
268 | |
269 | -from .utils import get_dist, url_downloadable, country_mirror |
270 | +from UpdateManager.Core.utils import get_dist, url_downloadable, country_mirror |
271 | |
272 | class DistUpgradeFetcherCore(object): |
273 | " base class (without GUI) for the upgrade fetcher " |
274 | @@ -150,7 +150,7 @@ |
275 | if not os.path.exists(script): |
276 | return self.error(_("Could not run the upgrade tool"), |
277 | _("Could not run the upgrade tool") + ". " + _("This is most likely a bug in the upgrade tool. " |
278 | - "Please report it as a bug using the command 'ubuntu-bug update-manager'.")) |
279 | + "Please report it as a bug using the command 'ubuntu-bug ubuntu-release-upgrader-core'.")) |
280 | return True |
281 | |
282 | def mirror_from_sources_list(self, uri, default_uri): |
283 | @@ -211,7 +211,7 @@ |
284 | |
285 | def fetchDistUpgrader(self): |
286 | " download the tarball with the upgrade script " |
287 | - self.tmpdir = tmpdir = tempfile.mkdtemp(prefix="update-manager-") |
288 | + self.tmpdir = tmpdir = tempfile.mkdtemp(prefix="ubuntu-release-upgrader-") |
289 | os.chdir(tmpdir) |
290 | logging.debug("using tmpdir: '%s'" % tmpdir) |
291 | # turn debugging on here (if required) |
292 | |
293 | === modified file 'DistUpgrade/DistUpgradeQuirks.py' |
294 | --- DistUpgrade/DistUpgradeQuirks.py 2012-06-12 01:00:52 +0000 |
295 | +++ DistUpgrade/DistUpgradeQuirks.py 2012-06-27 19:25:24 +0000 |
296 | @@ -34,7 +34,7 @@ |
297 | from subprocess import PIPE, Popen |
298 | from hashlib import md5 |
299 | |
300 | -from .utils import lsmod, get_arch |
301 | +from UpdateManager.Core.utils import lsmod, get_arch |
302 | |
303 | from .DistUpgradeGettext import gettext as _ |
304 | from janitor.plugincore.manager import PluginManager |
305 | |
306 | === modified file 'DistUpgrade/DistUpgradeView.py' |
307 | --- DistUpgrade/DistUpgradeView.py 2012-06-13 11:57:10 +0000 |
308 | +++ DistUpgrade/DistUpgradeView.py 2012-06-27 19:25:24 +0000 |
309 | @@ -206,7 +206,7 @@ |
310 | except Exception as e: |
311 | print("Exception during pm.DoInstall(): ", e) |
312 | logging.exception("Exception during pm.DoInstall()") |
313 | - open("/var/run/update-manager-apt-exception","w").write(str(e)) |
314 | + open("/var/run/ubuntu-release-upgrader-apt-exception","w").write(str(e)) |
315 | os._exit(pm.ResultFailed) |
316 | os._exit(res) |
317 | self.child_pid = pid |
318 | |
319 | === modified file 'DistUpgrade/DistUpgradeViewGtk.py' |
320 | --- DistUpgrade/DistUpgradeViewGtk.py 2012-06-13 11:40:17 +0000 |
321 | +++ DistUpgrade/DistUpgradeViewGtk.py 2012-06-27 19:25:24 +0000 |
322 | @@ -387,8 +387,8 @@ |
323 | gtk.init_check() |
324 | |
325 | try: |
326 | - locale.bindtextdomain("update-manager",localedir) |
327 | - gettext.textdomain("update-manager") |
328 | + locale.bindtextdomain("ubuntu-release-upgrader",localedir) |
329 | + gettext.textdomain("ubuntu-release-upgrader") |
330 | except Exception as e: |
331 | logging.warning("Error setting locales (%s)" % e) |
332 | |
333 | @@ -400,7 +400,7 @@ |
334 | pass |
335 | SimpleGtkbuilderApp.__init__(self, |
336 | gladedir+"/DistUpgrade.ui", |
337 | - "update-manager") |
338 | + "ubuntu-release-upgrader") |
339 | # terminal stuff |
340 | self.create_terminal() |
341 | |
342 | |
343 | === modified file 'DistUpgrade/DistUpgradeViewGtk3.py' |
344 | --- DistUpgrade/DistUpgradeViewGtk3.py 2012-06-13 11:40:17 +0000 |
345 | +++ DistUpgrade/DistUpgradeViewGtk3.py 2012-06-27 19:25:24 +0000 |
346 | @@ -407,14 +407,14 @@ |
347 | Gtk.init_check(sys.argv) |
348 | |
349 | try: |
350 | - locale.bindtextdomain("update-manager",localedir) |
351 | - gettext.textdomain("update-manager") |
352 | + locale.bindtextdomain("ubuntu-release-upgrader",localedir) |
353 | + gettext.textdomain("ubuntu-release-upgrader") |
354 | except Exception as e: |
355 | logging.warning("Error setting locales (%s)" % e) |
356 | |
357 | SimpleGtkbuilderApp.__init__(self, |
358 | gladedir+"/DistUpgrade.ui", |
359 | - "update-manager") |
360 | + "ubuntu-release-upgrader") |
361 | |
362 | icons = Gtk.IconTheme.get_default() |
363 | try: |
364 | |
365 | === modified file 'DistUpgrade/DistUpgradeViewKDE.py' |
366 | --- DistUpgrade/DistUpgradeViewKDE.py 2012-06-13 11:41:10 +0000 |
367 | +++ DistUpgrade/DistUpgradeViewKDE.py 2012-06-27 19:25:24 +0000 |
368 | @@ -455,12 +455,12 @@ |
369 | if not datadir: |
370 | localedir=os.path.join(os.getcwd(),"mo") |
371 | else: |
372 | - localedir="/usr/share/locale/update-manager" |
373 | + localedir="/usr/share/locale/ubuntu-release-upgrader" |
374 | |
375 | # FIXME: i18n must be somewhere relative do this dir |
376 | try: |
377 | - gettext.bindtextdomain("update-manager", localedir) |
378 | - gettext.textdomain("update-manager") |
379 | + gettext.bindtextdomain("ubuntu-release-upgrader", localedir) |
380 | + gettext.textdomain("ubuntu-release-upgrader") |
381 | except Exception as e: |
382 | logging.warning("Error setting locales (%s)" % e) |
383 | |
384 | @@ -474,7 +474,7 @@ |
385 | # exception when run without DISPLAY but dies instead |
386 | if not "DISPLAY" in os.environ: |
387 | raise Exception("No DISPLAY in os.environ found") |
388 | - self.app = QApplication(["update-manager"]) |
389 | + self.app = QApplication(["ubuntu-release-upgrader"]) |
390 | |
391 | if os.path.exists("/usr/share/icons/oxygen/48x48/apps/system-software-update.png"): |
392 | messageIcon = QPixmap("/usr/share/icons/oxygen/48x48/apps/system-software-update.png") |
393 | @@ -524,8 +524,8 @@ |
394 | subprocess.call(["killall", "adept_updater"]) |
395 | |
396 | # init gettext |
397 | - gettext.bindtextdomain("update-manager",localedir) |
398 | - gettext.textdomain("update-manager") |
399 | + gettext.bindtextdomain("ubuntu-release-upgrader",localedir) |
400 | + gettext.textdomain("ubuntu-release-upgrader") |
401 | self.translate_widget_children() |
402 | self.window_main.label_title.setText(self.window_main.label_title.text().replace("Ubuntu", "Kubuntu")) |
403 | |
404 | @@ -610,7 +610,7 @@ |
405 | """start konqueror""" |
406 | #need to run this else kdesu can't run Konqueror |
407 | #subprocess.call(['su', 'ubuntu', 'xhost', '+localhost']) |
408 | - QDesktopServices.openUrl(QUrl("https://launchpad.net/ubuntu/+source/update-manager/+filebug")) |
409 | + QDesktopServices.openUrl(QUrl("https://launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+filebug")) |
410 | |
411 | def showTerminal(self): |
412 | if self.window_main.konsole_frame.isVisible(): |
413 | |
414 | === modified file 'DistUpgrade/DistUpgradeViewText.py' |
415 | --- DistUpgrade/DistUpgradeViewText.py 2012-06-13 11:19:42 +0000 |
416 | +++ DistUpgrade/DistUpgradeViewText.py 2012-06-27 19:25:24 +0000 |
417 | @@ -33,7 +33,7 @@ |
418 | |
419 | import gettext |
420 | from .DistUpgradeGettext import gettext as _ |
421 | -from .utils import twrap |
422 | +from UpdateManager.Core.utils import twrap |
423 | |
424 | class TextAcquireProgress(AcquireProgress, apt.progress.text.AcquireProgress): |
425 | def __init__(self): |
426 | @@ -68,11 +68,11 @@ |
427 | if not datadir: |
428 | localedir=os.path.join(os.getcwd(),"mo") |
429 | else: |
430 | - localedir="/usr/share/locale/update-manager" |
431 | + localedir="/usr/share/locale/ubuntu-release-upgrader" |
432 | |
433 | try: |
434 | - gettext.bindtextdomain("update-manager", localedir) |
435 | - gettext.textdomain("update-manager") |
436 | + gettext.bindtextdomain("ubuntu-release-upgrader", localedir) |
437 | + gettext.textdomain("ubuntu-release-upgrader") |
438 | except Exception as e: |
439 | logging.warning("Error setting locales (%s)" % e) |
440 | |
441 | |
442 | === removed symlink 'DistUpgrade/MetaRelease.py' |
443 | === target was u'../UpdateManager/Core/MetaRelease.py' |
444 | === added file 'DistUpgrade/SimpleGtk3builderApp.py' |
445 | --- DistUpgrade/SimpleGtk3builderApp.py 1970-01-01 00:00:00 +0000 |
446 | +++ DistUpgrade/SimpleGtk3builderApp.py 2012-06-27 19:25:24 +0000 |
447 | @@ -0,0 +1,61 @@ |
448 | +""" |
449 | + SimpleGladeApp.py |
450 | + Module that provides an object oriented abstraction to pygtk and libglade. |
451 | + Copyright (C) 2004 Sandino Flores Moreno |
452 | +""" |
453 | + |
454 | +# This library is free software; you can redistribute it and/or |
455 | +# modify it under the terms of the GNU Lesser General Public |
456 | +# License as published by the Free Software Foundation; either |
457 | +# version 2.1 of the License, or (at your option) any later version. |
458 | +# |
459 | +# This library is distributed in the hope that it will be useful, |
460 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
461 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
462 | +# Lesser General Public License for more details. |
463 | +# |
464 | +# You should have received a copy of the GNU Lesser General Public |
465 | +# License along with this library; if not, write to the Free Software |
466 | +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
467 | +# USA |
468 | + |
469 | +import logging |
470 | + |
471 | +from gi.repository import Gtk |
472 | + |
473 | +# based on SimpleGladeApp |
474 | +class SimpleGtkbuilderApp: |
475 | + |
476 | + def __init__(self, path, domain): |
477 | + self.builder = Gtk.Builder() |
478 | + self.builder.set_translation_domain(domain) |
479 | + self.builder.add_from_file(path) |
480 | + self.builder.connect_signals(self) |
481 | + for o in self.builder.get_objects(): |
482 | + if issubclass(type(o), Gtk.Buildable): |
483 | + name = Gtk.Buildable.get_name(o) |
484 | + setattr(self, name, o) |
485 | + else: |
486 | + logging.debug("WARNING: can not get name for '%s'" % o) |
487 | + |
488 | + def run(self): |
489 | + """ |
490 | + Starts the main loop of processing events checking for Control-C. |
491 | + |
492 | + The default implementation checks wheter a Control-C is pressed, |
493 | + then calls on_keyboard_interrupt(). |
494 | + |
495 | + Use this method for starting programs. |
496 | + """ |
497 | + try: |
498 | + Gtk.main() |
499 | + except KeyboardInterrupt: |
500 | + self.on_keyboard_interrupt() |
501 | + |
502 | + def on_keyboard_interrupt(self): |
503 | + """ |
504 | + This method is called by the default implementation of run() |
505 | + after a program is finished by pressing Control-C. |
506 | + """ |
507 | + pass |
508 | + |
509 | |
510 | === removed symlink 'DistUpgrade/SimpleGtk3builderApp.py' |
511 | === target was u'../UpdateManager/SimpleGtk3builderApp.py' |
512 | === added file 'DistUpgrade/SimpleGtkbuilderApp.py' |
513 | --- DistUpgrade/SimpleGtkbuilderApp.py 1970-01-01 00:00:00 +0000 |
514 | +++ DistUpgrade/SimpleGtkbuilderApp.py 2012-06-27 19:25:24 +0000 |
515 | @@ -0,0 +1,61 @@ |
516 | +""" |
517 | + SimpleGladeApp.py |
518 | + Module that provides an object oriented abstraction to pygtk and libglade. |
519 | + Copyright (C) 2004 Sandino Flores Moreno |
520 | +""" |
521 | + |
522 | +# This library is free software; you can redistribute it and/or |
523 | +# modify it under the terms of the GNU Lesser General Public |
524 | +# License as published by the Free Software Foundation; either |
525 | +# version 2.1 of the License, or (at your option) any later version. |
526 | +# |
527 | +# This library is distributed in the hope that it will be useful, |
528 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
529 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
530 | +# Lesser General Public License for more details. |
531 | +# |
532 | +# You should have received a copy of the GNU Lesser General Public |
533 | +# License along with this library; if not, write to the Free Software |
534 | +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
535 | +# USA |
536 | + |
537 | +import logging |
538 | + |
539 | +import gtk |
540 | + |
541 | +# based on SimpleGladeApp |
542 | +class SimpleGtkbuilderApp: |
543 | + |
544 | + def __init__(self, path, domain): |
545 | + self.builder = gtk.Builder() |
546 | + self.builder.set_translation_domain(domain) |
547 | + self.builder.add_from_file(path) |
548 | + self.builder.connect_signals(self) |
549 | + for o in self.builder.get_objects(): |
550 | + if issubclass(type(o), gtk.Buildable): |
551 | + name = gtk.Buildable.get_name(o) |
552 | + setattr(self, name, o) |
553 | + else: |
554 | + logging.debug("WARNING: can not get name for '%s'" % o) |
555 | + |
556 | + def run(self): |
557 | + """ |
558 | + Starts the main loop of processing events checking for Control-C. |
559 | + |
560 | + The default implementation checks wheter a Control-C is pressed, |
561 | + then calls on_keyboard_interrupt(). |
562 | + |
563 | + Use this method for starting programs. |
564 | + """ |
565 | + try: |
566 | + gtk.main() |
567 | + except KeyboardInterrupt: |
568 | + self.on_keyboard_interrupt() |
569 | + |
570 | + def on_keyboard_interrupt(self): |
571 | + """ |
572 | + This method is called by the default implementation of run() |
573 | + after a program is finished by pressing Control-C. |
574 | + """ |
575 | + pass |
576 | + |
577 | |
578 | === removed symlink 'DistUpgrade/SimpleGtkbuilderApp.py' |
579 | === target was u'../UpdateManager/SimpleGtkbuilderApp.py' |
580 | === modified file 'DistUpgrade/TODO' |
581 | --- DistUpgrade/TODO 2006-10-05 14:36:09 +0000 |
582 | +++ DistUpgrade/TODO 2012-06-27 19:25:24 +0000 |
583 | @@ -8,8 +8,8 @@ |
584 | * if run from CDROM and we have network -> do a self update |
585 | * support dapper-commercial in sources.list rewriting |
586 | * after "no-network" dist-upgrade it is most likely that the system |
587 | - is only half-upgraded and update-manager will not be able to do |
588 | - the full upgrade. update-manager needs to be changed to support |
589 | + is only half-upgraded and ubuntu-release-upgrader will not be able to do |
590 | + the full upgrade. ubuntu-release-upgrader needs to be changed to support |
591 | full dist-upgrades (possible by just calling the dist-upgrader |
592 | in a special mode) |
593 | |
594 | |
595 | === modified file 'DistUpgrade/build-tarball.sh' |
596 | --- DistUpgrade/build-tarball.sh 2012-06-11 15:08:35 +0000 |
597 | +++ DistUpgrade/build-tarball.sh 2012-06-27 19:25:24 +0000 |
598 | @@ -7,7 +7,7 @@ |
599 | # cleanup |
600 | echo "Cleaning up" |
601 | |
602 | -for d in ./ janitor/; do |
603 | +for d in ./; do |
604 | rm -f $d/*~ $d/*.bak $d/*.pyc $d/*.moved $d/'#'* $d/*.rej $d/*.orig |
605 | rm -rf $d/__pycache__ |
606 | rm -f *.tar.gz *.tar |
607 | @@ -38,4 +38,4 @@ |
608 | tar --append -v -f $DIST.tar ./DistUpgrade |
609 | |
610 | # and compress it |
611 | -gzip -9 $DIST.tar |
612 | \ No newline at end of file |
613 | +gzip -9 $DIST.tar |
614 | |
615 | === modified file 'DistUpgrade/crashdialog.ui' |
616 | --- DistUpgrade/crashdialog.ui 2008-07-28 17:48:53 +0000 |
617 | +++ DistUpgrade/crashdialog.ui 2012-06-27 19:25:24 +0000 |
618 | @@ -59,7 +59,7 @@ |
619 | <item> |
620 | <widget class="QLabel" name="crash_info_text" > |
621 | <property name="text" > |
622 | - <string><qt>We're sorry; the upgrade tool crashed. Please file a new bug report at <a href="http://launchpad.net/ubuntu/+source/update-manager">http://launchpad.net/ubuntu/+source/update-manager</a> (do not attach your details to any existing bug) and a developer will attend to the problem as soon as possible. To help the developers understand what went wrong, include the following detail in your bug report, and attach the files /var/log/dist-upgrade/apt.log and /var/log/dist-upgrade/main.log:</string> |
623 | + <string><qt>We're sorry; the upgrade tool crashed. Please file a new bug report at <a href="http://launchpad.net/ubuntu/+source/ubuntu-release-upgrader">http://launchpad.net/ubuntu/+source/ubuntu-release-upgrader</a> (do not attach your details to any existing bug) and a developer will attend to the problem as soon as possible. To help the developers understand what went wrong, include the following detail in your bug report, and attach the files /var/log/dist-upgrade/apt.log and /var/log/dist-upgrade/main.log:</string> |
624 | </property> |
625 | <property name="alignment" > |
626 | <set>Qt::AlignVCenter</set> |
627 | |
628 | === removed symlink 'DistUpgrade/janitor' |
629 | === target was u'../janitor' |
630 | === modified file 'DistUpgrade/removal_blacklist.cfg' |
631 | --- DistUpgrade/removal_blacklist.cfg 2012-04-17 19:26:33 +0000 |
632 | +++ DistUpgrade/removal_blacklist.cfg 2012-06-27 19:25:24 +0000 |
633 | @@ -5,9 +5,10 @@ |
634 | kubuntu-desktop |
635 | xubuntu-desktop |
636 | lubuntu-desktop |
637 | -# update-manager itself should not remove itself |
638 | +# ubuntu-release-upgrader should not remove itself or update-manager |
639 | update-manager |
640 | update-manager-core |
641 | +ubuntu-release-upgrader |
642 | # posgresql (LP: #871893) |
643 | ^postgresql-.*[0-9]\.[0-9].* |
644 | # the upgrade runs in it |
645 | |
646 | === removed symlink 'DistUpgrade/utils.py' |
647 | === target was u'../UpdateManager/Core/utils.py' |
648 | === modified file 'DistUpgrade/xorg_fix_proprietary.py' |
649 | --- DistUpgrade/xorg_fix_proprietary.py 2012-05-28 10:20:51 +0000 |
650 | +++ DistUpgrade/xorg_fix_proprietary.py 2012-06-27 19:25:24 +0000 |
651 | @@ -31,7 +31,7 @@ |
652 | if (line.lower().startswith("section") and |
653 | line.lower().split("#")[0].strip().endswith('"inputdevice"')): |
654 | logging.debug("found 'InputDevice' section") |
655 | - content.append("# commented out by update-manager, HAL is now used and auto-detects devices\n") |
656 | + content.append("# commented out by ubuntu-release-upgrader, HAL is now used and auto-detects devices\n") |
657 | content.append("# Keyboard settings are now read from /etc/default/console-setup\n") |
658 | content.append("#"+raw) |
659 | in_input_devices=True |
660 | @@ -40,7 +40,7 @@ |
661 | in_input_devices=False |
662 | elif line.lower().startswith("inputdevice"): |
663 | logging.debug("commenting out '%s' " % line) |
664 | - content.append("# commented out by update-manager, HAL is now used and auto-detects devices\n") |
665 | + content.append("# commented out by ubuntu-release-upgrader, HAL is now used and auto-detects devices\n") |
666 | content.append("# Keyboard settings are now read from /etc/default/console-setup\n") |
667 | content.append("#"+raw) |
668 | elif in_input_devices: |
669 | @@ -123,8 +123,8 @@ |
670 | print("Need to run as root") |
671 | sys.exit(1) |
672 | |
673 | - # we pretend to be update-manger so that apport picks up when we crash |
674 | - sys.argv[0] = "/usr/bin/update-manager" |
675 | + # we pretend to be do-release-upgrade so that apport picks up when we crash |
676 | + sys.argv[0] = "/usr/bin/do-release-upgrade" |
677 | |
678 | # setup logging |
679 | logging.basicConfig(level=logging.DEBUG, |
680 | |
681 | === removed file 'LGPL' |
682 | --- LGPL 2007-02-07 15:47:06 +0000 |
683 | +++ LGPL 1970-01-01 00:00:00 +0000 |
684 | @@ -1,510 +0,0 @@ |
685 | - |
686 | - GNU LESSER GENERAL PUBLIC LICENSE |
687 | - Version 2.1, February 1999 |
688 | - |
689 | - Copyright (C) 1991, 1999 Free Software Foundation, Inc. |
690 | - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
691 | - Everyone is permitted to copy and distribute verbatim copies |
692 | - of this license document, but changing it is not allowed. |
693 | - |
694 | -[This is the first released version of the Lesser GPL. It also counts |
695 | - as the successor of the GNU Library Public License, version 2, hence |
696 | - the version number 2.1.] |
697 | - |
698 | - Preamble |
699 | - |
700 | - The licenses for most software are designed to take away your |
701 | -freedom to share and change it. By contrast, the GNU General Public |
702 | -Licenses are intended to guarantee your freedom to share and change |
703 | -free software--to make sure the software is free for all its users. |
704 | - |
705 | - This license, the Lesser General Public License, applies to some |
706 | -specially designated software packages--typically libraries--of the |
707 | -Free Software Foundation and other authors who decide to use it. You |
708 | -can use it too, but we suggest you first think carefully about whether |
709 | -this license or the ordinary General Public License is the better |
710 | -strategy to use in any particular case, based on the explanations |
711 | -below. |
712 | - |
713 | - When we speak of free software, we are referring to freedom of use, |
714 | -not price. Our General Public Licenses are designed to make sure that |
715 | -you have the freedom to distribute copies of free software (and charge |
716 | -for this service if you wish); that you receive source code or can get |
717 | -it if you want it; that you can change the software and use pieces of |
718 | -it in new free programs; and that you are informed that you can do |
719 | -these things. |
720 | - |
721 | - To protect your rights, we need to make restrictions that forbid |
722 | -distributors to deny you these rights or to ask you to surrender these |
723 | -rights. These restrictions translate to certain responsibilities for |
724 | -you if you distribute copies of the library or if you modify it. |
725 | - |
726 | - For example, if you distribute copies of the library, whether gratis |
727 | -or for a fee, you must give the recipients all the rights that we gave |
728 | -you. You must make sure that they, too, receive or can get the source |
729 | -code. If you link other code with the library, you must provide |
730 | -complete object files to the recipients, so that they can relink them |
731 | -with the library after making changes to the library and recompiling |
732 | -it. And you must show them these terms so they know their rights. |
733 | - |
734 | - We protect your rights with a two-step method: (1) we copyright the |
735 | -library, and (2) we offer you this license, which gives you legal |
736 | -permission to copy, distribute and/or modify the library. |
737 | - |
738 | - To protect each distributor, we want to make it very clear that |
739 | -there is no warranty for the free library. Also, if the library is |
740 | -modified by someone else and passed on, the recipients should know |
741 | -that what they have is not the original version, so that the original |
742 | -author's reputation will not be affected by problems that might be |
743 | -introduced by others. |
744 | - |
745 | |
746 | - Finally, software patents pose a constant threat to the existence of |
747 | -any free program. We wish to make sure that a company cannot |
748 | -effectively restrict the users of a free program by obtaining a |
749 | -restrictive license from a patent holder. Therefore, we insist that |
750 | -any patent license obtained for a version of the library must be |
751 | -consistent with the full freedom of use specified in this license. |
752 | - |
753 | - Most GNU software, including some libraries, is covered by the |
754 | -ordinary GNU General Public License. This license, the GNU Lesser |
755 | -General Public License, applies to certain designated libraries, and |
756 | -is quite different from the ordinary General Public License. We use |
757 | -this license for certain libraries in order to permit linking those |
758 | -libraries into non-free programs. |
759 | - |
760 | - When a program is linked with a library, whether statically or using |
761 | -a shared library, the combination of the two is legally speaking a |
762 | -combined work, a derivative of the original library. The ordinary |
763 | -General Public License therefore permits such linking only if the |
764 | -entire combination fits its criteria of freedom. The Lesser General |
765 | -Public License permits more lax criteria for linking other code with |
766 | -the library. |
767 | - |
768 | - We call this license the "Lesser" General Public License because it |
769 | -does Less to protect the user's freedom than the ordinary General |
770 | -Public License. It also provides other free software developers Less |
771 | -of an advantage over competing non-free programs. These disadvantages |
772 | -are the reason we use the ordinary General Public License for many |
773 | -libraries. However, the Lesser license provides advantages in certain |
774 | -special circumstances. |
775 | - |
776 | - For example, on rare occasions, there may be a special need to |
777 | -encourage the widest possible use of a certain library, so that it |
778 | -becomes a de-facto standard. To achieve this, non-free programs must |
779 | -be allowed to use the library. A more frequent case is that a free |
780 | -library does the same job as widely used non-free libraries. In this |
781 | -case, there is little to gain by limiting the free library to free |
782 | -software only, so we use the Lesser General Public License. |
783 | - |
784 | - In other cases, permission to use a particular library in non-free |
785 | -programs enables a greater number of people to use a large body of |
786 | -free software. For example, permission to use the GNU C Library in |
787 | -non-free programs enables many more people to use the whole GNU |
788 | -operating system, as well as its variant, the GNU/Linux operating |
789 | -system. |
790 | - |
791 | - Although the Lesser General Public License is Less protective of the |
792 | -users' freedom, it does ensure that the user of a program that is |
793 | -linked with the Library has the freedom and the wherewithal to run |
794 | -that program using a modified version of the Library. |
795 | - |
796 | - The precise terms and conditions for copying, distribution and |
797 | -modification follow. Pay close attention to the difference between a |
798 | -"work based on the library" and a "work that uses the library". The |
799 | -former contains code derived from the library, whereas the latter must |
800 | -be combined with the library in order to run. |
801 | - |
802 | |
803 | - GNU LESSER GENERAL PUBLIC LICENSE |
804 | - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION |
805 | - |
806 | - 0. This License Agreement applies to any software library or other |
807 | -program which contains a notice placed by the copyright holder or |
808 | -other authorized party saying it may be distributed under the terms of |
809 | -this Lesser General Public License (also called "this License"). |
810 | -Each licensee is addressed as "you". |
811 | - |
812 | - A "library" means a collection of software functions and/or data |
813 | -prepared so as to be conveniently linked with application programs |
814 | -(which use some of those functions and data) to form executables. |
815 | - |
816 | - The "Library", below, refers to any such software library or work |
817 | -which has been distributed under these terms. A "work based on the |
818 | -Library" means either the Library or any derivative work under |
819 | -copyright law: that is to say, a work containing the Library or a |
820 | -portion of it, either verbatim or with modifications and/or translated |
821 | -straightforwardly into another language. (Hereinafter, translation is |
822 | -included without limitation in the term "modification".) |
823 | - |
824 | - "Source code" for a work means the preferred form of the work for |
825 | -making modifications to it. For a library, complete source code means |
826 | -all the source code for all modules it contains, plus any associated |
827 | -interface definition files, plus the scripts used to control |
828 | -compilation and installation of the library. |
829 | - |
830 | - Activities other than copying, distribution and modification are not |
831 | -covered by this License; they are outside its scope. The act of |
832 | -running a program using the Library is not restricted, and output from |
833 | -such a program is covered only if its contents constitute a work based |
834 | -on the Library (independent of the use of the Library in a tool for |
835 | -writing it). Whether that is true depends on what the Library does |
836 | -and what the program that uses the Library does. |
837 | - |
838 | - 1. You may copy and distribute verbatim copies of the Library's |
839 | -complete source code as you receive it, in any medium, provided that |
840 | -you conspicuously and appropriately publish on each copy an |
841 | -appropriate copyright notice and disclaimer of warranty; keep intact |
842 | -all the notices that refer to this License and to the absence of any |
843 | -warranty; and distribute a copy of this License along with the |
844 | -Library. |
845 | - |
846 | - You may charge a fee for the physical act of transferring a copy, |
847 | -and you may at your option offer warranty protection in exchange for a |
848 | -fee. |
849 | - |
850 | |
851 | - 2. You may modify your copy or copies of the Library or any portion |
852 | -of it, thus forming a work based on the Library, and copy and |
853 | -distribute such modifications or work under the terms of Section 1 |
854 | -above, provided that you also meet all of these conditions: |
855 | - |
856 | - a) The modified work must itself be a software library. |
857 | - |
858 | - b) You must cause the files modified to carry prominent notices |
859 | - stating that you changed the files and the date of any change. |
860 | - |
861 | - c) You must cause the whole of the work to be licensed at no |
862 | - charge to all third parties under the terms of this License. |
863 | - |
864 | - d) If a facility in the modified Library refers to a function or a |
865 | - table of data to be supplied by an application program that uses |
866 | - the facility, other than as an argument passed when the facility |
867 | - is invoked, then you must make a good faith effort to ensure that, |
868 | - in the event an application does not supply such function or |
869 | - table, the facility still operates, and performs whatever part of |
870 | - its purpose remains meaningful. |
871 | - |
872 | - (For example, a function in a library to compute square roots has |
873 | - a purpose that is entirely well-defined independent of the |
874 | - application. Therefore, Subsection 2d requires that any |
875 | - application-supplied function or table used by this function must |
876 | - be optional: if the application does not supply it, the square |
877 | - root function must still compute square roots.) |
878 | - |
879 | -These requirements apply to the modified work as a whole. If |
880 | -identifiable sections of that work are not derived from the Library, |
881 | -and can be reasonably considered independent and separate works in |
882 | -themselves, then this License, and its terms, do not apply to those |
883 | -sections when you distribute them as separate works. But when you |
884 | -distribute the same sections as part of a whole which is a work based |
885 | -on the Library, the distribution of the whole must be on the terms of |
886 | -this License, whose permissions for other licensees extend to the |
887 | -entire whole, and thus to each and every part regardless of who wrote |
888 | -it. |
889 | - |
890 | -Thus, it is not the intent of this section to claim rights or contest |
891 | -your rights to work written entirely by you; rather, the intent is to |
892 | -exercise the right to control the distribution of derivative or |
893 | -collective works based on the Library. |
894 | - |
895 | -In addition, mere aggregation of another work not based on the Library |
896 | -with the Library (or with a work based on the Library) on a volume of |
897 | -a storage or distribution medium does not bring the other work under |
898 | -the scope of this License. |
899 | - |
900 | - 3. You may opt to apply the terms of the ordinary GNU General Public |
901 | -License instead of this License to a given copy of the Library. To do |
902 | -this, you must alter all the notices that refer to this License, so |
903 | -that they refer to the ordinary GNU General Public License, version 2, |
904 | -instead of to this License. (If a newer version than version 2 of the |
905 | -ordinary GNU General Public License has appeared, then you can specify |
906 | -that version instead if you wish.) Do not make any other change in |
907 | -these notices. |
908 | - |
909 | |
910 | - Once this change is made in a given copy, it is irreversible for |
911 | -that copy, so the ordinary GNU General Public License applies to all |
912 | -subsequent copies and derivative works made from that copy. |
913 | - |
914 | - This option is useful when you wish to copy part of the code of |
915 | -the Library into a program that is not a library. |
916 | - |
917 | - 4. You may copy and distribute the Library (or a portion or |
918 | -derivative of it, under Section 2) in object code or executable form |
919 | -under the terms of Sections 1 and 2 above provided that you accompany |
920 | -it with the complete corresponding machine-readable source code, which |
921 | -must be distributed under the terms of Sections 1 and 2 above on a |
922 | -medium customarily used for software interchange. |
923 | - |
924 | - If distribution of object code is made by offering access to copy |
925 | -from a designated place, then offering equivalent access to copy the |
926 | -source code from the same place satisfies the requirement to |
927 | -distribute the source code, even though third parties are not |
928 | -compelled to copy the source along with the object code. |
929 | - |
930 | - 5. A program that contains no derivative of any portion of the |
931 | -Library, but is designed to work with the Library by being compiled or |
932 | -linked with it, is called a "work that uses the Library". Such a |
933 | -work, in isolation, is not a derivative work of the Library, and |
934 | -therefore falls outside the scope of this License. |
935 | - |
936 | - However, linking a "work that uses the Library" with the Library |
937 | -creates an executable that is a derivative of the Library (because it |
938 | -contains portions of the Library), rather than a "work that uses the |
939 | -library". The executable is therefore covered by this License. |
940 | -Section 6 states terms for distribution of such executables. |
941 | - |
942 | - When a "work that uses the Library" uses material from a header file |
943 | -that is part of the Library, the object code for the work may be a |
944 | -derivative work of the Library even though the source code is not. |
945 | -Whether this is true is especially significant if the work can be |
946 | -linked without the Library, or if the work is itself a library. The |
947 | -threshold for this to be true is not precisely defined by law. |
948 | - |
949 | - If such an object file uses only numerical parameters, data |
950 | -structure layouts and accessors, and small macros and small inline |
951 | -functions (ten lines or less in length), then the use of the object |
952 | -file is unrestricted, regardless of whether it is legally a derivative |
953 | -work. (Executables containing this object code plus portions of the |
954 | -Library will still fall under Section 6.) |
955 | - |
956 | - Otherwise, if the work is a derivative of the Library, you may |
957 | -distribute the object code for the work under the terms of Section 6. |
958 | -Any executables containing that work also fall under Section 6, |
959 | -whether or not they are linked directly with the Library itself. |
960 | - |
961 | |
962 | - 6. As an exception to the Sections above, you may also combine or |
963 | -link a "work that uses the Library" with the Library to produce a |
964 | -work containing portions of the Library, and distribute that work |
965 | -under terms of your choice, provided that the terms permit |
966 | -modification of the work for the customer's own use and reverse |
967 | -engineering for debugging such modifications. |
968 | - |
969 | - You must give prominent notice with each copy of the work that the |
970 | -Library is used in it and that the Library and its use are covered by |
971 | -this License. You must supply a copy of this License. If the work |
972 | -during execution displays copyright notices, you must include the |
973 | -copyright notice for the Library among them, as well as a reference |
974 | -directing the user to the copy of this License. Also, you must do one |
975 | -of these things: |
976 | - |
977 | - a) Accompany the work with the complete corresponding |
978 | - machine-readable source code for the Library including whatever |
979 | - changes were used in the work (which must be distributed under |
980 | - Sections 1 and 2 above); and, if the work is an executable linked |
981 | - with the Library, with the complete machine-readable "work that |
982 | - uses the Library", as object code and/or source code, so that the |
983 | - user can modify the Library and then relink to produce a modified |
984 | - executable containing the modified Library. (It is understood |
985 | - that the user who changes the contents of definitions files in the |
986 | - Library will not necessarily be able to recompile the application |
987 | - to use the modified definitions.) |
988 | - |
989 | - b) Use a suitable shared library mechanism for linking with the |
990 | - Library. A suitable mechanism is one that (1) uses at run time a |
991 | - copy of the library already present on the user's computer system, |
992 | - rather than copying library functions into the executable, and (2) |
993 | - will operate properly with a modified version of the library, if |
994 | - the user installs one, as long as the modified version is |
995 | - interface-compatible with the version that the work was made with. |
996 | - |
997 | - c) Accompany the work with a written offer, valid for at least |
998 | - three years, to give the same user the materials specified in |
999 | - Subsection 6a, above, for a charge no more than the cost of |
1000 | - performing this distribution. |
1001 | - |
1002 | - d) If distribution of the work is made by offering access to copy |
1003 | - from a designated place, offer equivalent access to copy the above |
1004 | - specified materials from the same place. |
1005 | - |
1006 | - e) Verify that the user has already received a copy of these |
1007 | - materials or that you have already sent this user a copy. |
1008 | - |
1009 | - For an executable, the required form of the "work that uses the |
1010 | -Library" must include any data and utility programs needed for |
1011 | -reproducing the executable from it. However, as a special exception, |
1012 | -the materials to be distributed need not include anything that is |
1013 | -normally distributed (in either source or binary form) with the major |
1014 | -components (compiler, kernel, and so on) of the operating system on |
1015 | -which the executable runs, unless that component itself accompanies |
1016 | -the executable. |
1017 | - |
1018 | - It may happen that this requirement contradicts the license |
1019 | -restrictions of other proprietary libraries that do not normally |
1020 | -accompany the operating system. Such a contradiction means you cannot |
1021 | -use both them and the Library together in an executable that you |
1022 | -distribute. |
1023 | - |
1024 | |
1025 | - 7. You may place library facilities that are a work based on the |
1026 | -Library side-by-side in a single library together with other library |
1027 | -facilities not covered by this License, and distribute such a combined |
1028 | -library, provided that the separate distribution of the work based on |
1029 | -the Library and of the other library facilities is otherwise |
1030 | -permitted, and provided that you do these two things: |
1031 | - |
1032 | - a) Accompany the combined library with a copy of the same work |
1033 | - based on the Library, uncombined with any other library |
1034 | - facilities. This must be distributed under the terms of the |
1035 | - Sections above. |
1036 | - |
1037 | - b) Give prominent notice with the combined library of the fact |
1038 | - that part of it is a work based on the Library, and explaining |
1039 | - where to find the accompanying uncombined form of the same work. |
1040 | - |
1041 | - 8. You may not copy, modify, sublicense, link with, or distribute |
1042 | -the Library except as expressly provided under this License. Any |
1043 | -attempt otherwise to copy, modify, sublicense, link with, or |
1044 | -distribute the Library is void, and will automatically terminate your |
1045 | -rights under this License. However, parties who have received copies, |
1046 | -or rights, from you under this License will not have their licenses |
1047 | -terminated so long as such parties remain in full compliance. |
1048 | - |
1049 | - 9. You are not required to accept this License, since you have not |
1050 | -signed it. However, nothing else grants you permission to modify or |
1051 | -distribute the Library or its derivative works. These actions are |
1052 | -prohibited by law if you do not accept this License. Therefore, by |
1053 | -modifying or distributing the Library (or any work based on the |
1054 | -Library), you indicate your acceptance of this License to do so, and |
1055 | -all its terms and conditions for copying, distributing or modifying |
1056 | -the Library or works based on it. |
1057 | - |
1058 | - 10. Each time you redistribute the Library (or any work based on the |
1059 | -Library), the recipient automatically receives a license from the |
1060 | -original licensor to copy, distribute, link with or modify the Library |
1061 | -subject to these terms and conditions. You may not impose any further |
1062 | -restrictions on the recipients' exercise of the rights granted herein. |
1063 | -You are not responsible for enforcing compliance by third parties with |
1064 | -this License. |
1065 | - |
1066 | |
1067 | - 11. If, as a consequence of a court judgment or allegation of patent |
1068 | -infringement or for any other reason (not limited to patent issues), |
1069 | -conditions are imposed on you (whether by court order, agreement or |
1070 | -otherwise) that contradict the conditions of this License, they do not |
1071 | -excuse you from the conditions of this License. If you cannot |
1072 | -distribute so as to satisfy simultaneously your obligations under this |
1073 | -License and any other pertinent obligations, then as a consequence you |
1074 | -may not distribute the Library at all. For example, if a patent |
1075 | -license would not permit royalty-free redistribution of the Library by |
1076 | -all those who receive copies directly or indirectly through you, then |
1077 | -the only way you could satisfy both it and this License would be to |
1078 | -refrain entirely from distribution of the Library. |
1079 | - |
1080 | -If any portion of this section is held invalid or unenforceable under |
1081 | -any particular circumstance, the balance of the section is intended to |
1082 | -apply, and the section as a whole is intended to apply in other |
1083 | -circumstances. |
1084 | - |
1085 | -It is not the purpose of this section to induce you to infringe any |
1086 | -patents or other property right claims or to contest validity of any |
1087 | -such claims; this section has the sole purpose of protecting the |
1088 | -integrity of the free software distribution system which is |
1089 | -implemented by public license practices. Many people have made |
1090 | -generous contributions to the wide range of software distributed |
1091 | -through that system in reliance on consistent application of that |
1092 | -system; it is up to the author/donor to decide if he or she is willing |
1093 | -to distribute software through any other system and a licensee cannot |
1094 | -impose that choice. |
1095 | - |
1096 | -This section is intended to make thoroughly clear what is believed to |
1097 | -be a consequence of the rest of this License. |
1098 | - |
1099 | - 12. If the distribution and/or use of the Library is restricted in |
1100 | -certain countries either by patents or by copyrighted interfaces, the |
1101 | -original copyright holder who places the Library under this License |
1102 | -may add an explicit geographical distribution limitation excluding those |
1103 | -countries, so that distribution is permitted only in or among |
1104 | -countries not thus excluded. In such case, this License incorporates |
1105 | -the limitation as if written in the body of this License. |
1106 | - |
1107 | - 13. The Free Software Foundation may publish revised and/or new |
1108 | -versions of the Lesser General Public License from time to time. |
1109 | -Such new versions will be similar in spirit to the present version, |
1110 | -but may differ in detail to address new problems or concerns. |
1111 | - |
1112 | -Each version is given a distinguishing version number. If the Library |
1113 | -specifies a version number of this License which applies to it and |
1114 | -"any later version", you have the option of following the terms and |
1115 | -conditions either of that version or of any later version published by |
1116 | -the Free Software Foundation. If the Library does not specify a |
1117 | -license version number, you may choose any version ever published by |
1118 | -the Free Software Foundation. |
1119 | - |
1120 | |
1121 | - 14. If you wish to incorporate parts of the Library into other free |
1122 | -programs whose distribution conditions are incompatible with these, |
1123 | -write to the author to ask for permission. For software which is |
1124 | -copyrighted by the Free Software Foundation, write to the Free |
1125 | -Software Foundation; we sometimes make exceptions for this. Our |
1126 | -decision will be guided by the two goals of preserving the free status |
1127 | -of all derivatives of our free software and of promoting the sharing |
1128 | -and reuse of software generally. |
1129 | - |
1130 | - NO WARRANTY |
1131 | - |
1132 | - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO |
1133 | -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. |
1134 | -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR |
1135 | -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY |
1136 | -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE |
1137 | -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
1138 | -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE |
1139 | -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME |
1140 | -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. |
1141 | - |
1142 | - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN |
1143 | -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY |
1144 | -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU |
1145 | -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR |
1146 | -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE |
1147 | -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING |
1148 | -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A |
1149 | -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF |
1150 | -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
1151 | -DAMAGES. |
1152 | - |
1153 | - END OF TERMS AND CONDITIONS |
1154 | - |
1155 | |
1156 | - How to Apply These Terms to Your New Libraries |
1157 | - |
1158 | - If you develop a new library, and you want it to be of the greatest |
1159 | -possible use to the public, we recommend making it free software that |
1160 | -everyone can redistribute and change. You can do so by permitting |
1161 | -redistribution under these terms (or, alternatively, under the terms |
1162 | -of the ordinary General Public License). |
1163 | - |
1164 | - To apply these terms, attach the following notices to the library. |
1165 | -It is safest to attach them to the start of each source file to most |
1166 | -effectively convey the exclusion of warranty; and each file should |
1167 | -have at least the "copyright" line and a pointer to where the full |
1168 | -notice is found. |
1169 | - |
1170 | - |
1171 | - <one line to give the library's name and a brief idea of what it does.> |
1172 | - Copyright (C) <year> <name of author> |
1173 | - |
1174 | - This library is free software; you can redistribute it and/or |
1175 | - modify it under the terms of the GNU Lesser General Public |
1176 | - License as published by the Free Software Foundation; either |
1177 | - version 2.1 of the License, or (at your option) any later version. |
1178 | - |
1179 | - This library is distributed in the hope that it will be useful, |
1180 | - but WITHOUT ANY WARRANTY; without even the implied warranty of |
1181 | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1182 | - Lesser General Public License for more details. |
1183 | - |
1184 | - You should have received a copy of the GNU Lesser General Public |
1185 | - License along with this library; if not, write to the Free Software |
1186 | - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
1187 | - |
1188 | -Also add information on how to contact you by electronic and paper mail. |
1189 | - |
1190 | -You should also get your employer (if you work as a programmer) or |
1191 | -your school, if any, to sign a "copyright disclaimer" for the library, |
1192 | -if necessary. Here is a sample; alter the names: |
1193 | - |
1194 | - Yoyodyne, Inc., hereby disclaims all copyright interest in the |
1195 | - library `Frob' (a library for tweaking knobs) written by James |
1196 | - Random Hacker. |
1197 | - |
1198 | - <signature of Ty Coon>, 1 April 1990 |
1199 | - Ty Coon, President of Vice |
1200 | - |
1201 | -That's all there is to it! |
1202 | - |
1203 | - |
1204 | |
1205 | === removed file 'README' |
1206 | --- README 2012-05-15 19:43:43 +0000 |
1207 | +++ README 1970-01-01 00:00:00 +0000 |
1208 | @@ -1,18 +0,0 @@ |
1209 | -Software Updater for apt |
1210 | ------------------------- |
1211 | - |
1212 | -This is an application which lets you manage available updates for your |
1213 | -computer via apt and python-apt. |
1214 | - |
1215 | -It also supports easy release upgrades. The following environment variables |
1216 | -are honored: |
1217 | - |
1218 | -DEBUG_UPDATE_MANAGER: |
1219 | -- If set, debug information is printed to sys.stderr. This is useful for |
1220 | - testing e.g. release upgrade checking/fetching. |
1221 | - |
1222 | - |
1223 | -If the release upgrade is running in text mode and gnu screen is |
1224 | -available it will automatically use gnu screen. This means that if |
1225 | -e.g. the network connection is dropping just running the upgrader |
1226 | -again will just reconnect to the running upgrade. |
1227 | |
1228 | === renamed file 'README.dist-upgrade' => 'README' |
1229 | === removed file 'TODO' |
1230 | --- TODO 2007-07-31 10:55:22 +0000 |
1231 | +++ TODO 1970-01-01 00:00:00 +0000 |
1232 | @@ -1,22 +0,0 @@ |
1233 | -* offer removal of no-longer-supported apps |
1234 | -* improve countrymirror detection |
1235 | - |
1236 | - |
1237 | -UpdateManager.Common.aptsources.py: |
1238 | -- make the distro detection in sources.list more clever by using the |
1239 | - origin informaton to avoid adding full uris to (unofficial/internal) |
1240 | - mirrors |
1241 | -- make it possible to inherit the mirrros from a ParentSuite (for |
1242 | - the childs) |
1243 | - |
1244 | -Misc: |
1245 | -- have a common error dialog readymade and rib out all those |
1246 | - GtkMessageDialogs |
1247 | -- add download size to treeview |
1248 | -- add /etc/apt/software-properties.d dir where the user can |
1249 | - install matchers and templates |
1250 | -- handle cases like "deb http://bla/ dist sec1 sec2 # comment" |
1251 | -- rework the add channel/cdrom dialogs |
1252 | -- d'n'd for key files |
1253 | -- use one row per section and not one per channel in the treeview |
1254 | -- sort the sources by dist |
1255 | |
1256 | === removed directory 'UpdateManager' |
1257 | === removed file 'UpdateManager/ChangelogViewer.py' |
1258 | --- UpdateManager/ChangelogViewer.py 2012-06-11 16:17:31 +0000 |
1259 | +++ UpdateManager/ChangelogViewer.py 1970-01-01 00:00:00 +0000 |
1260 | @@ -1,283 +0,0 @@ |
1261 | -# ReleaseNotesViewer.py |
1262 | -# |
1263 | -# Copyright (c) 2006 Sebastian Heinlein |
1264 | -# 2007 Canonical |
1265 | -# |
1266 | -# Author: Sebastian Heinlein <sebastian.heinlein@web.de> |
1267 | -# Michael Vogt <michael.vogt@ubuntu.com> |
1268 | -# |
1269 | -# This modul provides an inheritance of the Gtk.TextView that is |
1270 | -# aware of http URLs and allows to open them in a browser. |
1271 | -# It is based on the pygtk-demo "hypertext". |
1272 | -# |
1273 | -# This program is free software; you can redistribute it and/or |
1274 | -# modify it under the terms of the GNU General Public License as |
1275 | -# published by the Free Software Foundation; either version 2 of the |
1276 | -# License, or (at your option) any later version. |
1277 | -# |
1278 | -# This program is distributed in the hope that it will be useful, |
1279 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1280 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1281 | -# GNU General Public License for more details. |
1282 | -# |
1283 | -# You should have received a copy of the GNU General Public License |
1284 | -# along with this program; if not, write to the Free Software |
1285 | -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
1286 | -# USA |
1287 | - |
1288 | - |
1289 | -from __future__ import absolute_import |
1290 | - |
1291 | -from gi.repository import Gtk |
1292 | -from gi.repository import Gdk |
1293 | -from gi.repository import GObject |
1294 | -from gi.repository import Pango |
1295 | -from gettext import gettext as _ |
1296 | - |
1297 | -from .ReleaseNotesViewer import open_url |
1298 | - |
1299 | -class ChangelogViewer(Gtk.TextView): |
1300 | - def __init__(self, changelog=None): |
1301 | - """Init the ChangelogViewer as an Inheritance of the Gtk.TextView""" |
1302 | - # init the parent |
1303 | - GObject.GObject.__init__(self) |
1304 | - # global hovering over link state |
1305 | - self.hovering = False |
1306 | - self.first = True |
1307 | - # setup the buffer and signals |
1308 | - self.set_property("editable", False) |
1309 | - self.set_cursor_visible(False) |
1310 | - # set some margin |
1311 | - self.set_right_margin(4) |
1312 | - self.set_left_margin(4) |
1313 | - self.set_pixels_above_lines(4) |
1314 | - self.buffer = Gtk.TextBuffer() |
1315 | - self.set_buffer(self.buffer) |
1316 | - self.connect("button-press-event", self.button_press_event) |
1317 | - self.connect("motion-notify-event", self.motion_notify_event) |
1318 | - self.connect("visibility-notify-event", self.visibility_notify_event) |
1319 | - #self.buffer.connect("changed", self.search_links) |
1320 | - self.buffer.connect_after("insert-text", self.on_insert_text) |
1321 | - # search for links in the changelog and make them clickable |
1322 | - if changelog != None: |
1323 | - self.buffer.set_text(changelog) |
1324 | - |
1325 | - def create_context_menu(self, url): |
1326 | - """Create the context menu to be displayed when links are right clicked""" |
1327 | - self.menu = Gtk.Menu() |
1328 | - |
1329 | - # create menu items |
1330 | - item_grey_link = Gtk.MenuItem() |
1331 | - item_grey_link.set_label(url) |
1332 | - item_grey_link.connect("activate", self.handle_context_menu, "open", url) |
1333 | - item_seperator = Gtk.MenuItem() |
1334 | - item_open_link = Gtk.MenuItem() |
1335 | - item_open_link.set_label(_("Open Link in Browser")) |
1336 | - item_open_link.connect("activate", self.handle_context_menu, "open", url) |
1337 | - item_copy_link = Gtk.MenuItem() |
1338 | - item_copy_link.set_label(_("Copy Link to Clipboard")) |
1339 | - item_copy_link.connect("activate", self.handle_context_menu, "copy", url) |
1340 | - |
1341 | - # add menu items |
1342 | - self.menu.add(item_grey_link) |
1343 | - self.menu.add(item_seperator) |
1344 | - self.menu.add(item_open_link) |
1345 | - self.menu.add(item_copy_link) |
1346 | - self.menu.show_all() |
1347 | - |
1348 | - def handle_context_menu(self, menuitem, action, url): |
1349 | - """Handle activate event for the links' context menu""" |
1350 | - if action == "open": |
1351 | - open_url(url) |
1352 | - if action == "copy": |
1353 | - # the following two lines used to be enough - then gtk3/pygi |
1354 | - # came along ... |
1355 | - #cb = Gtk.Clipboard() |
1356 | - #cb.set_text(url) |
1357 | - display = Gdk.Display.get_default() |
1358 | - selection = Gdk.Atom.intern ("CLIPBOARD", False) |
1359 | - cb = Gtk.Clipboard.get_for_display(display, selection) |
1360 | - cb.set_text(url, -1) |
1361 | - cb.store() |
1362 | - |
1363 | - def tag_link(self, start, end, url): |
1364 | - """Apply the tag that marks links to the specified buffer selection""" |
1365 | - tags = start.get_tags() |
1366 | - for tag in tags: |
1367 | - url = getattr(tag, "url", None) |
1368 | - if url != "": |
1369 | - return |
1370 | - tag = self.buffer.create_tag(None, foreground="blue", |
1371 | - underline=Pango.Underline.SINGLE) |
1372 | - tag.url = url |
1373 | - self.buffer.apply_tag(tag , start, end) |
1374 | - |
1375 | - def on_insert_text(self, buffer, iter_end, text, *args): |
1376 | - """Search for http URLs in newly inserted text |
1377 | - and tag them accordingly""" |
1378 | - |
1379 | - # some convenient urls |
1380 | - MALONE = "https://launchpad.net/bugs/" |
1381 | - DEBIAN = "http://bugs.debian.org/" |
1382 | - CVE = "http://cve.mitre.org/cgi-bin/cvename.cgi?name=" |
1383 | - # some convinient end-markers |
1384 | - ws = [" ","\t","\n"] |
1385 | - brak = [")","]",">"] |
1386 | - punct = [",","!",":"] |
1387 | - dot = ["."]+punct |
1388 | - dot_cr = [".\n"] |
1389 | - |
1390 | - # search items are start-str, list-of-end-strs, url-prefix |
1391 | - # a lot of this search is "TEH SUCK"(tm) because of limitations |
1392 | - # in iter.forward_search() |
1393 | - # - i.e. no insensitive searching, no regexp |
1394 | - search_items = [ ("http://", ws+brak+punct+dot_cr, "http://"), |
1395 | - ("LP#", ws+brak+dot, MALONE), |
1396 | - ("LP: #", ws+brak+dot, MALONE), |
1397 | - ("lp: #", ws+brak+dot, MALONE), |
1398 | - ("LP:#", ws+brak+dot, MALONE), |
1399 | - ("Malone: #", ws+brak+dot, MALONE), |
1400 | - ("Malone:#", ws+brak+dot, MALONE), |
1401 | - ("Ubuntu: #", ws+brak+dot, MALONE), |
1402 | - ("Ubuntu:#", ws+brak+dot, MALONE), |
1403 | - ("Closes: #",ws+brak+dot, DEBIAN), |
1404 | - ("Closes:#",ws+brak+dot, DEBIAN), |
1405 | - ("closes:#",ws+brak+dot, DEBIAN), |
1406 | - ("closes: #",ws+brak+dot, DEBIAN), |
1407 | - ("CVE-", ws+brak+dot, CVE), |
1408 | - ] |
1409 | - # init |
1410 | - iter = buffer.get_iter_at_offset(iter_end.get_offset() - len(text)) |
1411 | - |
1412 | - # search for the next match in the buffer |
1413 | - for (start_str, end_list, url_prefix) in search_items: |
1414 | - while True: |
1415 | - ret = iter.forward_search(start_str, |
1416 | - Gtk.TextSearchFlags.VISIBLE_ONLY, |
1417 | - iter_end) |
1418 | - # if we reach the end break the loop |
1419 | - if not ret: |
1420 | - break |
1421 | - # get the position of the protocol prefix |
1422 | - (match_start, match_end) = ret |
1423 | - match_suffix = match_end.copy() |
1424 | - match_tmp = match_end.copy() |
1425 | - while True: |
1426 | - # extend the selection to the complete search item |
1427 | - if match_tmp.forward_char(): |
1428 | - text = match_end.get_text(match_tmp) |
1429 | - if text in end_list: |
1430 | - break |
1431 | - # move one char futher to get two char |
1432 | - # end-markers (and back later) LP: #396393 |
1433 | - match_tmp.forward_char() |
1434 | - text = match_end.get_text(match_tmp) |
1435 | - if text in end_list: |
1436 | - break |
1437 | - match_tmp.backward_char() |
1438 | - else: |
1439 | - break |
1440 | - match_end = match_tmp.copy() |
1441 | - |
1442 | - # call the tagging method for the complete URL |
1443 | - url = url_prefix + match_suffix.get_text(match_end) |
1444 | - |
1445 | - self.tag_link(match_start, match_end, url) |
1446 | - # set the starting point for the next search |
1447 | - iter = match_end |
1448 | - |
1449 | - def button_press_event(self, text_view, event): |
1450 | - """callback for mouse click events""" |
1451 | - # we only react on left or right mouse clicks |
1452 | - if event.button != 1 and event.button != 3: |
1453 | - return False |
1454 | - |
1455 | - # try to get a selection |
1456 | - try: |
1457 | - (start, end) = self.buffer.get_selection_bounds() |
1458 | - except ValueError: |
1459 | - pass |
1460 | - else: |
1461 | - if start.get_offset() != end.get_offset(): |
1462 | - return False |
1463 | - |
1464 | - # get the iter at the mouse position |
1465 | - (x, y) = self.window_to_buffer_coords(Gtk.TextWindowType.WIDGET, |
1466 | - int(event.x), int(event.y)) |
1467 | - iter = self.get_iter_at_location(x, y) |
1468 | - |
1469 | - # call open_url or menu.popup if an URL is assigned to the iter |
1470 | - tags = iter.get_tags() |
1471 | - for tag in tags: |
1472 | - if hasattr(tag, "url"): |
1473 | - if event.button == 1: |
1474 | - open_url(tag.url) |
1475 | - break |
1476 | - if event.button == 3: |
1477 | - self.create_context_menu(tag.url) |
1478 | - self.menu.popup(None, None, None, None, event.button, event.time) |
1479 | - return True |
1480 | - |
1481 | - def motion_notify_event(self, text_view, event): |
1482 | - """callback for the mouse movement event, that calls the |
1483 | - check_hovering method with the mouse postition coordiantes""" |
1484 | - x, y = text_view.window_to_buffer_coords(Gtk.TextWindowType.WIDGET, |
1485 | - int(event.x), int(event.y)) |
1486 | - self.check_hovering(x, y) |
1487 | - self.get_window(Gtk.TextWindowType.TEXT).get_pointer() |
1488 | - return False |
1489 | - |
1490 | - def visibility_notify_event(self, text_view, event): |
1491 | - """callback if the widgets gets visible (e.g. moves to the foreground) |
1492 | - that calls the check_hovering method with the mouse position |
1493 | - coordinates""" |
1494 | - (screen, wx, wy, mod) = text_view.get_window(Gtk.TextWindowType.TEXT).get_pointer() |
1495 | - (bx, by) = text_view.window_to_buffer_coords(Gtk.TextWindowType.WIDGET, wx, |
1496 | - wy) |
1497 | - self.check_hovering(bx, by) |
1498 | - return False |
1499 | - |
1500 | - def check_hovering(self, x, y): |
1501 | - """Check if the mouse is above a tagged link and if yes show |
1502 | - a hand cursor""" |
1503 | - _hovering = False |
1504 | - # get the iter at the mouse position |
1505 | - iter = self.get_iter_at_location(x, y) |
1506 | - |
1507 | - # set _hovering if the iter has the tag "url" |
1508 | - tags = iter.get_tags() |
1509 | - for tag in tags: |
1510 | - if hasattr(tag, "url"): |
1511 | - _hovering = True |
1512 | - break |
1513 | - |
1514 | - # change the global hovering state |
1515 | - if _hovering != self.hovering or self.first == True: |
1516 | - self.first = False |
1517 | - self.hovering = _hovering |
1518 | - # Set the appropriate cursur icon |
1519 | - if self.hovering: |
1520 | - self.get_window(Gtk.TextWindowType.TEXT).\ |
1521 | - set_cursor(Gdk.Cursor.new(Gdk.CursorType.HAND2)) |
1522 | - else: |
1523 | - self.get_window(Gtk.TextWindowType.TEXT).\ |
1524 | - set_cursor(Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR)) |
1525 | - |
1526 | - |
1527 | -if __name__ == "__main__": |
1528 | - w = Gtk.Window() |
1529 | - cv = ChangelogViewer() |
1530 | - changes = cv.get_buffer() |
1531 | - changes.create_tag("versiontag", weight=Pango.Weight.BOLD) |
1532 | - changes.set_text(""" |
1533 | - |
1534 | -Version 6-14-0ubuntu1.9.04: |
1535 | - |
1536 | - * New upstream version. LP: #382918. |
1537 | - Release notes at http://java.sun.com/javase/6/webnotes/ReleaseNotes.html. |
1538 | - |
1539 | -""") |
1540 | - |
1541 | - w.add(cv) |
1542 | - w.show_all() |
1543 | - Gtk.main() |
1544 | |
1545 | === removed directory 'UpdateManager/Core' |
1546 | === removed file 'UpdateManager/Core/AlertWatcher.py' |
1547 | --- UpdateManager/Core/AlertWatcher.py 2012-05-01 14:01:29 +0000 |
1548 | +++ UpdateManager/Core/AlertWatcher.py 1970-01-01 00:00:00 +0000 |
1549 | @@ -1,96 +0,0 @@ |
1550 | -# AlertWatcher.py |
1551 | -# |
1552 | -# Copyright (c) 2010 Mohamed Amine IL Idrissi |
1553 | -# |
1554 | -# Author: Mohamed Amine IL Idrissi <ilidrissiamine@gmail.com> |
1555 | -# |
1556 | -# This program is free software; you can redistribute it and/or |
1557 | -# modify it under the terms of the GNU General Public License as |
1558 | -# published by the Free Software Foundation; either version 2 of the |
1559 | -# License, or (at your option) any later version. |
1560 | -# |
1561 | -# This program is distributed in the hope that it will be useful, |
1562 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1563 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1564 | -# GNU General Public License for more details. |
1565 | -# |
1566 | -# You should have received a copy of the GNU General Public License |
1567 | -# along with this program; if not, write to the Free Software |
1568 | -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
1569 | -# USA |
1570 | - |
1571 | -from __future__ import absolute_import |
1572 | - |
1573 | -from gi.repository import GObject |
1574 | -import dbus |
1575 | -from dbus.mainloop.glib import DBusGMainLoop |
1576 | - |
1577 | -class AlertWatcher(GObject.GObject): |
1578 | - """ a class that checks for alerts and reports them, like a battery |
1579 | - or network warning """ |
1580 | - |
1581 | - __gsignals__ = {"network-alert": (GObject.SignalFlags.RUN_FIRST, |
1582 | - None, |
1583 | - (GObject.TYPE_INT,)), |
1584 | - "battery-alert": (GObject.SignalFlags.RUN_FIRST, |
1585 | - None, |
1586 | - (GObject.TYPE_BOOLEAN,)), |
1587 | - "network-3g-alert": (GObject.SignalFlags.RUN_FIRST, |
1588 | - None, |
1589 | - (GObject.TYPE_BOOLEAN, |
1590 | - GObject.TYPE_BOOLEAN,)), |
1591 | - } |
1592 | - |
1593 | - def __init__(self): |
1594 | - GObject.GObject.__init__(self) |
1595 | - DBusGMainLoop(set_as_default=True) |
1596 | - self.bus = dbus.Bus(dbus.Bus.TYPE_SYSTEM) |
1597 | - self.network_state = 3 # make it always connected if NM isn't available |
1598 | - |
1599 | - def check_alert_state(self): |
1600 | - try: |
1601 | - obj = self.bus.get_object("org.freedesktop.NetworkManager", |
1602 | - "/org/freedesktop/NetworkManager") |
1603 | - obj.connect_to_signal("StateChanged", |
1604 | - self._on_network_state_changed, |
1605 | - dbus_interface="org.freedesktop.NetworkManager") |
1606 | - interface = dbus.Interface(obj, "org.freedesktop.DBus.Properties") |
1607 | - self.network_state = interface.Get("org.freedesktop.NetworkManager", "State") |
1608 | - self._network_alert(self.network_state) |
1609 | - # power |
1610 | - obj = self.bus.get_object('org.freedesktop.UPower', |
1611 | - '/org/freedesktop/UPower') |
1612 | - obj.connect_to_signal("Changed", self._power_changed, |
1613 | - dbus_interface="org.freedesktop.UPower") |
1614 | - self._power_changed() |
1615 | - # 3g |
1616 | - self._update_3g_state() |
1617 | - except dbus.exceptions.DBusException: |
1618 | - pass |
1619 | - |
1620 | - def _on_network_state_changed(self, state): |
1621 | - self._network_alert(state) |
1622 | - self._update_3g_state() |
1623 | - |
1624 | - def _update_3g_state(self): |
1625 | - from .roam import NetworkManagerHelper |
1626 | - nm = NetworkManagerHelper() |
1627 | - on_3g = nm.is_active_connection_gsm_or_cdma() |
1628 | - is_roaming = nm.is_active_connection_gsm_or_cdma_roaming() |
1629 | - self._network_3g_alert(on_3g, is_roaming) |
1630 | - |
1631 | - def _network_3g_alert(self, on_3g, is_roaming): |
1632 | - self.emit("network-3g-alert", on_3g, is_roaming) |
1633 | - |
1634 | - def _network_alert(self, state): |
1635 | - self.network_state = state |
1636 | - self.emit("network-alert", state) |
1637 | - |
1638 | - def _power_changed(self): |
1639 | - obj = self.bus.get_object("org.freedesktop.UPower", \ |
1640 | - "/org/freedesktop/UPower") |
1641 | - interface = dbus.Interface(obj, "org.freedesktop.DBus.Properties") |
1642 | - on_battery = interface.Get("org.freedesktop.UPower", "OnBattery") |
1643 | - self.emit("battery-alert", on_battery) |
1644 | - |
1645 | - |
1646 | |
1647 | === removed file 'UpdateManager/Core/DistUpgradeFetcherCore.py' |
1648 | --- UpdateManager/Core/DistUpgradeFetcherCore.py 2012-05-28 10:20:51 +0000 |
1649 | +++ UpdateManager/Core/DistUpgradeFetcherCore.py 1970-01-01 00:00:00 +0000 |
1650 | @@ -1,313 +0,0 @@ |
1651 | -# DistUpgradeFetcherCore.py |
1652 | -# |
1653 | -# Copyright (c) 2006 Canonical |
1654 | -# |
1655 | -# Author: Michael Vogt <michael.vogt@ubuntu.com> |
1656 | -# |
1657 | -# This program is free software; you can redistribute it and/or |
1658 | -# modify it under the terms of the GNU General Public License as |
1659 | -# published by the Free Software Foundation; either version 2 of the |
1660 | -# License, or (at your option) any later version. |
1661 | -# |
1662 | -# This program is distributed in the hope that it will be useful, |
1663 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1664 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1665 | -# GNU General Public License for more details. |
1666 | -# |
1667 | -# You should have received a copy of the GNU General Public License |
1668 | -# along with this program; if not, write to the Free Software |
1669 | -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
1670 | -# USA |
1671 | - |
1672 | -from __future__ import absolute_import, print_function |
1673 | - |
1674 | -from string import Template |
1675 | -import os |
1676 | -import apt_pkg |
1677 | -import logging |
1678 | -import tarfile |
1679 | -import tempfile |
1680 | -import shutil |
1681 | -import sys |
1682 | -import subprocess |
1683 | -from gettext import gettext as _ |
1684 | -from aptsources.sourceslist import SourcesList |
1685 | - |
1686 | -from .utils import get_dist, url_downloadable, country_mirror |
1687 | - |
1688 | -class DistUpgradeFetcherCore(object): |
1689 | - " base class (without GUI) for the upgrade fetcher " |
1690 | - |
1691 | - DEFAULT_MIRROR="http://archive.ubuntu.com/ubuntu" |
1692 | - DEFAULT_COMPONENT="main" |
1693 | - DEBUG = "DEBUG_UPDATE_MANAGER" in os.environ |
1694 | - |
1695 | - def __init__(self, new_dist, progress): |
1696 | - self.new_dist = new_dist |
1697 | - self.current_dist_name = get_dist() |
1698 | - self._progress = progress |
1699 | - # options to pass to the release upgrader when it is run |
1700 | - self.run_options = [] |
1701 | - |
1702 | - def _debug(self, msg): |
1703 | - " helper to show debug information " |
1704 | - if self.DEBUG: |
1705 | - sys.stderr.write(msg+"\n") |
1706 | - |
1707 | - def showReleaseNotes(self): |
1708 | - return True |
1709 | - |
1710 | - def error(self, summary, message): |
1711 | - """ dummy implementation for error display, should be overwriten |
1712 | - by subclasses that want to more fancy method |
1713 | - """ |
1714 | - print(summary) |
1715 | - print(message) |
1716 | - return False |
1717 | - |
1718 | - def authenticate(self): |
1719 | - if self.new_dist.upgradeToolSig: |
1720 | - f = self.tmpdir+"/"+os.path.basename(self.new_dist.upgradeTool) |
1721 | - sig = self.tmpdir+"/"+os.path.basename(self.new_dist.upgradeToolSig) |
1722 | - print(_("authenticate '%(file)s' against '%(signature)s' ") % { |
1723 | - 'file' : os.path.basename(f), |
1724 | - 'signature' : os.path.basename(sig)}) |
1725 | - if self.gpgauthenticate(f, sig): |
1726 | - return True |
1727 | - return False |
1728 | - |
1729 | - def gpgauthenticate(self, file, signature, |
1730 | - keyring='/etc/apt/trusted.gpg'): |
1731 | - """ authenticated a file against a given signature, if no keyring |
1732 | - is given use the apt default keyring |
1733 | - """ |
1734 | - status_pipe = os.pipe() |
1735 | - logger_pipe = os.pipe() |
1736 | - gpg = [ |
1737 | - "gpg", |
1738 | - "--status-fd", "%d" % status_pipe[1], |
1739 | - "--logger-fd", "%d" % logger_pipe[1], |
1740 | - "--no-options", |
1741 | - "--homedir", self.tmpdir, |
1742 | - "--no-default-keyring", |
1743 | - "--ignore-time-conflict", |
1744 | - "--keyring", keyring, |
1745 | - "--verify", signature, file, |
1746 | - ] |
1747 | - def gpg_preexec(): |
1748 | - os.close(status_pipe[0]) |
1749 | - os.close(logger_pipe[0]) |
1750 | - proc = subprocess.Popen( |
1751 | - gpg, stderr=subprocess.PIPE, preexec_fn=gpg_preexec, |
1752 | - close_fds=False, universal_newlines=True) |
1753 | - os.close(status_pipe[1]) |
1754 | - os.close(logger_pipe[1]) |
1755 | - status_handle = os.fdopen(status_pipe[0]) |
1756 | - logger_handle = os.fdopen(logger_pipe[0]) |
1757 | - try: |
1758 | - gpgres = status_handle.read() |
1759 | - ret = proc.wait() |
1760 | - if ret != 0: |
1761 | - # gnupg returned a problem (non-zero exit) |
1762 | - print("gpg exited %d" % ret) |
1763 | - print("Debug information: ") |
1764 | - print(status_handle.read()) |
1765 | - print(proc.stderr.read()) |
1766 | - print(logger_handle.read()) |
1767 | - return False |
1768 | - if "VALIDSIG" in gpgres: |
1769 | - return True |
1770 | - print("invalid result from gpg:") |
1771 | - print(gpgres) |
1772 | - return False |
1773 | - finally: |
1774 | - status_handle.close() |
1775 | - proc.stderr.close() |
1776 | - logger_handle.close() |
1777 | - |
1778 | - def extractDistUpgrader(self): |
1779 | - # extract the tarbal |
1780 | - fname = os.path.join(self.tmpdir,os.path.basename(self.uri)) |
1781 | - print(_("extracting '%s'") % os.path.basename(fname)) |
1782 | - if not os.path.exists(fname): |
1783 | - return False |
1784 | - try: |
1785 | - tar = tarfile.open(self.tmpdir+"/"+os.path.basename(self.uri),"r") |
1786 | - for tarinfo in tar: |
1787 | - tar.extract(tarinfo) |
1788 | - tar.close() |
1789 | - except tarfile.ReadError as e: |
1790 | - logging.error("failed to open tarfile (%s)" % e) |
1791 | - return False |
1792 | - return True |
1793 | - |
1794 | - def verifyDistUprader(self): |
1795 | - # FIXME: check a internal dependency file to make sure |
1796 | - # that the script will run correctly |
1797 | - |
1798 | - # see if we have a script file that we can run |
1799 | - self.script = script = "%s/%s" % (self.tmpdir, self.new_dist.name) |
1800 | - if not os.path.exists(script): |
1801 | - return self.error(_("Could not run the upgrade tool"), |
1802 | - _("Could not run the upgrade tool") + ". " + _("This is most likely a bug in the upgrade tool. " |
1803 | - "Please report it as a bug using the command 'ubuntu-bug update-manager'.")) |
1804 | - return True |
1805 | - |
1806 | - def mirror_from_sources_list(self, uri, default_uri): |
1807 | - """ |
1808 | - try to figure what the mirror is from current sources.list |
1809 | - |
1810 | - do this by looing for matching DEFAULT_COMPONENT, current dist |
1811 | - in sources.list and then doing a http HEAD/ftp size request |
1812 | - to see if the uri is available on this server |
1813 | - """ |
1814 | - self._debug("mirror_from_sources_list: %s" % self.current_dist_name) |
1815 | - sources = SourcesList(withMatcher=False) |
1816 | - seen = set() |
1817 | - for e in sources.list: |
1818 | - if e.disabled or e.invalid or not e.type == "deb": |
1819 | - continue |
1820 | - # check if we probed this mirror already |
1821 | - if e.uri in seen: |
1822 | - continue |
1823 | - # we are using the main mirror already, so we are fine |
1824 | - if (e.uri.startswith(default_uri) and |
1825 | - e.dist == self.current_dist_name and |
1826 | - self.DEFAULT_COMPONENT in e.comps): |
1827 | - return uri |
1828 | - elif (e.dist == self.current_dist_name and |
1829 | - "main" in e.comps): |
1830 | - mirror_uri = e.uri+uri[len(default_uri):] |
1831 | - if url_downloadable(mirror_uri, self._debug): |
1832 | - return mirror_uri |
1833 | - seen.add(e.uri) |
1834 | - self._debug("no mirror found") |
1835 | - return "" |
1836 | - |
1837 | - def _expandUri(self, uri): |
1838 | - """ |
1839 | - expand the uri so that it uses a mirror if the url starts |
1840 | - with a well know string (like archive.ubuntu.com) |
1841 | - """ |
1842 | - # try to guess the mirror from the sources.list |
1843 | - if uri.startswith(self.DEFAULT_MIRROR): |
1844 | - self._debug("trying to find suitable mirror") |
1845 | - new_uri = self.mirror_from_sources_list(uri, self.DEFAULT_MIRROR) |
1846 | - if new_uri: |
1847 | - return new_uri |
1848 | - # if that fails, use old method |
1849 | - uri_template = Template(uri) |
1850 | - m = country_mirror() |
1851 | - new_uri = uri_template.safe_substitute(countrymirror=m) |
1852 | - # be paranoid and check if the given uri is really downloadable |
1853 | - try: |
1854 | - if not url_downloadable(new_uri, self._debug): |
1855 | - raise Exception("failed to download %s" % new_uri) |
1856 | - except Exception as e: |
1857 | - self._debug("url '%s' could not be downloaded" % e) |
1858 | - # else fallback to main server |
1859 | - new_uri = uri_template.safe_substitute(countrymirror='') |
1860 | - return new_uri |
1861 | - |
1862 | - def fetchDistUpgrader(self): |
1863 | - " download the tarball with the upgrade script " |
1864 | - self.tmpdir = tmpdir = tempfile.mkdtemp(prefix="update-manager-") |
1865 | - os.chdir(tmpdir) |
1866 | - logging.debug("using tmpdir: '%s'" % tmpdir) |
1867 | - # turn debugging on here (if required) |
1868 | - if self.DEBUG > 0: |
1869 | - apt_pkg.config.set("Debug::Acquire::http","1") |
1870 | - apt_pkg.config.set("Debug::Acquire::ftp","1") |
1871 | - #os.listdir(tmpdir) |
1872 | - fetcher = apt_pkg.Acquire(self._progress) |
1873 | - if self.new_dist.upgradeToolSig != None: |
1874 | - uri = self._expandUri(self.new_dist.upgradeToolSig) |
1875 | - af1 = apt_pkg.AcquireFile(fetcher, |
1876 | - uri, |
1877 | - descr=_("Upgrade tool signature")) |
1878 | - # reference it here to shut pyflakes up |
1879 | - af1 |
1880 | - if self.new_dist.upgradeTool != None: |
1881 | - self.uri = self._expandUri(self.new_dist.upgradeTool) |
1882 | - af2 = apt_pkg.AcquireFile(fetcher, |
1883 | - self.uri, |
1884 | - descr=_("Upgrade tool")) |
1885 | - # reference it here to shut pyflakes up |
1886 | - af2 |
1887 | - result = fetcher.run() |
1888 | - if result != fetcher.RESULT_CONTINUE: |
1889 | - logging.warn("fetch result != continue (%s)" % result) |
1890 | - return False |
1891 | - # check that both files are really there and non-null |
1892 | - for f in [os.path.basename(self.new_dist.upgradeToolSig), |
1893 | - os.path.basename(self.new_dist.upgradeTool)]: |
1894 | - if not (os.path.exists(f) and os.path.getsize(f) > 0): |
1895 | - logging.warn("file '%s' missing" % f) |
1896 | - return False |
1897 | - return True |
1898 | - return False |
1899 | - |
1900 | - def runDistUpgrader(self): |
1901 | - args = [self.script]+self.run_options |
1902 | - if os.getuid() != 0: |
1903 | - os.execv("/usr/bin/sudo",["sudo"]+args) |
1904 | - else: |
1905 | - os.execv(self.script,args) |
1906 | - |
1907 | - def cleanup(self): |
1908 | - # cleanup |
1909 | - os.chdir("..") |
1910 | - # del tmpdir |
1911 | - shutil.rmtree(self.tmpdir) |
1912 | - |
1913 | - def run(self): |
1914 | - # see if we have release notes |
1915 | - if not self.showReleaseNotes(): |
1916 | - return |
1917 | - if not self.fetchDistUpgrader(): |
1918 | - self.error(_("Failed to fetch"), |
1919 | - _("Fetching the upgrade failed. There may be a network " |
1920 | - "problem. ")) |
1921 | - return |
1922 | - if not self.authenticate(): |
1923 | - self.error(_("Authentication failed"), |
1924 | - _("Authenticating the upgrade failed. There may be a problem " |
1925 | - "with the network or with the server. ")) |
1926 | - self.cleanup() |
1927 | - return |
1928 | - if not self.extractDistUpgrader(): |
1929 | - self.error(_("Failed to extract"), |
1930 | - _("Extracting the upgrade failed. There may be a problem " |
1931 | - "with the network or with the server. ")) |
1932 | - |
1933 | - return |
1934 | - if not self.verifyDistUprader(): |
1935 | - self.error(_("Verification failed"), |
1936 | - _("Verifying the upgrade failed. There may be a problem " |
1937 | - "with the network or with the server. ")) |
1938 | - self.cleanup() |
1939 | - return |
1940 | - try: |
1941 | - # check if we can execute, if we run it via sudo we will |
1942 | - # not know otherwise, sudo/gksu will not raise a exception |
1943 | - if not os.access(self.script, os.X_OK): |
1944 | - ex = OSError("Can not execute '%s'" % self.script) |
1945 | - ex.errno = 13 |
1946 | - raise ex |
1947 | - self.runDistUpgrader() |
1948 | - except OSError as e: |
1949 | - if e.errno == 13: |
1950 | - self.error(_("Can not run the upgrade"), |
1951 | - _("This usually is caused by a system where /tmp " |
1952 | - "is mounted noexec. Please remount without " |
1953 | - "noexec and run the upgrade again.")) |
1954 | - return False |
1955 | - else: |
1956 | - self.error(_("Can not run the upgrade"), |
1957 | - _("The error message is '%s'.") % e.strerror) |
1958 | - return True |
1959 | - |
1960 | -if __name__ == "__main__": |
1961 | - d = DistUpgradeFetcherCore(None,None) |
1962 | -# print(d.authenticate('/tmp/Release','/tmp/Release.gpg')) |
1963 | - print("got mirror: '%s'" % d.mirror_from_sources_list("http://archive.ubuntu.com/ubuntu/dists/intrepid-proposed/main/dist-upgrader-all/0.93.34/intrepid.tar.gz", "http://archive.ubuntu.com/ubuntu")) |
1964 | |
1965 | === removed file 'UpdateManager/Core/MetaRelease.py' |
1966 | --- UpdateManager/Core/MetaRelease.py 2012-06-15 20:13:15 +0000 |
1967 | +++ UpdateManager/Core/MetaRelease.py 1970-01-01 00:00:00 +0000 |
1968 | @@ -1,350 +0,0 @@ |
1969 | -# MetaRelease.py |
1970 | -# |
1971 | -# Copyright (c) 2004,2005 Canonical |
1972 | -# |
1973 | -# Author: Michael Vogt <michael.vogt@ubuntu.com> |
1974 | -# |
1975 | -# This program is free software; you can redistribute it and/or |
1976 | -# modify it under the terms of the GNU General Public License as |
1977 | -# published by the Free Software Foundation; either version 2 of the |
1978 | -# License, or (at your option) any later version. |
1979 | -# |
1980 | -# This program is distributed in the hope that it will be useful, |
1981 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1982 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1983 | -# GNU General Public License for more details. |
1984 | -# |
1985 | -# You should have received a copy of the GNU General Public License |
1986 | -# along with this program; if not, write to the Free Software |
1987 | -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
1988 | -# USA |
1989 | - |
1990 | -from __future__ import absolute_import, print_function |
1991 | - |
1992 | -import apt_pkg |
1993 | -try: |
1994 | - import configparser |
1995 | -except ImportError: |
1996 | - import ConfigParser as configparser |
1997 | -try: |
1998 | - from http.client import BadStatusLine |
1999 | -except ImportError: |
2000 | - from httplib import BadStatusLine |
2001 | -import logging |
2002 | -import email.utils |
2003 | -import os |
2004 | -import sys |
2005 | -import time |
2006 | -import threading |
2007 | -try: |
2008 | - from urllib.request import Request, urlopen |
2009 | - from urllib.error import HTTPError, URLError |
2010 | -except ImportError: |
2011 | - from urllib2 import HTTPError, Request, URLError, urlopen |
2012 | - |
2013 | -from .utils import get_lang, get_dist, get_dist_version, get_ubuntu_flavor, get_ubuntu_flavor_name |
2014 | - |
2015 | -class Dist(object): |
2016 | - def __init__(self, name, version, date, supported): |
2017 | - self.name = name |
2018 | - self.version = version |
2019 | - self.date = date |
2020 | - self.supported = supported |
2021 | - self.releaseNotesURI = None |
2022 | - self.releaseNotesHtmlUri = None |
2023 | - self.upgradeTool = None |
2024 | - self.upgradeToolSig = None |
2025 | - # the server may report that the upgrade is broken currently |
2026 | - self.upgrade_broken = None |
2027 | - |
2028 | -class MetaReleaseCore(object): |
2029 | - """ |
2030 | - A MetaReleaseCore object astracts the list of released |
2031 | - distributions. |
2032 | - """ |
2033 | - |
2034 | - DEBUG = "DEBUG_UPDATE_MANAGER" in os.environ |
2035 | - |
2036 | - # some constants |
2037 | - CONF = "/etc/update-manager/release-upgrades" |
2038 | - CONF_METARELEASE = "/etc/update-manager/meta-release" |
2039 | - |
2040 | - def __init__(self, |
2041 | - useDevelopmentRelease=False, |
2042 | - useProposed=False, |
2043 | - forceLTS=False, |
2044 | - forceDownload=False): |
2045 | - self._debug("MetaRelease.__init__() useDevel=%s useProposed=%s" % (useDevelopmentRelease, useProposed)) |
2046 | - # force download instead of sending if-modified-since |
2047 | - self.forceDownload = forceDownload |
2048 | - # information about the available dists |
2049 | - self.downloading = True |
2050 | - self.upgradable_to = None |
2051 | - self.new_dist = None |
2052 | - self.flavor_name = get_ubuntu_flavor_name() |
2053 | - self.current_dist_name = get_dist() |
2054 | - self.current_dist_version = get_dist_version() |
2055 | - self.no_longer_supported = None |
2056 | - |
2057 | - # default (if the conf file is missing) |
2058 | - self.METARELEASE_URI = "http://changelogs.ubuntu.com/meta-release" |
2059 | - self.METARELEASE_URI_LTS = "http://changelogs.ubuntu.com/meta-release-lts" |
2060 | - self.METARELEASE_URI_UNSTABLE_POSTFIX = "-development" |
2061 | - self.METARELEASE_URI_PROPOSED_POSTFIX = "-development" |
2062 | - |
2063 | - # check the meta-release config first |
2064 | - parser = configparser.ConfigParser() |
2065 | - if os.path.exists(self.CONF_METARELEASE): |
2066 | - try: |
2067 | - parser.read(self.CONF_METARELEASE) |
2068 | - except configparser.Error as e: |
2069 | - sys.stderr.write("ERROR: failed to read '%s':\n%s" % ( |
2070 | - self.CONF_METARELEASE, e)) |
2071 | - return |
2072 | - # make changing the metarelease file and the location |
2073 | - # for the files easy |
2074 | - if parser.has_section("METARELEASE"): |
2075 | - sec = "METARELEASE" |
2076 | - for k in ["URI", |
2077 | - "URI_LTS", |
2078 | - "URI_UNSTABLE_POSTFIX", |
2079 | - "URI_PROPOSED_POSTFIX"]: |
2080 | - if parser.has_option(sec, k): |
2081 | - self._debug("%s: %s " % (self.CONF_METARELEASE, |
2082 | - parser.get(sec,k))) |
2083 | - setattr(self, "%s_%s" % (sec, k), parser.get(sec, k)) |
2084 | - |
2085 | - # check the config file first to figure if we want lts upgrades only |
2086 | - parser = configparser.ConfigParser() |
2087 | - if os.path.exists(self.CONF): |
2088 | - try: |
2089 | - parser.read(self.CONF) |
2090 | - except configparser.Error as e: |
2091 | - sys.stderr.write("ERROR: failed to read '%s':\n%s" % ( |
2092 | - self.CONF, e)) |
2093 | - return |
2094 | - # now check which specific url to use |
2095 | - if parser.has_option("DEFAULT","Prompt"): |
2096 | - type = parser.get("DEFAULT","Prompt").lower() |
2097 | - if (type == "never" or type == "no"): |
2098 | - # nothing to do for this object |
2099 | - # FIXME: what about no longer supported? |
2100 | - self.downloading = False |
2101 | - return |
2102 | - elif type == "lts": |
2103 | - self.METARELEASE_URI = self.METARELEASE_URI_LTS |
2104 | - # needed for the _tryUpgradeSelf() code in DistUpgradeController |
2105 | - if forceLTS: |
2106 | - self.METARELEASE_URI = self.METARELEASE_URI_LTS |
2107 | - # devel and proposed "just" change the postfix |
2108 | - if useDevelopmentRelease: |
2109 | - self.METARELEASE_URI += self.METARELEASE_URI_UNSTABLE_POSTFIX |
2110 | - elif useProposed: |
2111 | - self.METARELEASE_URI += self.METARELEASE_URI_PROPOSED_POSTFIX |
2112 | - |
2113 | - self._debug("metarelease-uri: %s" % self.METARELEASE_URI) |
2114 | - self.metarelease_information = None |
2115 | - if not self._buildMetaReleaseFile(): |
2116 | - self._debug("_buildMetaReleaseFile failed") |
2117 | - return |
2118 | - # we start the download thread here and we have a timeout |
2119 | - threading.Thread(target=self.download).start() |
2120 | - #threading.Thread(target=self.check).start() |
2121 | - |
2122 | - def _buildMetaReleaseFile(self): |
2123 | - # build the metarelease_file name |
2124 | - self.METARELEASE_FILE = os.path.join("/var/lib/update-manager/", |
2125 | - os.path.basename(self.METARELEASE_URI)) |
2126 | - # check if we can write to the global location, if not, |
2127 | - # write to homedir |
2128 | - try: |
2129 | - open(self.METARELEASE_FILE,"a") |
2130 | - except IOError as e: |
2131 | - cache_dir = os.getenv( |
2132 | - "XDG_CACHE_HOME", os.path.expanduser("~/.cache")) |
2133 | - path = os.path.join(cache_dir, 'update-manager-core') |
2134 | - if not os.path.exists(path): |
2135 | - try: |
2136 | - os.mkdir(path) |
2137 | - except OSError as e: |
2138 | - sys.stderr.write("mkdir() failed: '%s'" % e) |
2139 | - return False |
2140 | - self.METARELEASE_FILE = os.path.join(path,os.path.basename(self.METARELEASE_URI)) |
2141 | - # if it is empty, remove it to avoid I-M-S hits on empty file |
2142 | - try: |
2143 | - if os.path.getsize(self.METARELEASE_FILE) == 0: |
2144 | - os.unlink(self.METARELEASE_FILE) |
2145 | - except Exception as e: |
2146 | - pass |
2147 | - return True |
2148 | - |
2149 | - def dist_no_longer_supported(self, dist): |
2150 | - """ virtual function that is called when the distro is no longer |
2151 | - supported |
2152 | - """ |
2153 | - self.no_longer_supported = dist |
2154 | - def new_dist_available(self, dist): |
2155 | - """ virtual function that is called when a new distro release |
2156 | - is available |
2157 | - """ |
2158 | - self.new_dist = dist |
2159 | - |
2160 | - def parse(self): |
2161 | - self._debug("MetaRelease.parse()") |
2162 | - current_dist_name = self.current_dist_name |
2163 | - self._debug("current dist name: '%s'" % current_dist_name) |
2164 | - current_dist = None |
2165 | - dists = [] |
2166 | - |
2167 | - # parse the metarelease_information file |
2168 | - index_tag = apt_pkg.TagFile(self.metarelease_information) |
2169 | - step_result = index_tag.step() |
2170 | - while step_result: |
2171 | - if "Dist" in index_tag.section: |
2172 | - name = index_tag.section["Dist"] |
2173 | - self._debug("found distro name: '%s'" % name) |
2174 | - rawdate = index_tag.section["Date"] |
2175 | - parseddate = list(email.utils.parsedate(rawdate)) |
2176 | - parseddate[8] = 0 # assume no DST |
2177 | - date = time.mktime(tuple(parseddate)) |
2178 | - supported = int(index_tag.section["Supported"]) |
2179 | - version = index_tag.section["Version"] |
2180 | - # add the information to a new date object |
2181 | - dist = Dist(name, version, date,supported) |
2182 | - if "ReleaseNotes" in index_tag.section: |
2183 | - dist.releaseNotesURI = index_tag.section["ReleaseNotes"] |
2184 | - lang = get_lang() |
2185 | - if lang: |
2186 | - dist.releaseNotesURI += "?lang=%s" % lang |
2187 | - if "ReleaseNotesHtml" in index_tag.section: |
2188 | - dist.releaseNotesHtmlUri = index_tag.section["ReleaseNotesHtml"] |
2189 | - query = self._get_release_notes_uri_query_string(dist) |
2190 | - if query: |
2191 | - dist.releaseNotesHtmlUri += query |
2192 | - if "UpgradeTool" in index_tag.section: |
2193 | - dist.upgradeTool = index_tag.section["UpgradeTool"] |
2194 | - if "UpgradeToolSignature" in index_tag.section: |
2195 | - dist.upgradeToolSig = index_tag.section["UpgradeToolSignature"] |
2196 | - if "UpgradeBroken" in index_tag.section: |
2197 | - dist.upgrade_broken = index_tag.section["UpgradeBroken"] |
2198 | - dists.append(dist) |
2199 | - if name == current_dist_name: |
2200 | - current_dist = dist |
2201 | - step_result = index_tag.step() |
2202 | - |
2203 | - # first check if the current runing distro is in the meta-release |
2204 | - # information. if not, we assume that we run on something not |
2205 | - # supported and silently return |
2206 | - if current_dist is None: |
2207 | - self._debug("current dist not found in meta-release file\n") |
2208 | - return False |
2209 | - |
2210 | - # then see what we can upgrade to |
2211 | - upgradable_to = "" |
2212 | - for dist in dists: |
2213 | - if dist.date > current_dist.date: |
2214 | - upgradable_to = dist |
2215 | - self._debug("new dist: %s" % upgradable_to) |
2216 | - break |
2217 | - |
2218 | - # only warn if unsupported and a new dist is available (because |
2219 | - # the development version is also unsupported) |
2220 | - if upgradable_to != "" and not current_dist.supported: |
2221 | - self.upgradable_to = upgradable_to |
2222 | - self.dist_no_longer_supported(current_dist) |
2223 | - if upgradable_to != "": |
2224 | - self.upgradable_to = upgradable_to |
2225 | - self.new_dist_available(upgradable_to) |
2226 | - |
2227 | - # parsing done and sucessfully |
2228 | - return True |
2229 | - |
2230 | - # the network thread that tries to fetch the meta-index file |
2231 | - # can't touch the gui, runs as a thread |
2232 | - def download(self): |
2233 | - self._debug("MetaRelease.download()") |
2234 | - lastmodified = 0 |
2235 | - req = Request(self.METARELEASE_URI) |
2236 | - # make sure that we always get the latest file (#107716) |
2237 | - req.add_header("Cache-Control", "No-Cache") |
2238 | - req.add_header("Pragma", "no-cache") |
2239 | - if os.access(self.METARELEASE_FILE, os.W_OK): |
2240 | - try: |
2241 | - lastmodified = os.stat(self.METARELEASE_FILE).st_mtime |
2242 | - except OSError as e: |
2243 | - pass |
2244 | - if lastmodified > 0 and not self.forceDownload: |
2245 | - req.add_header("If-Modified-Since", time.asctime(time.gmtime(lastmodified))) |
2246 | - try: |
2247 | - # open |
2248 | - uri=urlopen(req, timeout=20) |
2249 | - # sometime there is a root owned meta-relase file |
2250 | - # there, try to remove it so that we get it |
2251 | - # with proper permissions |
2252 | - if (os.path.exists(self.METARELEASE_FILE) and |
2253 | - not os.access(self.METARELEASE_FILE,os.W_OK)): |
2254 | - try: |
2255 | - os.unlink(self.METARELEASE_FILE) |
2256 | - except OSError as e: |
2257 | - print("Can't unlink '%s' (%s)" % (self.METARELEASE_FILE, e)) |
2258 | - # we may get exception here on e.g. disk full |
2259 | - try: |
2260 | - f=open(self.METARELEASE_FILE,"w+b") |
2261 | - for line in uri.readlines(): |
2262 | - f.write(line) |
2263 | - f.flush() |
2264 | - f.seek(0,0) |
2265 | - self.metarelease_information=f |
2266 | - except IOError as e: |
2267 | - pass |
2268 | - uri.close() |
2269 | - # http error |
2270 | - except HTTPError as e: |
2271 | - # mvo: only reuse local info on "not-modified" |
2272 | - if e.code == 304 and os.path.exists(self.METARELEASE_FILE): |
2273 | - self._debug("reading file '%s'" % self.METARELEASE_FILE) |
2274 | - self.metarelease_information=open(self.METARELEASE_FILE,"r") |
2275 | - else: |
2276 | - self._debug("result of meta-release download: '%s'" % e) |
2277 | - # generic network error |
2278 | - except (URLError, BadStatusLine) as e: |
2279 | - self._debug("result of meta-release download: '%s'" % e) |
2280 | - # now check the information we have |
2281 | - if self.metarelease_information != None: |
2282 | - self._debug("have self.metarelease_information") |
2283 | - try: |
2284 | - self.parse() |
2285 | - except: |
2286 | - logging.exception("parse failed for '%s'" % self.METARELEASE_FILE) |
2287 | - # no use keeping a broken file around |
2288 | - os.remove(self.METARELEASE_FILE) |
2289 | - # we don't want to keep a meta-release file around when it |
2290 | - # has a "Broken" flag, this ensures we are not bitten by |
2291 | - # I-M-S/cache issues |
2292 | - if self.new_dist and self.new_dist.upgrade_broken: |
2293 | - os.remove(self.METARELEASE_FILE) |
2294 | - else: |
2295 | - self._debug("NO self.metarelease_information") |
2296 | - self.downloading = False |
2297 | - |
2298 | - def _get_release_notes_uri_query_string(self, dist): |
2299 | - q = "?" |
2300 | - # get the lang |
2301 | - lang = get_lang() |
2302 | - if lang: |
2303 | - q += "lang=%s&" % lang |
2304 | - # get the os |
2305 | - os = get_ubuntu_flavor() |
2306 | - q += "os=%s&" % os |
2307 | - # get the version to upgrade to |
2308 | - q += "ver=%s" % dist.version |
2309 | - return q |
2310 | - |
2311 | - def _debug(self, msg): |
2312 | - if self.DEBUG: |
2313 | - sys.stderr.write(msg+"\n") |
2314 | - |
2315 | - |
2316 | -if __name__ == "__main__": |
2317 | - meta = MetaReleaseCore(False, False) |
2318 | - |
2319 | |
2320 | === removed file 'UpdateManager/Core/MyCache.py' |
2321 | --- UpdateManager/Core/MyCache.py 2012-06-12 01:40:26 +0000 |
2322 | +++ UpdateManager/Core/MyCache.py 1970-01-01 00:00:00 +0000 |
2323 | @@ -1,366 +0,0 @@ |
2324 | -# MyCache.py |
2325 | -# |
2326 | -# Copyright (c) 2004-2008 Canonical |
2327 | -# |
2328 | -# Author: Michael Vogt <mvo@debian.org> |
2329 | -# |
2330 | -# This program is free software; you can redistribute it and/or |
2331 | -# modify it under the terms of the GNU General Public License as |
2332 | -# published by the Free Software Foundation; either version 2 of the |
2333 | -# License, or (at your option) any later version. |
2334 | -# |
2335 | -# This program is distributed in the hope that it will be useful, |
2336 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2337 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2338 | -# GNU General Public License for more details. |
2339 | -# |
2340 | -# You should have received a copy of the GNU General Public License |
2341 | -# along with this program; if not, write to the Free Software |
2342 | -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
2343 | -# USA |
2344 | - |
2345 | -from __future__ import absolute_import, print_function |
2346 | - |
2347 | -import warnings |
2348 | -warnings.filterwarnings("ignore", "apt API not stable yet", FutureWarning) |
2349 | -import apt |
2350 | -import apt_pkg |
2351 | -import logging |
2352 | -import os |
2353 | -try: |
2354 | - from urllib.error import HTTPError |
2355 | - from urllib.request import urlopen |
2356 | - from urllib.parse import urlsplit |
2357 | -except ImportError: |
2358 | - from urllib2 import HTTPError, urlopen |
2359 | - from urlparse import urlsplit |
2360 | -try: |
2361 | - from http.client import BadStatusLine |
2362 | -except ImportError: |
2363 | - from httplib import BadStatusLine |
2364 | -import socket |
2365 | -import re |
2366 | -import DistUpgrade.DistUpgradeCache |
2367 | -from gettext import gettext as _ |
2368 | -from .UpdateList import UpdateOrigin |
2369 | - |
2370 | -SYNAPTIC_PINFILE = "/var/lib/synaptic/preferences" |
2371 | -CHANGELOGS_URI="http://changelogs.ubuntu.com/changelogs/pool/%s/%s/%s/%s_%s/%s" |
2372 | - |
2373 | -class HttpsChangelogsUnsupportedError(Exception): |
2374 | - """ https changelogs with credentials are unsupported because of the |
2375 | - lack of certitifcation validation in urllib2 which allows MITM |
2376 | - attacks to steal the credentials |
2377 | - """ |
2378 | - pass |
2379 | - |
2380 | -class MyCache(DistUpgrade.DistUpgradeCache.MyCache): |
2381 | - |
2382 | - CHANGELOG_ORIGIN = "Ubuntu" |
2383 | - |
2384 | - def __init__(self, progress, rootdir=None): |
2385 | - apt.Cache.__init__(self, progress, rootdir) |
2386 | - # raise if we have packages in reqreinst state |
2387 | - # and let the caller deal with that (runs partial upgrade) |
2388 | - assert len(self.req_reinstall_pkgs) == 0 |
2389 | - # check if the dpkg journal is ok (we need to do that here |
2390 | - # too because libapt will only do it when it tries to lock |
2391 | - # the packaging system) |
2392 | - assert(not self._dpkgJournalDirty()) |
2393 | - # init the regular cache |
2394 | - self._initDepCache() |
2395 | - self.all_changes = {} |
2396 | - self.all_news = {} |
2397 | - # on broken packages, try to fix via saveDistUpgrade() |
2398 | - if self._depcache.broken_count > 0: |
2399 | - self.saveDistUpgrade() |
2400 | - assert (self._depcache.broken_count == 0 and |
2401 | - self._depcache.del_count == 0) |
2402 | - |
2403 | - def _dpkgJournalDirty(self): |
2404 | - """ |
2405 | - test if the dpkg journal is dirty |
2406 | - (similar to debSystem::CheckUpdates) |
2407 | - """ |
2408 | - d = os.path.dirname( |
2409 | - apt_pkg.config.find_file("Dir::State::status"))+"/updates" |
2410 | - for f in os.listdir(d): |
2411 | - if re.match("[0-9]+", f): |
2412 | - return True |
2413 | - return False |
2414 | - |
2415 | - def _initDepCache(self): |
2416 | - #apt_pkg.config.set("Debug::pkgPolicy","1") |
2417 | - #self.depcache = apt_pkg.GetDepCache(self.cache) |
2418 | - #self._depcache = apt_pkg.GetDepCache(self._cache) |
2419 | - self._depcache.read_pinfile() |
2420 | - if os.path.exists(SYNAPTIC_PINFILE): |
2421 | - self._depcache.read_pinfile(SYNAPTIC_PINFILE) |
2422 | - self._depcache.init() |
2423 | - def clear(self): |
2424 | - self._initDepCache() |
2425 | - @property |
2426 | - def required_download(self): |
2427 | - """ get the size of the packages that are required to download """ |
2428 | - pm = apt_pkg.PackageManager(self._depcache) |
2429 | - fetcher = apt_pkg.Acquire() |
2430 | - pm.get_archives(fetcher, self._list, self._records) |
2431 | - return fetcher.fetch_needed |
2432 | - @property |
2433 | - def install_count(self): |
2434 | - return self._depcache.inst_count |
2435 | - def keep_count(self): |
2436 | - return self._depcache.keep_count |
2437 | - def saveDistUpgrade(self): |
2438 | - """ this functions mimics a upgrade but will never remove anything """ |
2439 | - #self._apply_dselect_upgrade() |
2440 | - self._depcache.upgrade(True) |
2441 | - wouldDelete = self._depcache.del_count |
2442 | - if self._depcache.del_count > 0: |
2443 | - self.clear() |
2444 | - assert self._depcache.broken_count == 0 and self._depcache.del_count == 0 |
2445 | - #self._apply_dselect_upgrade() |
2446 | - self._depcache.upgrade() |
2447 | - return wouldDelete |
2448 | - def match_package_origin(self, pkg, matcher): |
2449 | - """ match 'pkg' origin against 'matcher', take versions between |
2450 | - installed.version and candidate.version into account too |
2451 | - Useful if installed pkg A v1.0 is available in both |
2452 | - -updates (as v1.2) and -security (v1.1). we want to display |
2453 | - it as a security update then |
2454 | - """ |
2455 | - inst_ver = pkg._pkg.current_ver |
2456 | - cand_ver = self._depcache.get_candidate_ver(pkg._pkg) |
2457 | - # init matcher with candidate.version |
2458 | - update_origin = matcher[(None,None)] |
2459 | - verFileIter = None |
2460 | - for (verFileIter,index) in cand_ver.file_list: |
2461 | - if (verFileIter.archive, verFileIter.origin) in matcher: |
2462 | - indexfile = pkg._pcache._list.find_index(verFileIter) |
2463 | - if indexfile: # and indexfile.IsTrusted: |
2464 | - match = matcher[verFileIter.archive, verFileIter.origin] |
2465 | - update_origin = match |
2466 | - break |
2467 | - else: |
2468 | - # add a node for each origin/archive combination |
2469 | - if verFileIter and verFileIter.origin and verFileIter.archive: |
2470 | - matcher[verFileIter.archive, verFileIter.origin] = UpdateOrigin(_("Other updates (%s)") % verFileIter.origin, 0) |
2471 | - update_origin = matcher[verFileIter.archive, verFileIter.origin] |
2472 | - # if the candidate comes from a unknown source (e.g. a PPA) skip |
2473 | - # skip the shadow logic below as it would put e.g. a PPA package |
2474 | - # in "Recommended updates" when the version in the PPA |
2475 | - # is higher than the one in %s-updates |
2476 | - if update_origin.importance <= 0: |
2477 | - return update_origin |
2478 | - # for known packages, check if we have higher versions that |
2479 | - # "shadow" this one |
2480 | - for ver in pkg._pkg.version_list: |
2481 | - # discard is < than installed ver |
2482 | - if (inst_ver and |
2483 | - apt_pkg.version_compare(ver.ver_str, inst_ver.ver_str) <= 0): |
2484 | - #print("skipping '%s' " % ver.ver_str) |
2485 | - continue |
2486 | - # check if we have a match |
2487 | - for(verFileIter,index) in ver.file_list: |
2488 | - if (verFileIter.archive, verFileIter.origin) in matcher: |
2489 | - indexfile = pkg._pcache._list.find_index(verFileIter) |
2490 | - if indexfile: # and indexfile.IsTrusted: |
2491 | - match = matcher[verFileIter.archive, verFileIter.origin] |
2492 | - if match.importance > update_origin.importance: |
2493 | - update_origin = match |
2494 | - return update_origin |
2495 | - |
2496 | - def _strip_epoch(self, verstr): |
2497 | - " strip of the epoch " |
2498 | - l = verstr.split(":") |
2499 | - if len(l) > 1: |
2500 | - verstr = "".join(l[1:]) |
2501 | - return verstr |
2502 | - |
2503 | - def _get_changelog_or_news(self, name, fname, strict_versioning=False, changelogs_uri=None): |
2504 | - " helper that fetches the file in question " |
2505 | - # don't touch the gui in this function, it needs to be thread-safe |
2506 | - pkg = self[name] |
2507 | - |
2508 | - # get the src package name |
2509 | - srcpkg = pkg.candidate.source_name |
2510 | - |
2511 | - # assume "main" section |
2512 | - src_section = "main" |
2513 | - # use the section of the candidate as a starting point |
2514 | - section = pkg._pcache._depcache.get_candidate_ver(pkg._pkg).section |
2515 | - |
2516 | - # get the source version, start with the binaries version |
2517 | - srcver_epoch = pkg.candidate.version |
2518 | - srcver = self._strip_epoch(srcver_epoch) |
2519 | - #print("bin: %s" % binver) |
2520 | - |
2521 | - l = section.split("/") |
2522 | - if len(l) > 1: |
2523 | - src_section = l[0] |
2524 | - |
2525 | - # lib is handled special |
2526 | - prefix = srcpkg[0] |
2527 | - if srcpkg.startswith("lib"): |
2528 | - prefix = "lib" + srcpkg[3] |
2529 | - |
2530 | - # the changelogs_uri argument overrides the default changelogs_uri, |
2531 | - # this is useful for e.g. PPAs where we construct the changelogs |
2532 | - # path differently |
2533 | - if changelogs_uri: |
2534 | - uri = changelogs_uri |
2535 | - else: |
2536 | - uri = CHANGELOGS_URI % (src_section,prefix,srcpkg,srcpkg, srcver, fname) |
2537 | - |
2538 | - # https uris are not supported when they contain a username/password |
2539 | - # because the urllib2 https implementation will not check certificates |
2540 | - # and so its possible to do a man-in-the-middle attack to steal the |
2541 | - # credentials |
2542 | - res = urlsplit(uri) |
2543 | - if res.scheme == "https" and res.username != "": |
2544 | - raise HttpsChangelogsUnsupportedError( |
2545 | - "https locations with username/password are not" |
2546 | - "supported to fetch changelogs") |
2547 | - |
2548 | - # print("Trying: %s " % uri) |
2549 | - changelog = urlopen(uri) |
2550 | - #print(changelog.read()) |
2551 | - # do only get the lines that are new |
2552 | - alllines = "" |
2553 | - regexp = "^%s \((.*)\)(.*)$" % (re.escape(srcpkg)) |
2554 | - |
2555 | - while True: |
2556 | - line = changelog.readline().decode("UTF-8", "replace") |
2557 | - if line == "": |
2558 | - break |
2559 | - match = re.match(regexp,line) |
2560 | - if match: |
2561 | - # strip epoch from installed version |
2562 | - # and from changelog too |
2563 | - installed = getattr(pkg.installed, "version", None) |
2564 | - if installed and ":" in installed: |
2565 | - installed = installed.split(":",1)[1] |
2566 | - changelogver = match.group(1) |
2567 | - if changelogver and ":" in changelogver: |
2568 | - changelogver = changelogver.split(":",1)[1] |
2569 | - # we test for "==" here for changelogs |
2570 | - # to ensure that the version |
2571 | - # is actually really in the changelog - if not |
2572 | - # just display it all, this catches cases like: |
2573 | - # gcc-defaults with "binver=4.3.1" and srcver=1.76 |
2574 | - # |
2575 | - # for NEWS.Debian we do require the changelogver > installed |
2576 | - if strict_versioning: |
2577 | - if (installed and |
2578 | - apt_pkg.version_compare(changelogver,installed)<0): |
2579 | - break |
2580 | - else: |
2581 | - if (installed and |
2582 | - apt_pkg.version_compare(changelogver,installed)==0): |
2583 | - break |
2584 | - alllines = alllines + line |
2585 | - return alllines |
2586 | - |
2587 | - def _guess_third_party_changelogs_uri_by_source(self, name): |
2588 | - pkg = self[name] |
2589 | - deb_uri = pkg.candidate.uri |
2590 | - if deb_uri is None: |
2591 | - return None |
2592 | - srcrec = pkg.candidate.record.get("Source") |
2593 | - if not srcrec: |
2594 | - return None |
2595 | - # srcpkg can be "apt" or "gcc-default (1.0)" |
2596 | - srcpkg = srcrec.split("(")[0].strip() |
2597 | - if "(" in srcrec: |
2598 | - srcver = srcrec.split("(")[1].rstrip(")") |
2599 | - else: |
2600 | - srcver = pkg.candidate.version |
2601 | - base_uri = deb_uri.rpartition("/")[0] |
2602 | - return base_uri + "/%s_%s.changelog" % (srcpkg, srcver) |
2603 | - |
2604 | - def _guess_third_party_changelogs_uri_by_binary(self, name): |
2605 | - """ guess changelogs uri based on ArchiveURI by replacing .deb |
2606 | - with .changelog |
2607 | - """ |
2608 | - # there is always a pkg and a pkg.candidate, no need to add |
2609 | - # check here |
2610 | - pkg = self[name] |
2611 | - deb_uri = pkg.candidate.uri |
2612 | - if deb_uri: |
2613 | - return "%s.changelog" % deb_uri.rsplit(".", 1)[0] |
2614 | - return None |
2615 | - |
2616 | - |
2617 | - def get_news_and_changelog(self, name, lock): |
2618 | - self.get_news(name) |
2619 | - self.get_changelog(name) |
2620 | - try: |
2621 | - lock.release() |
2622 | - except: |
2623 | - pass |
2624 | - |
2625 | - def get_news(self, name): |
2626 | - " get the NEWS.Debian file from the changelogs location " |
2627 | - try: |
2628 | - news = self._get_changelog_or_news(name, "NEWS.Debian", True) |
2629 | - except Exception: |
2630 | - return |
2631 | - if news: |
2632 | - self.all_news[name] = news |
2633 | - |
2634 | - def _fetch_changelog_for_third_party_package(self, name): |
2635 | - # Try non official changelog location |
2636 | - changelogs_uri_binary = self._guess_third_party_changelogs_uri_by_binary(name) |
2637 | - changelogs_uri_source = self._guess_third_party_changelogs_uri_by_source(name) |
2638 | - error_message = "" |
2639 | - for changelogs_uri in [changelogs_uri_binary,changelogs_uri_source]: |
2640 | - if changelogs_uri: |
2641 | - try: |
2642 | - changelog = self._get_changelog_or_news( |
2643 | - name, "changelog", False, changelogs_uri) |
2644 | - self.all_changes[name] += changelog |
2645 | - except (HTTPError, HttpsChangelogsUnsupportedError): |
2646 | - # no changelogs_uri or 404 |
2647 | - error_message = _( |
2648 | - "This update does not come from a " |
2649 | - "source that supports changelogs.") |
2650 | - except (IOError, BadStatusLine, socket.error): |
2651 | - # network errors and others |
2652 | - logging.exception("error on changelog fetching") |
2653 | - error_message = _( |
2654 | - "Failed to download the list of changes. \n" |
2655 | - "Please check your Internet connection.") |
2656 | - self.all_changes[name] += error_message |
2657 | - |
2658 | - def get_changelog(self, name): |
2659 | - " get the changelog file from the changelog location " |
2660 | - origins = self[name].candidate.origins |
2661 | - self.all_changes[name] = _("Changes for the versions:\nInstalled version: %s\nAvailable version: %s\n\n") % (getattr(self[name].installed, "version", None), self[name].candidate.version) |
2662 | - if not self.CHANGELOG_ORIGIN in [o.origin for o in origins]: |
2663 | - self._fetch_changelog_for_third_party_package(name) |
2664 | - return |
2665 | - # fixup epoch handling version |
2666 | - srcpkg = self[name].candidate.source_name |
2667 | - srcver_epoch = self[name].candidate.version.replace(':', '%3A') |
2668 | - try: |
2669 | - changelog = self._get_changelog_or_news(name, "changelog") |
2670 | - if len(changelog) == 0: |
2671 | - changelog = _("The changelog does not contain any relevant changes.\n\n" |
2672 | - "Please use http://launchpad.net/ubuntu/+source/%s/%s/+changelog\n" |
2673 | - "until the changes become available or try again " |
2674 | - "later.") % (srcpkg, srcver_epoch) |
2675 | - except HTTPError as e: |
2676 | - changelog = _("The list of changes is not available yet.\n\n" |
2677 | - "Please use http://launchpad.net/ubuntu/+source/%s/%s/+changelog\n" |
2678 | - "until the changes become available or try again " |
2679 | - "later.") % (srcpkg, srcver_epoch) |
2680 | - except (IOError, BadStatusLine, socket.error) as e: |
2681 | - print("caught exception: ", e) |
2682 | - changelog = _("Failed to download the list " |
2683 | - "of changes. \nPlease " |
2684 | - "check your Internet " |
2685 | - "connection.") |
2686 | - self.all_changes[name] += changelog |
2687 | - |
2688 | - |
2689 | - |
2690 | |
2691 | === removed file 'UpdateManager/Core/UpdateList.py' |
2692 | --- UpdateManager/Core/UpdateList.py 2012-06-12 13:17:46 +0000 |
2693 | +++ UpdateManager/Core/UpdateList.py 1970-01-01 00:00:00 +0000 |
2694 | @@ -1,102 +0,0 @@ |
2695 | -# UpdateList.py |
2696 | -# |
2697 | -# Copyright (c) 2004-2008 Canonical |
2698 | -# |
2699 | -# Author: Michael Vogt <mvo@debian.org> |
2700 | -# |
2701 | -# This program is free software; you can redistribute it and/or |
2702 | -# modify it under the terms of the GNU General Public License as |
2703 | -# published by the Free Software Foundation; either version 2 of the |
2704 | -# License, or (at your option) any later version. |
2705 | -# |
2706 | -# This program is distributed in the hope that it will be useful, |
2707 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2708 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2709 | -# GNU General Public License for more details. |
2710 | -# |
2711 | -# You should have received a copy of the GNU General Public License |
2712 | -# along with this program; if not, write to the Free Software |
2713 | -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
2714 | -# USA |
2715 | - |
2716 | -from __future__ import print_function |
2717 | - |
2718 | -import warnings |
2719 | -warnings.filterwarnings("ignore", "Accessed deprecated property", DeprecationWarning) |
2720 | - |
2721 | -from gettext import gettext as _ |
2722 | -import operator |
2723 | -import subprocess |
2724 | -import sys |
2725 | - |
2726 | -class UpdateOrigin(object): |
2727 | - def __init__(self, desc, importance): |
2728 | - self.packages = [] |
2729 | - self.importance = importance |
2730 | - self.description = desc |
2731 | - |
2732 | -class UpdateList(object): |
2733 | - """ |
2734 | - class that contains the list of available updates in |
2735 | - self.pkgs[origin] where origin is the user readable string |
2736 | - """ |
2737 | - |
2738 | - def __init__(self, parent): |
2739 | - # a map of packages under their origin |
2740 | - try: |
2741 | - dist = subprocess.check_output( |
2742 | - ["lsb_release", "-c", "-s"], universal_newlines=True).strip() |
2743 | - except subprocess.CalledProcessError as e: |
2744 | - print("Error in lsb_release: %s" % e) |
2745 | - parent.error(_("Failed to detect distribution"), |
2746 | - _("A error '%s' occurred while checking what system " |
2747 | - "you are using.") % e) |
2748 | - sys.exit(1) |
2749 | - self.distUpgradeWouldDelete = 0 |
2750 | - self.pkgs = {} |
2751 | - self.num_updates = 0 |
2752 | - self.matcher = self.initMatcher(dist) |
2753 | - |
2754 | - def initMatcher(self, dist): |
2755 | - # (origin, archive, description, importance) |
2756 | - matcher_templates = [ |
2757 | - ("%s-security" % dist, "Ubuntu", _("Important security updates"),10), |
2758 | - ("%s-updates" % dist, "Ubuntu", _("Recommended updates"), 9), |
2759 | - ("%s-proposed" % dist, "Ubuntu", _("Proposed updates"), 8), |
2760 | - ("%s-backports" % dist, "Ubuntu", _("Backports"), 7), |
2761 | - (dist, "Ubuntu", _("Distribution updates"), 6) |
2762 | - ] |
2763 | - matcher = {} |
2764 | - for (origin, archive, desc, importance) in matcher_templates: |
2765 | - matcher[(origin, archive)] = UpdateOrigin(desc, importance) |
2766 | - matcher[(None,None)] = UpdateOrigin(_("Other updates"), -1) |
2767 | - return matcher |
2768 | - |
2769 | - def update(self, cache): |
2770 | - self.held_back = [] |
2771 | - |
2772 | - # do the upgrade |
2773 | - self.distUpgradeWouldDelete = cache.saveDistUpgrade() |
2774 | - |
2775 | - #dselect_upgrade_origin = UpdateOrigin(_("Previous selected"), 1) |
2776 | - |
2777 | - # sort by origin |
2778 | - for pkg in cache: |
2779 | - if pkg.is_upgradable or pkg.marked_install: |
2780 | - if getattr(pkg.candidate, "origins", None) == None: |
2781 | - # can happen for e.g. locked packages |
2782 | - # FIXME: do something more sensible here (but what?) |
2783 | - print("WARNING: upgradable but no candidate.origins?!?: ", pkg.name) |
2784 | - continue |
2785 | - # check where the package belongs |
2786 | - origin_node = cache.match_package_origin(pkg, self.matcher) |
2787 | - if origin_node not in self.pkgs: |
2788 | - self.pkgs[origin_node] = [] |
2789 | - self.pkgs[origin_node].append(pkg) |
2790 | - self.num_updates = self.num_updates + 1 |
2791 | - if pkg.is_upgradable and not (pkg.marked_upgrade or pkg.marked_install): |
2792 | - self.held_back.append(pkg.name) |
2793 | - for l in self.pkgs.keys(): |
2794 | - self.pkgs[l].sort(key=operator.attrgetter("name")) |
2795 | - self.keepcount = cache._depcache.keep_count |
2796 | - |
2797 | |
2798 | === removed file 'UpdateManager/Core/__init__.py' |
2799 | === removed file 'UpdateManager/Core/roam.py' |
2800 | --- UpdateManager/Core/roam.py 2012-05-01 00:29:04 +0000 |
2801 | +++ UpdateManager/Core/roam.py 1970-01-01 00:00:00 +0000 |
2802 | @@ -1,205 +0,0 @@ |
2803 | -# utils.py |
2804 | -# |
2805 | -# Copyright (c) 2011 Canonical |
2806 | -# |
2807 | -# Author: Alex Chiang <achiang@canonical.com> |
2808 | -# Michael Vogt <michael.vogt@ubuntu.com> |
2809 | -# |
2810 | -# This program is free software; you can redistribute it and/or |
2811 | -# modify it under the terms of the GNU General Public License as |
2812 | -# published by the Free Software Foundation; either version 2 of the |
2813 | -# License, or (at your option) any later version. |
2814 | -# |
2815 | -# This program is distributed in the hope that it will be useful, |
2816 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2817 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2818 | -# GNU General Public License for more details. |
2819 | -# |
2820 | -# You should have received a copy of the GNU General Public License |
2821 | -# along with this program; if not, write to the Free Software |
2822 | -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
2823 | -# USA |
2824 | - |
2825 | - |
2826 | -from __future__ import print_function |
2827 | - |
2828 | -import dbus |
2829 | -import sys |
2830 | - |
2831 | -class ModemManagerHelper(object): |
2832 | - |
2833 | - # data taken from |
2834 | - # http://projects.gnome.org/NetworkManager/developers/mm-spec-04.html |
2835 | - MM_DBUS_IFACE = "org.freedesktop.ModemManager" |
2836 | - MM_DBUS_IFACE_MODEM = MM_DBUS_IFACE + ".Modem" |
2837 | - |
2838 | - # MM_MODEM_TYPE |
2839 | - MM_MODEM_TYPE_GSM = 1 |
2840 | - MM_MODEM_TYPE_CDMA = 2 |
2841 | - |
2842 | - # GSM |
2843 | - # Not registered, not searching for new operator to register. |
2844 | - MM_MODEM_GSM_NETWORK_REG_STATUS_IDLE = 0 |
2845 | - # Registered on home network. |
2846 | - MM_MODEM_GSM_NETWORK_REG_STATUS_HOME = 1 |
2847 | - # Not registered, searching for new operator to register with. |
2848 | - MM_MODEM_GSM_NETWORK_REG_STATUS_SEARCHING = 2 |
2849 | - # Registration denied. |
2850 | - MM_MODEM_GSM_NETWORK_REG_STATUS_DENIED = 3 |
2851 | - # Unknown registration status. |
2852 | - MM_MODEM_GSM_NETWORK_REG_STATUS_UNKNOWN = 4 |
2853 | - # Registered on a roaming network. |
2854 | - MM_MODEM_GSM_NETWORK_REG_STATUS_ROAMING = 5 |
2855 | - |
2856 | - # CDMA |
2857 | - # Registration status is unknown or the device is not registered. |
2858 | - MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN = 0 |
2859 | - # Registered, but roaming status is unknown or cannot be provided |
2860 | - # by the device. The device may or may not be roaming. |
2861 | - MM_MODEM_CDMA_REGISTRATION_STATE_REGISTERED = 1 |
2862 | - # Currently registered on the home network. |
2863 | - MM_MODEM_CDMA_REGISTRATION_STATE_HOME = 2 |
2864 | - # Currently registered on a roaming network. |
2865 | - MM_MODEM_CDMA_REGISTRATION_STATE_ROAMING = 3 |
2866 | - |
2867 | - def __init__(self): |
2868 | - self.bus = dbus.SystemBus() |
2869 | - self.proxy = self.bus.get_object("org.freedesktop.ModemManager", |
2870 | - "/org/freedesktop/ModemManager") |
2871 | - modem_manager = dbus.Interface(self.proxy, self.MM_DBUS_IFACE) |
2872 | - self.modems = modem_manager.EnumerateDevices() |
2873 | - |
2874 | - @staticmethod |
2875 | - def get_dbus_property(proxy, interface, property): |
2876 | - props = dbus.Interface(proxy, "org.freedesktop.DBus.Properties") |
2877 | - property = props.Get(interface, property) |
2878 | - return property |
2879 | - |
2880 | - def is_gsm_roaming(self): |
2881 | - for m in self.modems: |
2882 | - dev = self.bus.get_object(self.MM_DBUS_IFACE, m) |
2883 | - type = self.get_dbus_property(dev, self.MM_DBUS_IFACE_MODEM, "Type") |
2884 | - if type != self.MM_MODEM_TYPE_GSM: |
2885 | - continue |
2886 | - net = dbus.Interface(dev, self.MM_DBUS_IFACE_MODEM + ".Gsm.Network") |
2887 | - reg = net.GetRegistrationInfo() |
2888 | - # Be conservative about roaming. If registration unknown, |
2889 | - # assume yes. |
2890 | - # MM_MODEM_GSM_NETWORK_REG_STATUS |
2891 | - if reg[0] in (self.MM_MODEM_GSM_NETWORK_REG_STATUS_UNKNOWN, |
2892 | - self.MM_MODEM_GSM_NETWORK_REG_STATUS_ROAMING): |
2893 | - return True |
2894 | - return False |
2895 | - |
2896 | - def is_cdma_roaming(self): |
2897 | - for m in self.modems: |
2898 | - dev = self.bus.get_object(self.MM_DBUS_IFACE, m) |
2899 | - type = self.get_dbus_property(dev, self.MM_DBUS_IFACE_MODEM, "Type") |
2900 | - if type != self.MM_MODEM_TYPE_CDMA: |
2901 | - continue |
2902 | - cdma = dbus.Interface(dev, self.MM_DBUS_IFACE_MODEM + ".Cdma") |
2903 | - (cmda_1x, evdo) = cdma.GetRegistrationState() |
2904 | - # Be conservative about roaming. If registration unknown, |
2905 | - # assume yes. |
2906 | - # MM_MODEM_CDMA_REGISTRATION_STATE |
2907 | - roaming_states = (self.MM_MODEM_CDMA_REGISTRATION_STATE_REGISTERED, |
2908 | - self.MM_MODEM_CDMA_REGISTRATION_STATE_ROAMING) |
2909 | - # evdo trumps cmda_1x (thanks to Mathieu Trudel-Lapierre) |
2910 | - if evdo in roaming_states: |
2911 | - return True |
2912 | - elif cmda_1x in roaming_states: |
2913 | - return True |
2914 | - return False |
2915 | - |
2916 | -class NetworkManagerHelper(object): |
2917 | - NM_DBUS_IFACE = "org.freedesktop.NetworkManager" |
2918 | - |
2919 | - # connection states |
2920 | - # Old enum values are for NM 0.7 |
2921 | - |
2922 | - # The NetworkManager daemon is in an unknown state. |
2923 | - NM_STATE_UNKNOWN = 0 |
2924 | - # The NetworkManager daemon is connecting a device. |
2925 | - NM_STATE_CONNECTING_OLD = 2 |
2926 | - NM_STATE_CONNECTING = 40 |
2927 | - NM_STATE_CONNECTING_LIST = [NM_STATE_CONNECTING_OLD, |
2928 | - NM_STATE_CONNECTING] |
2929 | - # The NetworkManager daemon is connected. |
2930 | - NM_STATE_CONNECTED_OLD = 3 |
2931 | - NM_STATE_CONNECTED_LOCAL = 50 |
2932 | - NM_STATE_CONNECTED_SITE = 60 |
2933 | - NM_STATE_CONNECTED_GLOBAL = 70 |
2934 | - NM_STATE_CONNECTED_LIST = [NM_STATE_CONNECTED_OLD, |
2935 | - NM_STATE_CONNECTED_LOCAL, |
2936 | - NM_STATE_CONNECTED_SITE, |
2937 | - NM_STATE_CONNECTED_GLOBAL] |
2938 | - |
2939 | - # The device type is unknown. |
2940 | - NM_DEVICE_TYPE_UNKNOWN = 0 |
2941 | - # The device is wired Ethernet device. |
2942 | - NM_DEVICE_TYPE_ETHERNET = 1 |
2943 | - # The device is an 802.11 WiFi device. |
2944 | - NM_DEVICE_TYPE_WIFI = 2 |
2945 | - # The device is a GSM-based cellular WAN device. |
2946 | - NM_DEVICE_TYPE_GSM = 3 |
2947 | - # The device is a CDMA/IS-95-based cellular WAN device. |
2948 | - NM_DEVICE_TYPE_CDMA = 4 |
2949 | - |
2950 | - def __init__(self): |
2951 | - self.bus = dbus.SystemBus() |
2952 | - self.proxy = self.bus.get_object("org.freedesktop.NetworkManager", |
2953 | - "/org/freedesktop/NetworkManager") |
2954 | - |
2955 | - @staticmethod |
2956 | - def get_dbus_property(proxy, interface, property): |
2957 | - props = dbus.Interface(proxy, "org.freedesktop.DBus.Properties") |
2958 | - property = props.Get(interface, property) |
2959 | - return property |
2960 | - |
2961 | - def is_active_connection_gsm_or_cdma(self): |
2962 | - res = False |
2963 | - actives = self.get_dbus_property( |
2964 | - self.proxy, self.NM_DBUS_IFACE, 'ActiveConnections') |
2965 | - for a in actives: |
2966 | - active = self.bus.get_object(self.NM_DBUS_IFACE, a) |
2967 | - default_route = self.get_dbus_property( |
2968 | - active, self.NM_DBUS_IFACE + ".Connection.Active", 'Default') |
2969 | - if not default_route: |
2970 | - continue |
2971 | - devs = self.get_dbus_property( |
2972 | - active, self.NM_DBUS_IFACE + ".Connection.Active", 'Devices') |
2973 | - for d in devs: |
2974 | - dev = self.bus.get_object(self.NM_DBUS_IFACE, d) |
2975 | - type = self.get_dbus_property( |
2976 | - dev, self.NM_DBUS_IFACE + ".Device", 'DeviceType') |
2977 | - if type == self.NM_DEVICE_TYPE_GSM: |
2978 | - return True |
2979 | - elif type == self.NM_DEVICE_TYPE_CDMA: |
2980 | - return True |
2981 | - else: |
2982 | - continue |
2983 | - return res |
2984 | - |
2985 | - def is_active_connection_gsm_or_cdma_roaming(self): |
2986 | - res = False |
2987 | - if self.is_active_connection_gsm_or_cdma(): |
2988 | - mmhelper = ModemManagerHelper() |
2989 | - res |= mmhelper.is_gsm_roaming() |
2990 | - res |= mmhelper.is_cdma_roaming() |
2991 | - return res |
2992 | - |
2993 | -if __name__ == "__main__": |
2994 | - |
2995 | - # test code |
2996 | - if sys.argv[1:] and sys.argv[1] == "--test": |
2997 | - mmhelper = ModemManagerHelper() |
2998 | - print("is_gsm_roaming", mmhelper.is_gsm_roaming()) |
2999 | - print("is_cdma_romaing", mmhelper.is_cdma_roaming()) |
3000 | - |
3001 | - # roaming? |
3002 | - nmhelper = NetworkManagerHelper() |
3003 | - is_roaming = nmhelper.is_active_connection_gsm_or_cdma_roaming() |
3004 | - print("roam: ", is_roaming) |
3005 | - if is_roaming: |
3006 | - sys.exit(1) |
3007 | - sys.exit(0) |
3008 | |
3009 | === removed file 'UpdateManager/Core/utils.py' |
3010 | --- UpdateManager/Core/utils.py 2012-06-15 20:13:15 +0000 |
3011 | +++ UpdateManager/Core/utils.py 1970-01-01 00:00:00 +0000 |
3012 | @@ -1,510 +0,0 @@ |
3013 | -# utils.py |
3014 | -# |
3015 | -# Copyright (c) 2004-2008 Canonical |
3016 | -# |
3017 | -# Author: Michael Vogt <mvo@debian.org> |
3018 | -# |
3019 | -# This program is free software; you can redistribute it and/or |
3020 | -# modify it under the terms of the GNU General Public License as |
3021 | -# published by the Free Software Foundation; either version 2 of the |
3022 | -# License, or (at your option) any later version. |
3023 | -# |
3024 | -# This program is distributed in the hope that it will be useful, |
3025 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
3026 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3027 | -# GNU General Public License for more details. |
3028 | -# |
3029 | -# You should have received a copy of the GNU General Public License |
3030 | -# along with this program; if not, write to the Free Software |
3031 | -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
3032 | -# USA |
3033 | - |
3034 | -from __future__ import print_function |
3035 | - |
3036 | -from gettext import gettext as _ |
3037 | -from gettext import ngettext |
3038 | -from stat import (S_IMODE, ST_MODE, S_IXUSR) |
3039 | -from math import ceil |
3040 | - |
3041 | -import apt_pkg |
3042 | -apt_pkg.init_config() |
3043 | - |
3044 | -import locale |
3045 | -import logging |
3046 | -import re |
3047 | -import os |
3048 | -import glob |
3049 | -import subprocess |
3050 | -import sys |
3051 | -import time |
3052 | -try: |
3053 | - from urllib.request import ( |
3054 | - ProxyHandler, |
3055 | - Request, |
3056 | - build_opener, |
3057 | - install_opener, |
3058 | - urlopen, |
3059 | - ) |
3060 | - from urllib.parse import urlsplit |
3061 | -except ImportError: |
3062 | - from urllib2 import ( |
3063 | - ProxyHandler, |
3064 | - Request, |
3065 | - build_opener, |
3066 | - install_opener, |
3067 | - urlopen, |
3068 | - ) |
3069 | - from urlparse import urlsplit |
3070 | - |
3071 | -from copy import copy |
3072 | - |
3073 | - |
3074 | -class ExecutionTime(object): |
3075 | - """ |
3076 | - Helper that can be used in with statements to have a simple |
3077 | - measure of the timing of a particular block of code, e.g. |
3078 | - with ExecutionTime("db flush"): |
3079 | - db.flush() |
3080 | - """ |
3081 | - def __init__(self, info=""): |
3082 | - self.info = info |
3083 | - def __enter__(self): |
3084 | - self.now = time.time() |
3085 | - def __exit__(self, type, value, stack): |
3086 | - print("%s: %s" % (self.info, time.time() - self.now)) |
3087 | - |
3088 | -def get_string_with_no_auth_from_source_entry(entry): |
3089 | - tmp = copy(entry) |
3090 | - url_parts = urlsplit(tmp.uri) |
3091 | - if url_parts.username: |
3092 | - tmp.uri = tmp.uri.replace(url_parts.username, "hidden-u") |
3093 | - if url_parts.password: |
3094 | - tmp.uri = tmp.uri.replace(url_parts.password, "hidden-p") |
3095 | - return str(tmp) |
3096 | - |
3097 | -def estimate_kernel_size_in_boot(): |
3098 | - """ estimate the amount of space that the current kernel takes in /boot """ |
3099 | - size = 0 |
3100 | - kver = os.uname()[2] |
3101 | - for f in glob.glob("/boot/*%s*" % kver): |
3102 | - size += os.path.getsize(f) |
3103 | - return size |
3104 | - |
3105 | -def is_unity_running(): |
3106 | - """ return True if Unity is currently running """ |
3107 | - unity_running = False |
3108 | - try: |
3109 | - import dbus |
3110 | - bus = dbus.SessionBus() |
3111 | - unity_running = bus.name_has_owner("com.canonical.Unity") |
3112 | - except: |
3113 | - logging.exception("could not check for Unity dbus service") |
3114 | - return unity_running |
3115 | - |
3116 | -def is_child_of_process_name(processname, pid=None): |
3117 | - if not pid: |
3118 | - pid = os.getpid() |
3119 | - while pid > 0: |
3120 | - stat_file = "/proc/%s/stat" % pid |
3121 | - with open(stat_file) as stat_f: |
3122 | - stat = stat_f.read() |
3123 | - # extract command (inside ()) |
3124 | - command = stat.partition("(")[2].partition(")")[0] |
3125 | - if command == processname: |
3126 | - return True |
3127 | - # get parent (second to the right of command) and check that next |
3128 | - pid = int(stat.partition(")")[2].split()[1]) |
3129 | - return False |
3130 | - |
3131 | -def inside_chroot(): |
3132 | - """ returns True if we are inside a chroot |
3133 | - """ |
3134 | - # if there is no proc or no pid 1 we are very likely inside a chroot |
3135 | - if not os.path.exists("/proc") or not os.path.exists("/proc/1"): |
3136 | - return True |
3137 | - # if the inode is differnt for pid 1 "/" and our "/" |
3138 | - return os.stat("/") != os.stat("/proc/1/root") |
3139 | - |
3140 | -def wrap(t, width=70, subsequent_indent=""): |
3141 | - """ helpers inspired after textwrap - unfortunately |
3142 | - we can not use textwrap directly because it break |
3143 | - packagenames with "-" in them into new lines |
3144 | - """ |
3145 | - out = "" |
3146 | - for s in t.split(): |
3147 | - if (len(out)-out.rfind("\n")) + len(s) > width: |
3148 | - out += "\n" + subsequent_indent |
3149 | - out += s + " " |
3150 | - return out |
3151 | - |
3152 | -def twrap(s, **kwargs): |
3153 | - msg = "" |
3154 | - paras = s.split("\n") |
3155 | - for par in paras: |
3156 | - s = wrap(par, **kwargs) |
3157 | - msg += s+"\n" |
3158 | - return msg |
3159 | - |
3160 | -def lsmod(): |
3161 | - " return list of loaded modules (or [] if lsmod is not found) " |
3162 | - modules=[] |
3163 | - # FIXME raise? |
3164 | - if not os.path.exists("/sbin/lsmod"): |
3165 | - return [] |
3166 | - p=subprocess.Popen(["/sbin/lsmod"], stdout=subprocess.PIPE, |
3167 | - universal_newlines=True) |
3168 | - lines=p.communicate()[0].split("\n") |
3169 | - # remove heading line: "Modules Size Used by" |
3170 | - del lines[0] |
3171 | - # add lines to list, skip empty lines |
3172 | - for line in lines: |
3173 | - if line: |
3174 | - modules.append(line.split()[0]) |
3175 | - return modules |
3176 | - |
3177 | -def check_and_fix_xbit(path): |
3178 | - " check if a given binary has the executable bit and if not, add it" |
3179 | - if not os.path.exists(path): |
3180 | - return |
3181 | - mode = S_IMODE(os.stat(path)[ST_MODE]) |
3182 | - if not ((mode & S_IXUSR) == S_IXUSR): |
3183 | - os.chmod(path, mode | S_IXUSR) |
3184 | - |
3185 | -def country_mirror(): |
3186 | - " helper to get the country mirror from the current locale " |
3187 | - # special cases go here |
3188 | - lang_mirror = { 'c' : '', |
3189 | - } |
3190 | - # no lang, no mirror |
3191 | - if not 'LANG' in os.environ: |
3192 | - return '' |
3193 | - lang = os.environ['LANG'].lower() |
3194 | - # check if it is a special case |
3195 | - if lang[:5] in lang_mirror: |
3196 | - return lang_mirror[lang[:5]] |
3197 | - # now check for the most comon form (en_US.UTF-8) |
3198 | - if "_" in lang: |
3199 | - country = lang.split(".")[0].split("_")[1] |
3200 | - if "@" in country: |
3201 | - country = country.split("@")[0] |
3202 | - return country+"." |
3203 | - else: |
3204 | - return lang[:2]+"." |
3205 | - return '' |
3206 | - |
3207 | -def get_dist(): |
3208 | - " return the codename of the current runing distro " |
3209 | - # support debug overwrite |
3210 | - dist = os.environ.get("META_RELEASE_FAKE_CODENAME") |
3211 | - if dist: |
3212 | - logging.warn("using fake release name '%s' (because of META_RELEASE_FAKE_CODENAME environment) " % dist) |
3213 | - return dist |
3214 | - # then check the real one |
3215 | - from subprocess import Popen, PIPE |
3216 | - p = Popen(["lsb_release","-c","-s"], stdout=PIPE, universal_newlines=True) |
3217 | - res = p.wait() |
3218 | - if res != 0: |
3219 | - sys.stderr.write("lsb_release returned exitcode: %i\n" % res) |
3220 | - return "unknown distribution" |
3221 | - dist = p.stdout.readline().strip() |
3222 | - p.stdout.close() |
3223 | - return dist |
3224 | - |
3225 | -def get_dist_version(): |
3226 | - " return the version of the current running distro " |
3227 | - # support debug overwrite |
3228 | - desc = os.environ.get("META_RELEASE_FAKE_VERSION") |
3229 | - if desc: |
3230 | - logging.warn("using fake release version '%s' (because of META_RELEASE_FAKE_VERSION environment) " % desc) |
3231 | - return desc |
3232 | - # then check the real one |
3233 | - from subprocess import Popen, PIPE |
3234 | - p = Popen(["lsb_release","-r","-s"], stdout=PIPE, universal_newlines=True) |
3235 | - res = p.wait() |
3236 | - if res != 0: |
3237 | - sys.stderr.write("lsb_release returned exitcode: %i\n" % res) |
3238 | - return "unknown distribution" |
3239 | - desc = p.stdout.readline().strip() |
3240 | - p.stdout.close() |
3241 | - return desc |
3242 | - |
3243 | -class HeadRequest(Request): |
3244 | - def get_method(self): |
3245 | - return "HEAD" |
3246 | - |
3247 | -def url_downloadable(uri, debug_func=None): |
3248 | - """ |
3249 | - helper that checks if the given uri exists and is downloadable |
3250 | - (supports optional debug_func function handler to support |
3251 | - e.g. logging) |
3252 | - |
3253 | - Supports http (via HEAD) and ftp (via size request) |
3254 | - """ |
3255 | - if not debug_func: |
3256 | - lambda x: True |
3257 | - debug_func("url_downloadable: %s" % uri) |
3258 | - (scheme, netloc, path, querry, fragment) = urlsplit(uri) |
3259 | - debug_func("s='%s' n='%s' p='%s' q='%s' f='%s'" % (scheme, netloc, path, querry, fragment)) |
3260 | - if scheme == "http": |
3261 | - try: |
3262 | - http_file = urlopen(HeadRequest(uri)) |
3263 | - http_file.close() |
3264 | - if http_file.code == 200: |
3265 | - return True |
3266 | - return False |
3267 | - except Exception as e: |
3268 | - debug_func("error from httplib: '%s'" % e) |
3269 | - return False |
3270 | - elif scheme == "ftp": |
3271 | - import ftplib |
3272 | - try: |
3273 | - f = ftplib.FTP(netloc) |
3274 | - f.login() |
3275 | - f.cwd(os.path.dirname(path)) |
3276 | - size = f.size(os.path.basename(path)) |
3277 | - f.quit() |
3278 | - if debug_func: |
3279 | - debug_func("ftplib.size() returned: %s" % size) |
3280 | - if size != 0: |
3281 | - return True |
3282 | - except Exception as e: |
3283 | - if debug_func: |
3284 | - debug_func("error from ftplib: '%s'" % e) |
3285 | - return False |
3286 | - return False |
3287 | - |
3288 | -def init_proxy(gsettings=None): |
3289 | - """ init proxy settings |
3290 | - |
3291 | - * first check for http_proxy environment (always wins), |
3292 | - * then check the apt.conf http proxy, |
3293 | - * then look into synaptics conffile |
3294 | - * then into gconf (if gconfclient was supplied) |
3295 | - """ |
3296 | - SYNAPTIC_CONF_FILE = "/root/.synaptic/synaptic.conf" |
3297 | - proxy = None |
3298 | - # generic apt config wins |
3299 | - if apt_pkg.config.find("Acquire::http::Proxy") != '': |
3300 | - proxy = apt_pkg.config.find("Acquire::http::Proxy") |
3301 | - # then synaptic |
3302 | - elif os.path.exists(SYNAPTIC_CONF_FILE): |
3303 | - cnf = apt_pkg.Configuration() |
3304 | - apt_pkg.read_config_file(cnf, SYNAPTIC_CONF_FILE) |
3305 | - use_proxy = cnf.find_b("Synaptic::useProxy", False) |
3306 | - if use_proxy: |
3307 | - proxy_host = cnf.find("Synaptic::httpProxy") |
3308 | - proxy_port = str(cnf.find_i("Synaptic::httpProxyPort")) |
3309 | - if proxy_host and proxy_port: |
3310 | - proxy = "http://%s:%s/" % (proxy_host, proxy_port) |
3311 | - # gconf is no more |
3312 | - # elif gconfclient: |
3313 | - # try: # see LP: #281248 |
3314 | - # if gconfclient.get_bool("/system/http_proxy/use_http_proxy"): |
3315 | - # host = gconfclient.get_string("/system/http_proxy/host") |
3316 | - # port = gconfclient.get_int("/system/http_proxy/port") |
3317 | - # use_auth = gconfclient.get_bool("/system/http_proxy/use_authentication") |
3318 | - # if host and port: |
3319 | - # if use_auth: |
3320 | - # auth_user = gconfclient.get_string("/system/http_proxy/authentication_user") |
3321 | - # auth_pw = gconfclient.get_string("/system/http_proxy/authentication_password") |
3322 | - # proxy = "http://%s:%s@%s:%s/" % (auth_user,auth_pw,host, port) |
3323 | - # else: |
3324 | - # proxy = "http://%s:%s/" % (host, port) |
3325 | - # except Exception as e: |
3326 | - # print("error from gconf: %s" % e) |
3327 | - # if we have a proxy, set it |
3328 | - if proxy: |
3329 | - # basic verification |
3330 | - if not re.match("http://\w+", proxy): |
3331 | - print("proxy '%s' looks invalid" % proxy, file=sys.stderr) |
3332 | - return |
3333 | - proxy_support = ProxyHandler({"http":proxy}) |
3334 | - opener = build_opener(proxy_support) |
3335 | - install_opener(opener) |
3336 | - os.putenv("http_proxy",proxy) |
3337 | - return proxy |
3338 | - |
3339 | -def on_battery(): |
3340 | - """ |
3341 | - Check via dbus if the system is running on battery. |
3342 | - This function is using UPower per default, if UPower is not |
3343 | - available it falls-back to DeviceKit.Power. |
3344 | - """ |
3345 | - try: |
3346 | - import dbus |
3347 | - bus = dbus.Bus(dbus.Bus.TYPE_SYSTEM) |
3348 | - try: |
3349 | - devobj = bus.get_object('org.freedesktop.UPower', |
3350 | - '/org/freedesktop/UPower') |
3351 | - dev = dbus.Interface(devobj, 'org.freedesktop.DBus.Properties') |
3352 | - return dev.Get('org.freedesktop.UPower', 'OnBattery') |
3353 | - except dbus.exceptions.DBusException as e: |
3354 | - if e._dbus_error_name != 'org.freedesktop.DBus.Error.ServiceUnknown': |
3355 | - raise |
3356 | - devobj = bus.get_object('org.freedesktop.DeviceKit.Power', |
3357 | - '/org/freedesktop/DeviceKit/Power') |
3358 | - dev = dbus.Interface(devobj, "org.freedesktop.DBus.Properties") |
3359 | - return dev.Get("org.freedesktop.DeviceKit.Power", "on_battery") |
3360 | - except Exception as e: |
3361 | - #import sys |
3362 | - #print("on_battery returned error: ", e, file=sys.stderr) |
3363 | - return False |
3364 | - |
3365 | -def inhibit_sleep(): |
3366 | - """ |
3367 | - Send a dbus signal to power-manager to not suspend |
3368 | - the system, using the freedesktop common interface |
3369 | - """ |
3370 | - try: |
3371 | - import dbus |
3372 | - bus = dbus.Bus(dbus.Bus.TYPE_SESSION) |
3373 | - devobj = bus.get_object('org.freedesktop.PowerManagement', |
3374 | - '/org/freedesktop/PowerManagement/Inhibit') |
3375 | - dev = dbus.Interface(devobj, "org.freedesktop.PowerManagement.Inhibit") |
3376 | - cookie = dev.Inhibit('UpdateManager', 'Updating system') |
3377 | - return (dev, cookie) |
3378 | - except Exception: |
3379 | - #print("could not send the dbus Inhibit signal: %s" % e) |
3380 | - return (False, False) |
3381 | - |
3382 | -def allow_sleep(dev, cookie): |
3383 | - """Send a dbus signal to gnome-power-manager to allow a suspending |
3384 | - the system""" |
3385 | - try: |
3386 | - dev.UnInhibit(cookie) |
3387 | - except Exception as e: |
3388 | - print("could not send the dbus UnInhibit signal: %s" % e) |
3389 | - |
3390 | - |
3391 | -def str_to_bool(str): |
3392 | - if str == "0" or str.upper() == "FALSE": |
3393 | - return False |
3394 | - return True |
3395 | - |
3396 | -def get_lang(): |
3397 | - import logging |
3398 | - try: |
3399 | - (locale_s, encoding) = locale.getdefaultlocale() |
3400 | - return locale_s |
3401 | - except Exception: |
3402 | - logging.exception("gedefaultlocale() failed") |
3403 | - return None |
3404 | - |
3405 | -def get_ubuntu_flavor(): |
3406 | - """ try to guess the flavor based on the running desktop """ |
3407 | - # this will (of course) not work in a server environment, |
3408 | - # but the main use case for this is to show the right |
3409 | - # release notes |
3410 | - # TODO: actually examine which meta packages are installed, like |
3411 | - # DistUpgrade/DistUpgradeCache.py does and use that to choose a flavor. |
3412 | - denv = os.environ.get("DESKTOP_SESSION", "") |
3413 | - if "gnome" in denv: |
3414 | - return "ubuntu" |
3415 | - elif "kde" in denv: |
3416 | - return "kubuntu" |
3417 | - elif "xfce" in denv or "xubuntu" in denv: |
3418 | - return "xubuntu" |
3419 | - elif "LXDE" in denv or "Lubuntu" in denv: |
3420 | - return "lubuntu" |
3421 | - # default to ubuntu if nothing more specific is found |
3422 | - return "ubuntu" |
3423 | - |
3424 | -def get_ubuntu_flavor_name(): |
3425 | - flavor = get_ubuntu_flavor() |
3426 | - if flavor == "kubuntu": |
3427 | - return "Kubuntu" |
3428 | - elif flavor == "xubuntu": |
3429 | - return "Xubuntu" |
3430 | - elif flavor == "lubuntu": |
3431 | - return "Lubuntu" |
3432 | - else: |
3433 | - return "Ubuntu" |
3434 | - |
3435 | -def error(parent, summary, message): |
3436 | - from gi.repository import Gtk, Gdk |
3437 | - d = Gtk.MessageDialog(parent=parent, |
3438 | - flags=Gtk.DialogFlags.MODAL, |
3439 | - type=Gtk.MessageType.ERROR, |
3440 | - buttons=Gtk.ButtonsType.CLOSE) |
3441 | - d.set_markup("<big><b>%s</b></big>\n\n%s" % (summary, message)) |
3442 | - d.realize() |
3443 | - d.window.set_functions(Gdk.FUNC_MOVE) |
3444 | - d.set_title("") |
3445 | - d.run() |
3446 | - d.destroy() |
3447 | - return False |
3448 | - |
3449 | -def humanize_size(bytes): |
3450 | - """ |
3451 | - Convert a given size in bytes to a nicer better readable unit |
3452 | - """ |
3453 | - |
3454 | - if bytes < 1000 * 1000: |
3455 | - # to have 0 for 0 bytes, 1 for 0-1000 bytes and for 1 and above round up |
3456 | - size_in_kb = int(ceil(bytes/float(1000))); |
3457 | - # TRANSLATORS: download size of small updates, e.g. "250 kB" |
3458 | - return ngettext("%(size).0f kB", "%(size).0f kB", size_in_kb) % { "size" : size_in_kb } |
3459 | - else: |
3460 | - # TRANSLATORS: download size of updates, e.g. "2.3 MB" |
3461 | - return locale.format_string(_("%.1f MB"), bytes / 1000.0 / 1000.0) |
3462 | - |
3463 | -def get_arch(): |
3464 | - return apt_pkg.config.find("APT::Architecture") |
3465 | - |
3466 | - |
3467 | -def is_port_already_listening(port): |
3468 | - """ check if the current system is listening on the given tcp port """ |
3469 | - # index in the line |
3470 | - INDEX_LOCAL_ADDR = 1 |
3471 | - #INDEX_REMOTE_ADDR = 2 |
3472 | - INDEX_STATE = 3 |
3473 | - # state (st) that we care about |
3474 | - STATE_LISTENING = '0A' |
3475 | - # read the data |
3476 | - with open("/proc/net/tcp") as net_tcp: |
3477 | - for line in net_tcp: |
3478 | - line = line.strip() |
3479 | - if not line: |
3480 | - continue |
3481 | - # split, values are: |
3482 | - # sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode |
3483 | - values = line.split() |
3484 | - state = values[INDEX_STATE] |
3485 | - if state != STATE_LISTENING: |
3486 | - continue |
3487 | - local_port_str = values[INDEX_LOCAL_ADDR].split(":")[1] |
3488 | - local_port = int(local_port_str, 16) |
3489 | - if local_port == port: |
3490 | - return True |
3491 | - return False |
3492 | - |
3493 | - |
3494 | -def iptables_active(): |
3495 | - """ Return True if iptables is active """ |
3496 | - # FIXME: is there a better way? |
3497 | - iptables_empty="""Chain INPUT (policy ACCEPT) |
3498 | -target prot opt source destination |
3499 | - |
3500 | -Chain FORWARD (policy ACCEPT) |
3501 | -target prot opt source destination |
3502 | - |
3503 | -Chain OUTPUT (policy ACCEPT) |
3504 | -target prot opt source destination |
3505 | -""" |
3506 | - if os.getuid() != 0: |
3507 | - raise OSError("Need root to check the iptables state") |
3508 | - if not os.path.exists("/sbin/iptables"): |
3509 | - return False |
3510 | - out = subprocess.Popen(["iptables", "-L"], |
3511 | - stdout=subprocess.PIPE, |
3512 | - universal_newlines=True).communicate()[0] |
3513 | - if out == iptables_empty: |
3514 | - return False |
3515 | - return True |
3516 | - |
3517 | - |
3518 | -if __name__ == "__main__": |
3519 | - #print(mirror_from_sources_list()) |
3520 | - #print(on_battery()) |
3521 | - #print(inside_chroot()) |
3522 | - print(iptables_active()) |
3523 | |
3524 | === removed file 'UpdateManager/Dialogs.py' |
3525 | --- UpdateManager/Dialogs.py 2012-06-27 13:39:33 +0000 |
3526 | +++ UpdateManager/Dialogs.py 1970-01-01 00:00:00 +0000 |
3527 | @@ -1,235 +0,0 @@ |
3528 | -# Dialogs.py |
3529 | -# -*- coding: utf-8 -*- |
3530 | -# |
3531 | -# Copyright (c) 2012 Canonical |
3532 | -# |
3533 | -# Author: Michael Terry <michael.terry@canonical.com> |
3534 | -# |
3535 | -# This program is free software; you can redistribute it and/or |
3536 | -# modify it under the terms of the GNU General Public License as |
3537 | -# published by the Free Software Foundation; either version 2 of the |
3538 | -# License, or (at your option) any later version. |
3539 | -# |
3540 | -# This program is distributed in the hope that it will be useful, |
3541 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
3542 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3543 | -# GNU General Public License for more details. |
3544 | -# |
3545 | -# You should have received a copy of the GNU General Public License |
3546 | -# along with this program; if not, write to the Free Software |
3547 | -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
3548 | -# USA |
3549 | - |
3550 | -from __future__ import absolute_import, print_function |
3551 | - |
3552 | -from gi.repository import Gtk |
3553 | -from gi.repository import GObject |
3554 | -GObject.threads_init() |
3555 | - |
3556 | -import warnings |
3557 | -warnings.filterwarnings("ignore", "Accessed deprecated property", DeprecationWarning) |
3558 | - |
3559 | -import dbus |
3560 | -import os |
3561 | -import subprocess |
3562 | -import sys |
3563 | -import time |
3564 | -from .SimpleGtk3builderApp import SimpleGtkbuilderApp |
3565 | -from .DistUpgradeFetcher import DistUpgradeFetcherGtk |
3566 | -from .GtkProgress import GtkAcquireProgress |
3567 | - |
3568 | -from gettext import gettext as _ |
3569 | - |
3570 | -class Dialog(SimpleGtkbuilderApp): |
3571 | - def __init__(self, window_main): |
3572 | - self.window_main = window_main |
3573 | - self.focus_button = None |
3574 | - SimpleGtkbuilderApp.__init__(self, self.window_main.datadir+"/gtkbuilder/Dialog.ui", |
3575 | - "update-manager") |
3576 | - |
3577 | - def main(self): |
3578 | - self.window_main.push(self.pane_dialog, self) |
3579 | - if self.focus_button: |
3580 | - self.focus_button.grab_focus() |
3581 | - |
3582 | - def run(self, parent=None): |
3583 | - if self.focus_button: |
3584 | - self.focus_button.grab_focus() |
3585 | - if parent: |
3586 | - self.window_dialog.set_transient_for(parent) |
3587 | - self.window_dialog.set_modal(True) |
3588 | - self.window_dialog.run() |
3589 | - |
3590 | - def close(self): |
3591 | - sys.exit(0) # By default, exit the app |
3592 | - |
3593 | - def add_button(self, label, callback, secondary=False): |
3594 | - # from_stock tries stock first and falls back to mnemonic |
3595 | - button = Gtk.Button.new_from_stock(label) |
3596 | - button.connect("clicked", lambda x: callback()) |
3597 | - button.show() |
3598 | - self.buttonbox.add(button) |
3599 | - self.buttonbox.set_child_secondary(button, secondary) |
3600 | - return button |
3601 | - |
3602 | - def add_settings_button(self): |
3603 | - if os.path.exists("/usr/bin/software-properties-gtk"): |
3604 | - return self.add_button(_("Settings…"), self.on_settings_button_clicked, secondary=True) |
3605 | - else: |
3606 | - return None |
3607 | - |
3608 | - def on_settings_button_clicked(self): |
3609 | - cmd = ["/usr/bin/software-properties-gtk", |
3610 | - "--open-tab","2", |
3611 | - # FIXME: once get_xid() is available via introspections, add |
3612 | - # this back |
3613 | - #"--toplevel", "%s" % self.window_main.get_window().get_xid() |
3614 | - ] |
3615 | - self.window_main.set_sensitive(False) |
3616 | - p = subprocess.Popen(cmd) |
3617 | - while p.poll() is None: |
3618 | - while Gtk.events_pending(): |
3619 | - Gtk.main_iteration() |
3620 | - time.sleep(0.05) |
3621 | - self.window_main.set_sensitive(True) |
3622 | - |
3623 | - def set_header(self, label): |
3624 | - self.label_header.set_label(label) |
3625 | - |
3626 | - def set_desc(self, label): |
3627 | - self.label_desc.set_label(label) |
3628 | - self.label_desc.set_visible(bool(label)) |
3629 | - |
3630 | - |
3631 | -class NoUpdatesDialog(Dialog): |
3632 | - def __init__(self, window_main): |
3633 | - Dialog.__init__(self, window_main) |
3634 | - self.set_header(_("The software on this computer is up to date.")) |
3635 | - self.add_settings_button() |
3636 | - self.focus_button = self.add_button(Gtk.STOCK_OK, self.close) |
3637 | - |
3638 | - |
3639 | -class DistUpgradeDialog(Dialog): |
3640 | - def __init__(self, window_main, meta_release): |
3641 | - Dialog.__init__(self, window_main) |
3642 | - self.meta_release = meta_release |
3643 | - self.set_header(_("The software on this computer is up to date.")) |
3644 | - # Translators: these are Ubuntu version names like "Ubuntu 12.04" |
3645 | - self.set_desc(_("However, %s %s is now available (you have %s).") % ( |
3646 | - meta_release.flavor_name, |
3647 | - meta_release.upgradable_to.version, |
3648 | - meta_release.current_dist_version)) |
3649 | - self.add_settings_button() |
3650 | - self.add_button(_("Upgrade…"), self.upgrade) |
3651 | - self.focus_button = self.add_button(Gtk.STOCK_OK, self.close) |
3652 | - |
3653 | - def upgrade(self): |
3654 | - progress = GtkAcquireProgress(self.window_main, self.window_main.datadir, |
3655 | - _("Downloading the release upgrade tool")) |
3656 | - fetcher = DistUpgradeFetcherGtk(new_dist=self.meta_release.upgradable_to, |
3657 | - parent=self.window_main, |
3658 | - progress=progress, |
3659 | - datadir=self.window_main.datadir) |
3660 | - if self.window_main.options.sandbox: |
3661 | - fetcher.run_options.append("--sandbox") |
3662 | - fetcher.run() |
3663 | - |
3664 | - |
3665 | -class UnsupportedDialog(DistUpgradeDialog): |
3666 | - def __init__(self, window_main, meta_release): |
3667 | - DistUpgradeDialog.__init__(self, window_main, meta_release) |
3668 | - # Translators: this is an Ubuntu version name like "Ubuntu 12.04" |
3669 | - self.set_header(_("Software updates are no longer provided for %s %s.") % ( |
3670 | - meta_release.flavor_name, |
3671 | - meta_release.current_dist_version)) |
3672 | - # Translators: this is an Ubuntu version name like "Ubuntu 12.04" |
3673 | - self.set_desc(_("To stay secure, you should upgrade to %s %s.") % ( |
3674 | - meta_release.flavor_name, |
3675 | - meta_release.upgradable_to.version)) |
3676 | - |
3677 | - def run(self, parent): |
3678 | - # This field is used in tests/test_end_of_life.py |
3679 | - self.window_main.no_longer_supported_nag = self.window_dialog |
3680 | - DistUpgradeDialog.run(self, parent) |
3681 | - |
3682 | - |
3683 | -class PartialUpgradeDialog(Dialog): |
3684 | - def __init__(self, window_main): |
3685 | - Dialog.__init__(self, window_main) |
3686 | - self.set_header(_("Not all updates can be installed")) |
3687 | - self.set_desc(_("""Run a partial upgrade, to install as many updates as possible. |
3688 | - |
3689 | -This can be caused by: |
3690 | - * A previous upgrade which didn't complete |
3691 | - * Problems with some of the installed software |
3692 | - * Unofficial software packages not provided by Ubuntu |
3693 | - * Normal changes of a pre-release version of Ubuntu""")) |
3694 | - self.add_settings_button() |
3695 | - self.add_button(_("_Partial Upgrade"), self.upgrade) |
3696 | - self.focus_button = self.add_button(_("_Continue"), Gtk.main_quit) |
3697 | - |
3698 | - def upgrade(self): |
3699 | - os.execl("/usr/bin/gksu", |
3700 | - "/usr/bin/gksu", "--desktop", |
3701 | - "/usr/share/applications/update-manager.desktop", |
3702 | - "--", "/usr/bin/update-manager", "--dist-upgrade") |
3703 | - |
3704 | - def main(self): |
3705 | - Dialog.main(self) |
3706 | - # Block progress until user has answered this question |
3707 | - Gtk.main() |
3708 | - |
3709 | - |
3710 | -class ErrorDialog(Dialog): |
3711 | - def __init__(self, window_main, header, desc=None): |
3712 | - Dialog.__init__(self, window_main) |
3713 | - self.set_header(header) |
3714 | - if desc: |
3715 | - self.set_desc(desc) |
3716 | - self.label_desc.set_selectable(True) |
3717 | - self.add_settings_button() |
3718 | - self.focus_button = self.add_button(Gtk.STOCK_OK, self.close) |
3719 | - |
3720 | - def main(self): |
3721 | - Dialog.main(self) |
3722 | - # The label likes to start selecting everything (b/c it got focus before |
3723 | - # we switched to our default button). |
3724 | - self.label_desc.select_region(0, 0) |
3725 | - # Since errors usually are outside the normal flow, we'll guarantee that |
3726 | - # we don't continue with normal code flow by running our own loop here. |
3727 | - # We won't screw anything up because the only thing this dialog will do |
3728 | - # is exit. |
3729 | - Gtk.main() |
3730 | - |
3731 | - |
3732 | -class NeedRestartDialog(Dialog): |
3733 | - def __init__(self, window_main): |
3734 | - Dialog.__init__(self, window_main) |
3735 | - self.set_header(_("The computer needs to restart to finish installing updates.")) |
3736 | - self.focus_button = self.add_button(_("_Restart"), self.restart) |
3737 | - |
3738 | - def restart(self, *args, **kwargs): |
3739 | - self._request_reboot_via_session_manager() |
3740 | - |
3741 | - def _request_reboot_via_session_manager(self): |
3742 | - try: |
3743 | - bus = dbus.SessionBus() |
3744 | - proxy_obj = bus.get_object("org.gnome.SessionManager", |
3745 | - "/org/gnome/SessionManager") |
3746 | - iface = dbus.Interface(proxy_obj, "org.gnome.SessionManager") |
3747 | - iface.RequestReboot() |
3748 | - except dbus.DBusException: |
3749 | - self._request_reboot_via_consolekit() |
3750 | - except: |
3751 | - pass |
3752 | - |
3753 | - def _request_reboot_via_consolekit(self): |
3754 | - try: |
3755 | - bus = dbus.SystemBus() |
3756 | - proxy_obj = bus.get_object("org.freedesktop.ConsoleKit", |
3757 | - "/org/freedesktop/ConsoleKit/Manager") |
3758 | - iface = dbus.Interface(proxy_obj, "org.freedesktop.ConsoleKit.Manager") |
3759 | - iface.Restart() |
3760 | - except dbus.DBusException: |
3761 | - pass |
3762 | - |
3763 | |
3764 | === removed file 'UpdateManager/DistUpgradeFetcher.py' |
3765 | --- UpdateManager/DistUpgradeFetcher.py 2012-06-15 20:02:33 +0000 |
3766 | +++ UpdateManager/DistUpgradeFetcher.py 1970-01-01 00:00:00 +0000 |
3767 | @@ -1,143 +0,0 @@ |
3768 | -# DistUpgradeFetcher.py |
3769 | -# |
3770 | -# Copyright (c) 2006 Canonical |
3771 | -# |
3772 | -# Author: Michael Vogt <michael.vogt@ubuntu.com> |
3773 | -# |
3774 | -# This program is free software; you can redistribute it and/or |
3775 | -# modify it under the terms of the GNU General Public License as |
3776 | -# published by the Free Software Foundation; either version 2 of the |
3777 | -# License, or (at your option) any later version. |
3778 | -# |
3779 | -# This program is distributed in the hope that it will be useful, |
3780 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
3781 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3782 | -# GNU General Public License for more details. |
3783 | -# |
3784 | -# You should have received a copy of the GNU General Public License |
3785 | -# along with this program; if not, write to the Free Software |
3786 | -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
3787 | -# USA |
3788 | - |
3789 | -from __future__ import absolute_import, print_function |
3790 | - |
3791 | -from gi.repository import Gtk, Gdk |
3792 | - |
3793 | -from .ReleaseNotesViewer import ReleaseNotesViewer |
3794 | -from .Core.utils import error, inhibit_sleep, allow_sleep |
3795 | -from .Core.DistUpgradeFetcherCore import DistUpgradeFetcherCore |
3796 | -from .SimpleGtk3builderApp import SimpleGtkbuilderApp |
3797 | -from gettext import gettext as _ |
3798 | -try: |
3799 | - from urllib.request import urlopen |
3800 | - from urllib.error import HTTPError |
3801 | -except ImportError: |
3802 | - from urllib2 import urlopen, HTTPError |
3803 | -import os |
3804 | -import socket |
3805 | - |
3806 | - |
3807 | -class DistUpgradeFetcherGtk(DistUpgradeFetcherCore): |
3808 | - |
3809 | - def __init__(self, new_dist, progress, parent, datadir): |
3810 | - DistUpgradeFetcherCore.__init__(self,new_dist,progress) |
3811 | - uifile = datadir + "gtkbuilder/ReleaseNotes.ui" |
3812 | - self.widgets = SimpleGtkbuilderApp(uifile, "update-manager") |
3813 | - self.window_main = parent |
3814 | - |
3815 | - def error(self, summary, message): |
3816 | - return error(self.window_main, summary, message) |
3817 | - |
3818 | - def runDistUpgrader(self): |
3819 | - inhibit_sleep() |
3820 | - # now run it with sudo |
3821 | - if os.getuid() != 0: |
3822 | - os.execv("/usr/bin/gksu",["gksu", |
3823 | - "--desktop","/usr/share/applications/update-manager.desktop", |
3824 | - "--", |
3825 | - self.script]+self.run_options) |
3826 | - else: |
3827 | - os.execv(self.script,[self.script]+self.run_options) |
3828 | - # we shouldn't come to this point, but if we do, undo our |
3829 | - # inhibit sleep |
3830 | - allow_sleep() |
3831 | - |
3832 | - def showReleaseNotes(self): |
3833 | - # first try showing the webkit version, this may fail (return None |
3834 | - # because e.g. there is no webkit installed) |
3835 | - res = self._try_show_release_notes_webkit() |
3836 | - if res is not None: |
3837 | - return res |
3838 | - else: |
3839 | - # fallback to text |
3840 | - return self._try_show_release_notes_textview() |
3841 | - |
3842 | - def _try_show_release_notes_webkit(self): |
3843 | - if self.new_dist.releaseNotesHtmlUri is not None: |
3844 | - try: |
3845 | - from .ReleaseNotesViewerWebkit import ReleaseNotesViewerWebkit |
3846 | - webkit_release_notes = ReleaseNotesViewerWebkit(self.new_dist.releaseNotesHtmlUri) |
3847 | - webkit_release_notes.show() |
3848 | - self.widgets.scrolled_notes.add(webkit_release_notes) |
3849 | - res = self.widgets.dialog_release_notes.run() |
3850 | - self.widgets.dialog_release_notes.hide() |
3851 | - if res == Gtk.ResponseType.OK: |
3852 | - return True |
3853 | - return False |
3854 | - except ImportError: |
3855 | - pass |
3856 | - return None |
3857 | - |
3858 | - def _try_show_release_notes_textview(self): |
3859 | - # FIXME: care about i18n! (append -$lang or something) |
3860 | - if self.new_dist.releaseNotesURI != None: |
3861 | - uri = self._expandUri(self.new_dist.releaseNotesURI) |
3862 | - self.window_main.set_sensitive(False) |
3863 | - self.window_main.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH)) |
3864 | - while Gtk.events_pending(): |
3865 | - Gtk.main_iteration() |
3866 | - |
3867 | - # download/display the release notes |
3868 | - # FIXME: add some progress reporting here |
3869 | - res = Gtk.ResponseType.CANCEL |
3870 | - timeout = socket.getdefaulttimeout() |
3871 | - try: |
3872 | - socket.setdefaulttimeout(5) |
3873 | - release_notes = urlopen(uri) |
3874 | - notes = release_notes.read().decode("UTF-8", "replace") |
3875 | - textview_release_notes = ReleaseNotesViewer(notes) |
3876 | - textview_release_notes.show() |
3877 | - self.widgets.scrolled_notes.add(textview_release_notes) |
3878 | - self.widgets.dialog_release_notes.set_transient_for(self.window_main) |
3879 | - res = self.widgets.dialog_release_notes.run() |
3880 | - self.widgets.dialog_release_notes.hide() |
3881 | - except HTTPError: |
3882 | - primary = "<span weight=\"bold\" size=\"larger\">%s</span>" % \ |
3883 | - _("Could not find the release notes") |
3884 | - secondary = _("The server may be overloaded. ") |
3885 | - dialog = Gtk.MessageDialog(self.window_main,Gtk.DialogFlags.MODAL, |
3886 | - Gtk.MessageType.ERROR,Gtk.ButtonsType.CLOSE,"") |
3887 | - dialog.set_title("") |
3888 | - dialog.set_markup(primary); |
3889 | - dialog.format_secondary_text(secondary); |
3890 | - dialog.run() |
3891 | - dialog.destroy() |
3892 | - except IOError: |
3893 | - primary = "<span weight=\"bold\" size=\"larger\">%s</span>" % \ |
3894 | - _("Could not download the release notes") |
3895 | - secondary = _("Please check your internet connection.") |
3896 | - dialog = Gtk.MessageDialog(self.window_main,Gtk.DialogFlags.MODAL, |
3897 | - Gtk.MessageType.ERROR,Gtk.ButtonsType.CLOSE,"") |
3898 | - dialog.set_title("") |
3899 | - dialog.set_markup(primary); |
3900 | - dialog.format_secondary_text(secondary); |
3901 | - dialog.run() |
3902 | - dialog.destroy() |
3903 | - socket.setdefaulttimeout(timeout) |
3904 | - self.window_main.set_sensitive(True) |
3905 | - self.window_main.get_window().set_cursor(None) |
3906 | - # user clicked cancel |
3907 | - if res == Gtk.ResponseType.OK: |
3908 | - return True |
3909 | - return False |
3910 | - |
3911 | |
3912 | === removed file 'UpdateManager/DistUpgradeFetcherKDE.py' |
3913 | --- UpdateManager/DistUpgradeFetcherKDE.py 2012-06-12 01:40:26 +0000 |
3914 | +++ UpdateManager/DistUpgradeFetcherKDE.py 1970-01-01 00:00:00 +0000 |
3915 | @@ -1,188 +0,0 @@ |
3916 | -# DistUpgradeFetcherKDE.py |
3917 | -# |
3918 | -# Copyright (c) 2008 Canonical Ltd |
3919 | -# |
3920 | -# Author: Jonathan Riddell <jriddell@ubuntu.com> |
3921 | -# |
3922 | -# This program is free software; you can redistribute it and/or |
3923 | -# modify it under the terms of the GNU General Public License as |
3924 | -# published by the Free Software Foundation; either version 2 of the |
3925 | -# License, or (at your option) any later version. |
3926 | -# |
3927 | -# This program is distributed in the hope that it will be useful, |
3928 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
3929 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3930 | -# GNU General Public License for more details. |
3931 | -# |
3932 | -# You should have received a copy of the GNU General Public License |
3933 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
3934 | - |
3935 | -from __future__ import absolute_import |
3936 | - |
3937 | -from PyKDE4.kdecore import ki18n, KAboutData, KCmdLineOptions, KCmdLineArgs |
3938 | -from PyKDE4.kdeui import KIcon, KMessageBox, KApplication, KStandardGuiItem |
3939 | -from PyQt4.QtCore import QDir, QTimer |
3940 | -from PyQt4.QtGui import QDialog, QDialogButtonBox |
3941 | -from PyQt4 import uic |
3942 | - |
3943 | -import apt_pkg |
3944 | -import sys |
3945 | - |
3946 | -from .Core.utils import inhibit_sleep, allow_sleep |
3947 | -from .Core.DistUpgradeFetcherCore import DistUpgradeFetcherCore |
3948 | -from gettext import gettext as _ |
3949 | -try: |
3950 | - from urllib.request import urlopen |
3951 | - from urllib.error import HTTPError |
3952 | -except ImportError: |
3953 | - from urllib2 import urlopen, HTTPError |
3954 | -import os |
3955 | - |
3956 | -from .Core.MetaRelease import MetaReleaseCore |
3957 | -import time |
3958 | -import apt |
3959 | - |
3960 | -class DistUpgradeFetcherKDE(DistUpgradeFetcherCore): |
3961 | - """A small application run by Adept to download, verify |
3962 | - and run the dist-upgrade tool""" |
3963 | - |
3964 | - def __init__(self, useDevelopmentRelease=False, useProposed=False): |
3965 | - self.useDevelopmentRelease = useDevelopmentRelease |
3966 | - self.useProposed = useProposed |
3967 | - metaRelease = MetaReleaseCore(useDevelopmentRelease, useProposed) |
3968 | - while metaRelease.downloading: |
3969 | - time.sleep(0.2) |
3970 | - if metaRelease.new_dist is None and __name__ == "__main__": |
3971 | - sys.exit() |
3972 | - elif metaRelease.new_dist is None: |
3973 | - return |
3974 | - |
3975 | - self.progressDialogue = QDialog() |
3976 | - if os.path.exists("fetch-progress.ui"): |
3977 | - self.APPDIR = QDir.currentPath() |
3978 | - else: |
3979 | - self.APPDIR = "/usr/share/update-manager" |
3980 | - |
3981 | - uic.loadUi(self.APPDIR + "/fetch-progress.ui", self.progressDialogue) |
3982 | - self.progressDialogue.setWindowIcon(KIcon("system-software-update")) |
3983 | - self.progressDialogue.setWindowTitle(_("Upgrade")) |
3984 | - self.progress = KDEAcquireProgressAdapter(self.progressDialogue.installationProgress, self.progressDialogue.installingLabel, None) |
3985 | - DistUpgradeFetcherCore.__init__(self,metaRelease.new_dist,self.progress) |
3986 | - |
3987 | - def error(self, summary, message): |
3988 | - KMessageBox.sorry(None, message, summary) |
3989 | - |
3990 | - def runDistUpgrader(self): |
3991 | - inhibit_sleep() |
3992 | - # now run it with sudo |
3993 | - if os.getuid() != 0: |
3994 | - os.execv("/usr/bin/kdesudo",["kdesudo", self.script + " --frontend=DistUpgradeViewKDE"]) |
3995 | - else: |
3996 | - os.execv(self.script,[self.script]+ ["--frontend=DistUpgradeViewKDE"] + self.run_options) |
3997 | - # we shouldn't come to this point, but if we do, undo our |
3998 | - # inhibit sleep |
3999 | - allow_sleep() |
4000 | - |
4001 | - def showReleaseNotes(self): |
4002 | - # FIXME: care about i18n! (append -$lang or something) |
4003 | - self.dialogue = QDialog() |
4004 | - uic.loadUi(self.APPDIR + "/dialog_release_notes.ui", self.dialogue) |
4005 | - upgradeButton = self.dialogue.buttonBox.button(QDialogButtonBox.Ok) |
4006 | - upgradeButton.setText(_("Upgrade")) |
4007 | - upgradeButton.setIcon(KIcon("dialog-ok")) |
4008 | - cancelButton = self.dialogue.buttonBox.button(QDialogButtonBox.Cancel) |
4009 | - cancelButton.setIcon(KIcon("dialog-cancel")) |
4010 | - self.dialogue.setWindowTitle(_("Release Notes")) |
4011 | - self.dialogue.show() |
4012 | - if self.new_dist.releaseNotesURI != None: |
4013 | - uri = self._expandUri(self.new_dist.releaseNotesURI) |
4014 | - # download/display the release notes |
4015 | - # FIXME: add some progress reporting here |
4016 | - result = None |
4017 | - try: |
4018 | - release_notes = urlopen(uri) |
4019 | - notes = release_notes.read().decode("UTF-8", "replace") |
4020 | - self.dialogue.scrolled_notes.setText(notes) |
4021 | - result = self.dialogue.exec_() |
4022 | - except HTTPError: |
4023 | - primary = "<span weight=\"bold\" size=\"larger\">%s</span>" % \ |
4024 | - _("Could not find the release notes") |
4025 | - secondary = _("The server may be overloaded. ") |
4026 | - KMessageBox.sorry(None, primary + "<br />" + secondary, "") |
4027 | - except IOError: |
4028 | - primary = "<span weight=\"bold\" size=\"larger\">%s</span>" % \ |
4029 | - _("Could not download the release notes") |
4030 | - secondary = _("Please check your internet connection.") |
4031 | - KMessageBox.sorry(None, primary + "<br />" + secondary, "") |
4032 | - # user clicked cancel |
4033 | - if result == QDialog.Accepted: |
4034 | - self.progressDialogue.show() |
4035 | - return True |
4036 | - if __name__ == "__main__": |
4037 | - KApplication.kApplication().exit(1) |
4038 | - if self.useDevelopmentRelease or self.useProposed: |
4039 | - sys.exit() #FIXME why does KApplication.kApplication().exit() crash but this doesn't? |
4040 | - return False |
4041 | - |
4042 | -class KDEAcquireProgressAdapter(apt.progress.base.AcquireProgress): |
4043 | - def __init__(self,progress,label,parent): |
4044 | - self.progress = progress |
4045 | - self.label = label |
4046 | - self.parent = parent |
4047 | - |
4048 | - def start(self): |
4049 | - self.label.setText(_("Downloading additional package files...")) |
4050 | - self.progress.setValue(0) |
4051 | - |
4052 | - def stop(self): |
4053 | - pass |
4054 | - |
4055 | - def pulse(self, owner): |
4056 | - apt.progress.base.AcquireProgress.pulse(self, owner) |
4057 | - self.progress.setValue((self.current_bytes + self.current_items) / |
4058 | - float(self.total_bytes + self.total_items)) |
4059 | - current_item = self.current_items + 1 |
4060 | - if current_item > self.total_items: |
4061 | - current_item = self.total_items |
4062 | - if self.current_cps > 0: |
4063 | - self.label.setText(_("Downloading additional package files...") + _("File %s of %s at %sB/s") % (self.current_items,self.total_items,apt_pkg.size_to_str(self.current_cps))) |
4064 | - else: |
4065 | - self.label.setText(_("Downloading additional package files...") + _("File %s of %s") % (self.current_items,self.total_items)) |
4066 | - KApplication.kApplication().processEvents() |
4067 | - return True |
4068 | - |
4069 | - def mediaChange(self, medium, drive): |
4070 | - msg = _("Please insert '%s' into the drive '%s'") % (medium,drive) |
4071 | - #change = QMessageBox.question(None, _("Media Change"), msg, QMessageBox.Ok, QMessageBox.Cancel) |
4072 | - change = KMessageBox.questionYesNo(None, _("Media Change"), _("Media Change") + "<br>" + msg, KStandardGuiItem.ok(), KStandardGuiItem.cancel()) |
4073 | - if change == KMessageBox.Yes: |
4074 | - return True |
4075 | - return False |
4076 | - |
4077 | -if __name__ == "__main__": |
4078 | - |
4079 | - appName = "dist-upgrade-fetcher" |
4080 | - catalog = "" |
4081 | - programName = ki18n ("Dist Upgrade Fetcher") |
4082 | - version = "0.3.4" |
4083 | - description = ki18n ("Dist Upgrade Fetcher") |
4084 | - license = KAboutData.License_GPL |
4085 | - copyright = ki18n ("(c) 2008 Canonical Ltd") |
4086 | - text = ki18n ("none") |
4087 | - homePage = "https://launchpad.net/update-manager" |
4088 | - bugEmail = "" |
4089 | - |
4090 | - aboutData = KAboutData (appName, catalog, programName, version, description, license, copyright, text, homePage, bugEmail) |
4091 | - |
4092 | - aboutData.addAuthor(ki18n("Jonathan Riddell"), ki18n("Author")) |
4093 | - |
4094 | - options = KCmdLineOptions() |
4095 | - |
4096 | - KCmdLineArgs.init (sys.argv, aboutData) |
4097 | - KCmdLineArgs.addCmdLineOptions(options) |
4098 | - |
4099 | - app = KApplication() |
4100 | - fetcher = DistUpgradeFetcherKDE() |
4101 | - QTimer.singleShot(10, fetcher.run) |
4102 | - |
4103 | - app.exec_() |
4104 | |
4105 | === removed file 'UpdateManager/GtkProgress.py' |
4106 | --- UpdateManager/GtkProgress.py 2012-06-15 20:24:05 +0000 |
4107 | +++ UpdateManager/GtkProgress.py 1970-01-01 00:00:00 +0000 |
4108 | @@ -1,89 +0,0 @@ |
4109 | -# GtkProgress.py |
4110 | -# |
4111 | -# Copyright (c) 2004,2005 Canonical |
4112 | -# |
4113 | -# Author: Michael Vogt <michael.vogt@ubuntu.com> |
4114 | -# |
4115 | -# This program is free software; you can redistribute it and/or |
4116 | -# modify it under the terms of the GNU General Public License as |
4117 | -# published by the Free Software Foundation; either version 2 of the |
4118 | -# License, or (at your option) any later version. |
4119 | -# |
4120 | -# This program is distributed in the hope that it will be useful, |
4121 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4122 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4123 | -# GNU General Public License for more details. |
4124 | -# |
4125 | -# You should have received a copy of the GNU General Public License |
4126 | -# along with this program; if not, write to the Free Software |
4127 | -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
4128 | -# USA |
4129 | - |
4130 | -from __future__ import absolute_import, print_function |
4131 | - |
4132 | -from gi.repository import Gtk, Gdk |
4133 | -import apt |
4134 | -from gettext import gettext as _ |
4135 | -from .Core.utils import humanize_size |
4136 | -from .SimpleGtk3builderApp import SimpleGtkbuilderApp |
4137 | - |
4138 | -class GtkAcquireProgress(apt.progress.base.AcquireProgress): |
4139 | - def __init__(self, parent, datadir, summary="", descr=""): |
4140 | - uifile = datadir + "gtkbuilder/AcquireProgress.ui" |
4141 | - self.widgets = SimpleGtkbuilderApp(uifile, "update-manager") |
4142 | - # if this is set to false the download will cancel |
4143 | - self._continue = True |
4144 | - # init vars here |
4145 | - # FIXME: find a more elegant way, this sucks |
4146 | - self.summary = self.widgets.label_fetch_summary |
4147 | - self.status = self.widgets.label_fetch_status |
4148 | - # we need to connect the signal manual here, it won't work |
4149 | - # from the main window auto-connect |
4150 | - self.widgets.button_fetch_cancel.connect( |
4151 | - "clicked", self.on_button_fetch_cancel_clicked) |
4152 | - self.progress = self.widgets.progressbar_fetch |
4153 | - self.window_fetch = self.widgets.window_fetch |
4154 | - self.window_fetch.set_transient_for(parent) |
4155 | - self.window_fetch.realize() |
4156 | - self.window_fetch.get_window().set_functions(Gdk.WMFunction.MOVE) |
4157 | - # set summary |
4158 | - if summary != "": |
4159 | - self.summary.set_markup("<big><b>%s</b></big> \n\n%s" % |
4160 | - (summary, descr)) |
4161 | - def start(self): |
4162 | - self.progress.set_fraction(0) |
4163 | - self.window_fetch.show() |
4164 | - def stop(self): |
4165 | - self.window_fetch.hide() |
4166 | - def on_button_fetch_cancel_clicked(self, widget): |
4167 | - self._continue = False |
4168 | - def pulse(self, owner): |
4169 | - apt.progress.base.AcquireProgress.pulse(self, owner) |
4170 | - current_item = self.current_items + 1 |
4171 | - if current_item > self.total_items: |
4172 | - current_item = self.total_items |
4173 | - if self.current_cps > 0: |
4174 | - status_text = (_("Downloading file %(current)li of %(total)li with " |
4175 | - "%(speed)s/s") % {"current" : current_item, |
4176 | - "total" : self.total_items, |
4177 | - "speed" : humanize_size(self.current_cps)}) |
4178 | - else: |
4179 | - status_text = (_("Downloading file %(current)li of %(total)li") % \ |
4180 | - {"current" : current_item, |
4181 | - "total" : self.total_items }) |
4182 | - self.progress.set_fraction((self.current_bytes + self.current_items) / |
4183 | - float(self.total_bytes + self.total_items)) |
4184 | - self.status.set_markup("<i>%s</i>" % status_text) |
4185 | - # TRANSLATORS: show the remaining time in a progress bar: |
4186 | - #if self.current_cps > 0: |
4187 | - # eta = ((self.total_bytes + self.current_bytes) / float(self.current_cps)) |
4188 | - #else: |
4189 | - # eta = 0.0 |
4190 | - #self.progress.set_text(_("About %s left" % (apt_pkg.TimeToStr(eta)))) |
4191 | - # FIXME: show remaining time |
4192 | - self.progress.set_text("") |
4193 | - |
4194 | - while Gtk.events_pending(): |
4195 | - Gtk.main_iteration() |
4196 | - return self._continue |
4197 | - |
4198 | |
4199 | === removed file 'UpdateManager/HelpViewer.py' |
4200 | --- UpdateManager/HelpViewer.py 2012-05-28 11:11:59 +0000 |
4201 | +++ UpdateManager/HelpViewer.py 1970-01-01 00:00:00 +0000 |
4202 | @@ -1,33 +0,0 @@ |
4203 | -# helpviewer.py |
4204 | - |
4205 | -import os |
4206 | -import subprocess |
4207 | - |
4208 | -# Hardcoded list of available help viewers |
4209 | -# FIXME: khelpcenter support would be nice |
4210 | -#KNOWN_VIEWERS = ["/usr/bin/yelp", "/usr/bin/khelpcenter"] |
4211 | -KNOWN_VIEWERS = ["/usr/bin/yelp"] |
4212 | - |
4213 | -class HelpViewer: |
4214 | - def __init__(self, docu): |
4215 | - self.command = [] |
4216 | - self.docu = docu |
4217 | - for viewer in KNOWN_VIEWERS: |
4218 | - if os.path.exists(viewer): |
4219 | - self.command = [viewer, "ghelp:%s" % docu] |
4220 | - break |
4221 | - |
4222 | - def check(self): |
4223 | - """check if a viewer is available""" |
4224 | - if self.command == []: |
4225 | - return False |
4226 | - else: |
4227 | - return True |
4228 | - |
4229 | - def run(self): |
4230 | - """open the documentation in the viewer""" |
4231 | - # avoid running the help viewer as root |
4232 | - if os.getuid() == 0 and 'SUDO_USER' in os.environ: |
4233 | - self.command = ['sudo', '-u', os.environ['SUDO_USER']] +\ |
4234 | - self.command |
4235 | - subprocess.Popen(self.command) |
4236 | |
4237 | === removed file 'UpdateManager/InstallProgress.py' |
4238 | --- UpdateManager/InstallProgress.py 2012-06-15 20:24:05 +0000 |
4239 | +++ UpdateManager/InstallProgress.py 1970-01-01 00:00:00 +0000 |
4240 | @@ -1,93 +0,0 @@ |
4241 | -# InstallProgress.py |
4242 | -# |
4243 | -# Copyright (c) 2004-2012 Canonical |
4244 | -# 2004 Michiel Sikkes |
4245 | -# 2005 Martin Willemoes Hansen |
4246 | -# 2010 Mohamed Amine IL Idrissi |
4247 | -# |
4248 | -# Author: Michiel Sikkes <michiel@eyesopened.nl> |
4249 | -# Michael Vogt <mvo@debian.org> |
4250 | -# Martin Willemoes Hansen <mwh@sysrq.dk> |
4251 | -# Mohamed Amine IL Idrissi <ilidrissiamine@gmail.com> |
4252 | -# Alex Launi <alex.launi@canonical.com> |
4253 | -# Michael Terry <michael.terry@canonical.com> |
4254 | -# |
4255 | -# This program is free software; you can redistribute it and/or |
4256 | -# modify it under the terms of the GNU General Public License as |
4257 | -# published by the Free Software Foundation; either version 2 of the |
4258 | -# License, or (at your option) any later version. |
4259 | -# |
4260 | -# This program is distributed in the hope that it will be useful, |
4261 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4262 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4263 | -# GNU General Public License for more details. |
4264 | -# |
4265 | -# You should have received a copy of the GNU General Public License |
4266 | -# along with this program; if not, write to the Free Software |
4267 | -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
4268 | -# USA |
4269 | - |
4270 | -from __future__ import absolute_import, print_function |
4271 | - |
4272 | -import warnings |
4273 | -warnings.filterwarnings("ignore", "Accessed deprecated property", DeprecationWarning) |
4274 | - |
4275 | -import os |
4276 | -import sys |
4277 | - |
4278 | -from .backend import get_backend |
4279 | - |
4280 | -from .Core.utils import (inhibit_sleep, |
4281 | - allow_sleep) |
4282 | - |
4283 | -class InstallProgress(object): |
4284 | - |
4285 | - def __init__(self, app): |
4286 | - self.window_main = app |
4287 | - self.datadir = app.datadir |
4288 | - self.options = app.options |
4289 | - |
4290 | - # Used for inhibiting power management |
4291 | - self.sleep_cookie = None |
4292 | - self.sleep_dev = None |
4293 | - |
4294 | - # get the install backend |
4295 | - self.install_backend = get_backend(self.datadir, self.window_main) |
4296 | - self.install_backend.connect("action-done", self._on_backend_done) |
4297 | - |
4298 | - def invoke_manager(self): |
4299 | - # don't display apt-listchanges, we already showed the changelog |
4300 | - os.environ["APT_LISTCHANGES_FRONTEND"]="none" |
4301 | - |
4302 | - # Do not suspend during the update process |
4303 | - (self.sleep_dev, self.sleep_cookie) = inhibit_sleep() |
4304 | - |
4305 | - # If the progress dialog should be closed automatically afterwards |
4306 | - #settings = Gio.Settings("com.ubuntu.update-manager") |
4307 | - #close_on_done = settings.get_boolean("autoclose-install-window") |
4308 | - close_on_done = False # FIXME: confirm with mpt whether this should still be a setting |
4309 | - |
4310 | - # Get the packages which should be installed and update |
4311 | - pkgs_install = [] |
4312 | - pkgs_upgrade = [] |
4313 | - for pkg in self.window_main.cache: |
4314 | - if pkg.marked_install: |
4315 | - pkgs_install.append(pkg.name) |
4316 | - elif pkg.marked_upgrade: |
4317 | - pkgs_upgrade.append(pkg.name) |
4318 | - self.install_backend.commit(pkgs_install, pkgs_upgrade, close_on_done) |
4319 | - |
4320 | - def _on_backend_done(self, backend, action, authorized, success): |
4321 | - # Allow suspend after synaptic is finished |
4322 | - if self.sleep_cookie: |
4323 | - allow_sleep(self.sleep_dev, self.sleep_cookie) |
4324 | - self.sleep_cookie = self.sleep_dev = None |
4325 | - |
4326 | - # Either launch main dialog and continue or quit altogether |
4327 | - if success: |
4328 | - self.window_main.start_available(allow_restart=True) |
4329 | - else: |
4330 | - sys.exit(0) |
4331 | - |
4332 | - def main(self): |
4333 | - self.invoke_manager() |
4334 | |
4335 | === removed file 'UpdateManager/MetaReleaseGObject.py' |
4336 | --- UpdateManager/MetaReleaseGObject.py 2012-06-15 17:36:46 +0000 |
4337 | +++ UpdateManager/MetaReleaseGObject.py 1970-01-01 00:00:00 +0000 |
4338 | @@ -1,57 +0,0 @@ |
4339 | -# Copyright (c) 2004-2007 Canonical |
4340 | -# |
4341 | -# Author: Michael Vogt <michael.vogt@ubuntu.com> |
4342 | -# |
4343 | -# This program is free software; you can redistribute it and/or |
4344 | -# modify it under the terms of the GNU General Public License as |
4345 | -# published by the Free Software Foundation; either version 2 of the |
4346 | -# License, or (at your option) any later version. |
4347 | -# |
4348 | -# This program is distributed in the hope that it will be useful, |
4349 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4350 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4351 | -# GNU General Public License for more details. |
4352 | -# |
4353 | -# You should have received a copy of the GNU General Public License |
4354 | -# along with this program; if not, write to the Free Software |
4355 | -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
4356 | -# USA |
4357 | - |
4358 | -from __future__ import absolute_import |
4359 | - |
4360 | -from gi.repository import GObject |
4361 | -from .Core.MetaRelease import MetaReleaseCore |
4362 | - |
4363 | -class MetaRelease(MetaReleaseCore,GObject.GObject): |
4364 | - |
4365 | - __gsignals__ = { |
4366 | - 'new_dist_available' : (GObject.SignalFlags.RUN_LAST, |
4367 | - None, |
4368 | - (GObject.TYPE_PYOBJECT,)), |
4369 | - 'dist_no_longer_supported' : (GObject.SignalFlags.RUN_LAST, |
4370 | - None, |
4371 | - ()), |
4372 | - 'done_downloading' : (GObject.SignalFlags.RUN_LAST, |
4373 | - None, |
4374 | - ()) |
4375 | - } |
4376 | - |
4377 | - def __init__(self, useDevelopmentRelease=False, useProposed=False): |
4378 | - GObject.GObject.__init__(self) |
4379 | - MetaReleaseCore.__init__(self, useDevelopmentRelease, useProposed) |
4380 | - # in the gtk space to test if the download already finished |
4381 | - # this is needed because gtk is not thread-safe |
4382 | - GObject.timeout_add(1000, self.check) |
4383 | - |
4384 | - def check(self): |
4385 | - # check if we have a metarelease_information file |
4386 | - if self.no_longer_supported is not None: |
4387 | - self.emit("dist_no_longer_supported") |
4388 | - if self.new_dist is not None: |
4389 | - self.emit("new_dist_available", self.new_dist) |
4390 | - if self.downloading: |
4391 | - return True |
4392 | - else: |
4393 | - self.emit("done_downloading") |
4394 | - return False |
4395 | - |
4396 | |
4397 | === removed file 'UpdateManager/ReleaseNotesViewer.py' |
4398 | --- UpdateManager/ReleaseNotesViewer.py 2012-06-11 16:17:31 +0000 |
4399 | +++ UpdateManager/ReleaseNotesViewer.py 1970-01-01 00:00:00 +0000 |
4400 | @@ -1,186 +0,0 @@ |
4401 | -# ReleaseNotesViewer.py |
4402 | -# |
4403 | -# Copyright (c) 2006 Sebastian Heinlein |
4404 | -# |
4405 | -# Author: Sebastian Heinlein <sebastian.heinlein@web.de> |
4406 | -# |
4407 | -# This modul provides an inheritance of the Gtk.TextView that is |
4408 | -# aware of http URLs and allows to open them in a browser. |
4409 | -# It is based on the pygtk-demo "hypertext". |
4410 | -# |
4411 | -# This program is free software; you can redistribute it and/or |
4412 | -# modify it under the terms of the GNU General Public License as |
4413 | -# published by the Free Software Foundation; either version 2 of the |
4414 | -# License, or (at your option) any later version. |
4415 | -# |
4416 | -# This program is distributed in the hope that it will be useful, |
4417 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4418 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4419 | -# GNU General Public License for more details. |
4420 | -# |
4421 | -# You should have received a copy of the GNU General Public License |
4422 | -# along with this program; if not, write to the Free Software |
4423 | -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
4424 | -# USA |
4425 | - |
4426 | -from gi.repository import Pango |
4427 | -from gi.repository import Gtk, GObject, Gdk |
4428 | -import os |
4429 | -import subprocess |
4430 | - |
4431 | -def open_url(url): |
4432 | - """Open the specified URL in a browser""" |
4433 | - # Find an appropiate browser |
4434 | - if os.path.exists("/usr/bin/xdg-open"): |
4435 | - command = ["xdg-open", url] |
4436 | - elif os.path.exists("/usr/bin/exo-open"): |
4437 | - command = ["exo-open", url] |
4438 | - elif os.path.exists('/usr/bin/gnome-open'): |
4439 | - command = ['gnome-open', url] |
4440 | - else: |
4441 | - command = ['x-www-browser', url] |
4442 | - # Avoid to run the browser as user root |
4443 | - if os.getuid() == 0 and 'SUDO_USER' in os.environ: |
4444 | - command = ['sudo', '-u', os.environ['SUDO_USER']] + command |
4445 | - subprocess.Popen(command) |
4446 | - |
4447 | - |
4448 | -class ReleaseNotesViewer(Gtk.TextView): |
4449 | - def __init__(self, notes): |
4450 | - """Init the ReleaseNotesViewer as an Inheritance of the Gtk.TextView. |
4451 | - Load the notes into the buffer and make links clickable""" |
4452 | - # init the parent |
4453 | - GObject.GObject.__init__(self) |
4454 | - # global hovering over link state |
4455 | - self.hovering = False |
4456 | - self.first = True |
4457 | - # setup the buffer and signals |
4458 | - self.set_property("editable", False) |
4459 | - self.set_cursor_visible(False) |
4460 | - self.modify_font(Pango.FontDescription("monospace")) |
4461 | - self.buffer = Gtk.TextBuffer() |
4462 | - self.set_buffer(self.buffer) |
4463 | - self.buffer.set_text(notes) |
4464 | - self.connect("button-press-event", self.button_press_event) |
4465 | - self.connect("motion-notify-event", self.motion_notify_event) |
4466 | - self.connect("visibility-notify-event", self.visibility_notify_event) |
4467 | - # search for links in the notes and make them clickable |
4468 | - self.search_links() |
4469 | - |
4470 | - def tag_link(self, start, end, url): |
4471 | - """Apply the tag that marks links to the specified buffer selection""" |
4472 | - tag = self.buffer.create_tag(None, foreground="blue", |
4473 | - underline=Pango.Underline.SINGLE) |
4474 | - tag.url = url |
4475 | - self.buffer.apply_tag(tag , start, end) |
4476 | - |
4477 | - def search_links(self): |
4478 | - """Search for http URLs in the buffer and call the tag_link method |
4479 | - for each one to tag them as links""" |
4480 | - # start at the beginning of the buffer |
4481 | - iter = self.buffer.get_iter_at_offset(0) |
4482 | - while 1: |
4483 | - # search for the next URL in the buffer |
4484 | - ret = iter.forward_search("http://", Gtk.TextSearchFlags.VISIBLE_ONLY, |
4485 | - None) |
4486 | - # if we reach the end break the loop |
4487 | - if not ret: |
4488 | - break |
4489 | - # get the position of the protocol prefix |
4490 | - (match_start, match_end) = ret |
4491 | - match_tmp = match_end.copy() |
4492 | - while 1: |
4493 | - # extend the selection to the complete URL |
4494 | - if match_tmp.forward_char(): |
4495 | - text = match_end.get_text(match_tmp) |
4496 | - if text in (" ", ")", "]", "\n", "\t"): |
4497 | - break |
4498 | - else: |
4499 | - break |
4500 | - match_end = match_tmp.copy() |
4501 | - # call the tagging method for the complete URL |
4502 | - url = match_start.get_text(match_end) |
4503 | - self.tag_link(match_start, match_end, url) |
4504 | - # set the starting point for the next search |
4505 | - iter = match_end |
4506 | - |
4507 | - def button_press_event(self, text_view, event): |
4508 | - """callback for mouse click events""" |
4509 | - if event.button != 1: |
4510 | - return False |
4511 | - |
4512 | - # try to get a selection |
4513 | - try: |
4514 | - (start, end) = self.buffer.get_selection_bounds() |
4515 | - except ValueError: |
4516 | - pass |
4517 | - else: |
4518 | - if start.get_offset() != end.get_offset(): |
4519 | - return False |
4520 | - |
4521 | - # get the iter at the mouse position |
4522 | - (x, y) = self.window_to_buffer_coords(Gtk.TextWindowType.WIDGET, |
4523 | - int(event.x), int(event.y)) |
4524 | - iter = self.get_iter_at_location(x, y) |
4525 | - |
4526 | - # call open_url if an URL is assigned to the iter |
4527 | - tags = iter.get_tags() |
4528 | - for tag in tags: |
4529 | - url = getattr(tag, "url", None) |
4530 | - if url != "": |
4531 | - open_url(url) |
4532 | - break |
4533 | - |
4534 | - def motion_notify_event(self, text_view, event): |
4535 | - """callback for the mouse movement event, that calls the |
4536 | - check_hovering method with the mouse postition coordiantes""" |
4537 | - x, y = text_view.window_to_buffer_coords(Gtk.TextWindowType.WIDGET, |
4538 | - int(event.x), int(event.y)) |
4539 | - self.check_hovering(x, y) |
4540 | - self.get_window(Gtk.TextWindowType.TEXT).get_pointer() |
4541 | - return False |
4542 | - |
4543 | - def visibility_notify_event(self, text_view, event): |
4544 | - """callback if the widgets gets visible (e.g. moves to the foreground) |
4545 | - that calls the check_hovering method with the mouse position |
4546 | - coordinates""" |
4547 | - (screen, wx, wy, mod) = text_view.get_window(Gtk.TextWindowType.TEXT).get_pointer() |
4548 | - (bx, by) = text_view.window_to_buffer_coords( |
4549 | - Gtk.TextWindowType.WIDGET, wx, wy) |
4550 | - self.check_hovering(bx, by) |
4551 | - return False |
4552 | - |
4553 | - def check_hovering(self, x, y): |
4554 | - """Check if the mouse is above a tagged link and if yes show |
4555 | - a hand cursor""" |
4556 | - _hovering = False |
4557 | - # get the iter at the mouse position |
4558 | - iter = self.get_iter_at_location(x, y) |
4559 | - |
4560 | - # set _hovering if the iter has the tag "url" |
4561 | - tags = iter.get_tags() |
4562 | - for tag in tags: |
4563 | - url = getattr(tag, "url", None) |
4564 | - if url != "": |
4565 | - _hovering = True |
4566 | - break |
4567 | - |
4568 | - # change the global hovering state |
4569 | - if _hovering != self.hovering or self.first == True: |
4570 | - self.first = False |
4571 | - self.hovering = _hovering |
4572 | - # Set the appropriate cursur icon |
4573 | - if self.hovering: |
4574 | - self.get_window(Gtk.TextWindowType.TEXT).\ |
4575 | - set_cursor(Gdk.Cursor.new(Gdk.CursorType.HAND2)) |
4576 | - else: |
4577 | - self.get_window(Gtk.TextWindowType.TEXT).\ |
4578 | - set_cursor(Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR)) |
4579 | - |
4580 | -if __name__ == "__main__": |
4581 | - # some simple test code |
4582 | - win = Gtk.Window() |
4583 | - rv = ReleaseNotesViewer(open("../DistUpgrade/ReleaseAnnouncement").read()) |
4584 | - win.add(rv) |
4585 | - win.show_all() |
4586 | - Gtk.main() |
4587 | |
4588 | === removed file 'UpdateManager/ReleaseNotesViewerWebkit.py' |
4589 | --- UpdateManager/ReleaseNotesViewerWebkit.py 2012-05-01 14:01:29 +0000 |
4590 | +++ UpdateManager/ReleaseNotesViewerWebkit.py 1970-01-01 00:00:00 +0000 |
4591 | @@ -1,54 +0,0 @@ |
4592 | -# ReleaseNotesViewer.py |
4593 | -# |
4594 | -# Copyright (c) 2011 Canonical |
4595 | -# |
4596 | -# Author: Michael Vogt <mvo@ubutnu.com> |
4597 | -# |
4598 | -# This modul provides an inheritance of the Gtk.TextView that is |
4599 | -# aware of http URLs and allows to open them in a browser. |
4600 | -# It is based on the pygtk-demo "hypertext". |
4601 | -# |
4602 | -# This program is free software; you can redistribute it and/or |
4603 | -# modify it under the terms of the GNU General Public License as |
4604 | -# published by the Free Software Foundation; either version 2 of the |
4605 | -# License, or (at your option) any later version. |
4606 | -# |
4607 | -# This program is distributed in the hope that it will be useful, |
4608 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4609 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4610 | -# GNU General Public License for more details. |
4611 | -# |
4612 | -# You should have received a copy of the GNU General Public License |
4613 | -# along with this program; if not, write to the Free Software |
4614 | -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
4615 | -# USA |
4616 | - |
4617 | -from __future__ import absolute_import |
4618 | - |
4619 | -from gi.repository import Gtk |
4620 | -from gi.repository import WebKit |
4621 | - |
4622 | -from .ReleaseNotesViewer import open_url |
4623 | - |
4624 | -class ReleaseNotesViewerWebkit(WebKit.WebView): |
4625 | - def __init__(self, notes_url): |
4626 | - super(ReleaseNotesViewerWebkit, self).__init__() |
4627 | - self.load_uri(notes_url) |
4628 | - self.connect("navigation-policy-decision-requested", self._on_navigation_policy_decision_requested) |
4629 | - def _on_navigation_policy_decision_requested(self, view, frame, request, action, policy): |
4630 | - open_url(request.get_uri()) |
4631 | - policy.ignore() |
4632 | - return True |
4633 | - |
4634 | - |
4635 | -if __name__ == "__main__": |
4636 | - win = Gtk.Window() |
4637 | - win.set_size_request(600, 400) |
4638 | - scroll = Gtk.ScrolledWindow() |
4639 | - rv = ReleaseNotesViewerWebkit("http://archive.ubuntu.com/ubuntu/dists/natty/main/dist-upgrader-all/0.150/ReleaseAnnouncement.html") |
4640 | - scroll.add(rv) |
4641 | - win.add(scroll) |
4642 | - win.show_all() |
4643 | - Gtk.main() |
4644 | - |
4645 | - |
4646 | |
4647 | === removed file 'UpdateManager/SimpleGtk3builderApp.py' |
4648 | --- UpdateManager/SimpleGtk3builderApp.py 2011-07-15 15:32:30 +0000 |
4649 | +++ UpdateManager/SimpleGtk3builderApp.py 1970-01-01 00:00:00 +0000 |
4650 | @@ -1,61 +0,0 @@ |
4651 | -""" |
4652 | - SimpleGladeApp.py |
4653 | - Module that provides an object oriented abstraction to pygtk and libglade. |
4654 | - Copyright (C) 2004 Sandino Flores Moreno |
4655 | -""" |
4656 | - |
4657 | -# This library is free software; you can redistribute it and/or |
4658 | -# modify it under the terms of the GNU Lesser General Public |
4659 | -# License as published by the Free Software Foundation; either |
4660 | -# version 2.1 of the License, or (at your option) any later version. |
4661 | -# |
4662 | -# This library is distributed in the hope that it will be useful, |
4663 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4664 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
4665 | -# Lesser General Public License for more details. |
4666 | -# |
4667 | -# You should have received a copy of the GNU Lesser General Public |
4668 | -# License along with this library; if not, write to the Free Software |
4669 | -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
4670 | -# USA |
4671 | - |
4672 | -import logging |
4673 | - |
4674 | -from gi.repository import Gtk |
4675 | - |
4676 | -# based on SimpleGladeApp |
4677 | -class SimpleGtkbuilderApp: |
4678 | - |
4679 | - def __init__(self, path, domain): |
4680 | - self.builder = Gtk.Builder() |
4681 | - self.builder.set_translation_domain(domain) |
4682 | - self.builder.add_from_file(path) |
4683 | - self.builder.connect_signals(self) |
4684 | - for o in self.builder.get_objects(): |
4685 | - if issubclass(type(o), Gtk.Buildable): |
4686 | - name = Gtk.Buildable.get_name(o) |
4687 | - setattr(self, name, o) |
4688 | - else: |
4689 | - logging.debug("WARNING: can not get name for '%s'" % o) |
4690 | - |
4691 | - def run(self): |
4692 | - """ |
4693 | - Starts the main loop of processing events checking for Control-C. |
4694 | - |
4695 | - The default implementation checks wheter a Control-C is pressed, |
4696 | - then calls on_keyboard_interrupt(). |
4697 | - |
4698 | - Use this method for starting programs. |
4699 | - """ |
4700 | - try: |
4701 | - Gtk.main() |
4702 | - except KeyboardInterrupt: |
4703 | - self.on_keyboard_interrupt() |
4704 | - |
4705 | - def on_keyboard_interrupt(self): |
4706 | - """ |
4707 | - This method is called by the default implementation of run() |
4708 | - after a program is finished by pressing Control-C. |
4709 | - """ |
4710 | - pass |
4711 | - |
4712 | |
4713 | === removed file 'UpdateManager/SimpleGtkbuilderApp.py' |
4714 | --- UpdateManager/SimpleGtkbuilderApp.py 2011-07-15 15:32:30 +0000 |
4715 | +++ UpdateManager/SimpleGtkbuilderApp.py 1970-01-01 00:00:00 +0000 |
4716 | @@ -1,61 +0,0 @@ |
4717 | -""" |
4718 | - SimpleGladeApp.py |
4719 | - Module that provides an object oriented abstraction to pygtk and libglade. |
4720 | - Copyright (C) 2004 Sandino Flores Moreno |
4721 | -""" |
4722 | - |
4723 | -# This library is free software; you can redistribute it and/or |
4724 | -# modify it under the terms of the GNU Lesser General Public |
4725 | -# License as published by the Free Software Foundation; either |
4726 | -# version 2.1 of the License, or (at your option) any later version. |
4727 | -# |
4728 | -# This library is distributed in the hope that it will be useful, |
4729 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4730 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
4731 | -# Lesser General Public License for more details. |
4732 | -# |
4733 | -# You should have received a copy of the GNU Lesser General Public |
4734 | -# License along with this library; if not, write to the Free Software |
4735 | -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
4736 | -# USA |
4737 | - |
4738 | -import logging |
4739 | - |
4740 | -import gtk |
4741 | - |
4742 | -# based on SimpleGladeApp |
4743 | -class SimpleGtkbuilderApp: |
4744 | - |
4745 | - def __init__(self, path, domain): |
4746 | - self.builder = gtk.Builder() |
4747 | - self.builder.set_translation_domain(domain) |
4748 | - self.builder.add_from_file(path) |
4749 | - self.builder.connect_signals(self) |
4750 | - for o in self.builder.get_objects(): |
4751 | - if issubclass(type(o), gtk.Buildable): |
4752 | - name = gtk.Buildable.get_name(o) |
4753 | - setattr(self, name, o) |
4754 | - else: |
4755 | - logging.debug("WARNING: can not get name for '%s'" % o) |
4756 | - |
4757 | - def run(self): |
4758 | - """ |
4759 | - Starts the main loop of processing events checking for Control-C. |
4760 | - |
4761 | - The default implementation checks wheter a Control-C is pressed, |
4762 | - then calls on_keyboard_interrupt(). |
4763 | - |
4764 | - Use this method for starting programs. |
4765 | - """ |
4766 | - try: |
4767 | - gtk.main() |
4768 | - except KeyboardInterrupt: |
4769 | - self.on_keyboard_interrupt() |
4770 | - |
4771 | - def on_keyboard_interrupt(self): |
4772 | - """ |
4773 | - This method is called by the default implementation of run() |
4774 | - after a program is finished by pressing Control-C. |
4775 | - """ |
4776 | - pass |
4777 | - |
4778 | |
4779 | === removed file 'UpdateManager/UnitySupport.py' |
4780 | --- UpdateManager/UnitySupport.py 2012-05-30 20:47:45 +0000 |
4781 | +++ UpdateManager/UnitySupport.py 1970-01-01 00:00:00 +0000 |
4782 | @@ -1,94 +0,0 @@ |
4783 | -# UnitySupport.py |
4784 | -# |
4785 | -# Copyright (c) 2011 Canonical |
4786 | -# |
4787 | -# Author: Michael Vogt <mvo@ubuntu.com> |
4788 | -# Bilal Akhtar <bilalakhtar@ubuntu.com> |
4789 | -# |
4790 | -# This program is free software; you can redistribute it and/or |
4791 | -# modify it under the terms of the GNU General Public License as |
4792 | -# published by the Free Software Foundation; either version 2 of the |
4793 | -# License, or (at your option) any later version. |
4794 | -# |
4795 | -# This program is distributed in the hope that it will be useful, |
4796 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4797 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4798 | -# GNU General Public License for more details. |
4799 | -# |
4800 | -# You should have received a copy of the GNU General Public License |
4801 | -# along with this program; if not, write to the Free Software |
4802 | -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
4803 | -# USA |
4804 | - |
4805 | -import logging |
4806 | -from gettext import gettext as _ |
4807 | - |
4808 | -HAVE_UNITY_SUPPORT=False |
4809 | -try: |
4810 | - from gi.repository import Dbusmenu, Unity |
4811 | - HAVE_UNITY_SUPPORT=True |
4812 | -except ImportError as e: |
4813 | - logging.warn("can not import unity GI %s" % e) |
4814 | - |
4815 | -class IUnitySupport(object): |
4816 | - """ interface for unity support """ |
4817 | - def __init__(self, parent=None): pass |
4818 | - def set_updates_count(self, num_updates): pass |
4819 | - def set_urgency(self, urgent): pass |
4820 | - def set_install_menuitem_visible(self, visible): pass |
4821 | - def set_progress(self, progress): pass |
4822 | - |
4823 | -class UnitySupportImpl(IUnitySupport): |
4824 | - """ implementation of unity support (if unity is available) """ |
4825 | - |
4826 | - def __init__(self, parent=None): |
4827 | - # create launcher and quicklist |
4828 | - um_launcher_entry = Unity.LauncherEntry.get_for_desktop_id( |
4829 | - "update-manager.desktop") |
4830 | - self._unity = um_launcher_entry |
4831 | - if parent: |
4832 | - self._add_quicklist(parent) |
4833 | - |
4834 | - def _add_quicklist(self, parent): |
4835 | - quicklist = Dbusmenu.Menuitem.new() |
4836 | - # install |
4837 | - self.install_dbusmenuitem = Dbusmenu.Menuitem.new() |
4838 | - self.install_dbusmenuitem.property_set (Dbusmenu.MENUITEM_PROP_LABEL, |
4839 | - _("Install All Available Updates")) |
4840 | - self.install_dbusmenuitem.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, True) |
4841 | - self.install_dbusmenuitem.connect ( |
4842 | - "item-activated", parent.install_all_updates, None) |
4843 | - quicklist.child_append (self.install_dbusmenuitem) |
4844 | - # add it |
4845 | - self._unity.set_property ("quicklist", quicklist) |
4846 | - |
4847 | - def set_progress(self, progress): |
4848 | - """ set the progress [0,100] """ |
4849 | - self._unity.set_property("progress", progress/100.0) |
4850 | - # hide progress when out of bounds |
4851 | - if progress < 0 or progress > 100: |
4852 | - self._unity.set_property("progress_visible", False) |
4853 | - else: |
4854 | - self._unity.set_property("progress_visible", True) |
4855 | - |
4856 | - def set_updates_count(self, num_updates): |
4857 | - self._unity.set_property("count", num_updates) |
4858 | - # FIXME: setup emblem as well(?) |
4859 | - if num_updates > 0: |
4860 | - self._unity.set_property("count-visible", True) |
4861 | - else: |
4862 | - self._unity.set_property("count-visible", False) |
4863 | - |
4864 | - def set_urgency(self, urgent): |
4865 | - self._unity.set_property("urgent", urgent) |
4866 | - |
4867 | - def set_install_menuitem_visible(self, visible): |
4868 | - self.install_dbusmenuitem.property_set_bool(Dbusmenu.MENUITEM_PROP_VISIBLE, visible) |
4869 | - |
4870 | - |
4871 | -# check what to export to the clients |
4872 | -if HAVE_UNITY_SUPPORT: |
4873 | - UnitySupport = UnitySupportImpl |
4874 | -else: |
4875 | - # we just provide the empty interface |
4876 | - UnitySupport = IUnitySupport |
4877 | |
4878 | === removed file 'UpdateManager/UpdateManager.py' |
4879 | --- UpdateManager/UpdateManager.py 2012-06-15 20:02:33 +0000 |
4880 | +++ UpdateManager/UpdateManager.py 1970-01-01 00:00:00 +0000 |
4881 | @@ -1,335 +0,0 @@ |
4882 | -# UpdateManager.py |
4883 | -# -*- Mode: Python; indent-tabs-mode: nil; tab-width: 2; coding: utf-8 -*- |
4884 | -# |
4885 | -# Copyright (c) 2012 Canonical |
4886 | -# |
4887 | -# Author: Michael Terry <michael.terry@canonical.com> |
4888 | -# |
4889 | -# This program is free software; you can redistribute it and/or |
4890 | -# modify it under the terms of the GNU General Public License as |
4891 | -# published by the Free Software Foundation; either version 2 of the |
4892 | -# License, or (at your option) any later version. |
4893 | -# |
4894 | -# This program is distributed in the hope that it will be useful, |
4895 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4896 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4897 | -# GNU General Public License for more details. |
4898 | -# |
4899 | -# You should have received a copy of the GNU General Public License |
4900 | -# along with this program; if not, write to the Free Software |
4901 | -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
4902 | -# USA |
4903 | - |
4904 | -from __future__ import absolute_import, print_function |
4905 | - |
4906 | -from gi.repository import Gtk |
4907 | -from gi.repository import Gdk |
4908 | -from gi.repository import Gio |
4909 | -from gi.repository import GLib |
4910 | - |
4911 | -import warnings |
4912 | -warnings.filterwarnings("ignore", "Accessed deprecated property", DeprecationWarning) |
4913 | - |
4914 | -import apt_pkg |
4915 | -import os |
4916 | -import sys |
4917 | -from gettext import gettext as _ |
4918 | - |
4919 | -import dbus |
4920 | -import dbus.service |
4921 | -from dbus.mainloop.glib import DBusGMainLoop |
4922 | -DBusGMainLoop(set_as_default=True) |
4923 | - |
4924 | -from .UnitySupport import UnitySupport |
4925 | -from .Dialogs import (DistUpgradeDialog, |
4926 | - ErrorDialog, |
4927 | - NeedRestartDialog, |
4928 | - NoUpdatesDialog, |
4929 | - PartialUpgradeDialog, |
4930 | - UnsupportedDialog) |
4931 | -from .InstallProgress import InstallProgress |
4932 | -from .MetaReleaseGObject import MetaRelease |
4933 | -from .UpdateProgress import UpdateProgress |
4934 | -from .UpdatesAvailable import UpdatesAvailable |
4935 | -from .Core.AlertWatcher import AlertWatcher |
4936 | -from .Core.MyCache import MyCache |
4937 | -from .Core.roam import NetworkManagerHelper |
4938 | -from .Core.UpdateList import UpdateList |
4939 | - |
4940 | -# file that signals if we need to reboot |
4941 | -REBOOT_REQUIRED_FILE = "/var/run/reboot-required" |
4942 | - |
4943 | -class UpdateManager(Gtk.Window): |
4944 | - """ This class is the main window and work flow controller. Panes will add |
4945 | - themselves to the main window and it will morph between them.""" |
4946 | - |
4947 | - def __init__(self, datadir, options): |
4948 | - Gtk.Window.__init__(self) |
4949 | - |
4950 | - # Public members |
4951 | - self.datadir = datadir |
4952 | - self.options = options |
4953 | - self.unity = UnitySupport() |
4954 | - self.controller = None |
4955 | - self.cache = None |
4956 | - self.update_list = None |
4957 | - self.meta_release = None |
4958 | - |
4959 | - # Basic GTK+ parameters |
4960 | - self.set_title(_("Software Updater")) |
4961 | - self.set_icon_name("system-software-update") |
4962 | - self.set_resizable(False) |
4963 | - self.set_position(Gtk.WindowPosition.CENTER) |
4964 | - self.set_size_request(500,-1) |
4965 | - |
4966 | - # Signals |
4967 | - self.connect("delete-event", self.close) |
4968 | - |
4969 | - self._setup_dbus() |
4970 | - |
4971 | - # deal with no-focus-on-map |
4972 | - if self.options and self.options.no_focus_on_map: |
4973 | - self.set_focus_on_map(False) |
4974 | - self.iconify() |
4975 | - self.stick() |
4976 | - self.set_urgency_hint(True) |
4977 | - self.unity.set_urgency(True) |
4978 | - self.initial_focus_id = self.connect( |
4979 | - "focus-in-event", self.on_initial_focus_in) |
4980 | - |
4981 | - # Look for a new release in a thread |
4982 | - self.meta_release = MetaRelease(self.options and self.options.devel_release, |
4983 | - self.options and self.options.use_proposed) |
4984 | - |
4985 | - |
4986 | - def on_initial_focus_in(self, widget, event): |
4987 | - """callback run on initial focus-in (if started unmapped)""" |
4988 | - self.unstick() |
4989 | - self.set_urgency_hint(False) |
4990 | - self.unity.set_urgency(False) |
4991 | - self.disconnect(self.initial_focus_id) |
4992 | - return False |
4993 | - |
4994 | - def push(self, pane, controller): |
4995 | - child = self.get_child() |
4996 | - if child is not None: |
4997 | - if self.controller and hasattr(self.controller, "save_state"): |
4998 | - self.controller.save_state() |
4999 | - child.destroy() |
5000 | - |
Diff against target: 224858 lines (+111053/-13464) 238 files modified (has conflicts)
Ouch! I'm guessing the branch is out of date with the latest trunk of update-manager. Could you take a look at updating your branch, hopefully reducing the diff lines and resolving the conflicts? Thanks!