[the real PATCH] Split out anaconda's user interfaces into separate packages (#1012509)

Vratislav Podzimek vpodzime at redhat.com
Tue Sep 2 16:55:54 UTC 2014


Ported changes from commits
7161c69c9c10e79a0f2a89db99b7edc120384c95
06f7e38bc9f9ba445e61fe6ec648d64b54a45af4
b62a760e8de18a5fee1daaac496bd4df6aff5f15
eb7ae0f9e51ce03653fa25ba0de26eef4c3bfa08
9fe0091c3fde28a06b4588276f7897cfab50f77a
9784e31511aa7db2da810357a5566b230004aa25
8df36acfb7ebdcf62e598e3d28f31b8d4d5103b8
a8255d924c1007931d63212c5a29dd355e35cbe2
b48980dd206ba61364f382ab74a5eb3ae7770fd2

from master.

Related: rhbz#999464
Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 anaconda                    | 10 +++++++
 anaconda.spec.in            | 71 +++++++++++++++++++++++++++++++++++----------
 configure.ac                |  4 ---
 data/liveinst/liveinst      | 18 ++++++++++--
 pyanaconda/isys/Makefile.am |  2 +-
 pyanaconda/isys/isys.c      | 26 -----------------
 pyanaconda/keyboard.py      |  4 +--
 7 files changed, 84 insertions(+), 51 deletions(-)

diff --git a/anaconda b/anaconda
index 0fa742f..8b2f736 100755
--- a/anaconda
+++ b/anaconda
@@ -489,6 +489,16 @@ def setupDisplay(anaconda, opts, addon_paths=None):
         if vncS.vncconnectport == "":
             vncS.vncconnectport = anaconda.ksdata.vnc.port
 
+    if anaconda.displayMode == "g":
+        try:
+            # pylint: disable-msg=W0612
+            from pyanaconda.ui.gui import GraphicalUserInterface
+        except ImportError:
+            stdoutLog.warning("Graphical user interface not available, falling back to text mode")
+            anaconda.displayMode = "t"
+            flags.usevnc = 0
+            flags.vncquestion = False
+
     # disable VNC over text question when not enough memory is available
     if blivet.util.total_memory() < isys.MIN_GUI_RAM:
         stdoutLog.warning("Not asking for VNC because current memory (%d) < MIN_GUI_RAM (%d)", blivet.util.total_memory(), isys.MIN_GUI_RAM)
diff --git a/anaconda.spec.in b/anaconda.spec.in
index b192f50..a9e4b0c 100644
--- a/anaconda.spec.in
+++ b/anaconda.spec.in
@@ -18,7 +18,6 @@ Source0: %{name}-%{version}.tar.bz2
 # Versions of required components (done so we make sure the buildrequires
 # match the requires versions of things).
 %define gettextver 0.11
-%define gconfversion 2.28.1
 %define intltoolver 0.31.2-3
 %define libnlver 1.0
 %define pykickstartver  1.99.43.13
@@ -50,9 +49,6 @@ BuildRequires: gobject-introspection-devel
 BuildRequires: glade-devel
 BuildRequires: pygobject3
 BuildRequires: intltool >= %{intltoolver}
-BuildRequires: libX11-devel
-BuildRequires: libXt-devel
-BuildRequires: libXxf86misc-devel
 BuildRequires: libgnomekbd-devel
 BuildRequires: libnl-devel >= %{libnlver}
 BuildRequires: libxklavier-devel
@@ -79,9 +75,16 @@ BuildRequires: desktop-file-utils
 BuildRequires: s390utils-devel
 %endif
 
-Requires: anaconda-widgets = %{version}-%{release}
+Requires: anaconda-core = %{version}-%{release}
+Requires: anaconda-gui = %{version}-%{release}
+Requires: anaconda-tui = %{version}-%{release}
+
+%description
+The anaconda package is a metapackage for the Anaconda installer.
+
+%package core
+Summary: Core of the Anaconda installer
 Requires: python-blivet >= 0.18.36
-Requires: gnome-icon-theme-symbolic
 Requires: python-meh >= %{mehver}
 Requires: libreport-anaconda >= 2.0.21-1
 Requires: libreport-rhel-anaconda-bugzilla >= 2.1.11-1
@@ -91,7 +94,6 @@ Requires: parted >= %{partedver}
 Requires: pyparted >= %{pypartedver}
 Requires: yum >= %{yumver}
 Requires: python-urlgrabber >= %{pythonurlgrabberver}
-Requires: system-logos
 Requires: pykickstart >= %{pykickstartver}
 Requires: langtable-data >= %{langtablever}
 Requires: langtable-python >= %{langtablever}
@@ -103,18 +105,13 @@ Requires: dbus-python
 Requires: python-pwquality
 Requires: python-IPy
 Requires: python-nss
-Requires: tigervnc-server-minimal
 Requires: pytz
-Requires: libxklavier
-Requires: libgnomekbd
 Requires: realmd
 Requires: teamd
 Requires: keybinder3
 %ifarch %livearches
 Requires: usermode
-Requires: zenity
 %endif
-Requires: GConf2 >= %{gconfversion}
 %ifarch s390 s390x
 Requires: openssh
 %endif
@@ -122,7 +119,6 @@ Requires: isomd5sum >= %{isomd5sum}
 Requires: yum-utils >= %{yumutilsver}
 Requires: createrepo
 Requires: NetworkManager >= %{nmver}
-Requires: nm-connection-editor
 Requires: dhclient
 Requires: kbd
 Requires: chrony
@@ -141,6 +137,9 @@ Requires: hfsplus-tools
 %endif
 %endif
 
+# required because of the rescue mode and VNC question
+Requires: anaconda-tui = %{version}-%{release}
+
 Requires: python-coverage
 
 Obsoletes: anaconda-images <= 10
@@ -149,10 +148,35 @@ Obsoletes: anaconda-runtime < %{version}-%{release}
 Provides: anaconda-runtime = %{version}-%{release}
 Obsoletes: booty <= 0.107-1
 
-%description
-The anaconda package contains the program which was used to install your
+%description core
+The anaconda-core package contains the program which was used to install your
 system.
 
+%package gui
+Summary: Graphical user interface for the Anaconda installer
+Requires: anaconda-core = %{version}-%{release}
+Requires: anaconda-widgets = %{version}-%{release}
+Requires: python-meh-gui >= %{mehver}
+Requires: gnome-icon-theme-symbolic
+Requires: system-logos
+Requires: tigervnc-server-minimal
+Requires: libxklavier
+Requires: libgnomekbd
+Requires: nm-connection-editor
+%ifarch %livearches
+Requires: zenity
+%endif
+
+%description gui
+This package contains graphical user interface for the Anaconda installer.
+
+%package tui
+Summary: Textual user interface for the Anaconda installer
+Requires: anaconda-core = %{version}-%{release}
+
+%description tui
+This package contains textual user interface for the Anaconda installer.
+
 %package widgets
 Summary: A set of custom GTK+ widgets for use with anaconda
 Group: System Environment/Libraries
@@ -217,16 +241,23 @@ update-desktop-database &> /dev/null || :
 update-desktop-database &> /dev/null || :
 %endif
 
-%files -f %{name}.lang
+%files
 %doc COPYING
+
+%files core -f %{name}.lang
 %{_unitdir}/*
 %{_prefix}/lib/systemd/system-generators/*
 %{_bindir}/instperf
 %{_sbindir}/anaconda
 %{_sbindir}/handle-sshpw
 %{_datadir}/anaconda
+%exclude %{_datadir}/anaconda/tzmapdata
 %{_prefix}/libexec/anaconda
 %{_libdir}/python*/site-packages/pyanaconda/*
+%exclude %{_libdir}/python*/site-packages/pyanaconda/rescue.py
+%exclude %{_libdir}/python*/site-packages/pyanaconda/text.py
+%exclude %{_libdir}/python*/site-packages/pyanaconda/ui/gui/*
+%exclude %{_libdir}/python*/site-packages/pyanaconda/ui/tui/*
 %{_bindir}/analog
 %{_bindir}/anaconda-cleanup
 %ifarch %livearches
@@ -239,6 +270,14 @@ update-desktop-database &> /dev/null || :
 %{_datadir}/icons/hicolor/*
 %endif
 
+%files gui
+%{_libdir}/python*/site-packages/pyanaconda/ui/gui/*
+
+%files tui
+%{_libdir}/python*/site-packages/pyanaconda/rescue.py
+%{_libdir}/python*/site-packages/pyanaconda/text.py
+%{_libdir}/python*/site-packages/pyanaconda/ui/tui/*
+
 %files widgets
 %{_libdir}/libAnacondaWidgets.so.*
 %{_libdir}/girepository*/AnacondaWidgets*typelib
diff --git a/configure.ac b/configure.ac
index e6f9d2a..25eaf23 100644
--- a/configure.ac
+++ b/configure.ac
@@ -67,10 +67,6 @@ AC_SUBST(INTLTOOL_DESKTOP_RULE)
 AM_GNU_GETTEXT([external])
 
 # Checks for libraries.
-AC_CHECK_LIB([X11], [XGetWindowAttributes],
-             [AC_SUBST(X11_LIBS, [-lX11])],
-             [AC_MSG_FAILURE([*** libX11 not usable.])])
-
 AC_CHECK_LIB([audit], [audit_open],
              [AC_SUBST(AUDIT_LIBS, [-laudit])],
              [AC_MSG_FAILURE([*** libaudit not usable.])])
diff --git a/data/liveinst/liveinst b/data/liveinst/liveinst
index c5684e6..5660db1 100755
--- a/data/liveinst/liveinst
+++ b/data/liveinst/liveinst
@@ -47,7 +47,14 @@ if [ -z "$LIVE_BLOCK" ]; then
 fi
 
 if [ $LIVE_INSTALL = 1 -a ! -b "$LIVE_BLOCK" ]; then
-  zenity --error --title="Not a Live image" --text "Can't do live image installation unless running from a live image"
+  title="Not a Live image"
+  text="Can't do live image installation unless running from a live image"
+  if which zenity &> /dev/null; then
+      zenity --error --title="$title" --text="$text"
+  else
+      echo "$title" >&2
+      echo "$text" >&2
+  fi
   exit 1
 fi
 
@@ -112,7 +119,14 @@ anaconda-cleanup $ANACONDA $*
 # Set up the updates, if provided.
 if [ ! -z "$UPDATES" ]; then
     if [ -e /tmp/updates.img -o -e /tmp/updates ]; then
-        zenity --error --title="Updates already exist" --text "updates= was provided, but an updates image already exists.  Please remove /tmp/updates.img and /tmp/updates and try again."
+        title="Updates already exist"
+        text="updates= was provided, but an updates image already exists.  Please remove /tmp/updates.img and /tmp/updates and try again."
+        if which zenity &> /dev/null; then
+            zenity --error --title="$title" --text="$text"
+        else
+            echo "$title" >&2
+            echo "$text" >&2
+        fi
         exit 1
     fi
 
diff --git a/pyanaconda/isys/Makefile.am b/pyanaconda/isys/Makefile.am
index 3f37d45..7ad53bf 100644
--- a/pyanaconda/isys/Makefile.am
+++ b/pyanaconda/isys/Makefile.am
@@ -27,7 +27,7 @@ ISYS_CFLAGS = -DVERSION='"$(PACKAGE_VERSION)-$(PACKAGE_RELEASE)"' \
               $(NETWORKMANAGER_CFLAGS) $(LIBNL_CFLAGS) $(LIBNM_GLIB_CFLAGS) \
               $(SELINUX_CFLAGS)
 ISYS_LIBS   = $(RESOLV_LIBS) $(ZLIB_LIBS) \
-              $(DEVMAPPER_LIBS) $(X11_LIBS) $(SELINUX_LIBS) \
+              $(DEVMAPPER_LIBS) $(SELINUX_LIBS) \
               $(LIBNL_LIBS) $(LIBNM_GLIB_LIBS)
 
 isysdir     = $(pkgpyexecdir)/isys
diff --git a/pyanaconda/isys/isys.c b/pyanaconda/isys/isys.c
index 7848504..17e85da 100644
--- a/pyanaconda/isys/isys.c
+++ b/pyanaconda/isys/isys.c
@@ -58,10 +58,6 @@
 #include <signal.h>
 #include <execinfo.h>
 
-#include <X11/Xlib.h>
-#include <X11/XKBlib.h>
-#include <X11/keysym.h>
-
 #include "isys.h"
 #include "auditd.h"
 #include "log.h"
@@ -79,7 +75,6 @@ static PyObject * printObject(PyObject * s, PyObject * args);
 static PyObject * py_bind_textdomain_codeset(PyObject * o, PyObject * args);
 static PyObject * doSegvHandler(PyObject *s, PyObject *args);
 static PyObject * doAuditDaemon(PyObject *s);
-static PyObject * doIsCapsLockEnabled(PyObject * s, PyObject * args);
 static PyObject * doGetAnacondaVersion(PyObject * s, PyObject * args);
 static PyObject * doInitLog(PyObject * s);
 static PyObject * doTotalMemory(PyObject * s);
@@ -93,7 +88,6 @@ static PyMethodDef isysModuleMethods[] = {
     { "bind_textdomain_codeset", (PyCFunction) py_bind_textdomain_codeset, METH_VARARGS, NULL},
     { "handleSegv", (PyCFunction) doSegvHandler, METH_VARARGS, NULL },
     { "auditdaemon", (PyCFunction) doAuditDaemon, METH_NOARGS, NULL },
-    { "isCapsLockEnabled", (PyCFunction) doIsCapsLockEnabled, METH_VARARGS, NULL },
     { "getAnacondaVersion", (PyCFunction) doGetAnacondaVersion, METH_VARARGS, NULL },
     { "initLog", (PyCFunction) doInitLog, METH_VARARGS, NULL },
     { "total_memory", (PyCFunction) doTotalMemory, METH_NOARGS, NULL },
@@ -230,26 +224,6 @@ static PyObject * doAuditDaemon(PyObject *s) {
     return Py_None;
 }
 
-static PyObject * doIsCapsLockEnabled(PyObject * s, PyObject * args) {
-    Display *d = NULL;
-    XkbStateRec state;
-
-    if ((d = XOpenDisplay(NULL)) == NULL) {
-        PyErr_SetString(PyExc_RuntimeError, "XOpenDisplay failed");
-        return NULL;
-    }
-
-    memset(&state, 0, sizeof(state));
-    XkbGetState(d, XkbUseCoreKbd, &state);
-
-    if (XCloseDisplay(d)) {
-        PyErr_SetString(PyExc_RuntimeError, "XCloseDisplay failed");
-        return NULL;
-    }
-
-    return PyBool_FromLong(state.locked_mods & LockMask);
-}
-
 static PyObject * doGetAnacondaVersion(PyObject * s, PyObject * args) {
     return Py_BuildValue("s", VERSION);
 }
diff --git a/pyanaconda/keyboard.py b/pyanaconda/keyboard.py
index aeab7f4..9c02a1d 100755
--- a/pyanaconda/keyboard.py
+++ b/pyanaconda/keyboard.py
@@ -47,7 +47,7 @@ from pyanaconda.safe_dbus import dbus_call_safe_sync, dbus_get_property_safe_syn
 from pyanaconda.safe_dbus import DBUS_SYSTEM_BUS_ADDR, DBusPropertyError
 from pyanaconda.constants import DEFAULT_VC_FONT
 
-from gi.repository import Xkl, Gio, GLib
+from gi.repository import Gio, GLib
 
 import logging
 log = logging.getLogger("anaconda")
@@ -372,7 +372,7 @@ class XklWrapper(object):
         return XklWrapper._instance
 
     def __init__(self):
-        from gi.repository import GdkX11
+        from gi.repository import GdkX11, Xkl
 
         #initialize Xkl-related stuff
         display = GdkX11.x11_get_default_xdisplay()
-- 
1.9.3



More information about the anaconda-patches mailing list