From: "Wiktor W Brodlo" <wiktor@brodlo.net>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/anaconda:master commit in: gentoo/
Date: Sun, 26 Jun 2011 21:03:52 +0000 (UTC) [thread overview]
Message-ID: <43b2ebc433a997d0cb2d4ae8001f773f3186df5f.wiktor@gentoo> (raw)
commit: 43b2ebc433a997d0cb2d4ae8001f773f3186df5f
Author: wiktor w brodlo <wiktor <AT> brodlo <DOT> net>
AuthorDate: Sun Jun 26 21:02:45 2011 +0000
Commit: Wiktor W Brodlo <wiktor <AT> brodlo <DOT> net>
CommitDate: Sun Jun 26 21:02:45 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/anaconda.git;a=commit;h=43b2ebc4
Removed unneded functions and changed Entropy to Portage
---
gentoo/utils.py | 1069 +++++++++++++++++++++++++------------------------------
1 files changed, 485 insertions(+), 584 deletions(-)
diff --git a/gentoo/utils.py b/gentoo/utils.py
index d5f5ab3..2cc58ba 100644
--- a/gentoo/utils.py
+++ b/gentoo/utils.py
@@ -3,6 +3,8 @@
# gentoo/utils.py
#
# Copyright (C) 2010 Fabio Erculiani
+# Copyright (C) 2011 wiktor w brodlo
+# Copyright (C) 2011 Gentoo Foundation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,19 +34,10 @@ import statvfs
import tempfile
import time
-# Entropy imports
-from entropy.exceptions import EntropyPackageException
-from entropy.const import etpUi, etpConst, etpSys
-import entropy.tools
-import entropy.dep
-from entropy.core.settings.base import SystemSettings
-from entropy.core import Singleton
-from entropy.services.client import WebService
-
# Anaconda imports
import logging
from constants import productPath
-from gentoo import Entropy
+from gentoo import Portage
from gentoo.const import LIVE_USER, LANGUAGE_PACKS, REPO_NAME
import gettext
@@ -125,50 +118,51 @@ class GentooProgress(Singleton):
self._process_events()
else:
self._prog.set_fraction(pct)
-
- def _spawn_adimage(self):
-
- if not self.__adbox_running:
- return
-
- cur_t = time.time()
- if cur_t <= (self.__image_t + 10):
- return
- self.__image_t = cur_t
-
- pixmaps = getattr(self._prog, 'pixmaps', [])
- pix_len = len(pixmaps)
- if pix_len == 0:
- log.warning("Shutting down _spawn_adimage, no images")
- self.__adbox_running = False
- return
-
- if not self._prog.adpix:
- log.warning("Shutting down _spawn_adimage, no adpix")
- self.__adbox_running = False
- return
-
- try:
- pix_path = pixmaps[self._pix_count]
- except IndexError:
- self._pix_count = 0
- pix_path = pixmaps[0]
-
- self._pix_count += 1
-
- import gui
- pix = gui.readImageFromFile(pix_path)
- if pix:
- self._prog.adbox.remove(self._prog.adpix)
- self._prog.adpix.destroy()
- pix.set_alignment(0.5, 0.5)
- self._prog.adbox.add(pix)
- self._prog.adpix = pix
- else:
- log.warning("Shutting down _spawn_adimage, no pixmap: %s" % (
- pix_path,))
-
- self._prog.adbox.show_all()
+
+ # TODO: Check if we need this
+ #def _spawn_adimage(self):
+
+ # if not self.__adbox_running:
+ # return
+
+ # cur_t = time.time()
+ # if cur_t <= (self.__image_t + 10):
+ # return
+ # self.__image_t = cur_t
+
+ # pixmaps = getattr(self._prog, 'pixmaps', [])
+ # pix_len = len(pixmaps)
+ # if pix_len == 0:
+ # log.warning("Shutting down _spawn_adimage, no images")
+ # self.__adbox_running = False
+ # return
+
+ # if not self._prog.adpix:
+ # log.warning("Shutting down _spawn_adimage, no adpix")
+ # self.__adbox_running = False
+ # return
+
+ # try:
+ # pix_path = pixmaps[self._pix_count]
+ # except IndexError:
+ # self._pix_count = 0
+ # pix_path = pixmaps[0]
+
+ # self._pix_count += 1
+
+ # import gui
+ # pix = gui.readImageFromFile(pix_path)
+ # if pix:
+ # self._prog.adbox.remove(self._prog.adpix)
+ # self._prog.adpix.destroy()
+ # pix.set_alignment(0.5, 0.5)
+ # self._prog.adbox.add(pix)
+ # self._prog.adpix = pix
+ # else:
+ # log.warning("Shutting down _spawn_adimage, no pixmap: %s" % (
+ # pix_path,))
+
+ # self._prog.adbox.show_all()
class GentooInstall:
@@ -180,39 +174,40 @@ class GentooInstall:
self._prod_root = productPath
self._intf = anaconda.intf
self._progress = GentooProgress(anaconda)
- self._entropy = Entropy()
+ self._portage = Portage()
self._settings = SystemSettings()
with open("/proc/cmdline", "r") as cmd_f:
self.cmdline = cmd_f.readline().strip().split()
#sys.stderr = STDERR_LOG
- self._files_db_path = self._root+"/files.db"
- try:
- self._files_db = self._entropy.open_generic_repository(
- self._files_db_path, dbname = "filesdb",
- indexing_override = True)
- except TypeError:
- # new API
- self._files_db = self._entropy.open_generic_repository(
- self._files_db_path, name = "filesdb",
- indexing_override = True)
- if hasattr(self._files_db, "initializeDatabase"):
- self._files_db.initializeDatabase()
- else:
- self._files_db.initializeRepository()
- self._live_repo = self._open_live_installed_repository()
- self._package_identifiers_to_remove = set()
+ # TODO: Remove or change this
+ #self._files_db_path = self._root+"/files.db"
+ #try:
+ # self._files_db = self._entropy.open_generic_repository(
+ # self._files_db_path, dbname = "filesdb",
+ # indexing_override = True)
+ #except TypeError:
+ # # new API
+ # self._files_db = self._entropy.open_generic_repository(
+ # self._files_db_path, name = "filesdb",
+ # indexing_override = True)
+ #if hasattr(self._files_db, "initializeDatabase"):
+ # self._files_db.initializeDatabase()
+ #else:
+ # self._files_db.initializeRepository()
+ #self._live_repo = self._open_live_installed_repository()
+ #self._package_identifiers_to_remove = set()
def destroy(self):
# remove files db if exists
- if hasattr(self._files_db, "close"):
- self._files_db.close()
- else:
- self._files_db.closeDB()
- try:
- os.remove(self._files_db_path)
- except OSError:
- pass
+ #if hasattr(self._files_db, "close"):
+ # self._files_db.close()
+ #else:
+ # self._files_db.closeDB()
+ #try:
+ # os.remove(self._files_db_path)
+ #except OSError:
+ # pass
self._progress.stop()
@@ -246,165 +241,167 @@ class GentooInstall:
myargs = ' '.join(args)
return subprocess.call(myargs, shell = True)
- def _open_live_installed_repository(self):
- dbpath = self._prod_root + etpConst['etpdatabaseclientfilepath']
- try:
- dbconn = self._entropy.open_generic_repository(
- dbpath, xcache = False, read_only = True,
- dbname = "live_client", indexing_override = False)
- except TypeError:
- # new API
- dbconn = self._entropy.open_generic_repository(
- dbpath, xcache = False, read_only = True,
- name = "live_client", indexing_override = False)
- return dbconn
-
- def _change_entropy_chroot(self, chroot = None):
- if not chroot:
- self._entropy._installed_repo_enable = True
- self._entropy.noclientdb = False
- else:
- self._entropy._installed_repo_enable = False
- self._entropy.noclientdb = True
- if chroot is None:
- chroot = ""
- self._entropy.switch_chroot(chroot)
- sys_settings_plg_id = etpConst['system_settings_plugins_ids']['client_plugin']
- del self._settings[sys_settings_plg_id]['misc']['configprotectskip'][:]
+ #def _open_live_installed_repository(self):
+ # dbpath = self._prod_root + etpConst['etpdatabaseclientfilepath']
+ # try:
+ # dbconn = self._entropy.open_generic_repository(
+ # dbpath, xcache = False, read_only = True,
+ # dbname = "live_client", indexing_override = False)
+ # except TypeError:
+ # # new API
+ # dbconn = self._entropy.open_generic_repository(
+ # dbpath, xcache = False, read_only = True,
+ # name = "live_client", indexing_override = False)
+ # return dbconn
+
+ #def _change_entropy_chroot(self, chroot = None):
+ # if not chroot:
+ # self._entropy._installed_repo_enable = True
+ # self._entropy.noclientdb = False
+ # else:
+ # self._entropy._installed_repo_enable = False
+ # self._entropy.noclientdb = True
+ # if chroot is None:
+ # chroot = ""
+ # self._entropy.switch_chroot(chroot)
+ # sys_settings_plg_id = etpConst['system_settings_plugins_ids']['client_plugin']
+ # del self._settings[sys_settings_plg_id]['misc']['configprotectskip'][:]
def install_package(self, atom, match = None, silent = False, fetch = False):
- if silent and os.getenv('GENTOO_DEBUG'):
- silent = False
-
- chroot = self._root
- root = etpSys['rootdir']
- if chroot != root:
- self._change_entropy_chroot(chroot)
-
- if match is None:
- match = self._entropy.atom_match(atom)
-
- oldstdout = sys.stdout
- if silent:
- sys.stdout = STDERR_LOG
- etpUi['mute'] = True
-
- try:
- rc = 0
- if match[0] != -1:
- Package = self._entropy.Package()
- action = "install"
- if fetch:
- action = "fetch"
- Package.prepare(match, action)
- rc = Package.run()
- Package.kill()
- finally:
- if silent:
- sys.stdout = oldstdout
- etpUi['mute'] = False
- if chroot != root:
- self._change_entropy_chroot(root)
-
- return rc
-
+ #if silent and os.getenv('GENTOO_DEBUG'):
+ # silent = False
+
+ #chroot = self._root
+ #root = etpSys['rootdir']
+ # Doesn't matter, Portage chroots in the terminal if needed
+ #if chroot != root:
+ # self._change_entropy_chroot(chroot)
+
+ #if match is None:
+ # match = self._entropy.atom_match(atom)
+ #oldstdout = sys.stdout
+
+ #if silent:
+ # sys.stdout = STDERR_LOG
+ # etpUi['mute'] = True
+
+ #try:
+ # rc = 0
+ # if match[0] != -1:
+ # Package = self._entropy.Package()
+ # action = "install"
+ # if fetch:
+ # action = "fetch"
+ # Package.prepare(match, action)
+ # rc = Package.run()
+ # Package.kill()
+ #finally:
+ # if silent:
+ # sys.stdout = oldstdout
+ # etpUi['mute'] = False
+ # if chroot != root:
+ # self._change_entropy_chroot(root)
+
+ return self._portage.install(atom)
+
+ # TODO: We don't remove anything from stage3
def remove_package(self, atom, match = None, silent = False):
- if silent and os.getenv('GENTOO_DEBUG'):
- silent = False
-
- chroot = self._root
- root = etpSys['rootdir']
- if chroot != root:
- self._change_entropy_chroot(chroot)
-
- if match is None:
- match = self._entropy.installed_repository().atomMatch(atom)
-
- oldstdout = sys.stdout
- if silent:
- sys.stdout = STDERR_LOG
- etpUi['mute'] = True
-
- try:
- rc = 0
- if match[0] != -1:
- Package = self._entropy.Package()
- Package.prepare((match[0],), "remove")
- if 'remove_installed_vanished' not in Package.pkgmeta:
- rc = Package.run()
- Package.kill()
- finally:
- if silent:
- sys.stdout = oldstdout
- etpUi['mute'] = False
-
- if chroot != root:
- self._change_entropy_chroot(root)
-
- return rc
-
- def install_package_file(self, package_file):
- chroot = self._root
- root = etpSys['rootdir']
- if chroot != root:
- self._change_entropy_chroot(chroot)
-
- try:
- atomsfound = self._entropy.add_package_repository(
- package_file)
- except EntropyPackageException:
- return -1
- repo = 0
- for match in atomsfound:
- repo = match[1]
- Package = self._entropy.Package()
- Package.prepare(match, "install")
- rc2 = Package.run()
- if rc2 != 0:
- if chroot != root:
- self._change_entropy_chroot(root)
- return rc2
- Package.kill()
-
- if chroot != root:
- self._change_entropy_chroot(root)
-
- if repo != 0:
- self._entropy.remove_repository(repo)
-
- return 0
-
- def _configure_skel(self):
+ # if silent and os.getenv('GENTOO_DEBUG'):
+ # silent = False
+
+ # chroot = self._root
+ # root = etpSys['rootdir']
+ # if chroot != root:
+ # self._change_entropy_chroot(chroot)
+
+ # if match is None:
+ # match = self._entropy.installed_repository().atomMatch(atom)
+
+ # oldstdout = sys.stdout
+ # if silent:
+ # sys.stdout = STDERR_LOG
+ # etpUi['mute'] = True
+
+ # try:
+ # rc = 0
+ # if match[0] != -1:
+ # Package = self._entropy.Package()
+ # Package.prepare((match[0],), "remove")
+ # if 'remove_installed_vanished' not in Package.pkgmeta:
+ # rc = Package.run()
+ # Package.kill()
+ # finally:
+ # if silent:
+ # sys.stdout = oldstdout
+ # etpUi['mute'] = False
+
+ # if chroot != root:
+ # self._change_entropy_chroot(root)
+
+ return self._portage.remove(atom)
+
+ #def install_package_file(self, package_file):
+ # chroot = self._root
+ # root = etpSys['rootdir']
+ # if chroot != root:
+ # self._change_entropy_chroot(chroot)
+
+ # try:
+ # atomsfound = self._entropy.add_package_repository(
+ # package_file)
+ # except EntropyPackageException:
+ # return -1
+ # repo = 0
+ # for match in atomsfound:
+ # repo = match[1]
+ # Package = self._entropy.Package()
+ # Package.prepare(match, "install")
+ # rc2 = Package.run()
+ # if rc2 != 0:
+ # if chroot != root:
+ # self._change_entropy_chroot(root)
+ # return rc2
+ # Package.kill()
+
+ # if chroot != root:
+ # self._change_entropy_chroot(root)
+
+ # if repo != 0:
+ # self._entropy.remove_repository(repo)
+
+ # return 0
+
+ #def _configure_skel(self):
# copy Sulfur on the desktop
- sulfur_desktop = self._root+"/usr/share/applications/sulfur.desktop"
- if os.path.isfile(sulfur_desktop):
- sulfur_user_desktop = self._root+"/etc/skel/Desktop/sulfur.desktop"
- shutil.copy2(sulfur_desktop, sulfur_user_desktop)
- try:
- os.chmod(sulfur_user_desktop, 0775)
- except OSError:
- pass
-
- gparted_desktop = self._root+"/etc/skel/Desktop/gparted.desktop"
- if os.path.isfile(gparted_desktop):
- os.remove(gparted_desktop)
-
- installer_desk = self._root+"/etc/skel/Desktop/liveinst.desktop"
- if os.path.isfile(installer_desk):
- os.remove(installer_desk)
-
- # install welcome loader
- orig_welcome_desk = self._root+"/etc/gentoo/gentoo-welcome-loader.desktop"
- if os.path.isfile(orig_welcome_desk):
- autostart_dir = self._root+"/etc/skel/.config/autostart"
- if not os.path.isdir(autostart_dir):
- os.makedirs(autostart_dir)
- desk_name = os.path.basename(orig_welcome_desk)
- desk_path = os.path.join(autostart_dir, desk_name)
- shutil.copy2(orig_welcome_desk, desk_path)
+ # sulfur_desktop = self._root+"/usr/share/applications/sulfur.desktop"
+ # if os.path.isfile(sulfur_desktop):
+ # sulfur_user_desktop = self._root+"/etc/skel/Desktop/sulfur.desktop"
+ # shutil.copy2(sulfur_desktop, sulfur_user_desktop)
+ # try:
+ # os.chmod(sulfur_user_desktop, 0775)
+ # except OSError:
+ # pass
+
+ # gparted_desktop = self._root+"/etc/skel/Desktop/gparted.desktop"
+ # if os.path.isfile(gparted_desktop):
+ # os.remove(gparted_desktop)
+
+ # installer_desk = self._root+"/etc/skel/Desktop/liveinst.desktop"
+ # if os.path.isfile(installer_desk):
+ # os.remove(installer_desk)
+
+ # # install welcome loader
+ # orig_welcome_desk = self._root+"/etc/gentoo/gentoo-welcome-loader.desktop"
+ # if os.path.isfile(orig_welcome_desk):
+ # autostart_dir = self._root+"/etc/skel/.config/autostart"
+ # if not os.path.isdir(autostart_dir):
+ # os.makedirs(autostart_dir)
+ # desk_name = os.path.basename(orig_welcome_desk)
+ # desk_path = os.path.join(autostart_dir, desk_name)
+ # shutil.copy2(orig_welcome_desk, desk_path)
def _is_virtualbox(self):
if not os.path.isfile("/etc/init.d/virtualbox-guest-additions"):
@@ -424,20 +421,8 @@ class GentooInstall:
action = _("Configuring System Services")
self._progress.set_text(action)
- is_gentoo_mce = "1"
- if not Entropy.is_gentoo_mce():
- is_gentoo_mce = "0"
-
- # Remove Installer services
+ # Installer services
config_script = """
- rc-update del installer-gui boot default
- rm -f /etc/init.d/installer-gui
- rc-update del installer-text boot default
- rm -f /etc/init.d/installer-text
- rc-update del music boot default
- rm -f /etc/init.d/music
- rc-update del gentoolive boot default
- rm -f /etc/init.d/gentoolive
rc-update add vixie-cron default
if [ ! -e "/etc/init.d/net.eth0" ]; then
cd /etc/init.d && ln -s net.lo net.eth0
@@ -454,10 +439,6 @@ class GentooInstall:
if [ -e "/etc/init.d/oemsystem-default" ]; then
rc-update add oemsystem-default default
fi
- if [ "0" = """+is_gentoo_mce+""" ]; then
- rc-update del gentoo-mce boot
- rc-update del gentoo-mce default
- fi
"""
self.spawn_chroot(config_script, silent = True)
@@ -479,6 +460,7 @@ class GentooInstall:
"cp -p /etc/modules.d/blacklist %s/etc/modules.d/blacklist" % (
self._root,))
+ # TODO: Check this after we have X working
def remove_proprietary_drivers(self):
"""
Detect a possible OSS video card and remove /etc/env.d/*ati
@@ -734,9 +716,9 @@ class GentooInstall:
# mask all the nvidia-drivers, this avoids having people
# updating their drivers resulting in a non working system
mask_file = os.path.join(self._root+'/',
- "etc/entropy/packages/package.mask")
+ "etc/portage/packages/package.mask")
unmask_file = os.path.join(self._root+'/',
- "etc/entropy/packages/package.unmask")
+ "etc/portage/packages/package.unmask")
if os.access(mask_file, os.W_OK) and os.path.isfile(mask_file):
f = open(mask_file,"aw")
f.write("\n# added by Gentoo Installer\nx11-drivers/nvidia-drivers\n")
@@ -782,22 +764,16 @@ class GentooInstall:
def emit_install_done(self):
# user installed Gentoo, w00hooh!
- try:
- webserv = self._get_entropy_webservice()
- except WebService.UnsupportedService:
- return
- try:
- webserv.add_downloads(["installer"])
- except Exception as err:
- log.error("Unable to emit_install_done(): %s" % err)
+ pass
def live_install(self):
"""
- This function copy the LiveCD/DVD content into self._root
+ This function copies the stage3 into self._root
"""
- if not os.getenv("GENTOO_DISABLE_PKG_REMOVAL"):
- self._setup_packages_to_remove()
+ # We don't remove stuff from the stage3
+ #if not os.getenv("GENTOO_DISABLE_PKG_REMOVAL"):
+ # self._setup_packages_to_remove()
action = _("System Installation")
copy_update_interval = 300
@@ -921,42 +897,42 @@ class GentooInstall:
self._change_entropy_chroot(self._root)
# doing here, because client_repo should point to self._root chroot
client_repo = self._entropy.installed_repository()
- # Removing Unwanted Packages
- if self._package_identifiers_to_remove:
+ # NOT Removing Unwanted Packages
+ #if self._package_identifiers_to_remove:
# this makes packages removal much faster
- client_repo.createAllIndexes()
+ # client_repo.createAllIndexes()
- total_counter = len(self._package_identifiers_to_remove)
- current_counter = 0
- self._progress.set_fraction(current_counter)
- self._progress.set_text(_("Cleaning packages"))
- self._entropy.oldcount = [0,total_counter]
+ # total_counter = len(self._package_identifiers_to_remove)
+ # current_counter = 0
+ # self._progress.set_fraction(current_counter)
+ # self._progress.set_text(_("Cleaning packages"))
+ # self._entropy.oldcount = [0,total_counter]
- for pkg_id in self._package_identifiers_to_remove:
- current_counter += 1
- atom = client_repo.retrieveAtom(pkg_id)
- if not atom:
- continue
+ # for pkg_id in self._package_identifiers_to_remove:
+ # current_counter += 1
+ # atom = client_repo.retrieveAtom(pkg_id)
+ # if not atom:
+ # continue
### XXX needed to speed up removal process
#"""
- category = client_repo.retrieveCategory(pkg_id)
- version = client_repo.retrieveVersion(pkg_id)
- name = client_repo.retrieveName(pkg_id)
- ebuild_path = self._root+"/var/db/pkg/%s/%s-%s" % (
- category, name, version)
- if os.path.isdir(ebuild_path):
- shutil.rmtree(ebuild_path, True)
+ # category = client_repo.retrieveCategory(pkg_id)
+ # version = client_repo.retrieveVersion(pkg_id)
+ # name = client_repo.retrieveName(pkg_id)
+ # ebuild_path = self._root+"/var/db/pkg/%s/%s-%s" % (
+ # category, name, version)
+ # if os.path.isdir(ebuild_path):
+ # shutil.rmtree(ebuild_path, True)
#"""
### XXX
- self.remove_package(None, match = (pkg_id,0), silent = True)
- frac = float(current_counter)/total_counter
- self._progress.set_fraction(frac)
- self._progress.set_text("%s: %s" % (
- _("Cleaning package"), atom,))
- self._entropy.oldcount = [current_counter, total_counter]
+ # self.remove_package(None, match = (pkg_id,0), silent = True)
+ # frac = float(current_counter)/total_counter
+ # self._progress.set_fraction(frac)
+ # self._progress.set_text("%s: %s" % (
+ # _("Cleaning package"), atom,))
+ # self._entropy.oldcount = [current_counter, total_counter]
while 1:
change = False
@@ -978,184 +954,109 @@ class GentooInstall:
if not change:
break
+ # We don't do that on Gentoo
# list installed packages and setup a package set
- inst_packages = ['%s:%s\n' % (entropy.dep.dep_getkey(atom),slot,) \
- for idpk, atom, slot, revision in client_repo.listAllPackages(
- get_scope = True, order_by = "atom")]
+ #inst_packages = ['%s:%s\n' % (entropy.dep.dep_getkey(atom),slot,) \
+ # for idpk, atom, slot, revision in client_repo.listAllPackages(
+ # get_scope = True, order_by = "atom")]
# perfectly fine w/o self._root
- pkgset_dir = etpConst['confsetsdir']
- if not os.path.isdir(pkgset_dir):
- os.makedirs(pkgset_dir, 0755)
- set_name = "install_base"
- set_filepath = os.path.join(pkgset_dir, set_name)
- try:
- f = open(set_filepath,"w")
- f.writelines(inst_packages)
- f.flush()
- f.close()
- except (IOError,):
- pass
-
- self._change_entropy_chroot()
+ #pkgset_dir = etpConst['confsetsdir']
+ #if not os.path.isdir(pkgset_dir):
+ # os.makedirs(pkgset_dir, 0755)
+ #set_name = "install_base"
+ #set_filepath = os.path.join(pkgset_dir, set_name)
+ #try:
+ # f = open(set_filepath,"w")
+ # f.writelines(inst_packages)
+ # f.flush()
+ # f.close()
+ #except (IOError,):
+ # pass
+
+ #self._change_entropy_chroot()
self._progress.set_fraction(1)
self._progress.set_text(_("Installation complete"))
- def language_packs_install(self):
- langpacks = self._get_installable_language_packs()
- if not langpacks:
- # all fine already
- return
-
- question_text = _("The following language packs are available for "
- "download (you need Internet), would you like to install them?") + \
- " [" + ', '.join(sorted(langpacks)) + "]"
- buttons = [_("Yes"), _("No")]
- answer = self._intf.messageWindow(_("Language packs download"),
- question_text, custom_icon="question", type="custom",
- custom_buttons = buttons)
- if answer == 1: # No
- return
-
- chroot = self._root
- root = etpSys['rootdir']
- if chroot != root:
- self._change_entropy_chroot(chroot)
-
- try:
-
- # update repos
- done = self.update_entropy_repositories()
- if not done:
- return
-
- lang_matches = [self._entropy.atom_match(x) for x in langpacks]
- lang_matches = [x for x in lang_matches if x[0] != -1]
- if not lang_matches:
- msg = _("No language packs are available for download, sorry!")
- self._intf.messageWindow(_("Language packs"), msg,
- custom_icon="warning")
- return
+ #def language_packs_install(self):
+ # langpacks = self._get_installable_language_packs()
+ # if not langpacks:
+ # # all fine already
+ # return
+
+ # question_text = _("The following language packs are available for "
+ # "download (you need Internet), would you like to install them?") + \
+ # " [" + ', '.join(sorted(langpacks)) + "]"
+ # buttons = [_("Yes"), _("No")]
+ # answer = self._intf.messageWindow(_("Language packs download"),
+ # question_text, custom_icon="question", type="custom",
+ # custom_buttons = buttons)
+ # if answer == 1: # No
+ # return
+
+ # chroot = self._root
+ # root = etpSys['rootdir']
+ # if chroot != root:
+ # self._change_entropy_chroot(chroot)
+
+ # try:
+
+ # # update repos
+ # done = self.update_entropy_repositories()
+ # if not done:
+ # return
+
+ # lang_matches = [self._entropy.atom_match(x) for x in langpacks]
+ # lang_matches = [x for x in lang_matches if x[0] != -1]
+ # if not lang_matches:
+ # msg = _("No language packs are available for download, sorry!")
+ # self._intf.messageWindow(_("Language packs"), msg,
+ # custom_icon="warning")
+ # return
# calculate deps, use relaxed algo
- install_queue, conflicts_queue, status = \
- self._entropy.get_install_queue(lang_matches, False, False,
- relaxed = True)
- if status != 0:
- msg = _("No language packs are available for install, sorry!")
- self._intf.messageWindow(_("Language packs"), msg,
- custom_icon="warning")
- return
-
- # fetch packages
- for match in install_queue:
- dbc = self._entropy.open_repository(match[1])
- langpack = dbc.retrieveAtom(match[0])
- self._progress.set_text("%s: %s" % (
- _("Downloading package"), langpack,))
- self.install_package(None, match = match, silent = True,
- fetch = True)
-
- # install packages
- for match in install_queue:
- dbc = self._entropy.open_repository(match[1])
- langpack = dbc.retrieveAtom(match[0])
- self._progress.set_text("%s: %s" % (
- _("Installing package"), langpack,))
- self.install_package(None, match = match, silent = True)
-
- finally:
- if chroot != root:
- self._change_entropy_chroot(root)
-
- def setup_entropy_mirrors(self):
-
- if not hasattr(self._entropy, 'reorder_mirrors'):
- # Entropy version does not support it
- return
- # disable by default, pkg.gentoo.org was always selected
- # as first, causing massive bandwidth usage
- if not os.getenv('GENTOO_ENABLE_MIRROR_SORTING'):
- return
-
+ # install_queue, conflicts_queue, status = \
+ # self._entropy.get_install_queue(lang_matches, False, False,
+ # relaxed = True)
+ # if status != 0:
+ # msg = _("No language packs are available for install, sorry!")
+ # self._intf.messageWindow(_("Language packs"), msg,
+ # custom_icon="warning")
+ # return
+
+ # # fetch packages
+ # for match in install_queue:
+ # dbc = self._entropy.open_repository(match[1])
+ # langpack = dbc.retrieveAtom(match[0])
+ # self._progress.set_text("%s: %s" % (
+ # _("Downloading package"), langpack,))
+ # self.install_package(None, match = match, silent = True,
+ # fetch = True)
+
+ # # install packages
+ # for match in install_queue:
+ # dbc = self._entropy.open_repository(match[1])
+ # langpack = dbc.retrieveAtom(match[0])
+ # self._progress.set_text("%s: %s" % (
+ # _("Installing package"), langpack,))
+ # self.install_package(None, match = match, silent = True)
+
+ # finally:
+ # if chroot != root:
+ # self._change_entropy_chroot(root)
+
+ # TODO: Obviously make it do the thing
+ def setup_portage_mirrors(self):
self._progress.set_label("%s: %s" % (
- _("Reordering Entropy mirrors"), _("can take some time..."),))
-
- chroot = self._root
- root = etpSys['rootdir']
- if chroot != root:
- self._change_entropy_chroot(chroot)
- try:
- self._entropy.reorder_mirrors(REPO_NAME)
- except Exception as err:
- msg = "%s: %s" % (_("Error"), err)
- self._intf.messageWindow(_("Reordering Entropy mirrors"), msg,
- custom_icon="warning")
- finally:
- if chroot != root:
- self._change_entropy_chroot(root)
-
- def update_entropy_repositories(self):
-
- chroot = self._root
- root = etpSys['rootdir']
- if chroot != root:
- self._change_entropy_chroot(chroot)
-
- silent = True
- if os.getenv('GENTOO_DEBUG'):
- silent = False
- # XXX add stdout silence
- oldstdout = sys.stdout
- if silent:
- sys.stdout = STDERR_LOG
- etpUi['mute'] = True
-
- try:
- # fetch_security = False => avoid spamming stdout
- try:
- repo_intf = self._entropy.Repositories(fetch_security = False,
- entropy_updates_alert = False)
- except AttributeError:
- msg = "%s: %s" % (_('No repositories specified in'),
- etpConst['repositoriesconf'],)
- self._intf.messageWindow(_("Repositories update"), msg,
- custom_icon="warning")
- return False
- except Exception as e:
- msg = "%s: %s" % (_('Unhandled error'), e,)
- self._intf.messageWindow(_("Repositories update"), msg,
- custom_icon="warning")
- return False
-
- try:
- update_rc = repo_intf.sync()
- except Exception as e:
- msg = "%s: %s" % (_('Sync error'), e,)
- self._intf.messageWindow(_("Repositories update"), msg,
- custom_icon="warning")
- return False
-
- if repo_intf.sync_errors or (update_rc != 0):
- msg = _("Cannot download repositories right now, no big deal")
- self._intf.messageWindow(_("Repositories update"), msg,
- custom_icon="warning")
- return False
- return True
-
- finally:
+ _("Setting up mirrors"), _("not yet..."),))
- if silent:
- sys.stdout = oldstdout
- etpUi['mute'] = False
- self._entropy.close_repositories()
- self._settings.clear()
- if chroot != root:
- self._change_entropy_chroot(root)
-
- def _get_langpacks(self):
- return [x.strip() for x in LANGUAGE_PACKS.split("\n") if \
- (not x.strip().startswith("#")) and x.strip()]
+ def update_portage_repositories(self):
+ self._portage.sync()
+
+
+ #def _get_langpacks(self):
+ # return [x.strip() for x in LANGUAGE_PACKS.split("\n") if \
+ # (not x.strip().startswith("#")) and x.strip()]
def __get_langs(self):
def_lang = self._anaconda.instLanguage.instLang
@@ -1164,153 +1065,153 @@ class GentooInstall:
langs = [def_lang, def_lang_2]
return set(langs)
- def _get_removable_localized_packages(self):
- langpacks = self._get_langpacks()
- # get cur lang
- langs = self.__get_langs()
-
- new_langpacks = set()
- for langpack in langpacks:
- found = False
- for lang in langs:
- if langpack.endswith("-%s" % (lang,)):
- found = True
- break
- if not found:
- new_langpacks.add(langpack)
- langpacks = new_langpacks
-
- client_repo = self._entropy.installed_repository()
- for langpack in langpacks:
- matches, m_rc = client_repo.atomMatch(langpack, multiMatch = True)
- if m_rc != 0:
- continue
- for pkg_id in matches:
- valid = self._entropy.validate_package_removal(pkg_id)
- if not valid:
- continue
- yield pkg_id
-
- def _get_installable_language_packs(self):
- """
- Return a list of packages not available on the CD/DVD that
- could be downloaded and installed.
- """
- langpacks = self._get_langpacks()
+ #def _get_removable_localized_packages(self):
+ # langpacks = self._get_langpacks()
# get cur lang
- langs = self.__get_langs()
-
- new_langpacks = set()
- for langpack in langpacks:
- found = False
- for lang in langs:
- if langpack.endswith("-%s" % (lang,)):
- found = True
- break
- if found:
- new_langpacks.add(langpack)
- langpacks = new_langpacks
+ # langs = self.__get_langs()
+
+ # new_langpacks = set()
+ # for langpack in langpacks:
+ # found = False
+ # for lang in langs:
+ # if langpack.endswith("-%s" % (lang,)):
+ # found = True
+ # break
+ # if not found:
+ # new_langpacks.add(langpack)
+ # langpacks = new_langpacks
+
+ # client_repo = self._entropy.installed_repository()
+ # for langpack in langpacks:
+ # matches, m_rc = client_repo.atomMatch(langpack, multiMatch = True)
+ # if m_rc != 0:
+ # continue
+ # for pkg_id in matches:
+ # valid = self._entropy.validate_package_removal(pkg_id)
+ # if not valid:
+ # continue
+ # yield pkg_id
+
+ #def _get_installable_language_packs(self):
+ # """
+ # Return a list of packages not available on the CD/DVD that
+ # could be downloaded and installed.
+ # """
+ # langpacks = self._get_langpacks()
+ # # get cur lang
+ # langs = self.__get_langs()
+
+ # new_langpacks = set()
+ # for langpack in langpacks:
+ # found = False
+ # for lang in langs:
+ # if langpack.endswith("-%s" % (lang,)):
+ # found = True
+ # break
+ # if found:
+ # new_langpacks.add(langpack)
+ # langpacks = new_langpacks
# filter out unwanted packages
# see gentoo.const
- client_repo = self._entropy.installed_repository()
+ # client_repo = self._entropy.installed_repository()
# KDE
- matches, m_rc = client_repo.atomMatch("kde-base/kdebase-startkde")
- if m_rc != 0:
+ # matches, m_rc = client_repo.atomMatch("kde-base/kdebase-startkde")
+ # if m_rc != 0:
# remove kde* packages
- langpacks = [x for x in langpacks if x.find("kde") == -1]
+ # langpacks = [x for x in langpacks if x.find("kde") == -1]
# Openoffice
- matches, m_rc = client_repo.atomMatch("openoffice")
- if m_rc != 0:
+ # matches, m_rc = client_repo.atomMatch("openoffice")
+ # if m_rc != 0:
# remove openoffice* packages
- langpacks = [x for x in langpacks if x.find("openoffice") == -1]
+ # langpacks = [x for x in langpacks if x.find("openoffice") == -1]
# aspell
- matches, m_rc = client_repo.atomMatch("aspell")
- if m_rc != 0:
+ # matches, m_rc = client_repo.atomMatch("aspell")
+ # if m_rc != 0:
# remove aspell* packages
- langpacks = [x for x in langpacks if x.find("aspell") == -1]
+ # langpacks = [x for x in langpacks if x.find("aspell") == -1]
# man-pages
- matches, m_rc = client_repo.atomMatch("man-pages")
- if m_rc != 0:
+ # matches, m_rc = client_repo.atomMatch("man-pages")
+ # if m_rc != 0:
# remove man-pages* packages
- langpacks = [x for x in langpacks if x.find("man-pages") == -1]
+ # langpacks = [x for x in langpacks if x.find("man-pages") == -1]
- packs = []
- for langpack in langpacks:
- matches, m_rc = client_repo.atomMatch(langpack)
- if m_rc != 0:
- packs.append(langpack)
- return packs
+ # packs = []
+ # for langpack in langpacks:
+ # matches, m_rc = client_repo.atomMatch(langpack)
+ # if m_rc != 0:
+ # packs.append(langpack)
+ # return packs
- def _setup_packages_to_remove(self):
+ #def _setup_packages_to_remove(self):
# remove anaconda if installed
- client_repo = self._entropy.installed_repository()
- pkgs_rm = ["app-admin/anaconda", "app-misc/anaconda-runtime",
- "app-misc/anaconda-runtime-gui", "libselinux", "sys-process/audit"]
- for pkg_name in pkgs_rm:
- pkg_id, pkg_rc = client_repo.atomMatch(pkg_name)
- if pkg_id != -1:
- self._package_identifiers_to_remove.add(pkg_id)
-
- localized_pkgs = self._get_removable_localized_packages()
- if localized_pkgs:
- question_text = _("This medium contains many extra languages, "
- "would you like to keep them installed?")
- buttons = [_("Yes"), _("No")]
- answer = self._intf.messageWindow(_("Language packs installation"),
- question_text, custom_icon="question", type="custom",
- custom_buttons = buttons)
- if answer == 1:
- self._package_identifiers_to_remove.update(localized_pkgs)
-
- if self._package_identifiers_to_remove:
-
- current_counter = 0
- total_counter = len(self._package_identifiers_to_remove)
- self._progress.set_fraction(current_counter)
- self._progress.set_text(_("Generating list of files to copy"))
-
- for pkg in self._package_identifiers_to_remove:
- current_counter += 1
- self._progress.set_fraction(
- float(current_counter)/total_counter)
- # get its files
- mycontent = self._live_repo.retrieveContent(pkg,
- extended = True)
- mydirs = [x[0] for x in mycontent if x[1] == "dir"]
- for x in mydirs:
- if x.find("/usr/lib64") != -1:
- x = x.replace("/usr/lib64","/usr/lib")
- elif x.find("/lib64") != -1:
- x = x.replace("/lib64","/lib")
- self._add_file_to_ignore(x, "dir")
- mycontent = [x[0] for x in mycontent if x[1] == "obj"]
- for x in mycontent:
- if x.find("/usr/lib64") != -1:
- x = x.replace("/usr/lib64","/usr/lib")
- elif x.find("/lib64") != -1:
- x = x.replace("/lib64","/lib")
- self._add_file_to_ignore(x, "obj")
- del mycontent
-
- self._progress.set_fraction(1)
-
- if hasattr(self._files_db, "commit"):
- self._files_db.commit()
- else:
- self._files_db.commitChanges()
- if hasattr(self._files_db, "setIndexing"):
- self._files_db.setIndexing(True)
- else:
- self._files_db.indexing = True
- self._files_db.createAllIndexes()
-
- def _add_file_to_ignore(self, f_path, ctype):
- self._files_db._cursor().execute(
- 'INSERT into content VALUES (?,?,?)' , ( None, f_path, ctype, ))
+ # client_repo = self._entropy.installed_repository()
+ # pkgs_rm = ["app-admin/anaconda", "app-misc/anaconda-runtime",
+ # "app-misc/anaconda-runtime-gui", "libselinux", "sys-process/audit"]
+ # for pkg_name in pkgs_rm:
+ # pkg_id, pkg_rc = client_repo.atomMatch(pkg_name)
+ # if pkg_id != -1:
+ # self._package_identifiers_to_remove.add(pkg_id)
+
+ # localized_pkgs = self._get_removable_localized_packages()
+ # if localized_pkgs:
+ # question_text = _("This medium contains many extra languages, "
+ # "would you like to keep them installed?")
+ # buttons = [_("Yes"), _("No")]
+ # answer = self._intf.messageWindow(_("Language packs installation"),
+ # question_text, custom_icon="question", type="custom",
+ # custom_buttons = buttons)
+ # if answer == 1:
+ # self._package_identifiers_to_remove.update(localized_pkgs)
+
+ # if self._package_identifiers_to_remove:
+
+ # current_counter = 0
+ # total_counter = len(self._package_identifiers_to_remove)
+ # self._progress.set_fraction(current_counter)
+ # self._progress.set_text(_("Generating list of files to copy"))
+
+ # for pkg in self._package_identifiers_to_remove:
+ # current_counter += 1
+ # self._progress.set_fraction(
+ # float(current_counter)/total_counter)
+ # # get its files
+ # mycontent = self._live_repo.retrieveContent(pkg,
+ # extended = True)
+ # mydirs = [x[0] for x in mycontent if x[1] == "dir"]
+ # for x in mydirs:
+ # if x.find("/usr/lib64") != -1:
+ # x = x.replace("/usr/lib64","/usr/lib")
+ # elif x.find("/lib64") != -1:
+ # x = x.replace("/lib64","/lib")
+ # self._add_file_to_ignore(x, "dir")
+ # mycontent = [x[0] for x in mycontent if x[1] == "obj"]
+ # for x in mycontent:
+ # if x.find("/usr/lib64") != -1:
+ # x = x.replace("/usr/lib64","/usr/lib")
+ # elif x.find("/lib64") != -1:
+ # x = x.replace("/lib64","/lib")
+ # self._add_file_to_ignore(x, "obj")
+ # del mycontent
+
+ # self._progress.set_fraction(1)
+
+ # if hasattr(self._files_db, "commit"):
+ # self._files_db.commit()
+ # else:
+ # self._files_db.commitChanges()
+ # if hasattr(self._files_db, "setIndexing"):
+ # self._files_db.setIndexing(True)
+ # else:
+ # self._files_db.indexing = True
+ # self._files_db.createAllIndexes()
+
+ #def _add_file_to_ignore(self, f_path, ctype):
+ # self._files_db._cursor().execute(
+ # 'INSERT into content VALUES (?,?,?)' , ( None, f_path, ctype, ))
next reply other threads:[~2011-06-26 21:04 UTC|newest]
Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-26 21:03 Wiktor W Brodlo [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-08-22 4:28 [gentoo-commits] proj/anaconda:master commit in: gentoo/ Wiktor W Brodlo
2011-08-22 4:28 Wiktor W Brodlo
2011-08-21 1:30 Wiktor W Brodlo
2011-08-21 1:20 Wiktor W Brodlo
2011-08-21 1:13 Wiktor W Brodlo
2011-08-21 0:34 Wiktor W Brodlo
2011-08-21 0:03 Wiktor W Brodlo
2011-08-21 0:03 Wiktor W Brodlo
2011-08-21 0:03 Wiktor W Brodlo
2011-08-17 0:25 Wiktor W Brodlo
2011-08-11 12:58 Wiktor W Brodlo
2011-07-21 22:18 Wiktor W Brodlo
2011-07-21 22:02 Wiktor W Brodlo
2011-07-21 21:14 Wiktor W Brodlo
2011-07-21 20:53 Wiktor W Brodlo
2011-07-12 3:31 Wiktor W Brodlo
2011-07-12 1:09 Wiktor W Brodlo
2011-07-11 17:53 Wiktor W Brodlo
2011-07-11 17:53 Wiktor W Brodlo
2011-07-11 17:53 Wiktor W Brodlo
2011-07-10 15:36 Wiktor W Brodlo
2011-07-10 12:13 Wiktor W Brodlo
2011-07-10 3:18 Wiktor W Brodlo
2011-07-08 22:07 Wiktor W Brodlo
2011-07-08 17:54 Wiktor W Brodlo
2011-07-08 17:19 Wiktor W Brodlo
2011-07-08 15:56 Wiktor W Brodlo
2011-07-08 15:27 Wiktor W Brodlo
2011-07-08 14:48 Wiktor W Brodlo
2011-07-08 3:28 Wiktor W Brodlo
2011-07-08 2:35 Wiktor W Brodlo
2011-07-08 1:42 Wiktor W Brodlo
2011-07-08 0:49 Wiktor W Brodlo
2011-07-07 23:57 Wiktor W Brodlo
2011-07-07 15:40 Wiktor W Brodlo
2011-07-07 14:08 Wiktor W Brodlo
2011-07-07 2:31 Wiktor W Brodlo
2011-07-06 20:46 Wiktor W Brodlo
2011-07-06 18:20 Wiktor W Brodlo
2011-07-06 16:42 Wiktor W Brodlo
2011-07-06 14:31 Wiktor W Brodlo
2011-07-06 11:51 Wiktor W Brodlo
2011-07-06 11:19 Wiktor W Brodlo
2011-07-05 20:45 Wiktor W Brodlo
2011-07-05 18:48 Wiktor W Brodlo
2011-07-05 16:09 Wiktor W Brodlo
2011-07-05 15:38 Wiktor W Brodlo
2011-07-05 14:31 Wiktor W Brodlo
2011-07-05 14:07 Wiktor W Brodlo
2011-07-05 13:55 Wiktor W Brodlo
2011-07-05 13:29 Wiktor W Brodlo
2011-07-05 13:22 Wiktor W Brodlo
2011-07-05 13:20 Wiktor W Brodlo
2011-07-05 12:53 Wiktor W Brodlo
2011-07-04 22:47 Wiktor W Brodlo
2011-07-04 22:34 Wiktor W Brodlo
2011-07-04 22:24 Wiktor W Brodlo
2011-07-04 21:19 Wiktor W Brodlo
2011-07-04 21:02 Wiktor W Brodlo
2011-07-04 20:56 Wiktor W Brodlo
2011-07-04 20:52 Wiktor W Brodlo
2011-07-04 16:59 Wiktor W Brodlo
2011-06-27 19:20 Wiktor W Brodlo
2011-06-27 18:27 Wiktor W Brodlo
2011-06-27 13:49 Wiktor W Brodlo
2011-06-27 0:20 Wiktor W Brodlo
2011-06-27 0:05 Wiktor W Brodlo
2011-06-27 0:03 Wiktor W Brodlo
2011-06-26 23:40 Wiktor W Brodlo
2011-06-26 23:28 Wiktor W Brodlo
2011-06-26 21:08 Wiktor W Brodlo
2011-06-26 21:03 Wiktor W Brodlo
2011-06-26 19:05 Wiktor W Brodlo
2011-06-25 1:42 Wiktor W Brodlo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43b2ebc433a997d0cb2d4ae8001f773f3186df5f.wiktor@gentoo \
--to=wiktor@brodlo.net \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox