[PATCH] Pass ints to Gtk resize functions (#1065021)
by Brian C. Lane
When we pass Size objects to Gtk it ends up trying to use their human
readable string instead of an integer. Convert them before we use them.
---
pyanaconda/ui/gui/spokes/lib/resize.py | 35 +++++++++++++++++++++-------------
1 file changed, 22 insertions(+), 13 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/lib/resize.py b/pyanaconda/ui/gui/spokes/lib/resize.py
index 64c11e7..4557523 100644
--- a/pyanaconda/ui/gui/spokes/lib/resize.py
+++ b/pyanaconda/ui/gui/spokes/lib/resize.py
@@ -21,7 +21,6 @@
from __future__ import division
from collections import namedtuple
-from math import ceil
from gi.repository import Gdk, Gtk
@@ -244,30 +243,40 @@ class ResizeDialog(GUIObject):
slider and keyboard support. Any devices that are not resizable
will not have a slider displayed, so they do not need to be worried
with here.
+
+ :param device: The device
+ :type device: PartitionDevice
+ :param value: default value to set
+ :type value: Size
"""
- self._resizeSlider.handler_block_by_func(self.on_resize_value_changed)
- self._resizeSlider.set_range(int(ceil(device.minSize)), int(device.size))
- self._resizeSlider.handler_unblock_by_func(self.on_resize_value_changed)
- self._resizeSlider.set_value(value)
+ # Convert the Sizes to ints
+ minSize = int(device.minSize)
+ size = int(device.size)
+ default_value = int(value)
# The slider needs to be keyboard-accessible. We'll make small movements change in
# 1% increments, and large movements in 5% increments.
- distance = device.size - device.minSize
- onePercent = Size(bytes=distance / 100)
- fivePercent = Size(bytes=distance / 20)
- twentyPercent = Size(bytes=distance / 5)
+ distance = size - minSize
+ onePercent = int(distance / 100)
+ fivePercent = int(distance / 20)
+ twentyPercent = int(distance / 5)
+
+ self._resizeSlider.handler_block_by_func(self.on_resize_value_changed)
+ self._resizeSlider.set_range(minSize, size)
+ self._resizeSlider.handler_unblock_by_func(self.on_resize_value_changed)
+ self._resizeSlider.set_value(default_value)
adjustment = self.builder.get_object("resizeAdjustment")
- adjustment.configure(value, int(ceil(device.minSize)), int(device.size), onePercent, fivePercent, 0)
+ adjustment.configure(default_value, minSize, size, onePercent, fivePercent, 0)
# And then the slider needs a couple tick marks for easier navigation.
self._resizeSlider.clear_marks()
for i in range(1, 5):
- self._resizeSlider.add_mark(int(ceil(device.minSize)) + i*twentyPercent, Gtk.PositionType.BOTTOM, None)
+ self._resizeSlider.add_mark(minSize + i * twentyPercent, Gtk.PositionType.BOTTOM, None)
# Finally, add tick marks for the ends.
- self._resizeSlider.add_mark(device.minSize, Gtk.PositionType.BOTTOM, str(device.minSize))
- self._resizeSlider.add_mark(device.size, Gtk.PositionType.BOTTOM, str(device.size))
+ self._resizeSlider.add_mark(minSize, Gtk.PositionType.BOTTOM, str(device.minSize))
+ self._resizeSlider.add_mark(size, Gtk.PositionType.BOTTOM, str(device.size))
def _update_action_buttons(self, row):
obj = PartStoreRow(*row)
--
1.8.5.3
10 years, 3 months
[PATCH rhel7/master] Remove app_paintable from a couple nav boxes (#1064708).
by Chris Lumens
This setting prevents artwork from showing up on a spoke, and it was set
only on these three for some reason.
---
pyanaconda/ui/gui/spokes/filter.glade | 1 -
pyanaconda/ui/gui/spokes/langsupport.glade | 1 -
pyanaconda/ui/gui/spokes/user.glade | 1 -
3 files changed, 3 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/filter.glade b/pyanaconda/ui/gui/spokes/filter.glade
index 1d643a7..b83802a 100644
--- a/pyanaconda/ui/gui/spokes/filter.glade
+++ b/pyanaconda/ui/gui/spokes/filter.glade
@@ -55,7 +55,6 @@
<property name="spacing">6</property>
<child internal-child="nav_box">
<object class="GtkEventBox" id="AnacondaSpokeWindow-nav_box1">
- <property name="app_paintable">True</property>
<property name="can_focus">False</property>
<child internal-child="nav_area">
<object class="GtkGrid" id="AnacondaSpokeWindow-nav_area1">
diff --git a/pyanaconda/ui/gui/spokes/langsupport.glade b/pyanaconda/ui/gui/spokes/langsupport.glade
index 7dd4f89..941f16c 100644
--- a/pyanaconda/ui/gui/spokes/langsupport.glade
+++ b/pyanaconda/ui/gui/spokes/langsupport.glade
@@ -28,7 +28,6 @@
<property name="spacing">6</property>
<child internal-child="nav_box">
<object class="GtkEventBox" id="AnacondaSpokeWindow-nav_box1">
- <property name="app_paintable">True</property>
<property name="can_focus">False</property>
<child internal-child="nav_area">
<object class="GtkGrid" id="AnacondaSpokeWindow-nav_area1">
diff --git a/pyanaconda/ui/gui/spokes/user.glade b/pyanaconda/ui/gui/spokes/user.glade
index 7e0f120..dfe8efa 100644
--- a/pyanaconda/ui/gui/spokes/user.glade
+++ b/pyanaconda/ui/gui/spokes/user.glade
@@ -17,7 +17,6 @@
<property name="spacing">6</property>
<child internal-child="nav_box">
<object class="GtkEventBox" id="AnacondaSpokeWindow-nav_box1">
- <property name="app_paintable">True</property>
<property name="can_focus">False</property>
<child internal-child="nav_area">
<object class="GtkGrid" id="AnacondaSpokeWindow-nav_area1">
--
1.8.3.1
10 years, 3 months
[blivet/anaconda][master/rhel7-branch] DASD storage code re-write (#1001070, #859997)
by Samantha N. Bueno
The commit msgs tell all, but essentially:
-- The blivet patches get rid of a lot of clunky code that was used to
handle DASDs, some of which depended upon old, pre-rewrite anaconda
itself. Now everything is nicely consolidated and sitting in
blivet.devicelibs, and it does not depend on anaconda.
-- The anaconda patches add logic such that upon entering the storage
spoke, if (a) you're on s390x and (b) you've got unformatted DASDs,
a dialog box pops up to warn the user and give them the option of
running dasdfmt against them (or opting not to and just going back to
the storage spoke).
I discussed this with dlehman, and there really is no way to avoid
touching these disks before 'Begin Installation' is clicked. Hence, a
dialog box. And hence, disks are touched early on. Alas, alack.
Screencasts are here, for graphical and text:
http://sbueno.fedorapeople.org/1001070-graphical.webm
http://sbueno.fedorapeople.org/1001070-text.webm
There are some obvious issues with the graphical behavior (see
screencast), which I could use some help with, namely:
-- Pressing the 'format' button doesn't show the spinner until actual
formatting is nearly complete, so it looks like anaconda is stuck.
-- The warning label about unformatted DASDs doesn't just disappear
after formatting them.
Glade files are against rhel7-branch; I've remembered to add translation
contexts for the version against master branch.
I also tested kickstart installations on graphical and text. Behavior
seen is just a storage configuration error which halts automated
installation, forcing the user to go into the storage spoke to set
things up, where they're then prompted about unformatted DASDs.
10 years, 3 months
[PATCH] Allow AddonData classes to parse options in the %addon line
by David Shea
This adds a function AddonData.handle_header. The AddonSection parser
will ignore any extra arguments to %addon when extracting the addon ID,
and it will pass the remaining arguments to AddonData.handle_header.
AddonData.handle_header will fail on extra arguments if not overridden
in a subclass.
---
pyanaconda/addons.py | 32 ++++++++++++++++++++++++++++----
1 file changed, 28 insertions(+), 4 deletions(-)
diff --git a/pyanaconda/addons.py b/pyanaconda/addons.py
index 8202a1d..3b658d5 100644
--- a/pyanaconda/addons.py
+++ b/pyanaconda/addons.py
@@ -23,7 +23,8 @@ __all__ = ["AddonSection", "AddonRegistry", "AddonData", "collect_addon_paths"]
import os
from pykickstart.sections import Section
-from pykickstart.options import KSOptionParser
+from pykickstart.errors import KickstartParseError, formatErrorMsg
+from pyanaconda.i18n import _
def collect_addon_paths(toplevel_addon_paths, ui_subdir="gui"):
"""This method looks into the directories present
@@ -129,6 +130,27 @@ class AddonData(object):
"""
pass
+ def handle_header(self, lineno, args):
+ """Process additional arguments to the %addon line.
+
+ This function receives any arguments on the %addon line after the
+ addon ID. For example, for the line:
+
+ %addon com_example_foo --argument='example'
+
+ This function would be called with args=["--argument='example'"].
+
+ By default AddonData.handle_header will fail if passed any arguments,
+ so addon sections that take arguments must override this method.
+ """
+
+ if args:
+ msg = _("Unhandled arguments on %%addon line for %s") % self.name
+ if lineno != None:
+ raise KickstartParseError(formatErrorMsg(lineno, msg=msg))
+ else:
+ raise KickstartParseError(msg)
+
def handle_line(self, line):
"""Process one kickstart line."""
self.content += line
@@ -160,14 +182,16 @@ class AddonSection(Section):
def handleHeader(self, lineno, args):
"""Process the arguments to the %addon header."""
Section.handleHeader(self, lineno, args)
- op = KSOptionParser(version=self.version)
- (_opts, extra) = op.parse_args(args=args[1:], lineno=lineno)
- self.addon_id = extra[0]
+ self.addon_id = args[1]
# if the addon is not registered, create dummy placeholder for it
if self.addon_id and not hasattr(self.handler.addons, self.addon_id):
setattr(self.handler.addons, self.addon_id, AddonData(self.addon_id))
+ # Parse additional arguments to %addon to the AddonData handler
+ addon = getattr(self.handler.addons, self.addon_id)
+ addon.handle_header(lineno, args[2:])
+
def finalize(self):
"""Let addon know no additional data will come."""
Section.finalize(self)
--
1.8.5.3
10 years, 3 months
[PATCH] Give a more correct error for missing groups/packages on exclude (#1060194).
by Chris Lumens
---
pyanaconda/errors.py | 34 ++++++++++++++++++++++++++--------
pyanaconda/packaging/yumpayload.py | 8 ++++----
2 files changed, 30 insertions(+), 12 deletions(-)
diff --git a/pyanaconda/errors.py b/pyanaconda/errors.py
index 738a329..6259063 100644
--- a/pyanaconda/errors.py
+++ b/pyanaconda/errors.py
@@ -179,10 +179,19 @@ class ErrorHandler(object):
def _noSuchGroupHandler(self, *args, **kwargs):
group = args[0]
- message = _("You have specified that the group '%s' should be "
- "installed. This group does not exist. Would you like "
- "to skip this group and continue with "
- "installation?") % group
+ adding = args[1]
+
+ if adding:
+ message = _("You have specified that the group '%s' should be "
+ "installed. This group does not exist. Would you like "
+ "to skip this group and continue with "
+ "installation?") % group
+ else:
+ message = _("You have specified that the group '%s' should be "
+ "excluded from installation. This group does not exist. "
+ "Would you like to skip this group and continue with "
+ "installation?") % group
+
if self.ui.showYesNoQuestion(message):
return ERROR_CONTINUE
else:
@@ -190,10 +199,19 @@ class ErrorHandler(object):
def _noSuchPackageHandler(self, *args, **kwargs):
package = args[0]
- message = _("You have specified that the package '%s' should be "
- "installed. This package does not exist. Would you "
- "like to skip this package and continue with "
- "installation?") % package
+ adding = args[1]
+
+ if adding:
+ message = _("You have specified that the package '%s' should be "
+ "installed. This package does not exist. Would you "
+ "like to skip this package and continue with "
+ "installation?") % package
+ else:
+ message = _("You have specified that the package '%s' should be "
+ "excluded from installation. This package does not exist. "
+ "Would you like to skip this package and continue with "
+ "installation?") % package
+
if self.ui.showYesNoQuestion(message):
return ERROR_CONTINUE
else:
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index 43ce236..4872484 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -1179,11 +1179,11 @@ reposdir=%s
else:
self._yum._ts_save_file = None
- def _handleMissing(self, exn):
+ def _handleMissing(self, exn, adding=True):
if self.data.packages.handleMissing == KS_MISSING_IGNORE:
return
- if errorHandler.cb(exn, str(exn)) == ERROR_RAISE:
+ if errorHandler.cb(exn, str(exn), adding) == ERROR_RAISE:
# The progress bar polls kind of slowly, thus installation could
# still continue for a bit before the quit message is processed.
# Let's sleep forever to prevent any further actions and wait for
@@ -1228,13 +1228,13 @@ reposdir=%s
try:
self._deselectYumPackage(package)
except NoSuchPackage as e:
- self._handleMissing(e)
+ self._handleMissing(e, adding=False)
for group in self.data.packages.excludedGroupList:
try:
self._deselectYumGroup(group.name)
except NoSuchGroup as e:
- self._handleMissing(e)
+ self._handleMissing(e, adding=False)
self._select_kernel_package()
self.selectRequiredPackages()
--
1.8.3.1
10 years, 3 months
[master][PATCH] Package download retry NG
by Martin Kolman
NG = Now with Generators! :)
Based on suggestion from Vratislav, I've decided to convert the
master version of the patch to use generators and to move the
delay generator to iutil, so it can be easily used in other
parts of Anaconda.
For now it is called xprogressive_delay (inspired by the xrange function),
but I'm pretty much open for other naming suggestions.
Martin Kolman (1):
Properly retry package downloads (#924860)
pyanaconda/iutil.py | 14 ++++++++
scripts/anaconda-yum | 95 +++++++++++++++++++++++++++++++++++++++++-----------
2 files changed, 90 insertions(+), 19 deletions(-)
--
1.8.5.3
10 years, 3 months
[master/rhel7] Remove drivers and modules on ppc64 (#1060691)
by Brian C. Lane
Remove more drivers and remove plymouth and drm dracut modules. Only on
PPC64 initrd, all other arches have the full set of drivers and modules.
---
src/pylorax/__init__.py | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py
index 894e15b..0c3f263 100644
--- a/src/pylorax/__init__.py
+++ b/src/pylorax/__init__.py
@@ -49,6 +49,10 @@ from treeinfo import TreeInfo
from discinfo import DiscInfo
from executils import runcmd, runcmd_output
+# List of drivers to remove on ppc64 arch to keep initrd < 32MiB
+REMOVE_PPC64_DRIVERS = "floppy scsi_debug nouveau radeon cirrus mgag200"
+REMOVE_PPC64_MODULES = "drm plymouth"
+
class ArchData(DataHolder):
lib64_arches = ("x86_64", "ppc64", "s390x", "ia64", "aarch64")
bcj_arch = dict(i386="x86", x86_64="x86",
@@ -292,8 +296,12 @@ class Lorax(BaseLoraxClass):
templatedir=templatedir)
logger.info("rebuilding initramfs images")
- dracut_args = ["--xz", "--install", "/.buildstamp",
- "--omit-drivers", "floppy scsi_debug"]
+ dracut_args = ["--xz", "--install", "/.buildstamp"]
+
+ # ppc64 cannot boot an initrd > 32MiB so remove some drivers
+ if self.arch.basearch == "ppc64":
+ dracut_args.extend(["--omit-drivers", REMOVE_PPC64_DRIVERS])
+ dracut_args.extend(["--omit", REMOVE_PPC64_MODULES])
anaconda_args = dracut_args + ["--add", "anaconda pollcdrom"]
treebuilder.rebuild_initrds(add_args=anaconda_args)
--
1.8.5.3
10 years, 3 months
[PATCH] Allow AddonData classes to parse options in the %addon line.
by David Shea
This adds a function AddonData.handle_header. AddonSection will ignore
any options it encounters in the %addon line besides the addon ID, and
once the AddonData object has been created it will pass the arguments to
the %addon line to handle_header.
---
pyanaconda/addons.py | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/addons.py b/pyanaconda/addons.py
index 8202a1d..4326627 100644
--- a/pyanaconda/addons.py
+++ b/pyanaconda/addons.py
@@ -25,6 +25,21 @@ import os
from pykickstart.sections import Section
from pykickstart.options import KSOptionParser
+class ForgivingParser(KSOptionParser):
+ """Parse a kickstart line, but ignore any unknown options.
+
+ This class is used to parse %addon lines that may contain arguments
+ that will be handled by a yet-to-be-determined AddonData class.
+ """
+
+ def error(self, msg):
+ """Don't display anything when an error is encountered."""
+ pass
+
+ def exit(self, status=0, msg=None):
+ """Don't exit when an error is encountered."""
+ pass
+
def collect_addon_paths(toplevel_addon_paths, ui_subdir="gui"):
"""This method looks into the directories present
in toplevel_addon_paths and registers each subdirectory
@@ -129,6 +144,15 @@ class AddonData(object):
"""
pass
+ def handle_header(self, lineno, args):
+ """Process arguments in the %addon line.
+
+ This method rejects all arguments and must be overriden by addons
+ that take arguments on the %addon line.
+ """
+ op = KSOptionParser()
+ (_opts, _extra) = op.parse_args(args=args, lineno=lineno)
+
def handle_line(self, line):
"""Process one kickstart line."""
self.content += line
@@ -160,7 +184,7 @@ class AddonSection(Section):
def handleHeader(self, lineno, args):
"""Process the arguments to the %addon header."""
Section.handleHeader(self, lineno, args)
- op = KSOptionParser(version=self.version)
+ op = ForgivingParser(version=self.version)
(_opts, extra) = op.parse_args(args=args[1:], lineno=lineno)
self.addon_id = extra[0]
@@ -168,6 +192,10 @@ class AddonSection(Section):
if self.addon_id and not hasattr(self.handler.addons, self.addon_id):
setattr(self.handler.addons, self.addon_id, AddonData(self.addon_id))
+ # Pass the header to the AddonData object
+ addon = getattr(self.handler.addons, self.addon_id)
+ addon.handle_header(lineno, args[1:])
+
def finalize(self):
"""Let addon know no additional data will come."""
Section.finalize(self)
--
1.8.5.3
10 years, 3 months
[PATCH] Fix some incorrect RPM macros in the spec file.
by Chris Lumens
---
anaconda.spec.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/anaconda.spec.in b/anaconda.spec.in
index 62881c7..406c8f0 100755
--- a/anaconda.spec.in
+++ b/anaconda.spec.in
@@ -95,7 +95,7 @@ Requires: python-blivet >= 0.41
Requires: python-meh >= %{mehver}
Requires: libreport-anaconda >= 2.0.21-1
Requires: libselinux-python
-Requires: rpm-python >= %{rpmpythonver}
+Requires: rpm-python >= %{rpmver}
Requires: parted >= %{partedver}
Requires: pyparted >= %{pypartedver}
Requires: yum >= %{yumver}
@@ -125,7 +125,7 @@ Requires: isomd5sum >= %{isomd5sum}
Requires: yum-utils >= %{yumutilsver}
Requires: NetworkManager >= %{nmver}
Requires: dhclient
-Requires: libselinux-python >= %{libselinuxver}
+Requires: libselinux-python
Requires: kbd
Requires: chrony
Requires: python-ntplib
--
1.8.3.1
10 years, 3 months
[PATCH] Fixes for enabling and disabling InputChecks.
by David Shea
The first patch basically fixes a typo, and the second makes the behavior when
disabling a check less surprising.
David Shea (2):
Fix how an input check is disabled (#1062275).
Don't reset input check status when disabling a check (#1062273)
pyanaconda/ui/gui/spokes/user.py | 2 +-
pyanaconda/ui/helpers.py | 14 +++++++++-----
2 files changed, 10 insertions(+), 6 deletions(-)
--
1.8.5.3
10 years, 3 months