diff options
-rwxr-xr-x | anaconda | 1 | ||||
-rw-r--r-- | gentoo/livecd.py | 1 | ||||
-rw-r--r-- | gentoo/utils.py | 184 | ||||
-rw-r--r-- | iw/use_gui.py | 17 |
4 files changed, 52 insertions, 151 deletions
@@ -510,6 +510,7 @@ class Anaconda(object): self.upgrade = flags.cmdline.has_key("preupgrade") self.upgradeRoot = None self.upgradeSwapInfo = None + self.use_flags = [] self._users = None # *sigh* we still need to be able to write this out diff --git a/gentoo/livecd.py b/gentoo/livecd.py index 7a3acff..148967b 100644 --- a/gentoo/livecd.py +++ b/gentoo/livecd.py @@ -118,6 +118,7 @@ class LiveCDCopyBackend(backend.AnacondaBackend): # Now copy the portage tree self._gentoo_install.copy_portage() self._gentoo_install.set_profile() + self._gentoo_install.write_makeconf() self._gentoo_install.install_setup_tools() self._gentoo_install.setup_users() diff --git a/gentoo/utils.py b/gentoo/utils.py index b2b4403..2c8e171 100644 --- a/gentoo/utils.py +++ b/gentoo/utils.py @@ -1012,6 +1012,39 @@ class GentooInstall: self.spawn_chroot("eselect profile set "+self._anaconda.profile) self._progress.set_fraction(1.0) + def write_makeconf(self): + text = self.makeconf_factory(self._anaconda, os.environ["ANACONDA_PRODUCTARCH"]) + makeconf = open(self._root+"/etc/make.conf", "w") + makeconf.write(text) + + def makeconf_factory(self, settings, arch): + cflags = ("-march=%s -O%s", settings.makeconf_march, settings.makeconf_opt) + if settings.makeconf_pipe: + cflags += " -pipe" + cflags = ("CFLAGS=\"%s\"", cflags) + + cxxflags = "CXXFLAGS=\"${CFLAGS}\"" + + if arch == "amd64" + arch = "x86_64" + chost = ("CHOST=\"%s-pc-linux-gnu\"", arch) + + if settings.makeconf_jobs == 0: + makeopts = "-j" + else: + makeopts = ("-j%i", settings.makeconf_jobs) + if settings.makeconf_load > 0: + makeopts += (" -l%i", settings.makeconf_jobs) + if settings.makeconf_silent: + makeopts += " -s" + makeopts = ("MAKEOPTS=\"%s\"", makeopts) + + gentoo_mirrors = ("GENTOO_MIRRORS=\"%s\"", " ".join(settings.mirrors)) + sync = ("SYNC=\"%s\"", " ".join(settings.mirrors_sync)) + use = ("USE=\"%s\"", " ".join(settings.use_flags)) + + return "\n".join([cflags, cxxflags, chost, makeopts, gentoo_mirrors, sync, use]) + def _get_langpacks(self): return None @@ -1021,154 +1054,3 @@ class GentooInstall: def_lang_2 = def_lang.split("_")[0] 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() - # # 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() - - # KDE - # 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] - - # Openoffice - # 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] - - # aspell - # 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] - - # man-pages - # 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] - - # 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): - - # 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, )) diff --git a/iw/use_gui.py b/iw/use_gui.py index 8fcb199..b3bf64b 100644 --- a/iw/use_gui.py +++ b/iw/use_gui.py @@ -37,7 +37,22 @@ import gettext _ = lambda x: gettext.ldgettext("anaconda", x) class UseWindow(InstallWindow): + + buttons = [] + use_profile = [] + def getNext(self): + use = [] + for button in self.buttons: + if button.get_property("active"): + use.append(button.get_property("label")) + + for flag in use: + if flag not in use_profile: # flag enabled by user, disabled by profile + self.anaconda.use_flags.append(flag) + for flag in use_profile: + if flag not in use: # flag is disabled by user, enabled by profile + self.anaconda.use_flags.append("-"+flag) return None def getScreen(self, anaconda): @@ -85,6 +100,8 @@ class UseWindow(InstallWindow): table.attach(cb, 0, 1, rows, rows+1, gtk.FILL) table.attach(l, 1, 2, rows, rows+1) + + self.buttons.append(cb) self.use_profile = use_enabled |