author | Shawn Walker <shawn.walker@sun.com> |
Tue, 30 Sep 2008 19:37:17 -0500 | |
changeset 556 | 1c3526ca7b9e |
parent 551 | 233f0eeddd02 |
child 562 | afe71b27984d |
permissions | -rw-r--r-- |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/python2.4 |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2 |
# |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
3 |
# CDDL HEADER START |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
4 |
# |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
5 |
# The contents of this file are subject to the terms of the |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
6 |
# Common Development and Distribution License (the "License"). |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
7 |
# You may not use this file except in compliance with the License. |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
8 |
# |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
9 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
10 |
# or http://www.opensolaris.org/os/licensing. |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
11 |
# See the License for the specific language governing permissions |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
12 |
# and limitations under the License. |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
13 |
# |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
14 |
# When distributing Covered Code, include this CDDL HEADER in each |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
15 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
16 |
# If applicable, add the following below this CDDL HEADER, with the |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
17 |
# fields enclosed by brackets "[]" replaced with your own identifying |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
18 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
19 |
# |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
20 |
# CDDL HEADER END |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
21 |
# |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
22 |
# Copyright 2008 Sun Microsystems, Inc. All rights reserved. |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
23 |
# Use is subject to license terms. |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
24 |
# |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
25 |
|
483 | 26 |
import errno |
27 |
import gettext # XXX Temporary workaround |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
28 |
import itertools |
483 | 29 |
import os |
30 |
import sys |
|
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
31 |
import time |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
32 |
from threading import Thread |
483 | 33 |
from urllib2 import URLError |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
34 |
try: |
483 | 35 |
import gobject |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
36 |
import gtk |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
37 |
import gtk.glade |
483 | 38 |
import pygtk |
39 |
pygtk.require("2.0") |
|
40 |
except ImportError: |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
41 |
sys.exit(1) |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
42 |
import pkg.client.bootenv as bootenv |
539
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
43 |
import pkg.client.history as history |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
44 |
import pkg.client.imageplan as imageplan |
556
1c3526ca7b9e
2022 client should provide operational intent to server
Shawn Walker <shawn.walker@sun.com>
parents:
551
diff
changeset
|
45 |
import pkg.client.imagestate as imagestate |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
46 |
import pkg.client.progress as progress |
483 | 47 |
import pkg.fmri as fmri |
516
53da6297fb65
3039 Install and Image-update should check index consistency with installed packages
Brock Pytlik <bpytlik@sun.com>
parents:
510
diff
changeset
|
48 |
import pkg.client.indexer as indexer |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
49 |
import pkg.search_errors as search_errors |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
50 |
from pkg.misc import TransferTimedOutException |
483 | 51 |
from pkg.misc import CLIENT_DEFAULT_MEM_USE_KB |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
52 |
import pkg.gui.enumerations as enumerations |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
53 |
import pkg.gui.filelist as filelist |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
54 |
import pkg.gui.thread as guithread |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
55 |
from pkg.gui.filelist import CancelException |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
56 |
|
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
57 |
class InstallUpdate(progress.ProgressTracker): |
483 | 58 |
def __init__(self, install_list, parent, \ |
59 |
image_update = False, ips_update = False): |
|
60 |
# XXX Workaround as BE is using msg(_("message")) |
|
61 |
# which bypasses the self._ mechanism the GUI is using |
|
62 |
gettext.install("pkg","/usr/lib/locale") |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
63 |
progress.ProgressTracker.__init__(self) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
64 |
self.gui_thread = guithread.ThreadRun() |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
65 |
self.install_list = install_list |
459 | 66 |
self.update_list = None |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
67 |
self.parent = parent |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
68 |
self.image_update = image_update |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
69 |
self.ips_update = ips_update |
483 | 70 |
self.ip = None |
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
71 |
self.progress_stop_timer_thread = False |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
72 |
self.progress_stop_timer_running = False |
483 | 73 |
w_tree_createplan = gtk.glade.XML(parent.gladefile, "createplandialog") |
74 |
w_tree_installupdate = gtk.glade.XML(parent.gladefile, "installupdate") |
|
75 |
w_tree_downloadingfiles = \ |
|
76 |
gtk.glade.XML(parent.gladefile, "downloadingfiles") |
|
77 |
w_tree_installingdialog = \ |
|
78 |
gtk.glade.XML(parent.gladefile, "installingdialog") |
|
79 |
w_tree_networkdown = gtk.glade.XML(parent.gladefile, "networkdown") |
|
80 |
self.w_createplan_dialog = \ |
|
81 |
w_tree_createplan.get_widget("createplandialog") |
|
82 |
self.w_createplan_progressbar = \ |
|
83 |
w_tree_createplan.get_widget("createplanprogress") |
|
84 |
self.w_createplan_textview = \ |
|
85 |
w_tree_createplan.get_widget("createplantextview") |
|
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
86 |
self.w_createplan_label = \ |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
87 |
w_tree_createplan.get_widget("packagedependencies") |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
88 |
self.w_createplancancel_button = \ |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
89 |
w_tree_createplan.get_widget("cancelcreateplan") |
483 | 90 |
self.w_installupdate_dialog = w_tree_installupdate.get_widget("installupdate") |
91 |
self.w_summary_label = w_tree_installupdate.get_widget("packagenamelabel3") |
|
92 |
self.w_review_treeview = w_tree_installupdate.get_widget("treeview1") |
|
93 |
self.w_downloadingfiles_dialog = \ |
|
94 |
w_tree_downloadingfiles.get_widget("downloadingfiles") |
|
95 |
self.w_download_textview = \ |
|
96 |
w_tree_downloadingfiles.get_widget("downloadtextview") |
|
97 |
self.w_download_progressbar = \ |
|
98 |
w_tree_downloadingfiles.get_widget("downloadprogress") |
|
99 |
self.w_installing_dialog = \ |
|
100 |
w_tree_installingdialog.get_widget("installingdialog") |
|
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
101 |
self.w_installingdialog_label = \ |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
102 |
w_tree_installingdialog.get_widget("packagedependencies3") |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
103 |
self.w_installingdialog_expander = \ |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
104 |
w_tree_installingdialog.get_widget("expander4") |
483 | 105 |
self.w_installing_textview = \ |
106 |
w_tree_installingdialog.get_widget("installingtextview") |
|
107 |
self.w_installing_progressbar = \ |
|
108 |
w_tree_installingdialog.get_widget("installingprogress") |
|
109 |
self.w_networkdown_dialog = w_tree_networkdown.get_widget("networkdown") |
|
110 |
self.w_createplan_progressbar.set_pulse_step(0.1) |
|
111 |
installed_updated_column = gtk.TreeViewColumn('Installed/Updated') |
|
112 |
self.w_review_treeview.append_column(installed_updated_column) |
|
113 |
cell = gtk.CellRendererText() |
|
114 |
installed_updated_column.pack_start(cell, True) |
|
115 |
installed_updated_column.add_attribute(cell, 'text', 0) |
|
116 |
self.w_review_treeview.expand_all() |
|
117 |
try: |
|
118 |
dic_createplan = \ |
|
119 |
{ |
|
120 |
"on_cancelcreateplan_clicked": \ |
|
121 |
self.__on_cancelcreateplan_clicked, |
|
122 |
} |
|
123 |
dic_installupdate = \ |
|
124 |
{ |
|
125 |
"on_cancel_button_clicked": \ |
|
126 |
self.__on_cancel_button_clicked, |
|
127 |
"on_next_button_clicked":self.__on_next_button_clicked, |
|
128 |
} |
|
129 |
dic_downloadingfiles = \ |
|
130 |
{ |
|
131 |
"on_canceldownload_clicked": \ |
|
132 |
self.__on_cancel_download_clicked, |
|
133 |
} |
|
134 |
dic_networkdown = \ |
|
135 |
{ |
|
136 |
"on_networkdown_close_clicked": \ |
|
137 |
self.__on_networkdown_close_clicked, |
|
138 |
} |
|
139 |
w_tree_createplan.signal_autoconnect(dic_createplan) |
|
140 |
w_tree_installupdate.signal_autoconnect(dic_installupdate) |
|
141 |
w_tree_downloadingfiles.signal_autoconnect(dic_downloadingfiles) |
|
142 |
w_tree_networkdown.signal_autoconnect(dic_networkdown) |
|
143 |
except AttributeError, error: |
|
144 |
print self.parent._('GUI will not respond to any event! %s. \ |
|
145 |
Check installupdate.py signals') \ |
|
146 |
% error |
|
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
147 |
if image_update or ips_update: |
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
148 |
list_of_packages = install_list |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
149 |
else: |
483 | 150 |
list_of_packages = self.__prepare_list_of_packages() |
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
151 |
# XXX Hidden until progress will give information about fmri |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
152 |
self.w_installingdialog_expander.hide() |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
153 |
pulse_t = Thread(target = self.__progressdialog_progress_pulse) |
483 | 154 |
thread = Thread(target = self.__plan_the_install_updateimage, \ |
155 |
args = (list_of_packages, )) |
|
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
156 |
pulse_t.start() |
483 | 157 |
thread.start() |
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
158 |
self.w_createplan_label.set_text(\ |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
159 |
self.parent._("Checking package dependencies...")) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
160 |
self.w_createplancancel_button.set_sensitive(True) |
483 | 161 |
self.w_createplan_dialog.run() |
162 |
||
163 |
def __on_cancelcreateplan_clicked(self, widget): |
|
164 |
'''Handler for signal send by cancel button, which user might press during |
|
165 |
evaluation stage - while the dialog is creating plan''' |
|
539
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
166 |
self.ip.image.history.operation_result = \ |
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
167 |
history.RESULT_CANCELED |
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
168 |
self.w_createplan_label.set_text(\ |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
169 |
self.parent._("Canceling...")) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
170 |
self.w_createplancancel_button.set_sensitive(False) |
483 | 171 |
self.gui_thread.cancel() |
172 |
||
173 |
def __on_cancel_button_clicked(self, widget): |
|
174 |
'''Handler for signal send by cancel button, which is available for the |
|
175 |
user after evaluation stage on the dialog showing what will be installed |
|
176 |
or updated''' |
|
539
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
177 |
self.ip.image.history.operation_result = \ |
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
178 |
history.RESULT_CANCELED |
483 | 179 |
self.gui_thread.cancel() |
180 |
self.w_installupdate_dialog.destroy() |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
181 |
|
483 | 182 |
def __on_next_button_clicked(self, widget): |
183 |
'''Handler for signal send by next button, which is available for the |
|
184 |
user after evaluation stage on the dialog showing what will be installed |
|
185 |
or updated''' |
|
186 |
download_thread = Thread(target = self.__download_stage, args = ()) |
|
187 |
download_thread.start() |
|
188 |
||
189 |
def __on_cancel_download_clicked(self, widget): |
|
190 |
'''Handler for signal send by cancel button, which user might press during |
|
191 |
download stage.''' |
|
539
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
192 |
self.ip.image.history.operation_result = \ |
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
193 |
history.RESULT_CANCELED |
483 | 194 |
self.gui_thread.cancel() |
195 |
self.w_downloadingfiles_dialog.destroy() |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
196 |
|
483 | 197 |
def __on_networkdown_close_clicked(self, widget): |
198 |
'''Handler for signal send by close button on the dialog showing that |
|
199 |
there was some problem with the network connection.''' |
|
539
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
200 |
self.ip.image.history.operation_result = \ |
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
201 |
history.RESULT_FAILED_TRANSPORT |
483 | 202 |
self.gui_thread.cancel() |
203 |
self.w_networkdown_dialog.destroy() |
|
204 |
||
205 |
def __update_createplan_progress(self, action): |
|
206 |
buf = self.w_createplan_textview.get_buffer() |
|
207 |
textiter = buf.get_end_iter() |
|
208 |
buf.insert(textiter, action) |
|
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
209 |
|
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
210 |
def __progressdialog_progress_pulse(self): |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
211 |
while not self.progress_stop_timer_thread: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
212 |
gobject.idle_add(self.w_createplan_progressbar.pulse) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
213 |
time.sleep(0.1) |
483 | 214 |
|
215 |
def __update_download_progress(self, cur_bytes, total_bytes): |
|
216 |
prog = float(cur_bytes)/total_bytes |
|
217 |
self.w_download_progressbar.set_fraction(prog) |
|
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
218 |
a = str(cur_bytes/1024) |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
219 |
b = str(total_bytes/1024) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
220 |
c = "Downloaded: " + a + " / " + b + " KB" |
483 | 221 |
self.w_download_progressbar.set_text(c) |
222 |
||
223 |
def __update_install_progress(self, current, total): |
|
224 |
prog = float(current)/total |
|
225 |
self.w_installing_progressbar.set_fraction(prog) |
|
226 |
||
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
227 |
def __update_install_pulse(self): |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
228 |
while not self.progress_stop_timer_thread: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
229 |
self.progress_stop_timer_running = True |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
230 |
gobject.idle_add(self.w_installing_progressbar.pulse) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
231 |
time.sleep(0.1) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
232 |
self.progress_stop_timer_running = False |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
233 |
|
483 | 234 |
def __prepare_list_of_packages(self): |
235 |
''' This method return the dictionary of |
|
236 |
images and newest marked packages''' |
|
237 |
fmri_to_install_update = {} |
|
238 |
for row in self.install_list: |
|
239 |
if row[enumerations.MARK_COLUMN]: |
|
240 |
image = row[enumerations.IMAGE_OBJECT_COLUMN] |
|
241 |
packages = row[enumerations.PACKAGE_OBJECT_COLUMN] |
|
242 |
im = fmri_to_install_update.get(image) |
|
243 |
# XXX Hack to be bug to bug compatible - incorporations |
|
244 |
pkg_name = packages[0].get_name() |
|
245 |
if im: |
|
246 |
im.append(pkg_name) |
|
247 |
else: |
|
248 |
fmri_to_install_update[image] = [pkg_name, ] |
|
249 |
return fmri_to_install_update |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
250 |
|
483 | 251 |
def __plan_the_install_updateimage(self, list_of_packages): |
252 |
'''Function which plans the image''' |
|
253 |
self.gui_thread.run() |
|
254 |
filters = [] |
|
255 |
verbose = False |
|
256 |
noexecute = False |
|
257 |
for image in list_of_packages: |
|
258 |
# Take a list of packages, specified in pkg_list, and attempt |
|
259 |
# to assemble an appropriate image plan. This is a helper |
|
260 |
# routine for some common operations in the client. |
|
261 |
# |
|
262 |
# This method checks all authorities for a package match; |
|
263 |
# however, it defaults to choosing the preferred authority |
|
264 |
# when an ambiguous package name is specified. If the user |
|
265 |
# wishes to install a package from a non-preferred authority, |
|
266 |
# the full FMRI that contains an authority should be used |
|
267 |
# to name the package. |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
268 |
|
483 | 269 |
pkg_list = list_of_packages.get(image) |
270 |
||
271 |
error = 0 |
|
272 |
self.ip = imageplan.ImagePlan(image, self, filters = filters) |
|
539
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
273 |
if self.image_update: |
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
274 |
self.ip.image.history.operation_name = \ |
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
275 |
"image-update" |
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
276 |
else: |
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
277 |
self.ip.image.history.operation_name = \ |
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
278 |
"install" |
483 | 279 |
|
280 |
self.__load_optional_dependencies(image) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
281 |
|
483 | 282 |
for p in pkg_list: |
283 |
try: |
|
284 |
conp = image.apply_optional_dependencies(p) |
|
285 |
matches = list(image.inventory([ conp ], |
|
286 |
all_known = True)) |
|
526
8c243883ae41
822 Depot traceback on "pkgsend -s <server> open foo"
Dan Price <dp@eng.sun.com>
parents:
516
diff
changeset
|
287 |
except (RuntimeError, InventoryException): |
483 | 288 |
# XXX Module directly printing. |
289 |
error = 1 |
|
290 |
continue |
|
291 |
||
292 |
pnames = {} |
|
293 |
pmatch = [] |
|
294 |
npnames = {} |
|
295 |
npmatch = [] |
|
296 |
for m, state in matches: |
|
297 |
if m.preferred_authority(): |
|
298 |
pnames[m.get_pkg_stem()] = 1 |
|
299 |
pmatch.append(m) |
|
300 |
else: |
|
301 |
npnames[m.get_pkg_stem()] = 1 |
|
302 |
npmatch.append(m) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
303 |
|
483 | 304 |
if len(pnames.keys()) > 1: |
305 |
# XXX Module directly printing. |
|
306 |
error = 1 |
|
307 |
continue |
|
308 |
elif len(pnames.keys()) < 1 and len(npnames.keys()) > 1: |
|
309 |
# XXX Module directly printing. |
|
310 |
error = 1 |
|
311 |
continue |
|
312 |
||
313 |
# matches is a list reverse sorted by version, so take |
|
314 |
# the first; i.e., the latest. |
|
315 |
if len(pmatch) > 0: |
|
316 |
self.ip.propose_fmri(pmatch[0]) |
|
317 |
else: |
|
318 |
self.ip.propose_fmri(npmatch[0]) |
|
319 |
||
320 |
if error != 0: |
|
321 |
raise RuntimeError, "Unable to assemble image plan" |
|
322 |
||
539
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
323 |
self.ip.image.history.operation_start_state = \ |
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
324 |
self.ip.get_plan() |
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
325 |
|
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
326 |
try: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
327 |
self.__evaluate(image) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
328 |
except CancelException, e: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
329 |
self.progress_stop_timer_thread = True |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
330 |
gobject.idle_add(self.w_createplan_dialog.hide) |
539
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
331 |
else: |
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
332 |
self.ip.image.history.operation_end_state = \ |
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
333 |
self.ip.get_plan(full=False) |
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
334 |
|
483 | 335 |
image.imageplan = self.ip |
336 |
||
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
337 |
return |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
338 |
|
483 | 339 |
def __load_optional_dependencies(self, image): |
340 |
for b_fmri in image.gen_installed_pkgs(): |
|
341 |
if self.gui_thread.is_cancelled(): |
|
342 |
return |
|
343 |
mfst = image.get_manifest(b_fmri, filtered = True) |
|
344 |
||
345 |
for dep in mfst.gen_actions_by_type("depend"): |
|
346 |
required, min_fmri, max_fmri = dep.parse(image) |
|
347 |
if required == False: |
|
348 |
image.update_optional_dependency(min_fmri) |
|
349 |
||
350 |
def __evaluate(self, image): |
|
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
351 |
'''Code duplication from imageplan.evaluate()''' |
483 | 352 |
assert self.ip.state == imageplan.UNEVALUATED |
353 |
||
354 |
self.ip.progtrack.evaluate_start() |
|
355 |
||
356 |
outstring = "" |
|
357 |
||
358 |
# Operate on a copy, as it will be modified in flight. |
|
359 |
for f in self.ip.target_fmris[:]: |
|
360 |
self.ip.progtrack.evaluate_progress() |
|
361 |
try: |
|
362 |
self.__evaluate_fmri(f, image) |
|
363 |
except KeyError, e: |
|
364 |
outstring += "Attemping to install %s causes:\n\t%s\n" % \ |
|
365 |
(f.get_name(), e) |
|
366 |
except NameError: |
|
367 |
gobject.idle_add(self.__creating_plan_net_error) |
|
368 |
return |
|
369 |
if outstring: |
|
370 |
raise RuntimeError("No packages were installed because " |
|
371 |
"package dependencies could not be satisfied\n" + |
|
372 |
outstring) |
|
373 |
||
374 |
for f in self.ip.target_fmris: |
|
375 |
self.ip.add_pkg_plan(f) |
|
376 |
self.ip.progtrack.evaluate_progress() |
|
377 |
||
378 |
for f in self.ip.target_rem_fmris[:]: |
|
379 |
self.ip.evaluate_fmri_removal(f) |
|
380 |
self.ip.progtrack.evaluate_progress() |
|
381 |
||
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
382 |
# we now have a workable set of packages to add/upgrade/remove |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
383 |
# now combine all actions together to create a synthetic single |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
384 |
# step upgrade operation, and handle editable files moving from |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
385 |
# package to package. See theory comment in execute, below. |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
386 |
|
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
387 |
self.ip.state = imageplan.EVALUATED_PKGS |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
388 |
|
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
389 |
self.ip.removal_actions = [ (p, src, dest) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
390 |
for p in self.ip.pkg_plans |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
391 |
for src, dest in p.gen_removal_actions() |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
392 |
] |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
393 |
|
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
394 |
self.ip.update_actions = [ (p, src, dest) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
395 |
for p in self.ip.pkg_plans |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
396 |
for src, dest in p.gen_update_actions() |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
397 |
] |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
398 |
|
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
399 |
self.ip.install_actions = [ (p, src, dest) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
400 |
for p in self.ip.pkg_plans |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
401 |
for src, dest in p.gen_install_actions() |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
402 |
] |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
403 |
|
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
404 |
self.ip.progtrack.evaluate_progress() |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
405 |
|
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
406 |
# iterate over copy of removals since we're modding list |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
407 |
# keep track of deletion count so later use of index works |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
408 |
named_removals = {} |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
409 |
deletions = 0 |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
410 |
for i, a in enumerate(self.ip.removal_actions[:]): |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
411 |
# remove dir removals if dir is still in final image |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
412 |
if a[1].name == "dir" and \ |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
413 |
os.path.normpath(a[1].attrs["path"]) in \ |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
414 |
self.ip.get_directories(): |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
415 |
del self.ip.removal_actions[i - deletions] |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
416 |
deletions += 1 |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
417 |
continue |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
418 |
# store names of files being removed under own name |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
419 |
# or original name if specified |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
420 |
if a[1].name == "file": |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
421 |
attrs = a[1].attrs |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
422 |
fname = attrs.get("original_name", |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
423 |
"%s:%s" % (a[0].origin_fmri.get_name(), attrs["path"])) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
424 |
named_removals[fname] = \ |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
425 |
(i - deletions, |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
426 |
id(self.ip.removal_actions[i-deletions][1])) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
427 |
|
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
428 |
self.ip.progtrack.evaluate_progress() |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
429 |
|
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
430 |
for a in self.ip.install_actions: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
431 |
# In order to handle editable files that move their path or |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
432 |
# change pkgs, for all new files with original_name attribute, |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
433 |
# make sure file isn't being removed by checking removal list. |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
434 |
# if it is, tag removal to save file, and install to recover |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
435 |
# cached version... caching is needed if directories |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
436 |
# are removed or don't exist yet. |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
437 |
if a[2].name == "file" and "original_name" in a[2].attrs and \ |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
438 |
a[2].attrs["original_name"] in named_removals: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
439 |
cache_name = a[2].attrs["original_name"] |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
440 |
index = named_removals[cache_name][0] |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
441 |
assert(id(self.ip.removal_actions[index][1]) == |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
442 |
named_removals[cache_name][1]) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
443 |
self.ip.removal_actions[index][1].attrs["save_file"] = \ |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
444 |
cache_name |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
445 |
a[2].attrs["save_file"] = cache_name |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
446 |
|
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
447 |
self.ip.progtrack.evaluate_progress() |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
448 |
# Go over update actions |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
449 |
l_actions = self.ip.get_link_actions() |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
450 |
l_refresh = [] |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
451 |
for a in self.ip.update_actions: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
452 |
# for any files being updated that are the target of |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
453 |
# _any_ hardlink actions, append the hardlink actions |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
454 |
# to the update list so that they are not broken... |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
455 |
if a[2].name == "file": |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
456 |
path = a[2].attrs["path"] |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
457 |
if path in l_actions: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
458 |
l_refresh.extend([(a[0], l, l) for l in l_actions[path]]) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
459 |
self.ip.update_actions.extend(l_refresh) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
460 |
# sort actions to match needed processing order |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
461 |
self.ip.removal_actions.sort(key = lambda obj:obj[1], reverse=True) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
462 |
self.ip.update_actions.sort(key = lambda obj:obj[2]) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
463 |
self.ip.install_actions.sort(key = lambda obj:obj[2]) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
464 |
|
483 | 465 |
self.ip.progtrack.evaluate_done() |
466 |
||
467 |
self.ip.state = imageplan.EVALUATED_OK |
|
468 |
||
469 |
def __creating_plan_net_error(self): |
|
470 |
'''Helper method which shows the dialog informing user that there was |
|
471 |
problem with network connection''' |
|
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
472 |
self.progress_stop_timer_thread = True |
483 | 473 |
self.w_createplan_dialog.hide() |
474 |
self.w_networkdown_dialog.show() |
|
475 |
||
476 |
def __evaluate_fmri(self, pfmri, image): |
|
477 |
||
478 |
if self.gui_thread.is_cancelled(): |
|
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
479 |
raise CancelException |
483 | 480 |
gobject.idle_add(self.__update_createplan_progress, \ |
481 |
self.parent._("Evaluating: %s\n") % pfmri.get_fmri()) |
|
482 |
||
483 |
self.ip.progtrack.evaluate_progress() |
|
556
1c3526ca7b9e
2022 client should provide operational intent to server
Shawn Walker <shawn.walker@sun.com>
parents:
551
diff
changeset
|
484 |
self.ip.image.state.set_target(pfmri, imagestate.INTENT_PROCESS) |
483 | 485 |
m = image.get_manifest(pfmri) |
486 |
||
487 |
# [manifest] examine manifest for dependencies |
|
488 |
for a in m.actions: |
|
489 |
if a.name != "depend": |
|
490 |
continue |
|
491 |
||
492 |
type = a.attrs["type"] |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
493 |
|
483 | 494 |
f = fmri.PkgFmri(a.attrs["fmri"], |
495 |
self.ip.image.attrs["Build-Release"]) |
|
496 |
||
497 |
if self.ip.image.has_version_installed(f) and \ |
|
498 |
type != "exclude": |
|
499 |
continue |
|
500 |
||
501 |
# XXX This alone only prevents infinite recursion when a |
|
502 |
# cycle member is on the commandline, as we never update |
|
503 |
# target_fmris. Is target_fmris supposed to be just |
|
504 |
# what was specified on the commandline, or include what |
|
505 |
# we've found while processing dependencies? |
|
506 |
# XXX probably should just use propose_fmri() here |
|
507 |
# instead of this and the has_version_installed() call |
|
508 |
# above. |
|
509 |
if self.ip.is_proposed_fmri(f): |
|
510 |
continue |
|
511 |
||
512 |
# XXX LOG "%s not in pending transaction; |
|
513 |
# checking catalog" % f |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
514 |
|
483 | 515 |
required = True |
516 |
excluded = False |
|
517 |
if type == "optional" and \ |
|
551 | 518 |
not self.ip.image.cfg_cache.get_policy(imageconfig.REQUIRE_OPTIONAL): |
483 | 519 |
required = False |
520 |
elif type == "transfer" and \ |
|
521 |
not self.ip.image.older_version_installed(f): |
|
522 |
required = False |
|
523 |
elif type == "exclude": |
|
524 |
excluded = True |
|
525 |
elif type == "incorporate": |
|
526 |
self.ip.image.update_optional_dependency(f) |
|
527 |
if self.ip.image.older_version_installed(f) or \ |
|
528 |
self.ip.older_version_proposed(f): |
|
529 |
required = True |
|
530 |
else: |
|
531 |
required = False |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
532 |
|
483 | 533 |
if not required: |
534 |
continue |
|
535 |
||
536 |
if excluded: |
|
556
1c3526ca7b9e
2022 client should provide operational intent to server
Shawn Walker <shawn.walker@sun.com>
parents:
551
diff
changeset
|
537 |
self.ip.image.state.set_target() |
483 | 538 |
raise RuntimeError, "excluded by '%s'" % f |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
539 |
|
483 | 540 |
# treat-as-required, treat-as-required-unless-pinned, |
541 |
# ignore |
|
542 |
# skip if ignoring |
|
543 |
# if pinned |
|
544 |
# ignore if treat-as-required-unless-pinned |
|
545 |
# else |
|
546 |
# **evaluation of incorporations** |
|
547 |
# [imageplan] pursue installation of this package |
|
548 |
# --> |
|
549 |
# backtrack or reset?? |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
550 |
|
483 | 551 |
# This will be the newest version of the specified |
552 |
# dependency package, coming from the preferred |
|
553 |
# authority, if it's available there. |
|
554 |
cf = self.ip.image.inventory([ a.attrs["fmri"] ], |
|
555 |
all_known = True, preferred = True, |
|
556 |
first_only = True).next()[0] |
|
557 |
||
558 |
# XXX LOG "adding dependency %s" % pfmri |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
559 |
|
483 | 560 |
#msg("adding dependency %s" % cf) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
561 |
|
483 | 562 |
self.ip.propose_fmri(cf) |
563 |
self.__evaluate_fmri(cf, image) |
|
564 |
||
556
1c3526ca7b9e
2022 client should provide operational intent to server
Shawn Walker <shawn.walker@sun.com>
parents:
551
diff
changeset
|
565 |
self.ip.image.state.set_target() |
1c3526ca7b9e
2022 client should provide operational intent to server
Shawn Walker <shawn.walker@sun.com>
parents:
551
diff
changeset
|
566 |
|
483 | 567 |
def __download_stage(self, rebuild=False): |
568 |
'''Parts of the code duplicated from install and image-update from pkg(1) |
|
569 |
and pkg.client.ImagePlan.preexecute()''' |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
570 |
self.gui_thread.run() |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
571 |
if not rebuild: |
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
572 |
gobject.idle_add(self.w_installupdate_dialog.hide) |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
573 |
if rebuild: |
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
574 |
gobject.idle_add(self.w_installing_dialog.hide) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
575 |
gobject.idle_add(self.w_downloadingfiles_dialog.show) |
459 | 576 |
|
577 |
# Checks the index to make sure it exists and is |
|
578 |
# consistent. If it's inconsistent an exception is thrown. |
|
579 |
# If it's totally absent, it will index the existing packages |
|
580 |
# so that the incremental update that follows at the end of |
|
516
53da6297fb65
3039 Install and Image-update should check index consistency with installed packages
Brock Pytlik <bpytlik@sun.com>
parents:
510
diff
changeset
|
581 |
# the function will work correctly. It also repairs the index |
53da6297fb65
3039 Install and Image-update should check index consistency with installed packages
Brock Pytlik <bpytlik@sun.com>
parents:
510
diff
changeset
|
582 |
# for this BE so the user can boot into this BE and have a |
53da6297fb65
3039 Install and Image-update should check index consistency with installed packages
Brock Pytlik <bpytlik@sun.com>
parents:
510
diff
changeset
|
583 |
# correct index. |
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
584 |
try: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
585 |
self.ip.image.update_index_dir() |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
586 |
ind = indexer.Indexer(self.ip.image.index_dir, |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
587 |
CLIENT_DEFAULT_MEM_USE_KB, progtrack=self.ip.progtrack) |
516
53da6297fb65
3039 Install and Image-update should check index consistency with installed packages
Brock Pytlik <bpytlik@sun.com>
parents:
510
diff
changeset
|
588 |
if not ind.check_index_existence() or \ |
53da6297fb65
3039 Install and Image-update should check index consistency with installed packages
Brock Pytlik <bpytlik@sun.com>
parents:
510
diff
changeset
|
589 |
not ind.check_index_has_exactly_fmris( |
53da6297fb65
3039 Install and Image-update should check index consistency with installed packages
Brock Pytlik <bpytlik@sun.com>
parents:
510
diff
changeset
|
590 |
self.ip.image.gen_installed_pkg_names()): |
53da6297fb65
3039 Install and Image-update should check index consistency with installed packages
Brock Pytlik <bpytlik@sun.com>
parents:
510
diff
changeset
|
591 |
# XXX Once we have a framework for emitting a |
53da6297fb65
3039 Install and Image-update should check index consistency with installed packages
Brock Pytlik <bpytlik@sun.com>
parents:
510
diff
changeset
|
592 |
# message to the user in this spot in the |
53da6297fb65
3039 Install and Image-update should check index consistency with installed packages
Brock Pytlik <bpytlik@sun.com>
parents:
510
diff
changeset
|
593 |
# code, we should tell them something has gone |
53da6297fb65
3039 Install and Image-update should check index consistency with installed packages
Brock Pytlik <bpytlik@sun.com>
parents:
510
diff
changeset
|
594 |
# wrong so that we continue to get feedback to |
53da6297fb65
3039 Install and Image-update should check index consistency with installed packages
Brock Pytlik <bpytlik@sun.com>
parents:
510
diff
changeset
|
595 |
# allow us to debug the code. |
53da6297fb65
3039 Install and Image-update should check index consistency with installed packages
Brock Pytlik <bpytlik@sun.com>
parents:
510
diff
changeset
|
596 |
ind.rebuild_index_from_scratch( |
53da6297fb65
3039 Install and Image-update should check index consistency with installed packages
Brock Pytlik <bpytlik@sun.com>
parents:
510
diff
changeset
|
597 |
self.ip.image.get_fmri_manifest_pairs()) |
53da6297fb65
3039 Install and Image-update should check index consistency with installed packages
Brock Pytlik <bpytlik@sun.com>
parents:
510
diff
changeset
|
598 |
except search_errors.IndexingException: |
53da6297fb65
3039 Install and Image-update should check index consistency with installed packages
Brock Pytlik <bpytlik@sun.com>
parents:
510
diff
changeset
|
599 |
# If there's a problem indexing, we want to attempt |
53da6297fb65
3039 Install and Image-update should check index consistency with installed packages
Brock Pytlik <bpytlik@sun.com>
parents:
510
diff
changeset
|
600 |
# to finish the installation anyway. If there's a |
53da6297fb65
3039 Install and Image-update should check index consistency with installed packages
Brock Pytlik <bpytlik@sun.com>
parents:
510
diff
changeset
|
601 |
# problem updating the index on the new image, |
53da6297fb65
3039 Install and Image-update should check index consistency with installed packages
Brock Pytlik <bpytlik@sun.com>
parents:
510
diff
changeset
|
602 |
# that error needs to be communicated to the user. |
53da6297fb65
3039 Install and Image-update should check index consistency with installed packages
Brock Pytlik <bpytlik@sun.com>
parents:
510
diff
changeset
|
603 |
pass |
53da6297fb65
3039 Install and Image-update should check index consistency with installed packages
Brock Pytlik <bpytlik@sun.com>
parents:
510
diff
changeset
|
604 |
|
53da6297fb65
3039 Install and Image-update should check index consistency with installed packages
Brock Pytlik <bpytlik@sun.com>
parents:
510
diff
changeset
|
605 |
|
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
606 |
try: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
607 |
for p in self.ip.pkg_plans: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
608 |
p.preexecute() |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
609 |
|
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
610 |
for package_plan in self.ip.pkg_plans: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
611 |
if self.gui_thread.is_cancelled(): |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
612 |
return |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
613 |
self.__download(package_plan) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
614 |
except TransferTimedOutException: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
615 |
gobject.idle_add(self.w_downloadingfiles_dialog.hide) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
616 |
gobject.idle_add(self.w_networkdown_dialog.show) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
617 |
return |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
618 |
except URLError, e: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
619 |
#if e.reason[0] == 8: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
620 |
gobject.idle_add(self.w_downloadingfiles_dialog.hide) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
621 |
gobject.idle_add(self.w_networkdown_dialog.show) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
622 |
return |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
623 |
except CancelException: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
624 |
gobject.idle_add(self.w_downloadingfiles_dialog.hide) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
625 |
return |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
626 |
|
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
627 |
self.ip.progtrack.download_done() |
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
628 |
gobject.idle_add(self.w_downloadingfiles_dialog.hide) |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
629 |
|
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
630 |
try: |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
631 |
be = bootenv.BootEnv(self.ip.image.get_root()) |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
632 |
except RuntimeError: |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
633 |
be = bootenv.BootEnvNull(self.ip.image.get_root()) |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
634 |
|
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
635 |
if self.image_update: |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
636 |
be.init_image_recovery(self.ip.image) |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
637 |
if self.ip.image.is_liveroot(): |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
638 |
return 1 |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
639 |
try: |
483 | 640 |
self.__installation_stage() |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
641 |
if self.image_update: |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
642 |
be.activate_image() |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
643 |
else: |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
644 |
be.activate_install_uninstall() |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
645 |
ret_code = 0 |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
646 |
except RuntimeError, e: |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
647 |
if self.image_update: |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
648 |
be.restore_image() |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
649 |
else: |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
650 |
be.restore_install_uninstall() |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
651 |
ret_code = 1 |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
652 |
except search_errors.InconsistentIndexException, e: |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
653 |
ret_code = 2 |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
654 |
except search_errors.PartialIndexingException, e: |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
655 |
ret_code = 2 |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
656 |
except search_errors.ProblematicPermissionsIndexException, e: |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
657 |
ret_code = 2 |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
658 |
except Exception, e: |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
659 |
if self.image_update: |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
660 |
be.restore_image() |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
661 |
else: |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
662 |
be.restore_install_uninstall() |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
663 |
self.ip.image.cleanup_downloads() |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
664 |
raise |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
665 |
|
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
666 |
self.ip.image.cleanup_downloads() |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
667 |
if ret_code == 0: |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
668 |
self.ip.image.cleanup_cached_content() |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
669 |
elif ret_code == 2: |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
670 |
return_code = 0 |
483 | 671 |
return_code = self.__rebuild_index() |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
672 |
if return_code == 1: |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
673 |
return |
483 | 674 |
self.__download_stage(True) |
675 |
||
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
676 |
def __download(self, package_plan): |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
677 |
'''Code duplication from pkg.client.PkgPlan.download() except that |
483 | 678 |
pkg.gui.filelist is called instead of pkg.client.fileobject with shared |
679 |
cancel object - self.gui_thread that allows to cancel download |
|
680 |
operation''' |
|
681 |
flist = filelist.FileList(self, |
|
682 |
package_plan.image, |
|
683 |
package_plan.destination_fmri, |
|
684 |
self.gui_thread, |
|
685 |
maxbytes = None |
|
686 |
) |
|
687 |
_PkgPlan__prog = package_plan._PkgPlan__progtrack |
|
688 |
_PkgPlan__prog.download_start_pkg(package_plan.get_xfername()) |
|
689 |
||
690 |
for src, dest in itertools.chain(*package_plan.actions): |
|
691 |
if dest: |
|
692 |
if dest.needsdata(src): |
|
693 |
flist.add_action(dest) |
|
694 |
||
695 |
flist.flush() |
|
696 |
package_plan._PkgPlan__progtrack.download_end_pkg() |
|
697 |
||
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
698 |
def __rebuild_index(self): |
483 | 699 |
'''Code duplication from pkg(1): |
700 |
Forcibly rebuild the search indexes. Will remove existing indexes |
|
701 |
and build new ones from scratch.''' |
|
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
702 |
quiet = False |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
703 |
|
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
704 |
try: |
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
705 |
self.ip.image.rebuild_search_index(self.ip.progtrack) |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
706 |
except search_errors.InconsistentIndexException, iie: |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
707 |
return 1 |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
708 |
except search_errors.ProblematicPermissionsIndexException, ppie: |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
709 |
return 1 |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
710 |
|
483 | 711 |
def __installation_stage(self): |
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
712 |
'''Code duplication from imageplan.py def execute(self)''' |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
713 |
self.gui_thread.run() |
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
714 |
text = self.parent._("Installing Packages...") |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
715 |
gobject.idle_add(self.w_installingdialog_label.set_text, text) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
716 |
gobject.idle_add(self.w_installing_dialog.show) |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
717 |
self.ip.state = imageplan.PREEXECUTED_OK |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
718 |
|
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
719 |
if self.ip.nothingtodo(): |
539
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
720 |
self.ip.image.history.operation_result = \ |
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
721 |
history.RESULT_NOTHING_TO_DO |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
722 |
self.ip.state = imageplan.EXECUTED_OK |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
723 |
self.ip.progtrack.actions_done() |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
724 |
return |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
725 |
|
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
726 |
# execute removals |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
727 |
self.ip.progtrack.actions_set_goal("Removal Phase", len(self.ip.removal_actions)) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
728 |
for p, src, dest in self.ip.removal_actions: |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
729 |
p.execute_removal(src, dest) |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
730 |
self.ip.progtrack.actions_add_progress() |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
731 |
|
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
732 |
# execute installs |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
733 |
self.ip.progtrack.actions_set_goal("Install Phase", len(self.ip.install_actions)) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
734 |
for p, src, dest in self.ip.install_actions: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
735 |
p.execute_install(src, dest) |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
736 |
self.ip.progtrack.actions_add_progress() |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
737 |
|
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
738 |
# execute updates |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
739 |
self.ip.progtrack.actions_set_goal("Update Phase", len(self.ip.update_actions)) |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
740 |
|
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
741 |
for p, src, dest in self.ip.update_actions: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
742 |
p.execute_update(src, dest) |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
743 |
self.ip.progtrack.actions_add_progress() |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
744 |
|
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
745 |
# handle any postexecute operations |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
746 |
|
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
747 |
for p in self.ip.pkg_plans: |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
748 |
p.postexecute() |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
749 |
|
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
750 |
self.ip.state = imageplan.EXECUTED_OK |
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
751 |
|
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
752 |
# reduce memory consumption |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
753 |
del self.ip.removal_actions |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
754 |
del self.ip.update_actions |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
755 |
del self.ip.install_actions |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
756 |
|
459 | 757 |
del self.ip.target_rem_fmris |
758 |
del self.ip.target_fmris |
|
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
759 |
# XXX This is accessing private member, and this fix should go |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
760 |
# Once we will remove code duplication. |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
761 |
del self.ip._ImagePlan__directories |
459 | 762 |
|
763 |
# Perform the incremental update to the search indexes |
|
764 |
# for all changed packages |
|
765 |
plan_info = [] |
|
766 |
for p in self.ip.pkg_plans: |
|
767 |
d_fmri = p.destination_fmri |
|
768 |
d_manifest_path = None |
|
769 |
if d_fmri: |
|
770 |
d_manifest_path = \ |
|
771 |
self.ip.image.get_manifest_path(d_fmri) |
|
772 |
o_fmri = p.origin_fmri |
|
773 |
o_manifest_path = None |
|
774 |
o_filter_file = None |
|
775 |
if o_fmri: |
|
776 |
o_manifest_path = \ |
|
777 |
self.ip.image.get_manifest_path(o_fmri) |
|
778 |
plan_info.append((d_fmri, d_manifest_path, o_fmri, |
|
779 |
o_manifest_path)) |
|
780 |
self.update_list = self.ip.pkg_plans[:] |
|
781 |
del self.ip.pkg_plans |
|
782 |
||
783 |
self.ip.progtrack.actions_set_goal("Index Phase", len(plan_info)) |
|
784 |
||
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
785 |
try: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
786 |
self.ip.image.update_index_dir() |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
787 |
ind = indexer.Indexer(self.ip.image.index_dir, |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
788 |
CLIENT_DEFAULT_MEM_USE_KB, progtrack=self.ip.progtrack) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
789 |
ind.client_update_index((self.ip.filters, plan_info)) |
516
53da6297fb65
3039 Install and Image-update should check index consistency with installed packages
Brock Pytlik <bpytlik@sun.com>
parents:
510
diff
changeset
|
790 |
except (KeyboardInterrupt, |
53da6297fb65
3039 Install and Image-update should check index consistency with installed packages
Brock Pytlik <bpytlik@sun.com>
parents:
510
diff
changeset
|
791 |
search_errors.ProblematicPermissionsIndexException): |
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
792 |
# ProblematicPermissionsIndexException is included here |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
793 |
# as there's little chance that trying again will fix |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
794 |
# this problem. |
539
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
795 |
self.ip.image.history.operation_result = \ |
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
796 |
history.RESULT_FAILED_STORAGE |
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
797 |
raise |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
798 |
except Exception, e: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
799 |
del(ind) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
800 |
# XXX Once we have a framework for emitting a message |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
801 |
# to the user in this spot in the code, we should tell |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
802 |
# them something has gone wrong so that we continue to |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
803 |
# get feedback to allow us to debug the code. |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
804 |
self.ip.image.rebuild_search_index(self.ip.progtrack) |
539
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
805 |
self.ip.image.history.operation_result = \ |
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
806 |
history.RESULT_FAILED_UNKNOWN |
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
807 |
|
539
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
808 |
self.ip.image.history.operation_result = \ |
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
526
diff
changeset
|
809 |
history.RESULT_SUCCEEDED |
459 | 810 |
self.ip.progtrack.actions_done() |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
811 |
|
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
812 |
def actions_done(self): |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
813 |
if self.parent != None: |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
814 |
if not self.ips_update and not self.image_update: |
483 | 815 |
gobject.idle_add(self.__update_package_list) |
816 |
gobject.idle_add(self.w_installing_dialog.hide) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
817 |
|
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
818 |
if self.ips_update: |
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
819 |
gobject.idle_add(self.parent.shutdown_after_ips_update) |
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
820 |
elif self.image_update: |
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
821 |
gobject.idle_add(self.parent.shutdown_after_image_update) |
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
822 |
|
483 | 823 |
def __update_package_list(self): |
459 | 824 |
for pkg in self.update_list: |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
825 |
pkg_name = pkg.get_xfername() |
483 | 826 |
self.__update_install_list(pkg_name) |
459 | 827 |
del self.update_list |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
828 |
self.parent.update_package_list() |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
829 |
|
483 | 830 |
def __update_install_list(self, pkg_name): |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
831 |
for row in self.install_list: |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
832 |
if row[enumerations.NAME_COLUMN] == pkg_name: |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
833 |
row[enumerations.MARK_COLUMN] = True |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
834 |
return |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
835 |
|
483 | 836 |
def download_file_path(self, file_path): |
837 |
'''Called by GUI's filelist.py through the progress, which is passed |
|
838 |
to the filelist.''' |
|
839 |
# XXX this function should be removed and also pkg.gui.filelist should |
|
840 |
# not call it, since we don't want to show single file progress |
|
841 |
gobject.idle_add(self.__add_file_to_downloadtext, file_path) |
|
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
842 |
|
483 | 843 |
def __add_file_to_downloadtext(self, file_path): |
844 |
'''Function which adds another line text in the "more details" download |
|
845 |
dialog''' |
|
846 |
buf = self.w_download_textview.get_buffer() |
|
847 |
textiter = buf.get_end_iter() |
|
848 |
buf.insert(textiter, self.parent._("Downloading: ") + file_path + "\n") |
|
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
849 |
|
483 | 850 |
def __add_info_to_installtext(self, text): |
851 |
'''Function which adds another line text in the "more details" install |
|
852 |
dialog''' |
|
853 |
buf = self.w_installing_textview.get_buffer() |
|
854 |
textiter = buf.get_end_iter() |
|
855 |
buf.insert(textiter, text) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
856 |
|
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
857 |
def cat_output_start(self): |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
858 |
return |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
859 |
|
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
860 |
def cat_output_done(self): |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
861 |
return |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
862 |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
863 |
def eval_output_start(self): |
483 | 864 |
'''Called by progress tracker when the evaluation of the packages just |
865 |
started.''' |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
866 |
return |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
867 |
|
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
868 |
def eval_output_progress(self): |
483 | 869 |
'''Called by progress tracker each time some package was evaluated. The |
870 |
call is being done by calling progress tracker evaluate_progress() |
|
871 |
function''' |
|
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
872 |
return |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
873 |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
874 |
def eval_output_done(self): |
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
875 |
gobject.idle_add(self.__eval_output_done) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
876 |
|
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
877 |
def __eval_output_done(self): |
483 | 878 |
'''Called by progress tracker after the evaluation of the packages is |
879 |
finished. Gets information like how many packages will be |
|
880 |
updated/installed and maximum amount of data which will be downloaded. |
|
881 |
Later this information is being adjusted, while downloading''' |
|
882 |
if self.gui_thread.is_cancelled(): |
|
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
883 |
self.progress_stop_timer_thread = True |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
884 |
self.w_createplan_dialog.hide() |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
885 |
return |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
886 |
updated_installed = \ |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
887 |
[ |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
888 |
["Packages To Be Installed:"], |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
889 |
["Packages To Be Updated:"] |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
890 |
] |
483 | 891 |
treestore = gtk.TreeStore(str) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
892 |
install_iter = None |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
893 |
updated_iter = None |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
894 |
install_count = 0 |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
895 |
updated_count = 0 |
483 | 896 |
total_download_count = 0 |
897 |
total_files_count = 0 |
|
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
898 |
npkgs = 0 |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
899 |
for package_plan in self.ip.pkg_plans: |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
900 |
npkgs += 1 |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
901 |
if package_plan.origin_fmri and package_plan.destination_fmri: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
902 |
if not updated_iter: |
483 | 903 |
updated_iter = treestore.append(None, \ |
904 |
updated_installed[1]) |
|
905 |
d_fmri = package_plan.destination_fmri |
|
906 |
dt = self.get_datetime(d_fmri.version) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
907 |
dt_str = (":%02d%02d") % (dt.month, dt.day) |
483 | 908 |
pkg_version = d_fmri.version.get_short_version() + dt_str |
909 |
pkg = d_fmri.get_name() + "@" + pkg_version |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
910 |
updated_count = updated_count + 1 |
483 | 911 |
treestore.append(updated_iter, [pkg]) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
912 |
elif package_plan.destination_fmri: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
913 |
if not install_iter: |
483 | 914 |
install_iter = treestore.append(None, \ |
915 |
updated_installed[0]) |
|
916 |
d_fmri = package_plan.destination_fmri |
|
917 |
dt = self.get_datetime(d_fmri.version) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
918 |
dt_str = (":%02d%02d") % (dt.month, dt.day) |
483 | 919 |
pkg_version = d_fmri.version.get_short_version() + dt_str |
920 |
pkg = d_fmri.get_name() + "@" + pkg_version |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
921 |
install_count = install_count + 1 |
483 | 922 |
treestore.append(install_iter, [pkg]) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
923 |
xferfiles, xfersize = package_plan.get_xferstats() |
483 | 924 |
total_download_count = total_download_count + xfersize |
925 |
total_files_count = total_files_count + xferfiles |
|
926 |
self.ip.progtrack.download_set_goal(npkgs, total_files_count, \ |
|
927 |
total_download_count) |
|
928 |
self.w_review_treeview.set_model(treestore) |
|
929 |
self.w_review_treeview.expand_all() |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
930 |
updated_str = self.parent._("%d packages will be updated\n") |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
931 |
if updated_count == 1: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
932 |
updated_str = self.parent._("%d package will be updated\n") |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
933 |
install_str = self.parent._("%d packages will be installed\n\n") |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
934 |
if install_count == 1: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
935 |
install_str = self.parent._("%d package will be installed\n\n") |
483 | 936 |
self.w_summary_label.set_text((updated_str + install_str + \ |
937 |
self.parent._("%d MB will be downloaded"))% \ |
|
938 |
(updated_count, install_count, (total_download_count/1024/1024))) |
|
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
939 |
self.progress_stop_timer_thread = True |
483 | 940 |
self.w_createplan_dialog.hide() |
941 |
self.w_installupdate_dialog.show() |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
942 |
|
483 | 943 |
def ver_output(self): |
944 |
return |
|
945 |
||
946 |
def ver_output_error(self, actname, errors): |
|
947 |
return |
|
948 |
||
949 |
def dl_output(self): |
|
950 |
gobject.idle_add(self.__update_download_progress, self.dl_cur_nbytes, \ |
|
951 |
self.dl_goal_nbytes) |
|
952 |
return |
|
953 |
||
954 |
def dl_output_done(self): |
|
955 |
return |
|
956 |
||
957 |
def act_output(self): |
|
958 |
gobject.idle_add(self.__update_install_progress, \ |
|
959 |
self.act_cur_nactions, self.act_goal_nactions) |
|
960 |
return |
|
961 |
||
962 |
def act_output_done(self): |
|
963 |
return |
|
964 |
||
965 |
def ind_output(self): |
|
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
966 |
self.progress_stop_timer_thread = False |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
967 |
gobject.idle_add(self.__indexing_progress) |
483 | 968 |
return |
969 |
||
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
970 |
def __indexing_progress(self): |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
971 |
if not self.progress_stop_timer_running: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
972 |
self.w_installingdialog_label.set_text(\ |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
973 |
self.parent._("Creating packages index...")) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
974 |
Thread(target = self.__update_install_pulse).start() |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
975 |
|
483 | 976 |
def ind_output_done(self): |
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
483
diff
changeset
|
977 |
self.progress_stop_timer_thread = True |
483 | 978 |
return |
979 |
||
980 |
@staticmethod |
|
981 |
def get_datetime(version): |
|
982 |
'''Support function for change in the IPS API: get_timestamp() was |
|
983 |
replaced by get_datetime()''' |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
984 |
dt = None |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
985 |
try: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
986 |
dt = version.get_datetime() |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
987 |
except AttributeError: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
988 |
dt = version.get_timestamp() |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
989 |
return dt |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
990 |