summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dispatch.py1
-rwxr-xr-xgui.py1
-rw-r--r--installclass.py1
-rw-r--r--iw/simple_pkgselect.py74
-rw-r--r--text.py1
-rw-r--r--textw/simple_pkgselect_text.py67
-rw-r--r--yuminstall.py31
7 files changed, 174 insertions, 2 deletions
diff --git a/dispatch.py b/dispatch.py
index 3d9112fd2..f64e89c30 100644
--- a/dispatch.py
+++ b/dispatch.py
@@ -128,6 +128,7 @@ installSteps = [
# FIXME: package selection should be done before we create filesystems
("preselection", doPreSelection, ("backend","intf", "id", "instPath")),
+ ("group-selection", ("backend", "intf")),
("postselection", doPostSelection, ("backend", "intf", "id", "instPath")),
("preinstallconfig", doPreInstall, ("backend", "intf", "id", "instPath", "dir")),
diff --git a/gui.py b/gui.py
index e5e6fedba..66271bb36 100755
--- a/gui.py
+++ b/gui.py
@@ -68,6 +68,7 @@ stepToClass = {
"accounts" : ("account_gui", "AccountWindow"),
"desktopchoice": ("desktop_choice_gui", "DesktopChoiceWindow"),
"package-selection" : ("package_gui", "PackageSelectionWindow"),
+ "group-selection": ("simple_pkgselect", "GroupSelectionWindow"),
"indivpackage" : ("package_gui", "IndividualPackageSelectionWindow"),
"dependencies" : ("dependencies_gui", "UnresolvedDependenciesWindow"),
"confirminstall" : ("confirm_gui", "InstallConfirmWindow"),
diff --git a/installclass.py b/installclass.py
index 1e1070132..0480f779d 100644
--- a/installclass.py
+++ b/installclass.py
@@ -140,6 +140,7 @@ class BaseInstallClass:
"selectlangpackages",
"preselection",
"package-selection",
+ "group-selection",
"postselection",
"handleX11pkgs",
"handlemiscpkgs",
diff --git a/iw/simple_pkgselect.py b/iw/simple_pkgselect.py
new file mode 100644
index 000000000..bf3500a0e
--- /dev/null
+++ b/iw/simple_pkgselect.py
@@ -0,0 +1,74 @@
+#
+# simple_pkgselect - Simple package selection UI
+#
+# Jeremy Katz <katzj@redhat.com>
+# Copyright 2005 Red Hat, Inc.
+#
+# Only shows groups and allows selecting them. None of the real
+# "interesting" pieces of package selection are present
+# Mostly here as a placeholder until we write the real code
+#
+# This software may be freely redistributed under the terms of the GNU
+# general public license.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+
+
+import gtk
+import gobject
+import gui
+import copy
+from iw_gui import *
+from rhpl.translate import _, N_
+
+import checklist
+
+
+class GroupSelectionWindow (InstallWindow):
+ def getNext(self):
+ for row in self.cl.store:
+ (on, grp) = (row[0], row[1])
+ if on and grp not in self.instgrps:
+ self.backend.selectGroup(grp)
+ elif not on and grp in self.instgrps:
+ self.backend.deselectGroup(grp)
+
+ def getScreen(self, backend, intf):
+ self.backend = backend
+ self.intf = intf
+ self.instgrps = copy.copy(backend.anaconda_grouplist)
+
+ box = gtk.VBox(False)
+ box.set_border_width(6)
+
+ txt = gui.WrappingLabel("Please select the package groups you "
+ "would like to have installed.\n\n"
+ "Note that this is a temporary interface "
+ "as we work on hooking things up, so please "
+ "don't file bugs related directly to it.")
+ box.pack_start(txt, False)
+
+
+ sw = gtk.ScrolledWindow()
+ sw.set_border_width(6)
+ sw.set_policy (gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
+ sw.set_shadow_type(gtk.SHADOW_IN)
+ box.pack_start(sw)
+
+ self.cl = checklist.CheckList(columns = 1)
+
+ # FIXME: this is very yum backend specific...
+ groups = backend.ayum.groupInfo.visible_groups
+ groups.sort()
+
+ for g in groups:
+ self.cl.append_row([g], g in backend.anaconda_grouplist)
+
+ sw.add(self.cl)
+
+ return box
+
+
diff --git a/text.py b/text.py
index 6a685ae6f..bbf613bee 100644
--- a/text.py
+++ b/text.py
@@ -65,6 +65,7 @@ stepToClasses = {
"accounts" : ("userauth_text", "RootPasswordWindow"),
"desktopchoice": ("desktop_choice_text", "DesktopChoiceWindow"),
"package-selection" : ("packages_text", "PackageGroupWindow"),
+ "group-selection": ("simple_pkgselect_text", "GroupSelectionWindow"),
"indivpackage" : ("packages_text", ("IndividualPackageWindow")),
"dependencies" : ("packages_text", "PackageDepWindow"),
"confirminstall" : ("confirm_text", "BeginInstallWindow"),
diff --git a/textw/simple_pkgselect_text.py b/textw/simple_pkgselect_text.py
new file mode 100644
index 000000000..f6c54b342
--- /dev/null
+++ b/textw/simple_pkgselect_text.py
@@ -0,0 +1,67 @@
+#
+# simple_pkgselect - Simple package selection UI
+#
+# Jeremy Katz <katzj@redhat.com>
+# Copyright 2005 Red Hat, Inc.
+#
+# Only shows groups and allows selecting them. None of the real
+# "interesting" pieces of package selection are present
+# Mostly here as a placeholder until we write the real code
+#
+# This software may be freely redistributed under the terms of the GNU
+# general public license.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+
+from snack import *
+from constants_text import *
+from rhpl.translate import _, N_
+
+import copy
+
+class GroupSelectionWindow:
+ def __call__(self, screen, backend, intf):
+ self.instgrps = copy.copy(backend.anaconda_grouplist)
+
+ g = GridFormHelp(screen, "Package Group Selection",
+ "packagetree", 1, 5)
+
+ t = TextboxReflowed(50, "Please select the package groups you "
+ "would like to have installed.\n\n"
+ "Note that this is a temporary interface "
+ "as we work on hooking things up, so please "
+ "don't file bugs related directly to it.")
+ g.add(t, 0, 0, (0, 0, 0, 1), anchorLeft = 1)
+
+ # FIXME: this is very yum backend specific...
+ groups = backend.ayum.groupInfo.visible_groups
+ groups.sort()
+ ct = CheckboxTree(height = 6, scroll = (len(groups) > 6))
+ for grp in groups:
+ ct.append(grp, grp, grp in backend.anaconda_grouplist)
+ g.add(ct, 0, 2, (0, 0, 0, 1))
+
+ bb = ButtonBar (screen, (TEXT_OK_BUTTON, TEXT_BACK_BUTTON))
+ g.add(bb, 0, 3, growx = 1)
+
+ while 1:
+ result = g.run()
+ rc = bb.buttonPressed(result)
+
+ if rc == TEXT_BACK_CHECK:
+ screen.popWindow()
+ return INSTALL_BACK
+ break
+
+ screen.popWindow()
+ sel = ct.getSelection()
+ for g in groups:
+ if g in sel and g not in self.instgrps:
+ backend.selectGroup(g)
+ elif g not in sel and g in self.instgrps:
+ backend.deselectGroup(g)
+
+ return INSTALL_OK
diff --git a/yuminstall.py b/yuminstall.py
index 20e20d687..7619811db 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -23,6 +23,7 @@ import urlgrabber.grabber
import yum
import yum.repos
import yum.packages
+import yum.groups
import repomd.mdErrors
from backend import AnacondaBackend
from constants import *
@@ -240,6 +241,9 @@ class YumBackend(AnacondaBackend):
root=instPath)
self.ac.write()
+ # FIXME: this is a bad hack until we can get something better into yum
+ self.anaconda_grouplist = []
+
# FIXME: this step is actually probably not broken out properly
def doPreSelection(self, intf, id, instPath):
# should probably be done in __init__ instead...
@@ -249,8 +253,9 @@ class YumBackend(AnacondaBackend):
self.ayum.setup(fn="/tmp/yum.conf", root=instPath)
# then a base package selection step
- id.instClass.setPackageSelection(self)
- id.instClass.setGroupSelection(self)
+ if id: # hack for my test script :)
+ id.instClass.setPackageSelection(self)
+ id.instClass.setGroupSelection(self)
def doPostSelection(self, intf, id, instPath):
win = intf.waitWindow(_("Dependency Check"),
@@ -456,6 +461,28 @@ class YumBackend(AnacondaBackend):
continue
self.ayum.tsInfo.addInstall(p)
+ for grp in self.ayum.groupInfo.groupTree(group):
+ if grp not in self.anaconda_grouplist:
+ self.anaconda_grouplist.append(grp)
+
+ def deselectGroup(self, group, *args):
+ if not self.groupExists(group):
+ log.debug("no such group %s" %(group,))
+ return
+
+ pkgs = self.ayum.groupInfo.pkgTree(group)
+ for pkg in pkgs:
+ try:
+ p = self.ayum.pkgSack.returnNewestByName(pkg)
+ except repomd.mdErrors.PackageSackError:
+ log.debug("no such package %s in %s" %(pkg, group))
+ continue
+ self.ayum.tsInfo.remove(p.pkgtup)
+
+ for grp in self.ayum.groupInfo.groupTree(group):
+ if grp in self.anaconda_grouplist:
+ self.anaconda_grouplist.remove(grp)
+
def selectPackage(self, pkg, *args):
sp = pkg.rsplit(".", 2)
p = None