1 |
commit: 43b2ebc433a997d0cb2d4ae8001f773f3186df5f |
2 |
Author: wiktor w brodlo <wiktor <AT> brodlo <DOT> net> |
3 |
AuthorDate: Sun Jun 26 21:02:45 2011 +0000 |
4 |
Commit: Wiktor W Brodlo <wiktor <AT> brodlo <DOT> net> |
5 |
CommitDate: Sun Jun 26 21:02:45 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/anaconda.git;a=commit;h=43b2ebc4 |
7 |
|
8 |
Removed unneded functions and changed Entropy to Portage |
9 |
|
10 |
--- |
11 |
gentoo/utils.py | 1069 +++++++++++++++++++++++++------------------------------ |
12 |
1 files changed, 485 insertions(+), 584 deletions(-) |
13 |
|
14 |
diff --git a/gentoo/utils.py b/gentoo/utils.py |
15 |
index d5f5ab3..2cc58ba 100644 |
16 |
--- a/gentoo/utils.py |
17 |
+++ b/gentoo/utils.py |
18 |
@@ -3,6 +3,8 @@ |
19 |
# gentoo/utils.py |
20 |
# |
21 |
# Copyright (C) 2010 Fabio Erculiani |
22 |
+# Copyright (C) 2011 wiktor w brodlo |
23 |
+# Copyright (C) 2011 Gentoo Foundation |
24 |
# |
25 |
# This program is free software; you can redistribute it and/or modify |
26 |
# it under the terms of the GNU General Public License as published by |
27 |
@@ -32,19 +34,10 @@ import statvfs |
28 |
import tempfile |
29 |
import time |
30 |
|
31 |
-# Entropy imports |
32 |
-from entropy.exceptions import EntropyPackageException |
33 |
-from entropy.const import etpUi, etpConst, etpSys |
34 |
-import entropy.tools |
35 |
-import entropy.dep |
36 |
-from entropy.core.settings.base import SystemSettings |
37 |
-from entropy.core import Singleton |
38 |
-from entropy.services.client import WebService |
39 |
- |
40 |
# Anaconda imports |
41 |
import logging |
42 |
from constants import productPath |
43 |
-from gentoo import Entropy |
44 |
+from gentoo import Portage |
45 |
from gentoo.const import LIVE_USER, LANGUAGE_PACKS, REPO_NAME |
46 |
|
47 |
import gettext |
48 |
@@ -125,50 +118,51 @@ class GentooProgress(Singleton): |
49 |
self._process_events() |
50 |
else: |
51 |
self._prog.set_fraction(pct) |
52 |
- |
53 |
- def _spawn_adimage(self): |
54 |
- |
55 |
- if not self.__adbox_running: |
56 |
- return |
57 |
- |
58 |
- cur_t = time.time() |
59 |
- if cur_t <= (self.__image_t + 10): |
60 |
- return |
61 |
- self.__image_t = cur_t |
62 |
- |
63 |
- pixmaps = getattr(self._prog, 'pixmaps', []) |
64 |
- pix_len = len(pixmaps) |
65 |
- if pix_len == 0: |
66 |
- log.warning("Shutting down _spawn_adimage, no images") |
67 |
- self.__adbox_running = False |
68 |
- return |
69 |
- |
70 |
- if not self._prog.adpix: |
71 |
- log.warning("Shutting down _spawn_adimage, no adpix") |
72 |
- self.__adbox_running = False |
73 |
- return |
74 |
- |
75 |
- try: |
76 |
- pix_path = pixmaps[self._pix_count] |
77 |
- except IndexError: |
78 |
- self._pix_count = 0 |
79 |
- pix_path = pixmaps[0] |
80 |
- |
81 |
- self._pix_count += 1 |
82 |
- |
83 |
- import gui |
84 |
- pix = gui.readImageFromFile(pix_path) |
85 |
- if pix: |
86 |
- self._prog.adbox.remove(self._prog.adpix) |
87 |
- self._prog.adpix.destroy() |
88 |
- pix.set_alignment(0.5, 0.5) |
89 |
- self._prog.adbox.add(pix) |
90 |
- self._prog.adpix = pix |
91 |
- else: |
92 |
- log.warning("Shutting down _spawn_adimage, no pixmap: %s" % ( |
93 |
- pix_path,)) |
94 |
- |
95 |
- self._prog.adbox.show_all() |
96 |
+ |
97 |
+ # TODO: Check if we need this |
98 |
+ #def _spawn_adimage(self): |
99 |
+ |
100 |
+ # if not self.__adbox_running: |
101 |
+ # return |
102 |
+ |
103 |
+ # cur_t = time.time() |
104 |
+ # if cur_t <= (self.__image_t + 10): |
105 |
+ # return |
106 |
+ # self.__image_t = cur_t |
107 |
+ |
108 |
+ # pixmaps = getattr(self._prog, 'pixmaps', []) |
109 |
+ # pix_len = len(pixmaps) |
110 |
+ # if pix_len == 0: |
111 |
+ # log.warning("Shutting down _spawn_adimage, no images") |
112 |
+ # self.__adbox_running = False |
113 |
+ # return |
114 |
+ |
115 |
+ # if not self._prog.adpix: |
116 |
+ # log.warning("Shutting down _spawn_adimage, no adpix") |
117 |
+ # self.__adbox_running = False |
118 |
+ # return |
119 |
+ |
120 |
+ # try: |
121 |
+ # pix_path = pixmaps[self._pix_count] |
122 |
+ # except IndexError: |
123 |
+ # self._pix_count = 0 |
124 |
+ # pix_path = pixmaps[0] |
125 |
+ |
126 |
+ # self._pix_count += 1 |
127 |
+ |
128 |
+ # import gui |
129 |
+ # pix = gui.readImageFromFile(pix_path) |
130 |
+ # if pix: |
131 |
+ # self._prog.adbox.remove(self._prog.adpix) |
132 |
+ # self._prog.adpix.destroy() |
133 |
+ # pix.set_alignment(0.5, 0.5) |
134 |
+ # self._prog.adbox.add(pix) |
135 |
+ # self._prog.adpix = pix |
136 |
+ # else: |
137 |
+ # log.warning("Shutting down _spawn_adimage, no pixmap: %s" % ( |
138 |
+ # pix_path,)) |
139 |
+ |
140 |
+ # self._prog.adbox.show_all() |
141 |
|
142 |
|
143 |
class GentooInstall: |
144 |
@@ -180,39 +174,40 @@ class GentooInstall: |
145 |
self._prod_root = productPath |
146 |
self._intf = anaconda.intf |
147 |
self._progress = GentooProgress(anaconda) |
148 |
- self._entropy = Entropy() |
149 |
+ self._portage = Portage() |
150 |
self._settings = SystemSettings() |
151 |
with open("/proc/cmdline", "r") as cmd_f: |
152 |
self.cmdline = cmd_f.readline().strip().split() |
153 |
#sys.stderr = STDERR_LOG |
154 |
|
155 |
- self._files_db_path = self._root+"/files.db" |
156 |
- try: |
157 |
- self._files_db = self._entropy.open_generic_repository( |
158 |
- self._files_db_path, dbname = "filesdb", |
159 |
- indexing_override = True) |
160 |
- except TypeError: |
161 |
- # new API |
162 |
- self._files_db = self._entropy.open_generic_repository( |
163 |
- self._files_db_path, name = "filesdb", |
164 |
- indexing_override = True) |
165 |
- if hasattr(self._files_db, "initializeDatabase"): |
166 |
- self._files_db.initializeDatabase() |
167 |
- else: |
168 |
- self._files_db.initializeRepository() |
169 |
- self._live_repo = self._open_live_installed_repository() |
170 |
- self._package_identifiers_to_remove = set() |
171 |
+ # TODO: Remove or change this |
172 |
+ #self._files_db_path = self._root+"/files.db" |
173 |
+ #try: |
174 |
+ # self._files_db = self._entropy.open_generic_repository( |
175 |
+ # self._files_db_path, dbname = "filesdb", |
176 |
+ # indexing_override = True) |
177 |
+ #except TypeError: |
178 |
+ # # new API |
179 |
+ # self._files_db = self._entropy.open_generic_repository( |
180 |
+ # self._files_db_path, name = "filesdb", |
181 |
+ # indexing_override = True) |
182 |
+ #if hasattr(self._files_db, "initializeDatabase"): |
183 |
+ # self._files_db.initializeDatabase() |
184 |
+ #else: |
185 |
+ # self._files_db.initializeRepository() |
186 |
+ #self._live_repo = self._open_live_installed_repository() |
187 |
+ #self._package_identifiers_to_remove = set() |
188 |
|
189 |
def destroy(self): |
190 |
# remove files db if exists |
191 |
- if hasattr(self._files_db, "close"): |
192 |
- self._files_db.close() |
193 |
- else: |
194 |
- self._files_db.closeDB() |
195 |
- try: |
196 |
- os.remove(self._files_db_path) |
197 |
- except OSError: |
198 |
- pass |
199 |
+ #if hasattr(self._files_db, "close"): |
200 |
+ # self._files_db.close() |
201 |
+ #else: |
202 |
+ # self._files_db.closeDB() |
203 |
+ #try: |
204 |
+ # os.remove(self._files_db_path) |
205 |
+ #except OSError: |
206 |
+ # pass |
207 |
|
208 |
self._progress.stop() |
209 |
|
210 |
@@ -246,165 +241,167 @@ class GentooInstall: |
211 |
myargs = ' '.join(args) |
212 |
return subprocess.call(myargs, shell = True) |
213 |
|
214 |
- def _open_live_installed_repository(self): |
215 |
- dbpath = self._prod_root + etpConst['etpdatabaseclientfilepath'] |
216 |
- try: |
217 |
- dbconn = self._entropy.open_generic_repository( |
218 |
- dbpath, xcache = False, read_only = True, |
219 |
- dbname = "live_client", indexing_override = False) |
220 |
- except TypeError: |
221 |
- # new API |
222 |
- dbconn = self._entropy.open_generic_repository( |
223 |
- dbpath, xcache = False, read_only = True, |
224 |
- name = "live_client", indexing_override = False) |
225 |
- return dbconn |
226 |
- |
227 |
- def _change_entropy_chroot(self, chroot = None): |
228 |
- if not chroot: |
229 |
- self._entropy._installed_repo_enable = True |
230 |
- self._entropy.noclientdb = False |
231 |
- else: |
232 |
- self._entropy._installed_repo_enable = False |
233 |
- self._entropy.noclientdb = True |
234 |
- if chroot is None: |
235 |
- chroot = "" |
236 |
- self._entropy.switch_chroot(chroot) |
237 |
- sys_settings_plg_id = etpConst['system_settings_plugins_ids']['client_plugin'] |
238 |
- del self._settings[sys_settings_plg_id]['misc']['configprotectskip'][:] |
239 |
+ #def _open_live_installed_repository(self): |
240 |
+ # dbpath = self._prod_root + etpConst['etpdatabaseclientfilepath'] |
241 |
+ # try: |
242 |
+ # dbconn = self._entropy.open_generic_repository( |
243 |
+ # dbpath, xcache = False, read_only = True, |
244 |
+ # dbname = "live_client", indexing_override = False) |
245 |
+ # except TypeError: |
246 |
+ # # new API |
247 |
+ # dbconn = self._entropy.open_generic_repository( |
248 |
+ # dbpath, xcache = False, read_only = True, |
249 |
+ # name = "live_client", indexing_override = False) |
250 |
+ # return dbconn |
251 |
+ |
252 |
+ #def _change_entropy_chroot(self, chroot = None): |
253 |
+ # if not chroot: |
254 |
+ # self._entropy._installed_repo_enable = True |
255 |
+ # self._entropy.noclientdb = False |
256 |
+ # else: |
257 |
+ # self._entropy._installed_repo_enable = False |
258 |
+ # self._entropy.noclientdb = True |
259 |
+ # if chroot is None: |
260 |
+ # chroot = "" |
261 |
+ # self._entropy.switch_chroot(chroot) |
262 |
+ # sys_settings_plg_id = etpConst['system_settings_plugins_ids']['client_plugin'] |
263 |
+ # del self._settings[sys_settings_plg_id]['misc']['configprotectskip'][:] |
264 |
|
265 |
def install_package(self, atom, match = None, silent = False, fetch = False): |
266 |
|
267 |
- if silent and os.getenv('GENTOO_DEBUG'): |
268 |
- silent = False |
269 |
- |
270 |
- chroot = self._root |
271 |
- root = etpSys['rootdir'] |
272 |
- if chroot != root: |
273 |
- self._change_entropy_chroot(chroot) |
274 |
- |
275 |
- if match is None: |
276 |
- match = self._entropy.atom_match(atom) |
277 |
- |
278 |
- oldstdout = sys.stdout |
279 |
- if silent: |
280 |
- sys.stdout = STDERR_LOG |
281 |
- etpUi['mute'] = True |
282 |
- |
283 |
- try: |
284 |
- rc = 0 |
285 |
- if match[0] != -1: |
286 |
- Package = self._entropy.Package() |
287 |
- action = "install" |
288 |
- if fetch: |
289 |
- action = "fetch" |
290 |
- Package.prepare(match, action) |
291 |
- rc = Package.run() |
292 |
- Package.kill() |
293 |
- finally: |
294 |
- if silent: |
295 |
- sys.stdout = oldstdout |
296 |
- etpUi['mute'] = False |
297 |
- if chroot != root: |
298 |
- self._change_entropy_chroot(root) |
299 |
- |
300 |
- return rc |
301 |
- |
302 |
+ #if silent and os.getenv('GENTOO_DEBUG'): |
303 |
+ # silent = False |
304 |
+ |
305 |
+ #chroot = self._root |
306 |
+ #root = etpSys['rootdir'] |
307 |
+ # Doesn't matter, Portage chroots in the terminal if needed |
308 |
+ #if chroot != root: |
309 |
+ # self._change_entropy_chroot(chroot) |
310 |
+ |
311 |
+ #if match is None: |
312 |
+ # match = self._entropy.atom_match(atom) |
313 |
+ #oldstdout = sys.stdout |
314 |
+ |
315 |
+ #if silent: |
316 |
+ # sys.stdout = STDERR_LOG |
317 |
+ # etpUi['mute'] = True |
318 |
+ |
319 |
+ #try: |
320 |
+ # rc = 0 |
321 |
+ # if match[0] != -1: |
322 |
+ # Package = self._entropy.Package() |
323 |
+ # action = "install" |
324 |
+ # if fetch: |
325 |
+ # action = "fetch" |
326 |
+ # Package.prepare(match, action) |
327 |
+ # rc = Package.run() |
328 |
+ # Package.kill() |
329 |
+ #finally: |
330 |
+ # if silent: |
331 |
+ # sys.stdout = oldstdout |
332 |
+ # etpUi['mute'] = False |
333 |
+ # if chroot != root: |
334 |
+ # self._change_entropy_chroot(root) |
335 |
+ |
336 |
+ return self._portage.install(atom) |
337 |
+ |
338 |
+ # TODO: We don't remove anything from stage3 |
339 |
def remove_package(self, atom, match = None, silent = False): |
340 |
|
341 |
- if silent and os.getenv('GENTOO_DEBUG'): |
342 |
- silent = False |
343 |
- |
344 |
- chroot = self._root |
345 |
- root = etpSys['rootdir'] |
346 |
- if chroot != root: |
347 |
- self._change_entropy_chroot(chroot) |
348 |
- |
349 |
- if match is None: |
350 |
- match = self._entropy.installed_repository().atomMatch(atom) |
351 |
- |
352 |
- oldstdout = sys.stdout |
353 |
- if silent: |
354 |
- sys.stdout = STDERR_LOG |
355 |
- etpUi['mute'] = True |
356 |
- |
357 |
- try: |
358 |
- rc = 0 |
359 |
- if match[0] != -1: |
360 |
- Package = self._entropy.Package() |
361 |
- Package.prepare((match[0],), "remove") |
362 |
- if 'remove_installed_vanished' not in Package.pkgmeta: |
363 |
- rc = Package.run() |
364 |
- Package.kill() |
365 |
- finally: |
366 |
- if silent: |
367 |
- sys.stdout = oldstdout |
368 |
- etpUi['mute'] = False |
369 |
- |
370 |
- if chroot != root: |
371 |
- self._change_entropy_chroot(root) |
372 |
- |
373 |
- return rc |
374 |
- |
375 |
- def install_package_file(self, package_file): |
376 |
- chroot = self._root |
377 |
- root = etpSys['rootdir'] |
378 |
- if chroot != root: |
379 |
- self._change_entropy_chroot(chroot) |
380 |
- |
381 |
- try: |
382 |
- atomsfound = self._entropy.add_package_repository( |
383 |
- package_file) |
384 |
- except EntropyPackageException: |
385 |
- return -1 |
386 |
- repo = 0 |
387 |
- for match in atomsfound: |
388 |
- repo = match[1] |
389 |
- Package = self._entropy.Package() |
390 |
- Package.prepare(match, "install") |
391 |
- rc2 = Package.run() |
392 |
- if rc2 != 0: |
393 |
- if chroot != root: |
394 |
- self._change_entropy_chroot(root) |
395 |
- return rc2 |
396 |
- Package.kill() |
397 |
- |
398 |
- if chroot != root: |
399 |
- self._change_entropy_chroot(root) |
400 |
- |
401 |
- if repo != 0: |
402 |
- self._entropy.remove_repository(repo) |
403 |
- |
404 |
- return 0 |
405 |
- |
406 |
- def _configure_skel(self): |
407 |
+ # if silent and os.getenv('GENTOO_DEBUG'): |
408 |
+ # silent = False |
409 |
+ |
410 |
+ # chroot = self._root |
411 |
+ # root = etpSys['rootdir'] |
412 |
+ # if chroot != root: |
413 |
+ # self._change_entropy_chroot(chroot) |
414 |
+ |
415 |
+ # if match is None: |
416 |
+ # match = self._entropy.installed_repository().atomMatch(atom) |
417 |
+ |
418 |
+ # oldstdout = sys.stdout |
419 |
+ # if silent: |
420 |
+ # sys.stdout = STDERR_LOG |
421 |
+ # etpUi['mute'] = True |
422 |
+ |
423 |
+ # try: |
424 |
+ # rc = 0 |
425 |
+ # if match[0] != -1: |
426 |
+ # Package = self._entropy.Package() |
427 |
+ # Package.prepare((match[0],), "remove") |
428 |
+ # if 'remove_installed_vanished' not in Package.pkgmeta: |
429 |
+ # rc = Package.run() |
430 |
+ # Package.kill() |
431 |
+ # finally: |
432 |
+ # if silent: |
433 |
+ # sys.stdout = oldstdout |
434 |
+ # etpUi['mute'] = False |
435 |
+ |
436 |
+ # if chroot != root: |
437 |
+ # self._change_entropy_chroot(root) |
438 |
+ |
439 |
+ return self._portage.remove(atom) |
440 |
+ |
441 |
+ #def install_package_file(self, package_file): |
442 |
+ # chroot = self._root |
443 |
+ # root = etpSys['rootdir'] |
444 |
+ # if chroot != root: |
445 |
+ # self._change_entropy_chroot(chroot) |
446 |
+ |
447 |
+ # try: |
448 |
+ # atomsfound = self._entropy.add_package_repository( |
449 |
+ # package_file) |
450 |
+ # except EntropyPackageException: |
451 |
+ # return -1 |
452 |
+ # repo = 0 |
453 |
+ # for match in atomsfound: |
454 |
+ # repo = match[1] |
455 |
+ # Package = self._entropy.Package() |
456 |
+ # Package.prepare(match, "install") |
457 |
+ # rc2 = Package.run() |
458 |
+ # if rc2 != 0: |
459 |
+ # if chroot != root: |
460 |
+ # self._change_entropy_chroot(root) |
461 |
+ # return rc2 |
462 |
+ # Package.kill() |
463 |
+ |
464 |
+ # if chroot != root: |
465 |
+ # self._change_entropy_chroot(root) |
466 |
+ |
467 |
+ # if repo != 0: |
468 |
+ # self._entropy.remove_repository(repo) |
469 |
+ |
470 |
+ # return 0 |
471 |
+ |
472 |
+ #def _configure_skel(self): |
473 |
|
474 |
# copy Sulfur on the desktop |
475 |
- sulfur_desktop = self._root+"/usr/share/applications/sulfur.desktop" |
476 |
- if os.path.isfile(sulfur_desktop): |
477 |
- sulfur_user_desktop = self._root+"/etc/skel/Desktop/sulfur.desktop" |
478 |
- shutil.copy2(sulfur_desktop, sulfur_user_desktop) |
479 |
- try: |
480 |
- os.chmod(sulfur_user_desktop, 0775) |
481 |
- except OSError: |
482 |
- pass |
483 |
- |
484 |
- gparted_desktop = self._root+"/etc/skel/Desktop/gparted.desktop" |
485 |
- if os.path.isfile(gparted_desktop): |
486 |
- os.remove(gparted_desktop) |
487 |
- |
488 |
- installer_desk = self._root+"/etc/skel/Desktop/liveinst.desktop" |
489 |
- if os.path.isfile(installer_desk): |
490 |
- os.remove(installer_desk) |
491 |
- |
492 |
- # install welcome loader |
493 |
- orig_welcome_desk = self._root+"/etc/gentoo/gentoo-welcome-loader.desktop" |
494 |
- if os.path.isfile(orig_welcome_desk): |
495 |
- autostart_dir = self._root+"/etc/skel/.config/autostart" |
496 |
- if not os.path.isdir(autostart_dir): |
497 |
- os.makedirs(autostart_dir) |
498 |
- desk_name = os.path.basename(orig_welcome_desk) |
499 |
- desk_path = os.path.join(autostart_dir, desk_name) |
500 |
- shutil.copy2(orig_welcome_desk, desk_path) |
501 |
+ # sulfur_desktop = self._root+"/usr/share/applications/sulfur.desktop" |
502 |
+ # if os.path.isfile(sulfur_desktop): |
503 |
+ # sulfur_user_desktop = self._root+"/etc/skel/Desktop/sulfur.desktop" |
504 |
+ # shutil.copy2(sulfur_desktop, sulfur_user_desktop) |
505 |
+ # try: |
506 |
+ # os.chmod(sulfur_user_desktop, 0775) |
507 |
+ # except OSError: |
508 |
+ # pass |
509 |
+ |
510 |
+ # gparted_desktop = self._root+"/etc/skel/Desktop/gparted.desktop" |
511 |
+ # if os.path.isfile(gparted_desktop): |
512 |
+ # os.remove(gparted_desktop) |
513 |
+ |
514 |
+ # installer_desk = self._root+"/etc/skel/Desktop/liveinst.desktop" |
515 |
+ # if os.path.isfile(installer_desk): |
516 |
+ # os.remove(installer_desk) |
517 |
+ |
518 |
+ # # install welcome loader |
519 |
+ # orig_welcome_desk = self._root+"/etc/gentoo/gentoo-welcome-loader.desktop" |
520 |
+ # if os.path.isfile(orig_welcome_desk): |
521 |
+ # autostart_dir = self._root+"/etc/skel/.config/autostart" |
522 |
+ # if not os.path.isdir(autostart_dir): |
523 |
+ # os.makedirs(autostart_dir) |
524 |
+ # desk_name = os.path.basename(orig_welcome_desk) |
525 |
+ # desk_path = os.path.join(autostart_dir, desk_name) |
526 |
+ # shutil.copy2(orig_welcome_desk, desk_path) |
527 |
|
528 |
def _is_virtualbox(self): |
529 |
if not os.path.isfile("/etc/init.d/virtualbox-guest-additions"): |
530 |
@@ -424,20 +421,8 @@ class GentooInstall: |
531 |
action = _("Configuring System Services") |
532 |
self._progress.set_text(action) |
533 |
|
534 |
- is_gentoo_mce = "1" |
535 |
- if not Entropy.is_gentoo_mce(): |
536 |
- is_gentoo_mce = "0" |
537 |
- |
538 |
- # Remove Installer services |
539 |
+ # Installer services |
540 |
config_script = """ |
541 |
- rc-update del installer-gui boot default |
542 |
- rm -f /etc/init.d/installer-gui |
543 |
- rc-update del installer-text boot default |
544 |
- rm -f /etc/init.d/installer-text |
545 |
- rc-update del music boot default |
546 |
- rm -f /etc/init.d/music |
547 |
- rc-update del gentoolive boot default |
548 |
- rm -f /etc/init.d/gentoolive |
549 |
rc-update add vixie-cron default |
550 |
if [ ! -e "/etc/init.d/net.eth0" ]; then |
551 |
cd /etc/init.d && ln -s net.lo net.eth0 |
552 |
@@ -454,10 +439,6 @@ class GentooInstall: |
553 |
if [ -e "/etc/init.d/oemsystem-default" ]; then |
554 |
rc-update add oemsystem-default default |
555 |
fi |
556 |
- if [ "0" = """+is_gentoo_mce+""" ]; then |
557 |
- rc-update del gentoo-mce boot |
558 |
- rc-update del gentoo-mce default |
559 |
- fi |
560 |
""" |
561 |
self.spawn_chroot(config_script, silent = True) |
562 |
|
563 |
@@ -479,6 +460,7 @@ class GentooInstall: |
564 |
"cp -p /etc/modules.d/blacklist %s/etc/modules.d/blacklist" % ( |
565 |
self._root,)) |
566 |
|
567 |
+ # TODO: Check this after we have X working |
568 |
def remove_proprietary_drivers(self): |
569 |
""" |
570 |
Detect a possible OSS video card and remove /etc/env.d/*ati |
571 |
@@ -734,9 +716,9 @@ class GentooInstall: |
572 |
# mask all the nvidia-drivers, this avoids having people |
573 |
# updating their drivers resulting in a non working system |
574 |
mask_file = os.path.join(self._root+'/', |
575 |
- "etc/entropy/packages/package.mask") |
576 |
+ "etc/portage/packages/package.mask") |
577 |
unmask_file = os.path.join(self._root+'/', |
578 |
- "etc/entropy/packages/package.unmask") |
579 |
+ "etc/portage/packages/package.unmask") |
580 |
if os.access(mask_file, os.W_OK) and os.path.isfile(mask_file): |
581 |
f = open(mask_file,"aw") |
582 |
f.write("\n# added by Gentoo Installer\nx11-drivers/nvidia-drivers\n") |
583 |
@@ -782,22 +764,16 @@ class GentooInstall: |
584 |
|
585 |
def emit_install_done(self): |
586 |
# user installed Gentoo, w00hooh! |
587 |
- try: |
588 |
- webserv = self._get_entropy_webservice() |
589 |
- except WebService.UnsupportedService: |
590 |
- return |
591 |
- try: |
592 |
- webserv.add_downloads(["installer"]) |
593 |
- except Exception as err: |
594 |
- log.error("Unable to emit_install_done(): %s" % err) |
595 |
+ pass |
596 |
|
597 |
def live_install(self): |
598 |
""" |
599 |
- This function copy the LiveCD/DVD content into self._root |
600 |
+ This function copies the stage3 into self._root |
601 |
""" |
602 |
|
603 |
- if not os.getenv("GENTOO_DISABLE_PKG_REMOVAL"): |
604 |
- self._setup_packages_to_remove() |
605 |
+ # We don't remove stuff from the stage3 |
606 |
+ #if not os.getenv("GENTOO_DISABLE_PKG_REMOVAL"): |
607 |
+ # self._setup_packages_to_remove() |
608 |
|
609 |
action = _("System Installation") |
610 |
copy_update_interval = 300 |
611 |
@@ -921,42 +897,42 @@ class GentooInstall: |
612 |
self._change_entropy_chroot(self._root) |
613 |
# doing here, because client_repo should point to self._root chroot |
614 |
client_repo = self._entropy.installed_repository() |
615 |
- # Removing Unwanted Packages |
616 |
- if self._package_identifiers_to_remove: |
617 |
+ # NOT Removing Unwanted Packages |
618 |
+ #if self._package_identifiers_to_remove: |
619 |
|
620 |
# this makes packages removal much faster |
621 |
- client_repo.createAllIndexes() |
622 |
+ # client_repo.createAllIndexes() |
623 |
|
624 |
- total_counter = len(self._package_identifiers_to_remove) |
625 |
- current_counter = 0 |
626 |
- self._progress.set_fraction(current_counter) |
627 |
- self._progress.set_text(_("Cleaning packages")) |
628 |
- self._entropy.oldcount = [0,total_counter] |
629 |
+ # total_counter = len(self._package_identifiers_to_remove) |
630 |
+ # current_counter = 0 |
631 |
+ # self._progress.set_fraction(current_counter) |
632 |
+ # self._progress.set_text(_("Cleaning packages")) |
633 |
+ # self._entropy.oldcount = [0,total_counter] |
634 |
|
635 |
- for pkg_id in self._package_identifiers_to_remove: |
636 |
- current_counter += 1 |
637 |
- atom = client_repo.retrieveAtom(pkg_id) |
638 |
- if not atom: |
639 |
- continue |
640 |
+ # for pkg_id in self._package_identifiers_to_remove: |
641 |
+ # current_counter += 1 |
642 |
+ # atom = client_repo.retrieveAtom(pkg_id) |
643 |
+ # if not atom: |
644 |
+ # continue |
645 |
|
646 |
### XXX needed to speed up removal process |
647 |
#""" |
648 |
- category = client_repo.retrieveCategory(pkg_id) |
649 |
- version = client_repo.retrieveVersion(pkg_id) |
650 |
- name = client_repo.retrieveName(pkg_id) |
651 |
- ebuild_path = self._root+"/var/db/pkg/%s/%s-%s" % ( |
652 |
- category, name, version) |
653 |
- if os.path.isdir(ebuild_path): |
654 |
- shutil.rmtree(ebuild_path, True) |
655 |
+ # category = client_repo.retrieveCategory(pkg_id) |
656 |
+ # version = client_repo.retrieveVersion(pkg_id) |
657 |
+ # name = client_repo.retrieveName(pkg_id) |
658 |
+ # ebuild_path = self._root+"/var/db/pkg/%s/%s-%s" % ( |
659 |
+ # category, name, version) |
660 |
+ # if os.path.isdir(ebuild_path): |
661 |
+ # shutil.rmtree(ebuild_path, True) |
662 |
#""" |
663 |
### XXX |
664 |
|
665 |
- self.remove_package(None, match = (pkg_id,0), silent = True) |
666 |
- frac = float(current_counter)/total_counter |
667 |
- self._progress.set_fraction(frac) |
668 |
- self._progress.set_text("%s: %s" % ( |
669 |
- _("Cleaning package"), atom,)) |
670 |
- self._entropy.oldcount = [current_counter, total_counter] |
671 |
+ # self.remove_package(None, match = (pkg_id,0), silent = True) |
672 |
+ # frac = float(current_counter)/total_counter |
673 |
+ # self._progress.set_fraction(frac) |
674 |
+ # self._progress.set_text("%s: %s" % ( |
675 |
+ # _("Cleaning package"), atom,)) |
676 |
+ # self._entropy.oldcount = [current_counter, total_counter] |
677 |
|
678 |
while 1: |
679 |
change = False |
680 |
@@ -978,184 +954,109 @@ class GentooInstall: |
681 |
if not change: |
682 |
break |
683 |
|
684 |
+ # We don't do that on Gentoo |
685 |
# list installed packages and setup a package set |
686 |
- inst_packages = ['%s:%s\n' % (entropy.dep.dep_getkey(atom),slot,) \ |
687 |
- for idpk, atom, slot, revision in client_repo.listAllPackages( |
688 |
- get_scope = True, order_by = "atom")] |
689 |
+ #inst_packages = ['%s:%s\n' % (entropy.dep.dep_getkey(atom),slot,) \ |
690 |
+ # for idpk, atom, slot, revision in client_repo.listAllPackages( |
691 |
+ # get_scope = True, order_by = "atom")] |
692 |
# perfectly fine w/o self._root |
693 |
- pkgset_dir = etpConst['confsetsdir'] |
694 |
- if not os.path.isdir(pkgset_dir): |
695 |
- os.makedirs(pkgset_dir, 0755) |
696 |
- set_name = "install_base" |
697 |
- set_filepath = os.path.join(pkgset_dir, set_name) |
698 |
- try: |
699 |
- f = open(set_filepath,"w") |
700 |
- f.writelines(inst_packages) |
701 |
- f.flush() |
702 |
- f.close() |
703 |
- except (IOError,): |
704 |
- pass |
705 |
- |
706 |
- self._change_entropy_chroot() |
707 |
+ #pkgset_dir = etpConst['confsetsdir'] |
708 |
+ #if not os.path.isdir(pkgset_dir): |
709 |
+ # os.makedirs(pkgset_dir, 0755) |
710 |
+ #set_name = "install_base" |
711 |
+ #set_filepath = os.path.join(pkgset_dir, set_name) |
712 |
+ #try: |
713 |
+ # f = open(set_filepath,"w") |
714 |
+ # f.writelines(inst_packages) |
715 |
+ # f.flush() |
716 |
+ # f.close() |
717 |
+ #except (IOError,): |
718 |
+ # pass |
719 |
+ |
720 |
+ #self._change_entropy_chroot() |
721 |
|
722 |
self._progress.set_fraction(1) |
723 |
self._progress.set_text(_("Installation complete")) |
724 |
|
725 |
- def language_packs_install(self): |
726 |
- langpacks = self._get_installable_language_packs() |
727 |
- if not langpacks: |
728 |
- # all fine already |
729 |
- return |
730 |
- |
731 |
- question_text = _("The following language packs are available for " |
732 |
- "download (you need Internet), would you like to install them?") + \ |
733 |
- " [" + ', '.join(sorted(langpacks)) + "]" |
734 |
- buttons = [_("Yes"), _("No")] |
735 |
- answer = self._intf.messageWindow(_("Language packs download"), |
736 |
- question_text, custom_icon="question", type="custom", |
737 |
- custom_buttons = buttons) |
738 |
- if answer == 1: # No |
739 |
- return |
740 |
- |
741 |
- chroot = self._root |
742 |
- root = etpSys['rootdir'] |
743 |
- if chroot != root: |
744 |
- self._change_entropy_chroot(chroot) |
745 |
- |
746 |
- try: |
747 |
- |
748 |
- # update repos |
749 |
- done = self.update_entropy_repositories() |
750 |
- if not done: |
751 |
- return |
752 |
- |
753 |
- lang_matches = [self._entropy.atom_match(x) for x in langpacks] |
754 |
- lang_matches = [x for x in lang_matches if x[0] != -1] |
755 |
- if not lang_matches: |
756 |
- msg = _("No language packs are available for download, sorry!") |
757 |
- self._intf.messageWindow(_("Language packs"), msg, |
758 |
- custom_icon="warning") |
759 |
- return |
760 |
+ #def language_packs_install(self): |
761 |
+ # langpacks = self._get_installable_language_packs() |
762 |
+ # if not langpacks: |
763 |
+ # # all fine already |
764 |
+ # return |
765 |
+ |
766 |
+ # question_text = _("The following language packs are available for " |
767 |
+ # "download (you need Internet), would you like to install them?") + \ |
768 |
+ # " [" + ', '.join(sorted(langpacks)) + "]" |
769 |
+ # buttons = [_("Yes"), _("No")] |
770 |
+ # answer = self._intf.messageWindow(_("Language packs download"), |
771 |
+ # question_text, custom_icon="question", type="custom", |
772 |
+ # custom_buttons = buttons) |
773 |
+ # if answer == 1: # No |
774 |
+ # return |
775 |
+ |
776 |
+ # chroot = self._root |
777 |
+ # root = etpSys['rootdir'] |
778 |
+ # if chroot != root: |
779 |
+ # self._change_entropy_chroot(chroot) |
780 |
+ |
781 |
+ # try: |
782 |
+ |
783 |
+ # # update repos |
784 |
+ # done = self.update_entropy_repositories() |
785 |
+ # if not done: |
786 |
+ # return |
787 |
+ |
788 |
+ # lang_matches = [self._entropy.atom_match(x) for x in langpacks] |
789 |
+ # lang_matches = [x for x in lang_matches if x[0] != -1] |
790 |
+ # if not lang_matches: |
791 |
+ # msg = _("No language packs are available for download, sorry!") |
792 |
+ # self._intf.messageWindow(_("Language packs"), msg, |
793 |
+ # custom_icon="warning") |
794 |
+ # return |
795 |
|
796 |
# calculate deps, use relaxed algo |
797 |
- install_queue, conflicts_queue, status = \ |
798 |
- self._entropy.get_install_queue(lang_matches, False, False, |
799 |
- relaxed = True) |
800 |
- if status != 0: |
801 |
- msg = _("No language packs are available for install, sorry!") |
802 |
- self._intf.messageWindow(_("Language packs"), msg, |
803 |
- custom_icon="warning") |
804 |
- return |
805 |
- |
806 |
- # fetch packages |
807 |
- for match in install_queue: |
808 |
- dbc = self._entropy.open_repository(match[1]) |
809 |
- langpack = dbc.retrieveAtom(match[0]) |
810 |
- self._progress.set_text("%s: %s" % ( |
811 |
- _("Downloading package"), langpack,)) |
812 |
- self.install_package(None, match = match, silent = True, |
813 |
- fetch = True) |
814 |
- |
815 |
- # install packages |
816 |
- for match in install_queue: |
817 |
- dbc = self._entropy.open_repository(match[1]) |
818 |
- langpack = dbc.retrieveAtom(match[0]) |
819 |
- self._progress.set_text("%s: %s" % ( |
820 |
- _("Installing package"), langpack,)) |
821 |
- self.install_package(None, match = match, silent = True) |
822 |
- |
823 |
- finally: |
824 |
- if chroot != root: |
825 |
- self._change_entropy_chroot(root) |
826 |
- |
827 |
- def setup_entropy_mirrors(self): |
828 |
- |
829 |
- if not hasattr(self._entropy, 'reorder_mirrors'): |
830 |
- # Entropy version does not support it |
831 |
- return |
832 |
- # disable by default, pkg.gentoo.org was always selected |
833 |
- # as first, causing massive bandwidth usage |
834 |
- if not os.getenv('GENTOO_ENABLE_MIRROR_SORTING'): |
835 |
- return |
836 |
- |
837 |
+ # install_queue, conflicts_queue, status = \ |
838 |
+ # self._entropy.get_install_queue(lang_matches, False, False, |
839 |
+ # relaxed = True) |
840 |
+ # if status != 0: |
841 |
+ # msg = _("No language packs are available for install, sorry!") |
842 |
+ # self._intf.messageWindow(_("Language packs"), msg, |
843 |
+ # custom_icon="warning") |
844 |
+ # return |
845 |
+ |
846 |
+ # # fetch packages |
847 |
+ # for match in install_queue: |
848 |
+ # dbc = self._entropy.open_repository(match[1]) |
849 |
+ # langpack = dbc.retrieveAtom(match[0]) |
850 |
+ # self._progress.set_text("%s: %s" % ( |
851 |
+ # _("Downloading package"), langpack,)) |
852 |
+ # self.install_package(None, match = match, silent = True, |
853 |
+ # fetch = True) |
854 |
+ |
855 |
+ # # install packages |
856 |
+ # for match in install_queue: |
857 |
+ # dbc = self._entropy.open_repository(match[1]) |
858 |
+ # langpack = dbc.retrieveAtom(match[0]) |
859 |
+ # self._progress.set_text("%s: %s" % ( |
860 |
+ # _("Installing package"), langpack,)) |
861 |
+ # self.install_package(None, match = match, silent = True) |
862 |
+ |
863 |
+ # finally: |
864 |
+ # if chroot != root: |
865 |
+ # self._change_entropy_chroot(root) |
866 |
+ |
867 |
+ # TODO: Obviously make it do the thing |
868 |
+ def setup_portage_mirrors(self): |
869 |
self._progress.set_label("%s: %s" % ( |
870 |
- _("Reordering Entropy mirrors"), _("can take some time..."),)) |
871 |
- |
872 |
- chroot = self._root |
873 |
- root = etpSys['rootdir'] |
874 |
- if chroot != root: |
875 |
- self._change_entropy_chroot(chroot) |
876 |
- try: |
877 |
- self._entropy.reorder_mirrors(REPO_NAME) |
878 |
- except Exception as err: |
879 |
- msg = "%s: %s" % (_("Error"), err) |
880 |
- self._intf.messageWindow(_("Reordering Entropy mirrors"), msg, |
881 |
- custom_icon="warning") |
882 |
- finally: |
883 |
- if chroot != root: |
884 |
- self._change_entropy_chroot(root) |
885 |
- |
886 |
- def update_entropy_repositories(self): |
887 |
- |
888 |
- chroot = self._root |
889 |
- root = etpSys['rootdir'] |
890 |
- if chroot != root: |
891 |
- self._change_entropy_chroot(chroot) |
892 |
- |
893 |
- silent = True |
894 |
- if os.getenv('GENTOO_DEBUG'): |
895 |
- silent = False |
896 |
- # XXX add stdout silence |
897 |
- oldstdout = sys.stdout |
898 |
- if silent: |
899 |
- sys.stdout = STDERR_LOG |
900 |
- etpUi['mute'] = True |
901 |
- |
902 |
- try: |
903 |
- # fetch_security = False => avoid spamming stdout |
904 |
- try: |
905 |
- repo_intf = self._entropy.Repositories(fetch_security = False, |
906 |
- entropy_updates_alert = False) |
907 |
- except AttributeError: |
908 |
- msg = "%s: %s" % (_('No repositories specified in'), |
909 |
- etpConst['repositoriesconf'],) |
910 |
- self._intf.messageWindow(_("Repositories update"), msg, |
911 |
- custom_icon="warning") |
912 |
- return False |
913 |
- except Exception as e: |
914 |
- msg = "%s: %s" % (_('Unhandled error'), e,) |
915 |
- self._intf.messageWindow(_("Repositories update"), msg, |
916 |
- custom_icon="warning") |
917 |
- return False |
918 |
- |
919 |
- try: |
920 |
- update_rc = repo_intf.sync() |
921 |
- except Exception as e: |
922 |
- msg = "%s: %s" % (_('Sync error'), e,) |
923 |
- self._intf.messageWindow(_("Repositories update"), msg, |
924 |
- custom_icon="warning") |
925 |
- return False |
926 |
- |
927 |
- if repo_intf.sync_errors or (update_rc != 0): |
928 |
- msg = _("Cannot download repositories right now, no big deal") |
929 |
- self._intf.messageWindow(_("Repositories update"), msg, |
930 |
- custom_icon="warning") |
931 |
- return False |
932 |
- return True |
933 |
- |
934 |
- finally: |
935 |
+ _("Setting up mirrors"), _("not yet..."),)) |
936 |
|
937 |
- if silent: |
938 |
- sys.stdout = oldstdout |
939 |
- etpUi['mute'] = False |
940 |
- self._entropy.close_repositories() |
941 |
- self._settings.clear() |
942 |
- if chroot != root: |
943 |
- self._change_entropy_chroot(root) |
944 |
- |
945 |
- def _get_langpacks(self): |
946 |
- return [x.strip() for x in LANGUAGE_PACKS.split("\n") if \ |
947 |
- (not x.strip().startswith("#")) and x.strip()] |
948 |
+ def update_portage_repositories(self): |
949 |
+ self._portage.sync() |
950 |
+ |
951 |
+ |
952 |
+ #def _get_langpacks(self): |
953 |
+ # return [x.strip() for x in LANGUAGE_PACKS.split("\n") if \ |
954 |
+ # (not x.strip().startswith("#")) and x.strip()] |
955 |
|
956 |
def __get_langs(self): |
957 |
def_lang = self._anaconda.instLanguage.instLang |
958 |
@@ -1164,153 +1065,153 @@ class GentooInstall: |
959 |
langs = [def_lang, def_lang_2] |
960 |
return set(langs) |
961 |
|
962 |
- def _get_removable_localized_packages(self): |
963 |
- langpacks = self._get_langpacks() |
964 |
- # get cur lang |
965 |
- langs = self.__get_langs() |
966 |
- |
967 |
- new_langpacks = set() |
968 |
- for langpack in langpacks: |
969 |
- found = False |
970 |
- for lang in langs: |
971 |
- if langpack.endswith("-%s" % (lang,)): |
972 |
- found = True |
973 |
- break |
974 |
- if not found: |
975 |
- new_langpacks.add(langpack) |
976 |
- langpacks = new_langpacks |
977 |
- |
978 |
- client_repo = self._entropy.installed_repository() |
979 |
- for langpack in langpacks: |
980 |
- matches, m_rc = client_repo.atomMatch(langpack, multiMatch = True) |
981 |
- if m_rc != 0: |
982 |
- continue |
983 |
- for pkg_id in matches: |
984 |
- valid = self._entropy.validate_package_removal(pkg_id) |
985 |
- if not valid: |
986 |
- continue |
987 |
- yield pkg_id |
988 |
- |
989 |
- def _get_installable_language_packs(self): |
990 |
- """ |
991 |
- Return a list of packages not available on the CD/DVD that |
992 |
- could be downloaded and installed. |
993 |
- """ |
994 |
- langpacks = self._get_langpacks() |
995 |
+ #def _get_removable_localized_packages(self): |
996 |
+ # langpacks = self._get_langpacks() |
997 |
# get cur lang |
998 |
- langs = self.__get_langs() |
999 |
- |
1000 |
- new_langpacks = set() |
1001 |
- for langpack in langpacks: |
1002 |
- found = False |
1003 |
- for lang in langs: |
1004 |
- if langpack.endswith("-%s" % (lang,)): |
1005 |
- found = True |
1006 |
- break |
1007 |
- if found: |
1008 |
- new_langpacks.add(langpack) |
1009 |
- langpacks = new_langpacks |
1010 |
+ # langs = self.__get_langs() |
1011 |
+ |
1012 |
+ # new_langpacks = set() |
1013 |
+ # for langpack in langpacks: |
1014 |
+ # found = False |
1015 |
+ # for lang in langs: |
1016 |
+ # if langpack.endswith("-%s" % (lang,)): |
1017 |
+ # found = True |
1018 |
+ # break |
1019 |
+ # if not found: |
1020 |
+ # new_langpacks.add(langpack) |
1021 |
+ # langpacks = new_langpacks |
1022 |
+ |
1023 |
+ # client_repo = self._entropy.installed_repository() |
1024 |
+ # for langpack in langpacks: |
1025 |
+ # matches, m_rc = client_repo.atomMatch(langpack, multiMatch = True) |
1026 |
+ # if m_rc != 0: |
1027 |
+ # continue |
1028 |
+ # for pkg_id in matches: |
1029 |
+ # valid = self._entropy.validate_package_removal(pkg_id) |
1030 |
+ # if not valid: |
1031 |
+ # continue |
1032 |
+ # yield pkg_id |
1033 |
+ |
1034 |
+ #def _get_installable_language_packs(self): |
1035 |
+ # """ |
1036 |
+ # Return a list of packages not available on the CD/DVD that |
1037 |
+ # could be downloaded and installed. |
1038 |
+ # """ |
1039 |
+ # langpacks = self._get_langpacks() |
1040 |
+ # # get cur lang |
1041 |
+ # langs = self.__get_langs() |
1042 |
+ |
1043 |
+ # new_langpacks = set() |
1044 |
+ # for langpack in langpacks: |
1045 |
+ # found = False |
1046 |
+ # for lang in langs: |
1047 |
+ # if langpack.endswith("-%s" % (lang,)): |
1048 |
+ # found = True |
1049 |
+ # break |
1050 |
+ # if found: |
1051 |
+ # new_langpacks.add(langpack) |
1052 |
+ # langpacks = new_langpacks |
1053 |
|
1054 |
# filter out unwanted packages |
1055 |
# see gentoo.const |
1056 |
|
1057 |
- client_repo = self._entropy.installed_repository() |
1058 |
+ # client_repo = self._entropy.installed_repository() |
1059 |
|
1060 |
# KDE |
1061 |
- matches, m_rc = client_repo.atomMatch("kde-base/kdebase-startkde") |
1062 |
- if m_rc != 0: |
1063 |
+ # matches, m_rc = client_repo.atomMatch("kde-base/kdebase-startkde") |
1064 |
+ # if m_rc != 0: |
1065 |
# remove kde* packages |
1066 |
- langpacks = [x for x in langpacks if x.find("kde") == -1] |
1067 |
+ # langpacks = [x for x in langpacks if x.find("kde") == -1] |
1068 |
|
1069 |
# Openoffice |
1070 |
- matches, m_rc = client_repo.atomMatch("openoffice") |
1071 |
- if m_rc != 0: |
1072 |
+ # matches, m_rc = client_repo.atomMatch("openoffice") |
1073 |
+ # if m_rc != 0: |
1074 |
# remove openoffice* packages |
1075 |
- langpacks = [x for x in langpacks if x.find("openoffice") == -1] |
1076 |
+ # langpacks = [x for x in langpacks if x.find("openoffice") == -1] |
1077 |
|
1078 |
# aspell |
1079 |
- matches, m_rc = client_repo.atomMatch("aspell") |
1080 |
- if m_rc != 0: |
1081 |
+ # matches, m_rc = client_repo.atomMatch("aspell") |
1082 |
+ # if m_rc != 0: |
1083 |
# remove aspell* packages |
1084 |
- langpacks = [x for x in langpacks if x.find("aspell") == -1] |
1085 |
+ # langpacks = [x for x in langpacks if x.find("aspell") == -1] |
1086 |
|
1087 |
# man-pages |
1088 |
- matches, m_rc = client_repo.atomMatch("man-pages") |
1089 |
- if m_rc != 0: |
1090 |
+ # matches, m_rc = client_repo.atomMatch("man-pages") |
1091 |
+ # if m_rc != 0: |
1092 |
# remove man-pages* packages |
1093 |
- langpacks = [x for x in langpacks if x.find("man-pages") == -1] |
1094 |
+ # langpacks = [x for x in langpacks if x.find("man-pages") == -1] |
1095 |
|
1096 |
- packs = [] |
1097 |
- for langpack in langpacks: |
1098 |
- matches, m_rc = client_repo.atomMatch(langpack) |
1099 |
- if m_rc != 0: |
1100 |
- packs.append(langpack) |
1101 |
- return packs |
1102 |
+ # packs = [] |
1103 |
+ # for langpack in langpacks: |
1104 |
+ # matches, m_rc = client_repo.atomMatch(langpack) |
1105 |
+ # if m_rc != 0: |
1106 |
+ # packs.append(langpack) |
1107 |
+ # return packs |
1108 |
|
1109 |
- def _setup_packages_to_remove(self): |
1110 |
+ #def _setup_packages_to_remove(self): |
1111 |
|
1112 |
# remove anaconda if installed |
1113 |
- client_repo = self._entropy.installed_repository() |
1114 |
- pkgs_rm = ["app-admin/anaconda", "app-misc/anaconda-runtime", |
1115 |
- "app-misc/anaconda-runtime-gui", "libselinux", "sys-process/audit"] |
1116 |
- for pkg_name in pkgs_rm: |
1117 |
- pkg_id, pkg_rc = client_repo.atomMatch(pkg_name) |
1118 |
- if pkg_id != -1: |
1119 |
- self._package_identifiers_to_remove.add(pkg_id) |
1120 |
- |
1121 |
- localized_pkgs = self._get_removable_localized_packages() |
1122 |
- if localized_pkgs: |
1123 |
- question_text = _("This medium contains many extra languages, " |
1124 |
- "would you like to keep them installed?") |
1125 |
- buttons = [_("Yes"), _("No")] |
1126 |
- answer = self._intf.messageWindow(_("Language packs installation"), |
1127 |
- question_text, custom_icon="question", type="custom", |
1128 |
- custom_buttons = buttons) |
1129 |
- if answer == 1: |
1130 |
- self._package_identifiers_to_remove.update(localized_pkgs) |
1131 |
- |
1132 |
- if self._package_identifiers_to_remove: |
1133 |
- |
1134 |
- current_counter = 0 |
1135 |
- total_counter = len(self._package_identifiers_to_remove) |
1136 |
- self._progress.set_fraction(current_counter) |
1137 |
- self._progress.set_text(_("Generating list of files to copy")) |
1138 |
- |
1139 |
- for pkg in self._package_identifiers_to_remove: |
1140 |
- current_counter += 1 |
1141 |
- self._progress.set_fraction( |
1142 |
- float(current_counter)/total_counter) |
1143 |
- # get its files |
1144 |
- mycontent = self._live_repo.retrieveContent(pkg, |
1145 |
- extended = True) |
1146 |
- mydirs = [x[0] for x in mycontent if x[1] == "dir"] |
1147 |
- for x in mydirs: |
1148 |
- if x.find("/usr/lib64") != -1: |
1149 |
- x = x.replace("/usr/lib64","/usr/lib") |
1150 |
- elif x.find("/lib64") != -1: |
1151 |
- x = x.replace("/lib64","/lib") |
1152 |
- self._add_file_to_ignore(x, "dir") |
1153 |
- mycontent = [x[0] for x in mycontent if x[1] == "obj"] |
1154 |
- for x in mycontent: |
1155 |
- if x.find("/usr/lib64") != -1: |
1156 |
- x = x.replace("/usr/lib64","/usr/lib") |
1157 |
- elif x.find("/lib64") != -1: |
1158 |
- x = x.replace("/lib64","/lib") |
1159 |
- self._add_file_to_ignore(x, "obj") |
1160 |
- del mycontent |
1161 |
- |
1162 |
- self._progress.set_fraction(1) |
1163 |
- |
1164 |
- if hasattr(self._files_db, "commit"): |
1165 |
- self._files_db.commit() |
1166 |
- else: |
1167 |
- self._files_db.commitChanges() |
1168 |
- if hasattr(self._files_db, "setIndexing"): |
1169 |
- self._files_db.setIndexing(True) |
1170 |
- else: |
1171 |
- self._files_db.indexing = True |
1172 |
- self._files_db.createAllIndexes() |
1173 |
- |
1174 |
- def _add_file_to_ignore(self, f_path, ctype): |
1175 |
- self._files_db._cursor().execute( |
1176 |
- 'INSERT into content VALUES (?,?,?)' , ( None, f_path, ctype, )) |
1177 |
+ # client_repo = self._entropy.installed_repository() |
1178 |
+ # pkgs_rm = ["app-admin/anaconda", "app-misc/anaconda-runtime", |
1179 |
+ # "app-misc/anaconda-runtime-gui", "libselinux", "sys-process/audit"] |
1180 |
+ # for pkg_name in pkgs_rm: |
1181 |
+ # pkg_id, pkg_rc = client_repo.atomMatch(pkg_name) |
1182 |
+ # if pkg_id != -1: |
1183 |
+ # self._package_identifiers_to_remove.add(pkg_id) |
1184 |
+ |
1185 |
+ # localized_pkgs = self._get_removable_localized_packages() |
1186 |
+ # if localized_pkgs: |
1187 |
+ # question_text = _("This medium contains many extra languages, " |
1188 |
+ # "would you like to keep them installed?") |
1189 |
+ # buttons = [_("Yes"), _("No")] |
1190 |
+ # answer = self._intf.messageWindow(_("Language packs installation"), |
1191 |
+ # question_text, custom_icon="question", type="custom", |
1192 |
+ # custom_buttons = buttons) |
1193 |
+ # if answer == 1: |
1194 |
+ # self._package_identifiers_to_remove.update(localized_pkgs) |
1195 |
+ |
1196 |
+ # if self._package_identifiers_to_remove: |
1197 |
+ |
1198 |
+ # current_counter = 0 |
1199 |
+ # total_counter = len(self._package_identifiers_to_remove) |
1200 |
+ # self._progress.set_fraction(current_counter) |
1201 |
+ # self._progress.set_text(_("Generating list of files to copy")) |
1202 |
+ |
1203 |
+ # for pkg in self._package_identifiers_to_remove: |
1204 |
+ # current_counter += 1 |
1205 |
+ # self._progress.set_fraction( |
1206 |
+ # float(current_counter)/total_counter) |
1207 |
+ # # get its files |
1208 |
+ # mycontent = self._live_repo.retrieveContent(pkg, |
1209 |
+ # extended = True) |
1210 |
+ # mydirs = [x[0] for x in mycontent if x[1] == "dir"] |
1211 |
+ # for x in mydirs: |
1212 |
+ # if x.find("/usr/lib64") != -1: |
1213 |
+ # x = x.replace("/usr/lib64","/usr/lib") |
1214 |
+ # elif x.find("/lib64") != -1: |
1215 |
+ # x = x.replace("/lib64","/lib") |
1216 |
+ # self._add_file_to_ignore(x, "dir") |
1217 |
+ # mycontent = [x[0] for x in mycontent if x[1] == "obj"] |
1218 |
+ # for x in mycontent: |
1219 |
+ # if x.find("/usr/lib64") != -1: |
1220 |
+ # x = x.replace("/usr/lib64","/usr/lib") |
1221 |
+ # elif x.find("/lib64") != -1: |
1222 |
+ # x = x.replace("/lib64","/lib") |
1223 |
+ # self._add_file_to_ignore(x, "obj") |
1224 |
+ # del mycontent |
1225 |
+ |
1226 |
+ # self._progress.set_fraction(1) |
1227 |
+ |
1228 |
+ # if hasattr(self._files_db, "commit"): |
1229 |
+ # self._files_db.commit() |
1230 |
+ # else: |
1231 |
+ # self._files_db.commitChanges() |
1232 |
+ # if hasattr(self._files_db, "setIndexing"): |
1233 |
+ # self._files_db.setIndexing(True) |
1234 |
+ # else: |
1235 |
+ # self._files_db.indexing = True |
1236 |
+ # self._files_db.createAllIndexes() |
1237 |
+ |
1238 |
+ #def _add_file_to_ignore(self, f_path, ctype): |
1239 |
+ # self._files_db._cursor().execute( |
1240 |
+ # 'INSERT into content VALUES (?,?,?)' , ( None, f_path, ctype, )) |