parent
47a0aea0c6
commit
701ced5ddb
@ -1,9 +0,0 @@
|
||||
[anaconda.f21-branch]
|
||||
file_filter = po/<lang>.po
|
||||
source_file = po/anaconda.pot
|
||||
source_lang = en
|
||||
type = PO
|
||||
|
||||
[main]
|
||||
host = https://www.transifex.com
|
||||
|
@ -0,0 +1,75 @@
|
||||
dnl autoconf macros for anaconda
|
||||
dnl
|
||||
dnl Copyright (C) 2014 Red Hat, Inc.
|
||||
dnl
|
||||
dnl This program is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU Lesser General Public License as published
|
||||
dnl by the Free Software Foundation; either version 2.1 of the License, or
|
||||
dnl (at your option) any later version.
|
||||
dnl
|
||||
dnl This program is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU Lesser General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU Lesser General Public License
|
||||
dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
dnl
|
||||
dnl Author: David Shea <dshea@redhat.com>
|
||||
|
||||
dnl ANACONDA_SOFT_FAILURE(MESSAGE)
|
||||
dnl
|
||||
dnl Store a message that in some contexts could be considered indicative
|
||||
dnl of a failure, but in other contexts could be indicative of who cares.
|
||||
dnl
|
||||
dnl For example, the anaconda widgets require a version of gtk3-devel of
|
||||
dnl particular newness, and the widgets will fail to build if this library
|
||||
dnl and headers are not available. On the other hand, gtk3 isn't required at
|
||||
dnl all for most everything else, so it would be nice if a missing or old
|
||||
dnl gtk3-devel didn't halt the configure script.
|
||||
dnl
|
||||
dnl Any message sent to this macro will be stored, and they can all be
|
||||
dnl displayed at the end of configure using the ANACONDA_FAILURES macro.
|
||||
AC_DEFUN([ANACONDA_SOFT_FAILURE], [dnl
|
||||
AS_IF([test x"$anaconda_failure_messages" = x],
|
||||
[anaconda_failure_messages="[$1]"],
|
||||
[anaconda_failure_messages="$anaconda_failure_messages
|
||||
[$1]"
|
||||
])])dnl
|
||||
|
||||
dnl ANACONDA_PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES)
|
||||
dnl
|
||||
dnl Check whether a module is available, using pkg-config. Instead of failing
|
||||
dnl if a module is not found, store the failure in a message that can be
|
||||
dnl printed using the ANACONDA_FAILURES macro.
|
||||
dnl
|
||||
dnl The syntax and behavior of VARIABLE-PREFIX and MODULES is the same as for
|
||||
dnl PKG_CHECK_MODULES.
|
||||
AC_DEFUN([ANACONDA_PKG_CHECK_MODULES], [dnl
|
||||
PKG_CHECK_MODULES([$1], [$2], [], [ANACONDA_SOFT_FAILURE($[$1]_PKG_ERRORS)])
|
||||
])dnl
|
||||
|
||||
dnl ANACONDA_PKG_CHECK_EXISTS(MODULES)
|
||||
dnl
|
||||
dnl Check whether a module exists, using pkg-config. Instead of failing
|
||||
dnl if a module is not found, store the failure in a message that can be
|
||||
dnl printed using the ANACONDA_FAILURES macro.
|
||||
dnl
|
||||
dnl The syntax and behavior of MOUDLES is the same as for
|
||||
dnl PKG_CHECK_EXISTS.
|
||||
AC_DEFUN([ANACONDA_PKG_CHECK_EXISTS], [dnl
|
||||
PKG_CHECK_EXISTS([$1], [], [ANACONDA_SOFT_FAILURE([Check for $1 failed])])
|
||||
])dnl
|
||||
|
||||
dnl ANACONDA_FAILURES
|
||||
dnl
|
||||
dnl Print the failure messages collected by ANACONDA_SOFT_FAILURE and
|
||||
dnl ANACONDA_PKG_CHECK_MODULES
|
||||
AC_DEFUN([ANACONDA_FAILURES], [dnl
|
||||
AS_IF([test x"$anaconda_failure_messages" = x], [], [dnl
|
||||
echo ""
|
||||
echo "*** Anaconda encountered the following issues during configuration:"
|
||||
echo "$anaconda_failure_messages"
|
||||
echo ""
|
||||
echo "*** Anaconda will not successfully build without these missing dependencies"
|
||||
])])dnl
|
File diff suppressed because it is too large
Load Diff
@ -1,272 +0,0 @@
|
||||
# configure.ac for anaconda
|
||||
#
|
||||
# Copyright (C) 2009 Red Hat, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published
|
||||
# by the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Author: David Cantrell <dcantrell@redhat.com>
|
||||
|
||||
m4_define(python_required_version, 2.5)
|
||||
|
||||
AC_PREREQ([2.63])
|
||||
AC_INIT([anaconda], [20.25.16], [anaconda-devel-list@redhat.com])
|
||||
AM_INIT_AUTOMAKE([foreign no-dist-gzip dist-bzip2 tar-ustar])
|
||||
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
AC_DEFINE_UNQUOTED([BUILD_DATE], ["`date +%m%d%Y`"], [Date of anaconda build])
|
||||
AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_AWK
|
||||
AC_PROG_GREP
|
||||
AC_PROG_CC
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
# Check for the intltool programs
|
||||
# These checks and subsitutions are adapted IT_PROG_INTLTOOL provided in
|
||||
# intltool.m4, but without the parts where it breaks gettext.
|
||||
AC_PATH_PROG([INTLTOOL_EXTRACT], [intltool-extract])
|
||||
AC_PATH_PROG([INTLTOOL_MERGE], [intltool-merge])
|
||||
AS_IF([test -z "$INTLTOOL_EXTRACT" -o -z "$INTLTOOL_MERGE"],
|
||||
[AC_MSG_ERROR([*** intltool not found])])
|
||||
|
||||
# Add the bits for Makefile rules
|
||||
INTLTOOL_V_MERGE='$(INTLTOOL__v_MERGE_$(V))'
|
||||
INTLTOOL__v_MERGE_='$(INTLTOOL__v_MERGE_$(AM_DEFAULT_VERBOSITY))'
|
||||
INTLTOOL__v_MERGE_0='@echo " ITMRG " $@;'
|
||||
INTLTOOL_V_MERGE_OPTIONS='$(intltool__v_merge_options_$(V))'
|
||||
intltool__v_merge_options_='$(intltool__v_merge_options_$(AM_DEFAULT_VERBOSITY))'
|
||||
intltool__v_merge_options_0='-q'
|
||||
AC_SUBST(INTLTOOL_V_MERGE)
|
||||
AC_SUBST(INTLTOOL__v_MERGE_)
|
||||
AC_SUBST(INTLTOOL__v_MERGE_0)
|
||||
AC_SUBST(INTLTOOL_V_MERGE_OPTIONS)
|
||||
AC_SUBST(intltool__v_merge_options_)
|
||||
AC_SUBST(intltool__v_merge_options_0)
|
||||
|
||||
INTLTOOL_DESKTOP_RULE='%.desktop: %.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@'
|
||||
AC_SUBST(INTLTOOL_DESKTOP_RULE)
|
||||
|
||||
AM_GNU_GETTEXT([external])
|
||||
AM_GNU_GETTEXT_VERSION([0.18.1])
|
||||
|
||||
# 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.])])
|
||||
|
||||
AC_CHECK_LIB([z], [zlibVersion],
|
||||
[AC_SUBST(ZLIB_LIBS, [-lz])],
|
||||
[AC_MSG_FAILURE([*** libz not usable.])])
|
||||
|
||||
# Checks for header files.
|
||||
AC_PATH_X
|
||||
AC_FUNC_ALLOCA
|
||||
AC_HEADER_RESOLV
|
||||
AC_HEADER_MAJOR
|
||||
AC_CHECK_HEADERS([argz.h arpa/inet.h fcntl.h inttypes.h libintl.h limits.h \
|
||||
malloc.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h \
|
||||
string.h strings.h sys/ioctl.h sys/mount.h sys/param.h \
|
||||
sys/socket.h sys/time.h sys/vfs.h syslog.h termios.h \
|
||||
unistd.h utime.h wchar.h],
|
||||
[],
|
||||
[AC_MSG_FAILURE([*** Header file $ac_header not found.])],
|
||||
[])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_TYPE_UID_T
|
||||
AC_C_INLINE
|
||||
AC_TYPE_INT32_T
|
||||
AC_TYPE_MODE_T
|
||||
AC_TYPE_OFF_T
|
||||
AC_TYPE_PID_T
|
||||
AC_TYPE_SIZE_T
|
||||
AC_TYPE_SSIZE_T
|
||||
AC_CHECK_MEMBERS([struct stat.st_rdev])
|
||||
AC_TYPE_UINT16_T
|
||||
AC_TYPE_UINT32_T
|
||||
AC_TYPE_UINT64_T
|
||||
AC_TYPE_UINT8_T
|
||||
AC_TYPE_INT64_T
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_CHOWN
|
||||
AC_FUNC_ERROR_AT_LINE
|
||||
AC_FUNC_FORK
|
||||
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
|
||||
AC_FUNC_MALLOC
|
||||
AC_FUNC_MMAP
|
||||
AC_FUNC_REALLOC
|
||||
AC_CHECK_FUNCS([dup2 fdatasync ftruncate getcwd gethostbyname gettimeofday \
|
||||
lchown memmove memset mkdir mkfifo munmap realpath select \
|
||||
setenv sethostname socket strcasecmp strchr strcspn strdup \
|
||||
strerror strncasecmp strndup strrchr strstr strtol strtoul \
|
||||
strverscmp uname utime wcwidth],
|
||||
[],
|
||||
[AC_MSG_FAILURE([*** Required function $ac_func not found.])])
|
||||
|
||||
AM_PATH_PYTHON(python_required_version)
|
||||
|
||||
# Check for the python extension paths
|
||||
PKG_CHECK_MODULES([PYTHON], [python], [
|
||||
LIBS_save="$LIBS"
|
||||
LIBS="$LIBS $PYTHON_LIBS"
|
||||
AC_MSG_CHECKING([Python libraries])
|
||||
AC_TRY_LINK_FUNC([Py_Initialize],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[AC_MSG_RESULT([no])
|
||||
AC_MSG_FAILURE([*** Unable to use python library])])
|
||||
LIBS="$LIBS_save"
|
||||
],
|
||||
[AC_MSG_FAILURE([*** Unable to find python library])])
|
||||
|
||||
# Check for libraries we need that provide pkg-config scripts
|
||||
PKG_PROG_PKG_CONFIG([0.23])
|
||||
PKG_CHECK_MODULES([X11], [x11 >= 1.3])
|
||||
PKG_CHECK_MODULES([XCOMPOSITE], [xcomposite >= 0.4.1])
|
||||
PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.16.1])
|
||||
PKG_CHECK_MODULES([GTK_X11], [gtk+-x11-3.0 >= 3.0])
|
||||
PKG_CHECK_MODULES([GDK], [gdk-3.0])
|
||||
PKG_CHECK_MODULES([NETWORKMANAGER], [NetworkManager >= 0.7.1])
|
||||
PKG_CHECK_MODULES([LIBNL], [libnl-1 >= 1.0])
|
||||
PKG_CHECK_MODULES([LIBNM_GLIB], [libnm-glib >= 0.7.1 libnm-util >= 0.7.1])
|
||||
PKG_CHECK_MODULES([RPM], [rpm >= 4.10.0])
|
||||
PKG_CHECK_MODULES([LIBARCHIVE], [libarchive >= 3.0.4])
|
||||
|
||||
# Set $RPM_OPT_FLAGS if we don't have it
|
||||
if test -z $RPM_OPT_FLAGS ; then
|
||||
CFLAGS="$CFLAGS -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions"
|
||||
else
|
||||
CFLAGS="$CFLAGS $RPM_OPT_FLAGS"
|
||||
fi
|
||||
|
||||
# NFS support can, in theory, be enabled or disabled
|
||||
AC_ARG_ENABLE(nfs,
|
||||
AC_HELP_STRING([--enable-nfs],
|
||||
[enable NFS support (default is yes)]),
|
||||
[nfs=$enableval],
|
||||
[nfs=yes])
|
||||
|
||||
# IPv6 support can be enabled or disabled
|
||||
AC_ARG_ENABLE(ipv6,
|
||||
AC_HELP_STRING([--enable-ipv6],
|
||||
[enable IPv6 support (default is yes)]),
|
||||
[ipv6=$enableval],
|
||||
[ipv6=yes])
|
||||
if test x$ipv6 = xyes ; then
|
||||
AC_SUBST(IPV6_CFLAGS, [-DENABLE_IPV6])
|
||||
fi
|
||||
|
||||
# GCC likes to bomb out on some ridiculous warnings. Add your favorites
|
||||
# here.
|
||||
SHUT_UP_GCC="-Wno-unused-result"
|
||||
|
||||
# Add remaining compiler flags we want to use
|
||||
CFLAGS="$CFLAGS -Wall -Werror $SHUT_UP_GCC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"
|
||||
|
||||
# Filter CFLAGS (remove duplicate flags)
|
||||
cflags_filter() {
|
||||
have=
|
||||
first=1
|
||||
for flag in $* ; do
|
||||
if test -z "`echo $have | grep -- $flag`" ; then
|
||||
if test x$first == x1 ; then
|
||||
first=2
|
||||
else
|
||||
echo -n " "
|
||||
fi
|
||||
echo -n $flag
|
||||
have="$have $flag"
|
||||
fi
|
||||
done
|
||||
}
|
||||
CFLAGS="`cflags_filter $CFLAGS`"
|
||||
|
||||
# Unset $(LIBS) because different programs and libraries will have different
|
||||
# lists of libraries to link with, we don't want everything linking against
|
||||
# all libraries we checked for.
|
||||
LIBS=
|
||||
|
||||
# Get the release number from the spec file
|
||||
rel="`awk '/Release:/ { split($2, r, "%"); print r[[1]] }' $srcdir/anaconda.spec`"
|
||||
AC_SUBST(PACKAGE_RELEASE, [$rel])
|
||||
|
||||
# Perform arch related tests
|
||||
AC_CANONICAL_BUILD
|
||||
s_arch="`echo $build_cpu | sed -e s/i.86/i386/ -e s/powerpc.*/ppc/`"
|
||||
|
||||
AM_CONDITIONAL(IS_LIVEINST_ARCH,
|
||||
[test x$s_arch = xppc || test x$s_arch = xi386 || test x$s_arch = xx86_64])
|
||||
|
||||
AC_CONFIG_SUBDIRS([widgets])
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
data/Makefile
|
||||
data/command-stubs/Makefile
|
||||
docs/Makefile
|
||||
dracut/Makefile
|
||||
pyanaconda/installclasses/Makefile
|
||||
data/liveinst/Makefile
|
||||
data/liveinst/console.apps/Makefile
|
||||
data/liveinst/gnome/Makefile
|
||||
data/liveinst/pam.d/Makefile
|
||||
data/pixmaps/Makefile
|
||||
data/icons/Makefile
|
||||
data/icons/hicolor/Makefile
|
||||
data/icons/hicolor/16x16/Makefile
|
||||
data/icons/hicolor/16x16/apps/Makefile
|
||||
data/icons/hicolor/22x22/Makefile
|
||||
data/icons/hicolor/22x22/apps/Makefile
|
||||
data/icons/hicolor/24x24/Makefile
|
||||
data/icons/hicolor/24x24/apps/Makefile
|
||||
data/icons/hicolor/32x32/Makefile
|
||||
data/icons/hicolor/32x32/apps/Makefile
|
||||
data/icons/hicolor/48x48/Makefile
|
||||
data/icons/hicolor/48x48/apps/Makefile
|
||||
data/icons/hicolor/256x256/Makefile
|
||||
data/icons/hicolor/256x256/apps/Makefile
|
||||
data/systemd/Makefile
|
||||
po/Makefile.in
|
||||
scripts/Makefile
|
||||
pyanaconda/Makefile
|
||||
pyanaconda/isys/Makefile
|
||||
pyanaconda/packaging/Makefile
|
||||
pyanaconda/ui/Makefile
|
||||
pyanaconda/ui/lib/Makefile
|
||||
pyanaconda/ui/gui/categories/Makefile
|
||||
pyanaconda/ui/gui/hubs/Makefile
|
||||
pyanaconda/ui/gui/spokes/Makefile
|
||||
pyanaconda/ui/gui/spokes/advstorage/Makefile
|
||||
pyanaconda/ui/gui/spokes/lib/Makefile
|
||||
pyanaconda/ui/gui/tools/Makefile
|
||||
pyanaconda/ui/gui/Makefile
|
||||
pyanaconda/ui/tui/hubs/Makefile
|
||||
pyanaconda/ui/tui/simpleline/Makefile
|
||||
pyanaconda/ui/tui/spokes/Makefile
|
||||
pyanaconda/ui/tui/tools/Makefile
|
||||
pyanaconda/ui/tui/Makefile
|
||||
data/post-scripts/Makefile
|
||||
tests/Makefile
|
||||
utils/Makefile
|
||||
utils/dd/Makefile])
|
||||
AC_OUTPUT
|
@ -1,21 +0,0 @@
|
||||
# data/Makefile.am for anaconda
|
||||
#
|
||||
# Copyright (C) 2014 Red Hat, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published
|
||||
# by the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Author: Martin Kolman <mkolman@redhat.com>
|
||||
SUBDIRS = en-US
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
@ -1,26 +0,0 @@
|
||||
# data/Makefile.am for anaconda
|
||||
#
|
||||
# Copyright (C) 2014 Red Hat, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published
|
||||
# by the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Author: Martin Kolman <mkolman@redhat.com>
|
||||
|
||||
enhelpcontentdir = $(datadir)/anaconda/help/en-US
|
||||
# The $(srcdir)/*.*ml expression matches both the *.html placeholders and *.xml help
|
||||
# content files. It also works around the fact that autotools complain if the xml files
|
||||
# are not present but $(srcdir)/*.xml is used.
|
||||
dist_enhelpcontent_DATA = $(srcdir)/*.*ml
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
@ -0,0 +1,7 @@
|
||||
[Unit]
|
||||
ConditionKernelCommandLine=!ip=ibft
|
||||
Description=Anaconda NetworkManager configuration
|
||||
Before=NetworkManager.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/anaconda-disable-nm-ibft-plugin
|
@ -0,0 +1,39 @@
|
||||
# data/window-manager/config/Makefile.am for anaconda
|
||||
#
|
||||
# Copyright (C) 2015 Red Hat, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published
|
||||
# by the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Author: David Shea <dshea@redhat.com>
|
||||
|
||||
schemadir = $(pkgdatadir)/window-manager/glib-2.0/schemas
|
||||
|
||||
# These files need to be compiled by glib-compile-schemas. This is handled
|
||||
# in the spec file scriptlets.
|
||||
dist_schema_DATA = org.gnome.desktop.wm.keybindings.gschema.override \
|
||||
org.gnome.desktop.wm.preferences.gschema.override
|
||||
|
||||
# GSettings insists on the override files being in the same directory as the
|
||||
# schemas they modify, so pretend that this is the case with symlinks and
|
||||
# create the compiled schema.
|
||||
install-data-hook:
|
||||
$(MKDIR_P) $(DESTDIR)$(schemadir)
|
||||
$(LN_S) -f /usr/share/glib-2.0/schemas/org.gnome.desktop.wm.keybindings.gschema.xml $(DESTDIR)$(schemadir)
|
||||
$(LN_S) -f /usr/share/glib-2.0/schemas/org.gnome.desktop.wm.preferences.gschema.xml $(DESTDIR)$(schemadir)
|
||||
$(LN_S) -f /usr/share/glib-2.0/schemas/org.gnome.desktop.enums.xml $(DESTDIR)$(schemadir)
|
||||
glib-compile-schemas $(DESTDIR)$(schemadir)
|
||||
|
||||
uninstall-local:
|
||||
rm -f $(DESTDIR)$(schemadir)/*.xml
|
||||
rm -f $(DESTDIR)$(schemadir)/gschemas.compiled
|
@ -0,0 +1,35 @@
|
||||
[org.gnome.desktop.wm.keybindings]
|
||||
switch-to-workspace-left=[]
|
||||
switch-to-workspace-right=[]
|
||||
switch-to-workspace-up=[]
|
||||
switch-to-workspace-down=[]
|
||||
switch-to-workspace-1=[]
|
||||
switch-to-workspace-last=[]
|
||||
switch-group=[]
|
||||
switch-windows=[]
|
||||
switch-panels=[]
|
||||
cycle-group=[]
|
||||
cycle-windows=[]
|
||||
cycle-panels=[]
|
||||
activate-window-menu=[]
|
||||
toggle-maximized=[]
|
||||
minimize=[]
|
||||
maximize=[]
|
||||
unmaximize=[]
|
||||
begin-move=[]
|
||||
begin-resize=[]
|
||||
move-to-workspace-1=[]
|
||||
move-to-workspace-left=[]
|
||||
move-to-workspace-right=[]
|
||||
move-to-workspace-up=[]
|
||||
move-to-workspace-down=[]
|
||||
move-to-workspace-last=[]
|
||||
move-to-monitor-left=[]
|
||||
move-to-monitor-right=[]
|
||||
move-to-monitor-up=[]
|
||||
move-to-monitor-down=[]
|
||||
close=[]
|
||||
panel-main-menu=[]
|
||||
panel-run-dialog=[]
|
||||
switch-applications=[]
|
||||
switch-input-source=[]
|
@ -0,0 +1,6 @@
|
||||
[org.gnome.desktop.wm.preferences]
|
||||
button-layout=':'
|
||||
action-right-click-titlebar='none'
|
||||
num-workspaces=1
|
||||
theme='Anaconda'
|
||||
mouse-button-modifier=''
|
@ -0,0 +1,958 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This is a copy of the Clearlooks theme, with normal_maximized modified
|
||||
to hide the titlebar.
|
||||
-->
|
||||
<metacity_theme>
|
||||
<info>
|
||||
<name>Anaconda</name>
|
||||
<author>Daniel Borgmann <daniel.borgmann@gmail.com>, Andrea Cimitan <andrea.cimitan@gmail.com></author>
|
||||
<copyright>Â 2005-2007 Daniel Borgmann, Andrea Cimitan</copyright>
|
||||
<date>Apr, 2007</date>
|
||||
<description>The Clearlooks "Gummy" Metacity Theme</description>
|
||||
</info>
|
||||
|
||||
<!-- ::: GEOMETRY ::: -->
|
||||
<frame_geometry name="normal" rounded_top_left="true" rounded_top_right="true" rounded_bottom_left="false" rounded_bottom_right="false">
|
||||
<distance name="left_width" value="4"/>
|
||||
<distance name="right_width" value="4"/>
|
||||
<distance name="bottom_height" value="4"/>
|
||||
<distance name="left_titlebar_edge" value="4"/>
|
||||
<distance name="right_titlebar_edge" value="4"/>
|
||||
<aspect_ratio name="button" value="1.0"/>
|
||||
<distance name="title_vertical_pad" value="0"/>
|
||||
<border name="title_border" left="2" right="2" top="4" bottom="3"/>
|
||||
<border name="button_border" left="1" right="1" top="2" bottom="2"/>
|
||||
</frame_geometry>
|
||||
|
||||
<frame_geometry name="shaded" parent="normal" rounded_top_left="true" rounded_top_right="true" rounded_bottom_left="true" rounded_bottom_right="true"/>
|
||||
|
||||
<frame_geometry name="normal_maximized" parent="normal" rounded_top_left="false" rounded_top_right="false" rounded_bottom_left="false" rounded_bottom_right="false" has_title="false">
|
||||
<!-- strip frame spacing off the normal geometry when maximised -->
|
||||
<distance name="left_width" value="0"/>
|
||||
<distance name="right_width" value="0"/>
|
||||
<distance name="bottom_height" value="1"/>
|
||||
<distance name="left_titlebar_edge" value="1"/>
|
||||
<distance name="right_titlebar_edge" value="1"/>
|
||||
<border name="title_border" left="0" right="0" top="0" bottom="0"/>
|
||||
<border name="button_border" left="0" right="0" top="0" bottom="0"/>
|
||||
</frame_geometry>
|
||||
|
||||
<frame_geometry name="utility" title_scale="small" rounded_top_left="false" rounded_top_right="false" rounded_bottom_left="false" rounded_bottom_right="false">
|
||||
<distance name="left_width" value="4"/>
|
||||
<distance name="right_width" value="4"/>
|
||||
<distance name="bottom_height" value="4"/>
|
||||
<distance name="left_titlebar_edge" value="4"/>
|
||||
<distance name="right_titlebar_edge" value="4"/>
|
||||
<distance name="title_vertical_pad" value="0"/>
|
||||
<border name="title_border" left="2" right="2" top="4" bottom="3"/>
|
||||
<border name="button_border" left="0" right="0" top="2" bottom="2"/>
|
||||
<aspect_ratio name="button" value="1"/>
|
||||
</frame_geometry>
|
||||
|
||||
<frame_geometry name="border" has_title="false">
|
||||
<distance name="left_width" value="4"/>
|
||||
<distance name="right_width" value="4"/>
|
||||
<distance name="bottom_height" value="4"/>
|
||||
<distance name="left_titlebar_edge" value="0"/>
|
||||
<distance name="right_titlebar_edge" value="0"/>
|
||||
<distance name="button_width" value="0"/>
|
||||
<distance name="button_height" value="0"/>
|
||||
<distance name="title_vertical_pad" value="4"/>
|
||||
<border name="title_border" left="0" right="0" top="0" bottom="0"/>
|
||||
<border name="button_border" left="0" right="0" top="0" bottom="0"/>
|
||||
</frame_geometry>
|
||||
|
||||
<!-- button minimum size -->
|
||||
<constant name="Bmin" value="7"/>
|
||||
<!-- button inside padding -->
|
||||
<constant name="Bpad" value="6"/>
|
||||
|
||||
<!-- ::: CORNERS ::: -->
|
||||
<draw_ops name="corners_outline_selected_top">
|
||||
<!-- top left -->
|
||||
<line color="shade/gtk:bg[SELECTED]/0.6" x1="1" y1="3" x2="1" y2="3"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.73" x1="1" y1="4" x2="1" y2="4"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.6" x1="2" y1="2" x2="2" y2="2"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.6" x1="3" y1="1" x2="3" y2="1"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.73" x1="4" y1="1" x2="4" y2="1"/>
|
||||
|
||||
<!-- top right -->
|
||||
<line color="shade/gtk:bg[SELECTED]/0.6" x1="width-2" y1="3" x2="width-2" y2="3"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.73" x1="width-2" y1="4" x2="width-2" y2="4"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.6" x1="width-3" y1="2" x2="width-3" y2="2"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.6" x1="width-4" y1="1" x2="width-4" y2="1"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.73" x1="width-5" y1="1" x2="width-5" y2="1"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="corners_outline_top">
|
||||
<!-- top left -->
|
||||
<line color="shade/gtk:bg[NORMAL]/0.55" x1="1" y1="3" x2="1" y2="3"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.68" x1="1" y1="4" x2="1" y2="4"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.55" x1="2" y1="2" x2="2" y2="2"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.55" x1="3" y1="1" x2="3" y2="1"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.68" x1="4" y1="1" x2="4" y2="1"/>
|
||||
|
||||
<!-- top right -->
|
||||
<line color="shade/gtk:bg[NORMAL]/0.55" x1="width-2" y1="3" x2="width-2" y2="3"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.68" x1="width-2" y1="4" x2="width-2" y2="4"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.55" x1="width-3" y1="2" x2="width-3" y2="2"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.55" x1="width-4" y1="1" x2="width-4" y2="1"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.68" x1="width-5" y1="1" x2="width-5" y2="1"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="corners_outline_selected_bottom">
|
||||
<!-- bottom left -->
|
||||
<line color="shade/gtk:bg[SELECTED]/0.6" x1="1" y1="height-4" x2="1" y2="height-5"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.6" x1="2" y1="height-3" x2="2" y2="height-3"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.6" x1="2" y1="height-2" x2="4" y2="height-2"/>
|
||||
|
||||
<!-- bottom right -->
|
||||
<line color="shade/gtk:bg[SELECTED]/0.6" x1="width-2" y1="height-4" x2="width-2" y2="height-5"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.6" x1="width-3" y1="height-3" x2="width-3" y2="height-3"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.6" x1="width-4" y1="height-2" x2="width-5" y2="height-2"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="corners_outline_bottom">
|
||||
<!-- bottom left -->
|
||||
<line color="shade/gtk:bg[NORMAL]/0.55" x1="1" y1="height-4" x2="1" y2="height-5"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.55" x1="2" y1="height-3" x2="2" y2="height-3"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.55" x1="2" y1="height-2" x2="4" y2="height-2"/>
|
||||
|
||||
<!-- bottom right -->
|
||||
<line color="shade/gtk:bg[NORMAL]/0.55" x1="width-2" y1="height-4" x2="width-2" y2="height-5"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.55" x1="width-3" y1="height-3" x2="width-3" y2="height-3"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.55" x1="width-4" y1="height-2" x2="width-5" y2="height-2"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="corners_highlight">
|
||||
<!-- ** corner highlight for left top ** -->
|
||||
<line color="shade/gtk:bg[SELECTED]/1.18" x1="2" y1="3" x2="2" y2="4"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/1.18" x1="3" y1="2" x2="4" y2="2"/>
|
||||
|
||||
<!-- ** corner highlight for right top ** -->
|
||||
<line color="shade/gtk:bg[SELECTED]/0.98" x1="width-3" y1="3" x2="width-3" y2="4"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/1.16" x1="width-5" y1="2" x2="width-4" y2="2"/>
|
||||
|
||||
<!-- ** corner highlight for left bottom ** -->
|
||||
<!--<line color="shade/gtk:bg[NORMAL]/1.3" x1="2" y1="height-4" x2="2" y2="height-5"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.88" x1="3" y1="height-3" x2="4" y2="height-3"/>-->
|
||||
|
||||
<!-- ** corner highlight for right bottom ** -->
|
||||
<!--<line color="shade/gtk:bg[NORMAL]/0.88" x1="width-3" y1="height-4" x2="width-3" y2="height-5"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.88" x1="width-4" y1="height-3" x2="width-5" y2="height-3"/>-->
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="corners_highlight_unfocused">
|
||||
<!-- ** corner highlight for left top ** -->
|
||||
<line color="shade/gtk:bg[NORMAL]/1.05" x1="2" y1="3" x2="2" y2="4"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/1.05" x1="3" y1="2" x2="4" y2="2"/>
|
||||
|
||||
<!-- ** corner highlight for right top ** -->
|
||||
<line color="shade/gtk:bg[NORMAL]/0.88" x1="width-3" y1="3" x2="width-3" y2="4"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/1.04" x1="width-5" y1="2" x2="width-4" y2="2"/>
|
||||
|
||||
<!-- ** corner highlight for left bottom ** -->
|
||||
<!--<line color="shade/gtk:bg[NORMAL]/1.3" x1="2" y1="height-4" x2="2" y2="height-5"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.88" x1="3" y1="height-3" x2="4" y2="height-3"/>-->
|
||||
|
||||
<!-- ** corner highlight for right bottom ** -->
|
||||
<!--<line color="shade/gtk:bg[NORMAL]/0.88" x1="width-3" y1="height-4" x2="width-3" y2="height-5"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.88" x1="width-4" y1="height-3" x2="width-5" y2="height-3"/>-->
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="corners_highlight_shaded">
|
||||
<!-- ** corner highlight for left top ** -->
|
||||
<line color="shade/gtk:bg[SELECTED]/1.18" x1="2" y1="3" x2="2" y2="4"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/1.18" x1="3" y1="2" x2="4" y2="2"/>
|
||||
|
||||
<!-- ** corner highlight for right top ** -->
|
||||
<line color="shade/gtk:bg[SELECTED]/0.98" x1="width-3" y1="3" x2="width-3" y2="4"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/1.16" x1="width-5" y1="2" x2="width-4" y2="2"/>
|
||||
|
||||
<!-- ** corner highlight for left bottom ** -->
|
||||
<line color="shade/gtk:bg[SELECTED]/1.08" x1="2" y1="height-4" x2="2" y2="height-5"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.98" x1="3" y1="height-3" x2="4" y2="height-3"/>
|
||||
|
||||
<!-- ** corner highlight for right bottom ** -->
|
||||
<line color="shade/gtk:bg[SELECTED]/0.98" x1="width-3" y1="height-4" x2="width-3" y2="height-5"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.98" x1="width-4" y1="height-3" x2="width-5" y2="height-3"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="corners_highlight_shaded_unfocused">
|
||||
<!-- ** corner highlight for left top ** -->
|
||||
<line color="shade/gtk:bg[NORMAL]/1.05" x1="2" y1="3" x2="2" y2="4"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/1.05" x1="3" y1="2" x2="4" y2="2"/>
|
||||
|
||||
<!-- ** corner highlight for right top ** -->
|
||||
<line color="shade/gtk:bg[NORMAL]/0.88" x1="width-3" y1="3" x2="width-3" y2="4"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/1.04" x1="width-5" y1="2" x2="width-4" y2="2"/>
|
||||
|
||||
<!-- ** corner highlight for left bottom ** -->
|
||||
<line color="shade/gtk:bg[NORMAL]/1.02" x1="2" y1="height-4" x2="2" y2="height-5"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.88" x1="3" y1="height-3" x2="4" y2="height-3"/>
|
||||
|
||||
<!-- ** corner highlight for right bottom ** -->
|
||||
<line color="shade/gtk:bg[NORMAL]/0.88" x1="width-3" y1="height-4" x2="width-3" y2="height-5"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.88" x1="width-4" y1="height-3" x2="width-5" y2="height-3"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="window_bg">
|
||||
<rectangle color="gtk:bg[NORMAL]" filled="true" x="0" y="0" width="width" height="height"/>
|
||||
</draw_ops>
|
||||
|
||||
<!-- ::: BEVEL FOCUSED ::: -->
|
||||
<draw_ops name="bevel">
|
||||
<include name="window_bg"/>
|
||||
<!-- ** titlebar outline ** -->
|
||||
<rectangle color="shade/gtk:bg[SELECTED]/0.55" filled="false" x="0" y="0" width="width - 1" height="((title_height + 6) `max` (top_height - 2))"/>
|
||||
|
||||
<!-- ** 3d beveled frame ** -->
|
||||
<line color="shade/gtk:bg[NORMAL]/0.88" x1="1" y1="height - 2" x2="width - 2" y2="height - 2"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.88" x1="width - 2" y1="3" x2="width - 2" y2="height - 2"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/1.2" x1="3" y1="1" x2="width - 4" y2="1"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/1.2" x1="1" y1="3" x2="1" y2="height - 2"/>
|
||||
|
||||
<line color="shade/gtk:bg[SELECTED]/0.94" x1="2" y1="((title_height + 5) `max` (top_height - 3))" x2="width - 3" y2="((title_height + 5) `max` (top_height - 3))"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.95" x1="width - 2" y1="2" x2="width - 2" y2="((title_height + 6) `max` (top_height - 2))"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/1.18" x1="1" y1="1" x2="width - 2" y2="1"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/1.1" x1="1" y1="2" x2="1" y2="((title_height + 5) `max` (top_height - 3))"/>
|
||||
|
||||
<!-- ** fancy gradient ** -->
|
||||
<gradient type="vertical" x="2" y="top_height/2" width="width-4" height="top_height/2-1">
|
||||
<color value="shade/gtk:bg[SELECTED]/1.0"/>
|
||||
<color value="shade/gtk:bg[SELECTED]/0.94"/>
|
||||
</gradient>
|
||||
<gradient type="vertical" x="2" y="2" width="width-4" height="top_height/2-2">
|
||||
<color value="shade/gtk:bg[SELECTED]/1.08"/>
|
||||
<color value="shade/gtk:bg[SELECTED]/1.02"/>
|
||||
</gradient>
|
||||
|
||||
<line color="shade/gtk:bg[SELECTED]/0.7" x1="1" y1="((title_height + 6) `max` (top_height - 2))" x2="width - 2" y2="((title_height + 6) `max` (top_height - 2))"/>
|
||||
|
||||
<!-- ** border outline ** -->
|
||||
<line color="shade/gtk:bg[NORMAL]/0.45" x1="0" y1="((title_height + 6) `max` (top_height - 2))" x2="0" y2="height"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.45" x1="width - 1" y1="((title_height + 6) `max` (top_height - 2))" x2="width - 1" y2="height"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.45" x1="1" y1="height - 1" x2="width - 2" y2="height - 1"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="bevel_maximized">
|
||||
<!-- ** 3d beveled frame ** -->
|
||||
<line color="shade/gtk:bg[SELECTED]/0.55" x1="0" y1="0" x2="width" y2="0"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/1.18" x1="0" y1="1" x2="width" y2="1"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.94" x1="0" y1="((title_height + 5) `max` (top_height - 3))" x2="width" y2="((title_height + 5) `max` (top_height - 3))"/>
|
||||
|
||||
<!-- ** fancy gradient ** -->
|
||||
<gradient type="vertical" x="0" y="top_height/2" width="width" height="top_height/2-1">
|
||||
<color value="shade/gtk:bg[SELECTED]/1.0"/>
|
||||
<color value="shade/gtk:bg[SELECTED]/0.94"/>
|
||||
</gradient>
|
||||
<gradient type="vertical" x="0" y="1" width="width" height="top_height/2-1">
|
||||
<color value="shade/gtk:bg[SELECTED]/1.08"/>
|
||||
<color value="shade/gtk:bg[SELECTED]/1.02"/>
|
||||
</gradient>
|
||||
|
||||
<line color="shade/gtk:bg[SELECTED]/0.7" x1="0" y1="((title_height + 6) `max` (top_height - 2))" x2="width" y2="((title_height + 6) `max` (top_height - 2))"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.55" x1="0" y1="height-1" x2="width" y2="height-1"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="round_bevel">
|
||||
<include name="bevel"/>
|
||||
<include name="corners_outline_selected_top"/>
|
||||
<!--<include name="corners_outline_bottom"/>-->
|
||||
<include name="corners_highlight"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="bevel_shaded">
|
||||
<include name="bevel"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.6" x1="0" y1="height-1" x2="width" y2="height-1"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="round_bevel_shaded">
|
||||
<include name="bevel"/>
|
||||
<include name="corners_outline_selected_top"/>
|
||||
<include name="corners_outline_selected_bottom"/>
|
||||
<include name="corners_highlight_shaded"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.6" x1="5" y1="height-1" x2="width-6" y2="height-1"/>
|
||||
</draw_ops>
|
||||
|
||||
<!-- ::: BEVEL UNFOCUSED ::: -->
|
||||
<draw_ops name="bevel_unfocused">
|
||||
<include name="window_bg"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.88" x1="1" y1="height - 2" x2="width - 2" y2="height - 2"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.88" x1="width - 2" y1="2" x2="width - 2" y2="height - 2"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/1.05" x1="1" y1="1" x2="width - 2" y2="1"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/1.03" x1="1" y1="2" x2="1" y2="height - 2"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.89" x1="2" y1="((title_height + 5) `max` (top_height - 3))" x2="width - 3" y2="((title_height + 5) `max` (top_height - 3))"/>
|
||||
|
||||
<!-- ** fancy gradient ** -->
|
||||
<gradient type="vertical" x="2" y="top_height/2" width="width-4" height="top_height/2-1">
|
||||
<color value="shade/gtk:bg[NORMAL]/0.93"/>
|
||||
<color value="shade/gtk:bg[NORMAL]/0.89"/>
|
||||
</gradient>
|
||||
<gradient type="vertical" x="2" y="2" width="width-4" height="top_height/2-2">
|
||||
<color value="shade/gtk:bg[NORMAL]/0.99"/>
|
||||
<color value="shade/gtk:bg[NORMAL]/0.95"/>
|
||||
</gradient>
|
||||
|
||||
<line color="shade/gtk:bg[NORMAL]/0.65" x1="1" y1="((title_height + 6) `max` (top_height - 2))" x2="width - 2" y2="((title_height + 6) `max` (top_height - 2))"/>
|
||||
<rectangle color="shade/gtk:bg[NORMAL]/0.55" filled="false" x="0" y="0" width="width - 1" height="height - 1"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="bevel_maximized_unfocused">
|
||||
<!-- ** 3d beveled frame ** -->
|
||||
<line color="shade/gtk:bg[NORMAL]/0.55" x1="0" y1="0" x2="width" y2="0"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/1.05" x1="0" y1="1" x2="width" y2="1"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.89" x1="0" y1="((title_height + 5) `max` (top_height - 3))" x2="width" y2="((title_height + 5) `max` (top_height - 3))"/>
|
||||
|
||||
<!-- ** fancy gradient ** -->
|
||||
<gradient type="vertical" x="0" y="top_height/2" width="width" height="top_height/2-1">
|
||||
<color value="shade/gtk:bg[NORMAL]/0.93"/>
|
||||
<color value="shade/gtk:bg[NORMAL]/0.89"/>
|
||||
</gradient>
|
||||
<gradient type="vertical" x="0" y="2" width="width" height="top_height/2-2">
|
||||
<color value="shade/gtk:bg[NORMAL]/0.99"/>
|
||||
<color value="shade/gtk:bg[NORMAL]/0.95"/>
|
||||
</gradient>
|
||||
|
||||
<line color="shade/gtk:bg[NORMAL]/0.65" x1="0" y1="((title_height + 6) `max` (top_height - 2))" x2="width" y2="((title_height + 6) `max` (top_height - 2))"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.55" x1="0" y1="height-1" x2="width" y2="height-1"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="round_bevel_unfocused">
|
||||
<include name="bevel_unfocused"/>
|
||||
<include name="corners_outline_top"/>
|
||||
<!--<include name="corners_outline_bottom"/>-->
|
||||
<include name="corners_highlight_unfocused"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="round_bevel_unfocused_shaded">
|
||||
<include name="bevel_unfocused"/>
|
||||
<include name="corners_outline_top"/>
|
||||
<include name="corners_outline_bottom"/>
|
||||
<include name="corners_highlight_shaded_unfocused"/>
|
||||
</draw_ops>
|
||||
|
||||
<!-- ::: BORDER ::: -->
|
||||
<draw_ops name="border">
|
||||
<line color="shade/gtk:bg[NORMAL]/0.88" x1="1" y1="height - 2" x2="width - 2" y2="height - 2"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.88" x1="width - 2" y1="1" x2="width - 2" y2="height - 2"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/1.2" x1="1" y1="1" x2="width - 2" y2="1"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/1.2" x1="1" y1="1" x2="1" y2="height - 2"/>
|
||||
|
||||
<rectangle color="shade/gtk:bg[NORMAL]/0.55" filled="false" x="0" y="0" width="width - 1" height="height - 1"/>
|
||||
</draw_ops>
|
||||
|
||||
<!-- ::: TITLES ::: -->
|
||||
<draw_ops name="title_text">
|
||||
<title color="shade/gtk:bg[SELECTED]/0.7" x="((3 `max` (width-title_width)) / 2)" y="(((height - title_height) / 2) `max` 0) + 1"/>
|
||||
<title color="shade/gtk:bg[SELECTED]/0.7" x="((3 `max` (width-title_width)) / 2)+1" y="(((height - title_height) / 2) `max` 0)"/>
|
||||
<title color="shade/gtk:bg[SELECTED]/0.7" x="((3 `max` (width-title_width)) / 2)-1" y="(((height - title_height) / 2) `max` 0)"/>
|
||||
<title color="shade/gtk:bg[SELECTED]/0.7" x="((3 `max` (width-title_width)) / 2)" y="(((height - title_height) / 2) `max` 0)-1"/>
|
||||
<title color="#FFFFFF" x="(3 `max` (width-title_width)) / 2" y="(((height - title_height) / 2) `max` 0)"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="title_text_unfocused">
|
||||
<!--<title color="shade/gtk:bg[NORMAL]/1.07" x="5 `max` (width-title_width)/2+1" y="1 `max` ((height-title_height)/2)+1"/>-->
|
||||
<title color="blend/gtk:fg[NORMAL]/gtk:bg[NORMAL]/0.45" x="4 `max` (width-title_width)/2" y="0 `max` ((height-title_height)/2)"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="title">
|
||||
<include name="title_text"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="title_unfocused">
|
||||
<include name="title_text_unfocused"/>
|
||||
</draw_ops>
|
||||
|
||||
<!-- ::: BUTTONS ::: -->
|
||||
<draw_ops name="button_bg">
|
||||
<!-- inset -->
|
||||
<gradient type="vertical" x="0" y="3" width="width" height="height-6">
|
||||
<color value="shade/gtk:bg[SELECTED]/0.96"/>
|
||||
<color value="shade/gtk:bg[SELECTED]/1.05"/>
|
||||
</gradient>
|
||||
|
||||
<line color="shade/gtk:bg[SELECTED]/1.00" x1="2" y1="0" x2="width-3" y2="0"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.99" x1="1" y1="1" x2="width-2" y2="1"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.99" x1="0" y1="2" x2="width-1" y2="2"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.98" x1="3" y1="0" x2="width-4" y2="0"/>
|
||||
|
||||
<line color="shade/gtk:bg[SELECTED]/0.91" x1="2" y1="1" x2="width-3" y2="1"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.90" x1="1" y1="2" x2="width-2" y2="2"/>
|
||||
|
||||
<line color="shade/gtk:bg[SELECTED]/1.03" x1="2" y1="height-1" x2="width-3" y2="height-1"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/1.00" x1="1" y1="height-2" x2="width-2" y2="height-2"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/1.01" x1="0" y1="height-3" x2="width-1" y2="height-3"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/1.06" x1="3" y1="height-1" x2="width-4" y2="height-1"/>
|
||||
|
||||
<line color="shade/gtk:bg[SELECTED]/1.02" x1="2" y1="height-2" x2="width-3" y2="height-2"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/1.03" x1="1" y1="height-3" x2="width-2" y2="height-3"/>
|
||||
|
||||
<!-- border outline -->
|
||||
<line color="shade/gtk:bg[SELECTED]/0.6" x1="3" y1="1" x2="width-4" y2="1"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.6" x1="3" y1="height-2" x2="width-4" y2="height-2"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.6" x1="1" y1="3" x2="1" y2="height-4"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.6" x1="width-2" y1="3" x2="width-2" y2="height-4"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.6" x1="2" y1="2" x2="width-3" y2="2"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.6" x1="2" y1="height-3" x2="width-3" y2="height-3"/>
|
||||
|
||||
<!-- border smooth effect -->
|
||||
<line color="shade/gtk:bg[SELECTED]/1.02" x1="3" y1="2" x2="width-4" y2="2"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/1.00" x1="2" y1="3" x2="2" y2="height-4"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.90" x1="width-3" y1="3" x2="width-3" y2="height-4"/>
|
||||
|
||||
<!-- inside highlight -->
|
||||
<line color="shade/gtk:bg[SELECTED]/1.18" x1="4" y1="2" x2="width-5" y2="2"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/1.1" x1="2" y1="4" x2="2" y2="height-5"/>
|
||||
<!-- inside shadow -->
|
||||
<line color="shade/gtk:bg[SELECTED]/1.0" x1="width-3" y1="4" x2="width-3" y2="height-5"/>
|
||||
|
||||
<!-- fill gradient -->
|
||||
<gradient type="vertical" x="3" y="3" width="width-6" height="(height)/2-1">
|
||||
<color value="shade/gtk:bg[SELECTED]/1.1"/>
|
||||
<color value="shade/gtk:bg[SELECTED]/1.02"/>
|
||||
</gradient>
|
||||
<gradient type="vertical" x="3" y="(height)/2" width="width-6" height="(height)/2-2">
|
||||
<color value="shade/gtk:bg[SELECTED]/1.0"/>
|
||||
<color value="shade/gtk:bg[SELECTED]/0.92"/>
|
||||
</gradient>
|
||||
|
||||
<!-- bottom border smooth effect -->
|
||||
<line color="shade/gtk:bg[SELECTED]/0.84" x1="3" y1="height-3" x2="width-4" y2="height-3"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.92" x1="4" y1="height-3" x2="width-5" y2="height-3"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="button_bg_unfocused">
|
||||
<!-- inset -->
|
||||
<gradient type="vertical" x="0" y="3" width="width" height="height-6">
|
||||
<color value="shade/gtk:bg[NORMAL]/0.92"/>
|
||||
<color value="shade/gtk:bg[NORMAL]/0.96"/>
|
||||
</gradient>
|
||||
|
||||
<line color="shade/gtk:bg[NORMAL]/0.93" x1="2" y1="0" x2="width-3" y2="0"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.92" x1="1" y1="1" x2="width-2" y2="1"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.92" x1="0" y1="2" x2="width-1" y2="2"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.91" x1="3" y1="0" x2="width-4" y2="0"/>
|
||||
|
||||
<line color="shade/gtk:bg[NORMAL]/0.87" x1="2" y1="1" x2="width-3" y2="1"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.86" x1="1" y1="2" x2="width-2" y2="2"/>
|
||||
|
||||
<line color="shade/gtk:bg[NORMAL]/0.945" x1="2" y1="height-1" x2="width-3" y2="height-1"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.93" x1="1" y1="height-2" x2="width-2" y2="height-2"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.935" x1="0" y1="height-3" x2="width-1" y2="height-3"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.96" x1="3" y1="height-1" x2="width-4" y2="height-1"/>
|
||||
|
||||
<line color="shade/gtk:bg[NORMAL]/0.94" x1="2" y1="height-2" x2="width-3" y2="height-2"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.95" x1="1" y1="height-3" x2="width-2" y2="height-3"/>
|
||||
|
||||
<!-- border outline -->
|
||||
<line color="shade/gtk:bg[NORMAL]/0.6" x1="3" y1="1" x2="width-4" y2="1"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.6" x1="3" y1="height-2" x2="width-4" y2="height-2"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.6" x1="1" y1="3" x2="1" y2="height-4"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.6" x1="width-2" y1="3" x2="width-2" y2="height-4"/>
|
||||
|
||||
<line color="shade/gtk:bg[NORMAL]/0.6" x1="2" y1="2" x2="width-3" y2="2"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.6" x1="2" y1="height-3" x2="width-3" y2="height-3"/>
|
||||
|
||||
<!-- border smooth effect -->
|
||||
<line color="shade/gtk:bg[NORMAL]/1.02" x1="3" y1="2" x2="width-4" y2="2"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/1.00" x1="2" y1="3" x2="2" y2="height-4"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.95" x1="width-3" y1="3" x2="width-3" y2="height-4"/>
|
||||
|
||||
<!-- inside highlight -->
|
||||
<line color="shade/gtk:bg[NORMAL]/1.2" x1="4" y1="2" x2="width-5" y2="2"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/1.1" x1="2" y1="4" x2="2" y2="height-5"/>
|
||||
<!-- inside shadow -->
|
||||
<line color="shade/gtk:bg[NORMAL]/1.05" x1="width-3" y1="4" x2="width-3" y2="height-5"/>
|
||||
|
||||
<!-- fill gradient -->
|
||||
<gradient type="vertical" x="3" y="3" width="width-6" height="(height)/2-1">
|
||||
<color value="shade/gtk:bg[NORMAL]/1.15"/>
|
||||
<color value="shade/gtk:bg[NORMAL]/1.07"/>
|
||||
</gradient>
|
||||
<gradient type="vertical" x="3" y="(height)/2" width="width-6" height="(height)/2-2">
|
||||
<color value="shade/gtk:bg[NORMAL]/1.05"/>
|
||||
<color value="shade/gtk:bg[NORMAL]/0.97"/>
|
||||
</gradient>
|
||||
|
||||
<!-- bottom border smooth effect -->
|
||||
<line color="shade/gtk:bg[NORMAL]/0.89" x1="3" y1="height-3" x2="width-4" y2="height-3"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.97" x1="4" y1="height-3" x2="width-5" y2="height-3"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="button_bg_prelight">
|
||||
<include name="button_bg"/>
|
||||
<tint color="shade/gtk:bg[SELECTED]/1.5" alpha="0.2" x="3" y="3" width="width-5" height="height-5"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.6" x1="width-3" y1="height-3" x2="width-3" y2="height-3"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="button_bg_pressed">
|
||||
<!-- outside highlight -->
|
||||
<gradient type="vertical" x="width-2" y="2" width="1" height="height-4">
|
||||
<color value="shade/gtk:bg[SELECTED]/1.2"/>
|
||||
<color value="shade/gtk:bg[SELECTED]/1.0"/>
|
||||
</gradient>
|
||||
<gradient type="vertical" x="width-1" y="3" width="1" height="height-6">
|
||||
<color value="shade/gtk:bg[SELECTED]/1.2"/>
|
||||
<color value="shade/gtk:bg[SELECTED]/1.0"/>
|
||||
</gradient>
|
||||
<line color="shade/gtk:bg[SELECTED]/1.0" x1="2" y1="height-2" x2="width-3" y2="height-2"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/1.0" x1="3" y1="height-1" x2="width-4" y2="height-1"/>
|
||||
|
||||
<!-- border outline -->
|
||||
<line color="shade/gtk:bg[SELECTED]/0.55" x1="3" y1="1" x2="width-4" y2="1"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.55" x1="3" y1="height-2" x2="width-4" y2="height-2"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.55" x1="1" y1="3" x2="1" y2="height-4"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.55" x1="width-2" y1="3" x2="width-2" y2="height-4"/>
|
||||
|
||||
<line color="shade/gtk:bg[SELECTED]/0.55" x1="2" y1="2" x2="width-3" y2="2"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.55" x1="2" y1="height-3" x2="width-3" y2="height-3"/>
|
||||
|
||||
<!-- inside shadow -->
|
||||
<line color="shade/gtk:bg[SELECTED]/0.9" x1="3" y1="2" x2="width-4" y2="2"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.85" x1="2" y1="3" x2="2" y2="height-4"/>
|
||||
|
||||
<!-- fill gradient -->
|
||||
<gradient type="vertical" x="3" y="3" width="width-5" height="height-6">
|
||||
<color value="shade/gtk:bg[SELECTED]/0.95"/>
|
||||
<color value="shade/gtk:bg[SELECTED]/0.9"/>
|
||||
</gradient>
|
||||
|
||||
<line color="shade/gtk:bg[SELECTED]/0.9" x1="3" y1="height-3" x2="width-4" y2="height-3"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="button_bg_unfocused_prelight">
|
||||
<include name="button_bg_unfocused"/>
|
||||
<tint color="shade/gtk:bg[NORMAL]/1.5" alpha="0.3" x="3" y="3" width="width-5" height="height-5"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.6" x1="width-3" y1="height-3" x2="width-3" y2="height-3"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="button_bg_unfocused_pressed">
|
||||
<!-- outside highlight -->
|
||||
<gradient type="vertical" x="width-2" y="2" width="1" height="height-4">
|
||||
<color value="shade/gtk:bg[NORMAL]/1.25"/>
|
||||
<color value="shade/gtk:bg[NORMAL]/1.05"/>
|
||||
</gradient>
|
||||
<gradient type="vertical" x="width-1" y="3" width="1" height="height-6">
|
||||
<color value="shade/gtk:bg[NORMAL]/1.25"/>
|
||||
<color value="shade/gtk:bg[NORMAL]/1.05"/>
|
||||
</gradient>
|
||||
<line color="shade/gtk:bg[NORMAL]/1.05" x1="2" y1="height-2" x2="width-3" y2="height-2"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/1.05" x1="3" y1="height-1" x2="width-4" y2="height-1"/>
|
||||
|
||||
<!-- border outline -->
|
||||
<line color="shade/gtk:bg[NORMAL]/0.55" x1="3" y1="1" x2="width-4" y2="1"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.55" x1="3" y1="height-2" x2="width-4" y2="height-2"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.55" x1="1" y1="3" x2="1" y2="height-4"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.55" x1="width-2" y1="3" x2="width-2" y2="height-4"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.55" x1="2" y1="2" x2="width-3" y2="2"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.55" x1="2" y1="height-3" x2="width-3" y2="height-3"/>
|
||||
|
||||
<!-- inside shadow -->
|
||||
<line color="shade/gtk:bg[NORMAL]/0.8" x1="3" y1="2" x2="width-4" y2="2"/>
|
||||
<line color="shade/gtk:bg[NORMAL]/0.75" x1="2" y1="3" x2="2" y2="height-4"/>
|
||||
|
||||
<!-- fill gradient -->
|
||||
<gradient type="vertical" x="3" y="3" width="width-5" height="height-6">
|
||||
<color value="shade/gtk:bg[NORMAL]/0.9"/>
|
||||
<color value="shade/gtk:bg[NORMAL]/0.85"/>
|
||||
</gradient>
|
||||
|
||||
<line color="shade/gtk:bg[NORMAL]/0.85" x1="3" y1="height-3" x2="width-4" y2="height-3"/>
|
||||
</draw_ops>
|
||||
|
||||
<!-- ::: ICONS ::: -->
|
||||
<!--
|
||||
using a minimum icon size until there is a proper way to specify relative sizes
|
||||
unfortunately it's logically impossible to always center the icons on non-square
|
||||
buttons (utility windows) without distortion.
|
||||
|
||||
icon_size = (Bmin`max`height-Bpad*2)
|
||||
hpadding = (width - icon_size) / 2 = ((width-(Bmin`max`height-Bpad*2))/2)
|
||||
vpadding = (height - icon_size) / 2 = ((height-(Bmin`max`height-Bpad*2))/2)
|
||||
-->
|
||||
|
||||
<!-- menu icon -->
|
||||
<draw_ops name="menu_button_icon">
|
||||
<!--<icon x="0" y="0" width="width" height="height"/>-->
|
||||
<icon x="(width-mini_icon_width)/2" y="(height-mini_icon_height)/2" width="mini_icon_width" height="mini_icon_height"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="menu_button_icon_unfocused">
|
||||
<!--<icon x="0" y="0" width="width" height="height" alpha="0.5"/>-->
|
||||
<icon x="(width-mini_icon_width)/2" y="(height-mini_icon_height)/2" width="mini_icon_width" height="mini_icon_height"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="menu_button_normal">
|
||||
<include name="menu_button_icon"/>
|
||||
</draw_ops>
|
||||
<draw_ops name="menu_button_pressed">
|
||||
<include name="menu_button_icon"/>
|
||||
</draw_ops>
|
||||
<draw_ops name="menu_button_unfocused">
|
||||
<include name="menu_button_icon_unfocused"/>
|
||||
</draw_ops>
|
||||
|
||||
<!-- close icon -->
|
||||
<draw_ops name="close_button_icon">
|
||||
<!-- outside border -->
|
||||
|
||||
<!-- main cross -->
|
||||
<line color="shade/gtk:bg[SELECTED]/0.7" width="4"
|
||||
x1="((width-(Bmin`max`height-Bpad*2))/2)" y1="((height-(Bmin`max`height-Bpad*2))/2)"
|
||||
x2="width - ((width-(Bmin`max`height-Bpad*2))/2) - 1" y2="height - ((height-(Bmin`max`height-Bpad*2))/2) - 1"/>
|
||||
<line color="shade/gtk:bg[SELECTED]/0.7" width="4"
|
||||
x1="((width-(Bmin`max`height-Bpad*2))/2)" y1="height - ((height-(Bmin`max`height-Bpad*2))/2) - 1"
|
||||
x2="width - ((width-(Bmin`max`height-Bpad*2))/2) - 1" y2="((height-(Bmin`max`height-Bpad*2))/2)"/>
|
||||
<!-- top-left -->
|
||||
<tint color="shade/gtk:bg[SELECTED]/0.7" alpha="1.0"
|
||||
x="((width-(Bmin`max`height-Bpad*2))/2)" y="((height-(Bmin`max`height-Bpad*2))/2)-1"
|
||||
width="2" height="1"/>
|
||||
<tint color="shade/gtk:bg[SELECTED]/0.7" alpha="1.0"
|
||||
x="((width-(Bmin`max`height-Bpad*2))/2)-1" y="((height-(Bmin`max`height-Bpad*2))/2)/1"
|
||||
width="1" height="2"/>
|
||||
<!-- top-right -->
|
||||
<tint color="shade/gtk:bg[SELECTED]/0.7" alpha="1.0"
|
||||
x="width - ((width-(Bmin`max`height-Bpad*2))/2) -2" y="((height-(Bmin`max`height-Bpad*2))/2)-1"
|
||||
width="2" height="1"/>
|
||||
<tint color="shade/gtk:bg[SELECTED]/0.7" alpha="1.0"
|
||||
x="width - ((width-(Bmin`max`height-Bpad*2))/2)" y="((height-(Bmin`max`height-Bpad*2))/2)"
|
||||
width="1" height="2"/>
|
||||
<!-- bottom-left -->
|
||||
<tint color="shade/gtk:bg[SELECTED]/0.7" alpha="1.0"
|
||||
x="((width-(Bmin`max`height-Bpad*2))/2)" y="height - ((height-(Bmin`max`height-Bpad*2))/2)"
|
||||
width="2" height="1"/>
|
||||
<tint color="shade/gtk:bg[SELECTED]/0.7" alpha="1.0"
|
||||
x="((width-(Bmin`max`height-Bpad*2))/2)-1" y="height - ((height-(Bmin`max`height-Bpad*2))/2)-2"
|
||||
width="1" height="2"/>
|
||||
<!-- bottom-right -->
|
||||
<tint color="shade/gtk:bg[SELECTED]/0.7" alpha="1.0"
|
||||
x="width - ((width-(Bmin`max`height-Bpad*2))/2) -2" y="height - ((height-(Bmin`max`height-Bpad*2))/2)"
|
||||
width="2" height="1"/>
|
||||
<tint color="shade/gtk:bg[SELECTED]/0.7" alpha="1.0"
|
||||
x="width - ((width-(Bmin`max`height-Bpad*2))/2)" y="height - ((height-(Bmin`max`height-Bpad*2))/2)-2"
|
||||
width="1" height="2"/>
|
||||
|
||||
<!-- icon -->
|
||||
<line color="blend/gtk:bg[SELECTED]/#FFFFFF/0.75" width="2"
|
||||
x1="((width-(Bmin`max`height-Bpad*2))/2)" y1="((height-(Bmin`max`height-Bpad*2))/2)"
|
||||
x2="width - ((width-(Bmin`max`height-Bpad*2))/2) - 1" y2="height - ((height-(Bmin`max`height-Bpad*2))/2) - 1"/>
|
||||
<line color="blend/gtk:bg[SELECTED]/#FFFFFF/0.75" width="1"
|
||||
x1="((width-(Bmin`max`height-Bpad*2))/2)" y1="((height-(Bmin`max`height-Bpad*2))/2)"
|
||||
x2="width- ((width-(Bmin`max`height-Bpad*2))/2)" y2="height - ((height-(Bmin`max`height-Bpad*2))/2)"/>
|
||||
<line color="blend/gtk:bg[SELECTED]/#FFFFFF/0.75" width="2"
|
||||
x1="((width-(Bmin`max`height-Bpad*2))/2)" y1="height - ((height-(Bmin`max`height-Bpad*2))/2) - 1"
|
||||
x2="width - ((width-(Bmin`max`height-Bpad*2))/2) - 1" y2="((height-(Bmin`max`height-Bpad*2))/2)"/>
|
||||
<line color="blend/gtk:bg[SELECTED]/#FFFFFF/0.75" width="1"
|
||||
x1="((width-(Bmin`max`height-Bpad*2))/2)" y1="height - ((height-(Bmin`max`height-Bpad*2))/2) - 1"
|
||||
x2="width - ((width-(Bmin`max`height-Bpad*2))/2)" y2="((height-(Bmin`max`height-Bpad*2))/2) - 1"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="close_button_icon_unfocused">
|
||||
<line color="blend/gtk:fg[NORMAL]/gtk:bg[NORMAL]/0.45" width="2"
|
||||
x1="((width-(Bmin`max`height-Bpad*2))/2)" y1="((height-(Bmin`max`height-Bpad*2))/2)"
|
||||
x2="width-((width-(Bmin`max`height-Bpad*2))/2)-1" y2="height - ((height-(Bmin`max`height-Bpad*2))/2)-1"/>
|
||||
<line color="blend/gtk:fg[NORMAL]/gtk:bg[NORMAL]/0.45" width="1"
|
||||
x1="((width-(Bmin`max`height-Bpad*2))/2)" y1="((height-(Bmin`max`height-Bpad*2))/2)"
|
||||
x2="width-((width-(Bmin`max`height-Bpad*2))/2)" y2="height - ((height-(Bmin`max`height-Bpad*2))/2)"/>
|
||||
<line color="blend/gtk:fg[NORMAL]/gtk:bg[NORMAL]/0.45" width="2"
|
||||
x1="((width-(Bmin`max`height-Bpad*2))/2)" y1="height - ((height-(Bmin`max`height-Bpad*2))/2)-1"
|
||||
x2="width-((width-(Bmin`max`height-Bpad*2))/2)-1" y2="((height-(Bmin`max`height-Bpad*2))/2)"/>
|
||||
<line color="blend/gtk:fg[NORMAL]/gtk:bg[NORMAL]/0.45" width="1"
|
||||
x1="((width-(Bmin`max`height-Bpad*2))/2)" y1="height - ((height-(Bmin`max`height-Bpad*2))/2)-1"
|
||||
x2="width-((width-(Bmin`max`height-Bpad*2))/2)" y2="((height-(Bmin`max`height-Bpad*2))/2) - 1"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="close_button_normal">
|
||||
<include name="button_bg"/>
|
||||
<include name="close_button_icon"/>
|
||||
</draw_ops>
|
||||
<draw_ops name="close_button_prelight">
|
||||
<include name="button_bg_prelight"/>
|
||||
<include name="close_button_icon"/>
|
||||
</draw_ops>
|
||||
<draw_ops name="close_button_pressed">
|
||||
<include name="button_bg_pressed"/>
|
||||
<include name="close_button_icon"/>
|
||||
</draw_ops>
|
||||
<draw_ops name="close_button_unfocused">
|
||||
<include name="button_bg_unfocused"/>
|
||||
<include name="close_button_icon_unfocused"/>
|
||||
</draw_ops>
|
||||
<draw_ops name="close_button_unfocused_prelight">
|
||||
<include name="button_bg_unfocused_prelight"/>
|
||||
<include name="close_button_icon_unfocused"/>
|
||||
</draw_ops>
|
||||
<draw_ops name="close_button_unfocused_pressed">
|
||||
<include name="button_bg_unfocused_pressed"/>
|
||||
<include name="close_button_icon_unfocused"/>
|
||||
</draw_ops>
|
||||
|
||||
<!-- maximize icon -->
|
||||
<draw_ops name="maximize_button_icon">
|
||||
<!-- outside border -->
|
||||
<rectangle color="shade/gtk:bg[SELECTED]/0.7" filled="false"
|
||||
x="((width-(Bmin`max`height-Bpad*2))/2)-1" y="((height-(Bmin`max`height-Bpad*2))/2)-1"
|
||||
width="width-((width-(Bmin`max`height-Bpad*2))/2)*2+1" height="height-((height-(Bmin`max`height-Bpad*2))/2)*2+1"/>
|
||||
<rectangle color="shade/gtk:bg[SELECTED]/0.7" filled="false"
|
||||
x="((width-(Bmin`max`height-Bpad*2))/2)+1" y="((height-(Bmin`max`height-Bpad*2))/2)+2"
|
||||
width="width-((width-(Bmin`max`height-Bpad*2))/2)*2-3" height="height-((height-(Bmin`max`height-Bpad*2))/2)*2-4"/>
|
||||
|
||||
<!-- icon -->
|
||||
<rectangle color="blend/gtk:bg[SELECTED]/#FFFFFF/0.75" filled="false"
|
||||
x="((width-(Bmin`max`height-Bpad*2))/2)" y="((height-(Bmin`max`height-Bpad*2))/2)"
|
||||
width="width-((width-(Bmin`max`height-Bpad*2))/2)*2-1" height="height-((height-(Bmin`max`height-Bpad*2))/2)*2-1"/>
|
||||
<line color="blend/gtk:bg[SELECTED]/#FFFFFF/0.75" width="1"
|
||||
x1="((width-(Bmin`max`height-Bpad*2))/2) + 1" y1="((height-(Bmin`max`height-Bpad*2))/2) + 1"
|
||||
x2="width-((width-(Bmin`max`height-Bpad*2))/2)" y2="((height-(Bmin`max`height-Bpad*2))/2) + 1"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="maximize_button_icon_unfocused">
|
||||
<rectangle color="blend/gtk:fg[NORMAL]/gtk:bg[NORMAL]/0.45" filled="false"
|
||||
x="((width-(Bmin`max`height-Bpad*2))/2)" y="((height-(Bmin`max`height-Bpad*2))/2)"
|
||||
width="width-((width-(Bmin`max`height-Bpad*2))/2)*2-1" height="height-((height-(Bmin`max`height-Bpad*2))/2)*2-1"/>
|
||||
<line color="blend/gtk:fg[NORMAL]/gtk:bg[NORMAL]/0.45" width="1"
|
||||
x1="((width-(Bmin`max`height-Bpad*2))/2) + 1" y1="((height-(Bmin`max`height-Bpad*2))/2) + 1"
|
||||
x2="width-((width-(Bmin`max`height-Bpad*2))/2)" y2="((height-(Bmin`max`height-Bpad*2))/2) + 1"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="maximize_button_normal">
|
||||
<include name="button_bg"/>
|
||||
<include name="maximize_button_icon"/>
|
||||
</draw_ops>
|
||||
<draw_ops name="maximize_button_prelight">
|
||||
<include name="button_bg_prelight"/>
|
||||
<include name="maximize_button_icon"/>
|
||||
</draw_ops>
|
||||
<draw_ops name="maximize_button_pressed">
|
||||
<include name="button_bg_pressed"/>
|
||||
<include name="maximize_button_icon"/>
|
||||
</draw_ops>
|
||||
<draw_ops name="maximize_button_unfocused">
|
||||
<include name="button_bg_unfocused"/>
|
||||
<include name="maximize_button_icon_unfocused"/>
|
||||
</draw_ops>
|
||||
<draw_ops name="maximize_button_unfocused_prelight">
|
||||
<include name="button_bg_unfocused_prelight"/>
|
||||
<include name="maximize_button_icon_unfocused"/>
|
||||
</draw_ops>
|
||||
<draw_ops name="maximize_button_unfocused_pressed">
|
||||
<include name="button_bg_unfocused_pressed"/>
|
||||
<include name="maximize_button_icon_unfocused"/>
|
||||
</draw_ops>
|
||||
|
||||
<!-- restore icon -->
|
||||
<draw_ops name="restore_button_icon">
|
||||
<!-- outside border -->
|
||||
<rectangle color="shade/gtk:bg[SELECTED]/0.7" filled="false"
|
||||
x="((width-(Bmin`max`height-Bpad*2))/2)" y="((height-(Bmin`max`height-Bpad*2))/2)"
|
||||
width="width-((width-(Bmin`max`height-Bpad*2))/2)*2-1" height="height-((height-(Bmin`max`height-Bpad*2))/2)*2-1"/>
|
||||
<rectangle color="shade/gtk:bg[SELECTED]/0.7" filled="false"
|
||||
x="((width-(Bmin`max`height-Bpad*2))/2)+2" y="((height-(Bmin`max`height-Bpad*2))/2)+3"
|
||||
width="width-((width-(Bmin`max`height-Bpad*2))/2)*2-5" height="height-((height-(Bmin`max`height-Bpad*2))/2)*2-6"/>
|
||||
|
||||
<!-- icon -->
|
||||
<rectangle color="blend/gtk:bg[SELECTED]/#FFFFFF/0.75" filled="false"
|
||||
x="((width-(Bmin`max`height-Bpad*2))/2) + 1" y="((height-(Bmin`max`height-Bpad*2))/2) + 1"
|
||||
width="width-((width-(Bmin`max`height-Bpad*2))/2)*2-3" height="height-((height-(Bmin`max`height-Bpad*2))/2)*2-3"/>
|
||||
<line color="blend/gtk:bg[SELECTED]/#FFFFFF/0.75" width="1"
|
||||
x1="((width-(Bmin`max`height-Bpad*2))/2) + 2" y1="((height-(Bmin`max`height-Bpad*2))/2) + 2"
|
||||
x2="width-((width-(Bmin`max`height-Bpad*2))/2) - 2" y2="((height-(Bmin`max`height-Bpad*2))/2) + 2"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="restore_button_icon_unfocused">
|
||||
<rectangle color="blend/gtk:fg[NORMAL]/gtk:bg[NORMAL]/0.45" filled="false"
|
||||
x="((width-(Bmin`max`height-Bpad*2))/2) + 1" y="((height-(Bmin`max`height-Bpad*2))/2) + 1"
|
||||
width="width-((width-(Bmin`max`height-Bpad*2))/2)*2-3" height="height-((height-(Bmin`max`height-Bpad*2))/2)*2-3"/>
|
||||
<line color="blend/gtk:fg[NORMAL]/gtk:bg[NORMAL]/0.45" width="1"
|
||||
x1="((width-(Bmin`max`height-Bpad*2))/2) + 2" y1="((height-(Bmin`max`height-Bpad*2))/2) + 2"
|
||||
x2="width-((width-(Bmin`max`height-Bpad*2))/2) - 2" y2="((height-(Bmin`max`height-Bpad*2))/2) + 2"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="restore_button_normal">
|
||||
<include name="button_bg"/>
|
||||
<include name="restore_button_icon"/>
|
||||
</draw_ops>
|
||||
<draw_ops name="restore_button_prelight">
|
||||
<include name="button_bg_prelight"/>
|
||||
<include name="restore_button_icon"/>
|
||||
</draw_ops>
|
||||
<draw_ops name="restore_button_pressed">
|
||||
<include name="button_bg_pressed"/>
|
||||
<include name="restore_button_icon"/>
|
||||
</draw_ops>
|
||||
<draw_ops name="restore_button_unfocused">
|
||||
<include name="button_bg_unfocused"/>
|
||||
<include name="restore_button_icon_unfocused"/>
|
||||
</draw_ops>
|
||||
<draw_ops name="restore_button_unfocused_prelight">
|
||||
<include name="button_bg_unfocused_prelight"/>
|
||||
<include name="restore_button_icon_unfocused"/>
|
||||
</draw_ops>
|
||||
<draw_ops name="restore_button_unfocused_pressed">
|
||||
<include name="button_bg_unfocused_pressed"/>
|
||||
<include name="restore_button_icon_unfocused"/>
|
||||
</draw_ops>
|
||||
|
||||
<!-- minimize icon -->
|
||||
<draw_ops name="minimize_button_icon">
|
||||
<!-- outside border -->
|
||||
<rectangle color="shade/gtk:bg[SELECTED]/0.7" filled="false"
|
||||
x="((width-(Bmin`max`height-Bpad*2))/2)-1" y="height - ((height-(Bmin`max`height-Bpad*2))/2) - 3"
|
||||
width="width-((width-(Bmin`max`height-Bpad*2))/2)*2+1" height="3"/>
|
||||
<!-- icon -->
|
||||
<rectangle color="blend/gtk:bg[SELECTED]/#FFFFFF/0.75" filled="true"
|
||||
x="((width-(Bmin`max`height-Bpad*2))/2)" y="height - ((height-(Bmin`max`height-Bpad*2))/2) - 2"
|
||||
width="width-((width-(Bmin`max`height-Bpad*2))/2)*2" height="2"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="minimize_button_icon_unfocused">
|
||||
<rectangle color="blend/gtk:fg[NORMAL]/gtk:bg[NORMAL]/0.45" filled="true"
|
||||
x="((width-(Bmin`max`height-Bpad*2))/2)" y="height - ((height-(Bmin`max`height-Bpad*2))/2) - 2"
|
||||
width="width-((width-(Bmin`max`height-Bpad*2))/2)*2" height="2"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="minimize_button_normal">
|
||||
<include name="button_bg"/>
|
||||
<include name="minimize_button_icon"/>
|
||||
</draw_ops>
|
||||
<draw_ops name="minimize_button_prelight">
|
||||
<include name="button_bg_prelight"/>
|
||||
<include name="minimize_button_icon"/>
|
||||
</draw_ops>
|
||||
<draw_ops name="minimize_button_pressed">
|
||||
<include name="button_bg_pressed"/>
|
||||
<include name="minimize_button_icon"/>
|
||||
</draw_ops>
|
||||
<draw_ops name="minimize_button_unfocused">
|
||||
<include name="button_bg_unfocused"/>
|
||||
<include name="minimize_button_icon_unfocused"/>
|
||||
</draw_ops>
|
||||
<draw_ops name="minimize_button_unfocused_prelight">
|
||||
<include name="button_bg_unfocused_prelight"/>
|
||||
<include name="minimize_button_icon_unfocused"/>
|
||||
</draw_ops>
|
||||
<draw_ops name="minimize_button_unfocused_pressed">
|
||||
<include name="button_bg_unfocused_pressed"/>
|
||||
<include name="minimize_button_icon_unfocused"/>
|
||||
</draw_ops>
|
||||
|
||||
<draw_ops name="blank">
|
||||
<!-- nothing -->
|
||||
</draw_ops>
|
||||
|
||||
<!-- ::: FRAME STYLES ::: -->
|
||||
<frame_style name="normal" geometry="normal">
|
||||
<piece position="entire_background" draw_ops="round_bevel_unfocused"/>
|
||||
<piece position="title" draw_ops="title_unfocused"/>
|
||||
<button function="close" state="normal" draw_ops="close_button_unfocused"/>
|
||||
<button function="close" state="pressed" draw_ops="close_button_unfocused_pressed"/>
|
||||
<button function="close" state="prelight" draw_ops="close_button_unfocused_prelight"/>
|
||||
<button function="maximize" state="normal" draw_ops="maximize_button_unfocused"/>
|
||||
<button function="maximize" state="pressed" draw_ops="maximize_button_unfocused_pressed"/>
|
||||
<button function="maximize" state="prelight" draw_ops="maximize_button_unfocused_prelight"/>
|
||||
<button function="minimize" state="normal" draw_ops="minimize_button_unfocused"/>
|
||||
<button function="minimize" state="pressed" draw_ops="minimize_button_unfocused_pressed"/>
|
||||
<button function="minimize" state="prelight" draw_ops="minimize_button_unfocused_prelight"/>
|
||||
<button function="menu" state="normal" draw_ops="menu_button_normal"/>
|
||||
<button function="menu" state="pressed" draw_ops="menu_button_pressed"/>
|
||||
</frame_style>
|
||||
|
||||
<frame_style name="normal_shaded" geometry="shaded" parent="normal">
|
||||
<piece position="entire_background" draw_ops="round_bevel_unfocused_shaded"/>
|
||||
</frame_style>
|
||||
|
||||
<frame_style name="focused" geometry="normal" parent="normal">
|
||||
<piece position="entire_background" draw_ops="round_bevel"/>
|
||||
<piece position="title" draw_ops="title"/>
|
||||
<button function="close" state="normal" draw_ops="close_button_normal"/>
|
||||
<button function="close" state="pressed" draw_ops="close_button_pressed"/>
|
||||
<button function="close" state="prelight" draw_ops="close_button_prelight"/>
|
||||
<button function="maximize" state="normal" draw_ops="maximize_button_normal"/>
|
||||
<button function="maximize" state="pressed" draw_ops="maximize_button_pressed"/>
|
||||
<button function="maximize" state="prelight" draw_ops="maximize_button_prelight"/>
|
||||
<button function="minimize" state="normal" draw_ops="minimize_button_normal"/>
|
||||
<button function="minimize" state="pressed" draw_ops="minimize_button_pressed"/>
|
||||
<button function="minimize" state="prelight" draw_ops="minimize_button_prelight"/>
|
||||
</frame_style>
|
||||
|
||||
<frame_style name="focused_shaded" geometry="shaded" parent="focused">
|
||||
<piece position="entire_background" draw_ops="round_bevel_shaded"/>
|
||||
</frame_style>
|
||||
|
||||
<frame_style name="normal_maximized" geometry="normal_maximized" parent="normal">
|
||||
<piece position="entire_background" draw_ops="bevel_maximized_unfocused"/>
|
||||
<button function="maximize" state="normal" draw_ops="restore_button_unfocused"/>
|
||||
<button function="maximize" state="pressed" draw_ops="restore_button_unfocused_pressed"/>
|
||||
<button function="maximize" state="prelight" draw_ops="restore_button_unfocused_prelight"/>
|
||||
</frame_style>
|
||||
|
||||
<frame_style name="focused_maximized" geometry="normal_maximized" parent="focused">
|
||||
<piece position="entire_background" draw_ops="bevel_maximized"/>
|
||||
<button function="maximize" state="normal" draw_ops="restore_button_normal"/>
|
||||
<button function="maximize" state="pressed" draw_ops="restore_button_pressed"/>
|
||||
<button function="maximize" state="prelight" draw_ops="restore_button_prelight"/>
|
||||
</frame_style>
|
||||
|
||||
<frame_style name="border" geometry="border" parent="normal">
|
||||
<piece position="entire_background" draw_ops="border"/>
|
||||
<piece position="title" draw_ops="blank"/>
|
||||
</frame_style>
|
||||
|
||||
<frame_style name="utility_normal" geometry="utility" parent="normal">
|
||||
<piece position="entire_background" draw_ops="bevel_unfocused"/>
|
||||
</frame_style>
|
||||
<frame_style name="utility_focused" geometry="utility" parent="focused">
|
||||
<piece position="entire_background" draw_ops="bevel"/>
|
||||
</frame_style>
|
||||
<frame_style name="utility_focused_shaded" geometry="utility" parent="focused_shaded">
|
||||
<piece position="entire_background" draw_ops="bevel_shaded"/>
|
||||
</frame_style>
|
||||
|
||||
<frame_style_set name="normal">
|
||||
<frame focus="yes" state="normal" resize="both" style="focused"/>
|
||||
<frame focus="no" state="normal" resize="both" style="normal"/>
|
||||
<frame focus="yes" state="maximized" style="focused_maximized"/>
|
||||
<frame focus="no" state="maximized" style="normal_maximized"/>
|
||||
<frame focus="yes" state="shaded" style="focused_shaded"/>
|
||||
<frame focus="no" state="shaded" style="normal_shaded"/>
|
||||
<frame focus="yes" state="maximized_and_shaded" style="focused_maximized"/>
|
||||
<frame focus="no" state="maximized_and_shaded" style="normal_maximized"/>
|
||||
</frame_style_set>
|
||||
|
||||
<frame_style_set name="utility" parent="normal">
|
||||
<frame focus="yes" state="normal" resize="both" style="utility_focused"/>
|
||||
<frame focus="no" state="normal" resize="both" style="utility_normal"/>
|
||||
<!-- this is a bunch of crack since utility windows shouldn't be maximized -->
|
||||
<frame focus="yes" state="maximized" style="focused"/>
|
||||
<frame focus="no" state="maximized" style="normal"/>
|
||||
<frame focus="yes" state="shaded" style="utility_focused_shaded"/>
|
||||
<frame focus="no" state="shaded" style="utility_normal"/>
|
||||
<frame focus="yes" state="maximized_and_shaded" style="focused_shaded"/>
|
||||
<frame focus="no" state="maximized_and_shaded" style="normal"/>
|
||||
</frame_style_set>
|
||||
|
||||
<frame_style_set name="border">
|
||||
<frame focus="yes" state="normal" resize="both" style="border"/>
|
||||
<frame focus="no" state="normal" resize="both" style="border"/>
|
||||
<frame focus="yes" state="maximized" style="border"/>
|
||||
<frame focus="no" state="maximized" style="border"/>
|
||||
<frame focus="yes" state="shaded" style="border"/>
|
||||
<frame focus="no" state="shaded" style="border"/>
|
||||
<frame focus="yes" state="maximized_and_shaded" style="border"/>
|
||||
<frame focus="no" state="maximized_and_shaded" style="border"/>
|
||||
</frame_style_set>
|
||||
|
||||
<window type="normal" style_set="normal"/>
|
||||
<window type="dialog" style_set="normal"/>
|
||||
<window type="modal_dialog" style_set="normal"/>
|
||||
<window type="menu" style_set="normal"/>
|
||||
<window type="utility" style_set="utility"/>
|
||||
<window type="border" style_set="border"/>
|
||||
|
||||
<menu_icon function="close" state="normal" draw_ops="close_button_icon_unfocused"/>
|
||||
<menu_icon function="maximize" state="normal" draw_ops="maximize_button_icon_unfocused"/>
|
||||
<menu_icon function="unmaximize" state="normal" draw_ops="restore_button_icon_unfocused"/>
|
||||
<menu_icon function="minimize" state="normal" draw_ops="minimize_button_icon_unfocused"/>
|
||||
|
||||
</metacity_theme>
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,63 @@
|
||||
Anaconda Kickstart Documentation
|
||||
================================
|
||||
|
||||
Anaconda uses `kickstart <https://github.com/rhinstaller/pykickstart>`_ to automate
|
||||
installation and as a data store for the user interface. It also extends the kickstart
|
||||
commands `documented here <https://fedoraproject.org/wiki/Anaconda/Kickstart>`_
|
||||
by adding a new kickstart section named %anaconda where commands to control the behavior
|
||||
of Anaconda will be defined.
|
||||
|
||||
.. contents:: %anaconda section commands
|
||||
|
||||
|
||||
pwpolicy
|
||||
========
|
||||
|
||||
pwpolicy <name> [--minlen=LENGTH] [--minquality=QUALITY] [--strict|notstrict] [--emptyok|notempty] [--changesok|nochanges]
|
||||
Set the policy to use for the named password entry.
|
||||
|
||||
name
|
||||
Name of the password entry, currently supported values are: root, user and luks
|
||||
|
||||
--minlen (**8**)
|
||||
Minimum password length. This is passed on to libpwquality.
|
||||
|
||||
--minquality (**50**)
|
||||
Minimum libpwquality to consider good. When using --strict it will not allow
|
||||
passwords with a quality lower than this.
|
||||
|
||||
--strict (**DEFAULT**)
|
||||
Strict password enforcement. Passwords not meeting the --minquality level will
|
||||
not be allowed.
|
||||
|
||||
--notstrict
|
||||
Passwords not meeting the --minquality level will be allowed after Done is clicked
|
||||
twice.
|
||||
|
||||
--emptyok (**DEFAULT**)
|
||||
Allow empty password.
|
||||
|
||||
--notempty
|
||||
Don't allow an empty password
|
||||
|
||||
--changesok
|
||||
Allow UI to be used to change the password/user when it has already been set in
|
||||
the kickstart.
|
||||
|
||||
--nochanges (**DEFAULT**)
|
||||
Do not allow UI to be used to change the password/user if it has been set in
|
||||
the kickstart.
|
||||
|
||||
The defaults for these are set in the /usr/share/anaconda/interactive-defaults.ks file
|
||||
provided by Anaconda. If a product, such as Fedora Workstation, wishes to override them
|
||||
then a product.img needs to be created with a new version of the file included.
|
||||
|
||||
When using a kickstart the defaults can be overridded by placing a %anaconda section into
|
||||
the kickstart, like this::
|
||||
|
||||
%anaconda
|
||||
pwpolicy root --minlen=10 --minquality=60 --strict --notempty --nochanges
|
||||
%end
|
||||
|
||||
.. note:: The commit message for pwpolicy included some incorrect examples.
|
||||
|
@ -1,13 +0,0 @@
|
||||
Updated June 11, 2002
|
||||
---------------------
|
||||
|
||||
Current list of things we check for (good for regression testing):
|
||||
|
||||
- That selected PE is smaller than any PV in VG.
|
||||
- That size requests for LV are a multiple of the PE.
|
||||
- That maximum LV for a given PE is bigger than any currently defined LV in VG.
|
||||
- That if you change the PE, all the reclamped LV will fit in VG.
|
||||
- That VG_name+LV_name is unique for all VG.
|
||||
- That mount points are used only once.
|
||||
- Give warning if more than 10% of a PV is lost because of the PE selected.
|
||||
- That the bootable partition is not a LV.
|
@ -1,15 +0,0 @@
|
||||
How to make screenshots:
|
||||
|
||||
|
||||
This will only currently work for graphical installs.
|
||||
|
||||
During a graphical installation, you can now press SHIFT-Print Screen
|
||||
and a screenshot of the current installation screen will be taken.
|
||||
|
||||
These are stored in the following directory:
|
||||
|
||||
/root/anaconda-screenshots/
|
||||
|
||||
The screenshots can be accessed once the newly-installed system is rebooted.
|
||||
|
||||
|
@ -1,25 +0,0 @@
|
||||
Mediacheck documentation
|
||||
October, 2008
|
||||
|
||||
|
||||
Mediacheck is a tool we use to test the integrity of ISO images. The
|
||||
ISO9660 specification allows for a 512 byte region which is for
|
||||
application use. We use it to store a checksum of the ISO image. Of
|
||||
couse putting the checksum into this region will change the checksum
|
||||
of the final ISO image, so when we verify the checksum later we have
|
||||
to fill in this 512 region with the original contents before the
|
||||
implantation. It is set to all ASCII 32 decimal spaces.
|
||||
|
||||
If you have a set of ISO images you can implant the checksum data with
|
||||
this command:
|
||||
|
||||
implantmd5iso <isoname>
|
||||
|
||||
NOTE: You cannot re-implant an ISO once its been implanted.
|
||||
|
||||
To check a ISO image you can use this command line:
|
||||
|
||||
checkisomd5 <isoname>
|
||||
|
||||
The tools are in the isomd5sum package.
|
||||
|
@ -1,16 +0,0 @@
|
||||
Rescue mode
|
||||
-----------
|
||||
|
||||
1/4/1999 Michael Fulbright
|
||||
|
||||
Rescue mode is implemented via a bootable CDROM currently. The user
|
||||
specifies 'linux rescue' at the syslinux prompt when the CDROM boots.
|
||||
Then the kernel and an initial ramdisk is loaded. The installer is
|
||||
run and the user is dropped into bash.
|
||||
|
||||
The upd-instroot script in the anaconda/ source toplevel directory
|
||||
is responsible for creating the instimage which is used as the
|
||||
root for the rescue environment. It is located in /mnt/cdrom/Redhat/instimage
|
||||
when the CDROM is mounted under /mnt/cdrom.
|
||||
|
||||
|
@ -1,100 +0,0 @@
|
||||
Threads in anaconda? No!
|
||||
David Cantrell <dcantrell@redhat.com>
|
||||
|
||||
|
||||
INTRODUCTION
|
||||
|
||||
Threads make a lot of people run screaming. That's entirely
|
||||
understandable because thread concurrency can be a pain. In this short
|
||||
document, I want to explain why threads are in anaconda and how to work
|
||||
with them in the code.
|
||||
|
||||
MISCONCEPTIONS
|
||||
|
||||
Just to make sure everyone is on the same page, threads are similar to
|
||||
processes. The big advantage we get is easier shared data structures.
|
||||
Threads can communicate over more methods than just signals. But,
|
||||
multithreaded does not mean that we are taking every operation out to
|
||||
a separate thread.
|
||||
|
||||
ANACONDA THREADS
|
||||
|
||||
The idea for anaconda threads is to simplify life for things that can
|
||||
or need to run parallel to other operations. So we will reserve the
|
||||
use of threads for tasks that fit in to this category well (the logging
|
||||
system, for instance) and keep the bulk of the installer in the main
|
||||
thread.
|
||||
|
||||
THREADS AND PYTHON
|
||||
|
||||
Python has a nice model for threading. Threads in Python extend the
|
||||
threading.Thread class. So an easy way to identify something that will
|
||||
run or can be run as a thread is seeing a class definition like this:
|
||||
|
||||
class SomeClass(threading.Thread):
|
||||
|
||||
You still have your __init__ method for the constructor, but threads
|
||||
also have a run() method and a join() method (there are others, but
|
||||
I will just discuss these).
|
||||
|
||||
The run() method is called when you start the thread. This is where
|
||||
you want to do the work. Normally this happens in the class
|
||||
constructor, but in threads we need that separated out to a different
|
||||
method.
|
||||
|
||||
The join() method is to block execution of other threads. Whatever you
|
||||
put in the join() method will run and other threads will be blocked
|
||||
while it runs. Now, this method is only run when you call it explicitly
|
||||
from another thread, so think of it as similar to waitpid().
|
||||
|
||||
Python has the thread and threading modules. Use threading as it's
|
||||
built on top of thread and provides a threading system similar to the
|
||||
POSIX thread model.
|
||||
|
||||
More information:
|
||||
http://docs.python.org/lib/module-threading.html
|
||||
|
||||
THREAD NAMES
|
||||
|
||||
Threads have names in Python. They are automatically assigned or you
|
||||
can specify the name. For anaconda it probably makes more sense to
|
||||
name our threads since we won't be launching more than one for the
|
||||
same task.
|
||||
|
||||
The convention I'm using is: NameThr
|
||||
For example: RelNotesThr
|
||||
|
||||
The name is arbitrary, but we should probably have some sort of
|
||||
consistency.
|
||||
|
||||
PYGTK AND THREADS
|
||||
|
||||
GTK+ presents the biggest challenge for threads, but it's not
|
||||
impossible. When you call gtk.main(), you need to call it like this:
|
||||
|
||||
gtk.threads_enter()
|
||||
gtk.main()
|
||||
gtk.threads_leave()
|
||||
|
||||
Calls to PyGTK methods or fiddling with GTK objects...all that has to
|
||||
be wrapped in threads_enter/threads_leave calls. The suggested syntax
|
||||
is:
|
||||
|
||||
gtk.threads_enter()
|
||||
try:
|
||||
# do stuff
|
||||
finally:
|
||||
gtk.threads_leave()
|
||||
|
||||
Suggested reading:
|
||||
|
||||
http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq20.006.htp
|
||||
http://developer.gnome.org/doc/API/2.0/gdk/gdk-Threads.html
|
||||
|
||||
|
||||
I will try to expand this document as I move through more threading code.
|
||||
Email me if you have any questions.
|
||||
|
||||
--
|
||||
David Cantrell
|
||||
<dcantrell@redhat.com>
|
@ -1,129 +0,0 @@
|
||||
Transifex and anaconda Development
|
||||
09-Mar-2011
|
||||
by: David Cantrell <dcantrell@redhat.com>
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Setting up the new transifex-client on your system for anaconda builds.
|
||||
|
||||
1) Install the transifex-client package:
|
||||
yum install transifex-client
|
||||
-or-
|
||||
yum --enablerepo=updates-testing install transifex-client
|
||||
-or-
|
||||
yum --enablerepo=epel-testing install transifex-client
|
||||
|
||||
2) Create a Transifex.net account at https://fedora.transifex.net/
|
||||
NOTE: This system is not linked to FAS, it's hosted by another company,
|
||||
so it requires another account at this time. I'm sure this will change
|
||||
in the future, but this is how it is for now.
|
||||
|
||||
3) Configure 'tx' on your system:
|
||||
tx init
|
||||
Accept default host, fill in your username and password generated in #2.
|
||||
|
||||
Now tx is set up on your system. The translation files will only be pulled
|
||||
when a 'make release' is done. The 'make dist' step will just create a tar
|
||||
file of the what we have in our repo. The 'make bumpver' step will also
|
||||
push a new anaconda.pot file to Transifex, so any string changes are pushed
|
||||
to them on a regular basis.
|
||||
|
||||
NOTE: tx pull is slow. This is why I only added it to the 'make bumpver'
|
||||
step.
|
||||
|
||||
There are some other procedures related to tx that will have to be done
|
||||
when we create new branches or when there are translation errors.
|
||||
|
||||
|
||||
MAKING A RELEASE
|
||||
----------------
|
||||
|
||||
git clean -d -x -f
|
||||
./autogen.sh && ./configure --disable-static \
|
||||
--enable-introspection --enable-gtk-doc
|
||||
make bumpver # tx pull by dependent po-pull target
|
||||
git commit -a -m "New version." # DO NOT run 'git clean -d -x -f' after
|
||||
make && make release # signed tag happens after dist now
|
||||
|
||||
The process here is mostly the same. I do not recommend that you run
|
||||
git clean between 'make bumpver' and 'make release'. The reason is you
|
||||
will have to run 'tx pull' again and that's slow, plus translations may
|
||||
have changed between the two steps.
|
||||
|
||||
The 'make tag' step now runs after 'make dist' in case dist generation
|
||||
fails. That way you don't end up with a partially created dist AND a
|
||||
bad tag you have to delete.
|
||||
|
||||
The 'make scratch' target will also run po-pull to get translations. If
|
||||
we need translation files in other targets, we can add po-pull as a
|
||||
dependent target.
|
||||
|
||||
|
||||
DEALING WITH ERRORS IN *.po FILES
|
||||
---------------------------------
|
||||
|
||||
Translators sometimes introduce errors in the .po files. What we generally
|
||||
do is try to fix it if it's an obvious typo, or just revert the change and
|
||||
go back to the old po file. Reverting is harder now since we are not
|
||||
storing po files in our repo, but in severe cases we can go and fetch the
|
||||
last build and pull the affected po file from there and use it to revert the
|
||||
changes.
|
||||
|
||||
Here's an example of a po file error that will halt a 'make release':
|
||||
|
||||
rm -f af.gmo && /usr/bin/msgfmt -c --statistics -o af.gmo af.po
|
||||
af.po:7: field `Language-Team' still has initial default value
|
||||
af.po:1614: number of format specifications in 'msgid' and 'msgstr[1]' does not match
|
||||
/usr/bin/msgfmt: found 1 fatal error
|
||||
|
||||
In this case, I am going to the last known good af.po. To update Transifex,
|
||||
I do:
|
||||
|
||||
cp /path/to/last/known/good/af.po po/af.po
|
||||
touch po/af.po
|
||||
tx push -t -l af
|
||||
|
||||
The touch is necessary because transifex.net uses timestamps to determine
|
||||
if it should update its translation data with the po file you are asking
|
||||
it to use.
|
||||
|
||||
|
||||
CREATING A NEW ANACONDA BRANCH
|
||||
------------------------------
|
||||
|
||||
When we make a new branch, we need to branch the translation files.
|
||||
|
||||
First you need to populate the project with the initial po files. I suggest
|
||||
using the ones from the master branch, e.g.:
|
||||
|
||||
git checkout master
|
||||
git clean -xdf
|
||||
tx pull -a
|
||||
# leave the *.po files in the po/ subdirectory
|
||||
git checkout BRANCH_NAME
|
||||
|
||||
Next you need to update the transifex config with the new branch:
|
||||
|
||||
tx set --execute --auto-local -r anaconda.BRANCH_NAME -s en -t PO \
|
||||
-f po/anaconda.pot "po/<lang>.po"
|
||||
|
||||
The last argument is correct as-is, it's not a place where you substitute
|
||||
something for <lang>. The BRANCH_NAME will be something other than 'master'.
|
||||
For example, when we branch for F-20:
|
||||
|
||||
tx set --execute --auto-local -r anaconda.f20-branch -s en -t PO \
|
||||
-f po/anaconda.pot "po/<lang>.po"
|
||||
|
||||
Check the .tx/config file on the branch to ensure it references the correct
|
||||
anaconda.BRANCH_NAME in Transifex and remove the [anaconda.master] block so
|
||||
that it doesn't try to push to master and the new branch.
|
||||
|
||||
Now you can run:
|
||||
|
||||
tx push -s -t
|
||||
|
||||
This will push the po files and anaconda.pot from master to the BRANCH_NAME
|
||||
resource for anaconda in Transifex. This is just an initial seed that the
|
||||
translation team can work with. And since we branch from master, the code
|
||||
should be more or less in sync with the po files at branch time.
|
||||
|
||||
Don't forget to commit the new .tx/config file to the branch.
|
@ -0,0 +1,116 @@
|
||||
Translations and anaconda Development
|
||||
24-Feb-2015
|
||||
by: David Cantrell <dcantrell@redhat.com>
|
||||
Brian C. Lane <bcl@redhat.com>
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Anaconda, as of version 23.1, is using https://fedora.zanata.com for
|
||||
translations. You will need an account in order to pull translations until bug
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1172618 (anonymous pull requests)
|
||||
has been resolved.
|
||||
|
||||
The zanata-python-client is used by the build scripts, not the full zanata
|
||||
package.
|
||||
|
||||
|
||||
CLIENT SETUP
|
||||
------------
|
||||
Setting up the zanata-python-client on your system for anaconda builds.
|
||||
|
||||
1) Install the zanata-python-client package:
|
||||
yum install zanata-python-client
|
||||
|
||||
2) Create a Zanata account at https://fedora.zanata.org
|
||||
NOTE: This system is linked to FAS, but the 'remember my login' option
|
||||
only appears to work for about an hour, not 7 days as it claims.
|
||||
|
||||
3) Navigate to Dashboard->Settings->Client and click 'Generate New API Key'
|
||||
|
||||
4) Copy the contents of the Configuration text box to ~/.config/zanata.ini
|
||||
and make sure permissions are 0600.
|
||||
|
||||
Now zanata is set up on your system. The translation files will only be pulled
|
||||
when a 'make release' is done. The 'make dist' step will just create a tar
|
||||
file of the what we have in our repo. The 'make bumpver' step will also push a
|
||||
new anaconda.pot file to Zanata, so any string changes are pushed to them on a
|
||||
regular basis.
|
||||
|
||||
NOTE: zanata pull is slow. This is why I only added it to the 'make bumpver'
|
||||
step.
|
||||
|
||||
There are some other procedures related to zanata that will have to be done
|
||||
when we create new branches or when there are translation errors.
|
||||
|
||||
|
||||
MAKING A RELEASE
|
||||
----------------
|
||||
|
||||
git clean -d -x -f
|
||||
./autogen.sh && ./configure --disable-static \
|
||||
--enable-introspection --enable-gtk-doc
|
||||
make bumpver # zanata pull by dependent po-pull target
|
||||
git commit -a -m "New version." # DO NOT run 'git clean -d -x -f' after
|
||||
make && make release # signed tag happens after dist now
|
||||
|
||||
The process here is mostly the same. I do not recommend that you run
|
||||
git clean between 'make bumpver' and 'make release'. The reason is you
|
||||
will have to run 'zanata pull' again and that's slow, plus translations may
|
||||
have changed between the two steps.
|
||||
|
||||
The 'make tag' step now runs after 'make dist' in case dist generation
|
||||
fails. That way you don't end up with a partially created dist AND a
|
||||
bad tag you have to delete.
|
||||
|
||||
The 'make scratch' and 'make po-empty' targets will now create empty
|
||||
translation files so that local test builds can be created without needing a
|
||||
zanata account.
|
||||
|
||||
|
||||
DEALING WITH ERRORS IN *.po FILES
|
||||
---------------------------------
|
||||
|
||||
Translators sometimes introduce errors in the .po files. What we generally
|
||||
do is try to fix it if it's an obvious typo, or just revert the change and
|
||||
go back to the old po file. Reverting is harder now since we are not
|
||||
storing po files in our repo, but in severe cases we can go and fetch the
|
||||
last build and pull the affected po file from there and use it to revert the
|
||||
changes.
|
||||
|
||||
Here's an example of a po file error that will halt a 'make release':
|
||||
|
||||
rm -f af.gmo && /usr/bin/msgfmt -c --statistics -o af.gmo af.po
|
||||
af.po:7: field `Language-Team' still has initial default value
|
||||
af.po:1614: number of format specifications in 'msgid' and 'msgstr[1]' does not match
|
||||
/usr/bin/msgfmt: found 1 fatal error
|
||||
|
||||
In this case, I am going to the last known good af.po. To update Zanata,
|
||||
I do:
|
||||
|
||||
cp /path/to/last/known/good/af.po po/af.po
|
||||
zanata push --push-type target --lang af
|
||||
|
||||
|
||||
CREATING A NEW ANACONDA BRANCH
|
||||
------------------------------
|
||||
|
||||
When we make a new branch, we need to branch the translation files.
|
||||
|
||||
On https://fedora.zanata.com go to the project and version to use as a base.
|
||||
Select 'New Version+' from the hidden drop down menu on the right. Give it a
|
||||
name that matches the git branch. eg. f23-branch and select the version to copy
|
||||
from (usually master). Wait for it to finish processing documents.
|
||||
|
||||
Create a new git branch:
|
||||
|
||||
git checkout master
|
||||
git clean -xdf
|
||||
git checkout BRANCH_NAME
|
||||
|
||||
At https://fedora.zanata.com select the new version and then select the
|
||||
'Download Config file' from the hidden dropdown menu next to 'Settings'. This
|
||||
will download a new zanata.xml file. Replace the zanata.xml file in the root
|
||||
directory of anaconda project with this new one.
|
||||
|
||||
git add -u
|
||||
git commit -m "New Zanata config file"
|
||||
git push --set-upstream origin BRANCH_NAME
|
@ -1,22 +0,0 @@
|
||||
# tests/Makefile.am for anaconda
|
||||
#
|
||||
# Copyright (C) 2009 Red Hat, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published
|
||||
# by the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Author: David Cantrell <dcantrell@redhat.com>
|
||||
|
||||
SUBDIRS = mock kickstart_test regex pyanaconda_test logpicker_test
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
@ -1,21 +0,0 @@
|
||||
# tests/Makefile.am for anaconda
|
||||
#
|
||||
# Copyright (C) 2009 Red Hat, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published
|
||||
# by the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Author: David Cantrell <dcantrell@redhat.com>
|
||||
|
||||
EXTRA_DIST = *.py
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
@ -1,94 +0,0 @@
|
||||
# Mocking library for module and code injection, replay tests and other
|
||||
# unit testing purposes
|
||||
#
|
||||
# Copyright (C) 2010
|
||||
# Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# 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
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Author(s): Martin Sivak <msivak@redhat.com>
|
||||
|
||||
|
||||
from disk import *
|
||||
from mock import *
|
||||
import unittest
|
||||
|
||||
def slow(f):
|
||||
"""Decorates a test method as being slow, usefull for python-nose filtering"""
|
||||
f.slow = True
|
||||
return f
|
||||
|
||||
def acceptance(f):
|
||||
"""Decorates test as belonging to acceptance testing and not useable in common devellopment unit testing. To be used with python-nose filtering."""
|
||||
f.acceptance = True
|
||||
return f
|
||||
|
||||
class TestCase(unittest.TestCase):
|
||||
def __init__(self, *args, **kwargs):
|
||||
unittest.TestCase.__init__(self, *args, **kwargs)
|
||||
self.injectedModules = {}
|
||||
|
||||
def setupModules(self, a):
|
||||
"""Mock specified list of modules and store the list so it can be
|
||||
properly unloaded during tearDown"""
|
||||
|
||||
import sys
|
||||
self.preexistingModules = set(sys.modules.keys())
|
||||
|
||||
for m in a:
|
||||
sys.modules[m] = Mock()
|
||||
self.injectedModules[m] = sys.modules[m]
|
||||
|
||||
def modifiedModule(self, mname, mod = None):
|
||||
"""Mark module (and all it's parents) as tainted"""
|
||||
|
||||
oldname=""
|
||||
for m in mname.split("."):
|
||||
self.injectedModules[oldname+m] = mod
|
||||
oldname += m + "."
|
||||
self.injectedModules[mname] = mod
|
||||
|
||||
def tearDownModules(self):
|
||||
"""Unload previously Mocked modules"""
|
||||
|
||||
import sys
|
||||
|
||||
for m in sys.modules.keys():
|
||||
if m in self.preexistingModules and not m in self.injectedModules:
|
||||
continue
|
||||
|
||||
del sys.modules[m]
|
||||
|
||||
def take_over_io(self, disk, target_module):
|
||||
""" Trick target_module into using disk object as the filesystem.
|
||||
|
||||
This is achieved by overriding the module's 'open' binding as well
|
||||
as many global bindings in os.path.
|
||||
"""
|
||||
target_module.open = disk.open
|
||||
self.modifiedModule(target_module.__name__)
|
||||
|
||||
import glob
|
||||
self.modifiedModule("glob")
|
||||
glob.glob = disk.glob_glob
|
||||
|
||||
import os
|
||||
self.modifiedModule("os.path")
|
||||
# this is what os.path implementaion points at, reimport:
|
||||
import posixpath
|
||||
self.modifiedModule("posixpath")
|
||||
os.listdir = disk.os_listdir
|
||||
os.path.exists = disk.os_path_exists
|
||||
os.path.isdir = disk.os_path_isdir
|
||||
os.access = disk.os_access
|
@ -1,128 +0,0 @@
|
||||
# Copyright (C) 2010
|
||||
# Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# 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
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Author(s): Martin Sivak <msivak@redhat.com>
|
||||
|
||||
from StringIO import StringIO
|
||||
import fnmatch
|
||||
import os
|
||||
|
||||
class DiskIO(object):
|
||||
"""Simple object to simplify mocking of file operations in Mock
|
||||
based testing"""
|
||||
|
||||
class TestFile(StringIO):
|
||||
def __init__(self, store, path, content = ""):
|
||||
StringIO.__init__(self, content)
|
||||
self._store = store
|
||||
self._path = path
|
||||
self._ro = False
|
||||
|
||||
def flush(self):
|
||||
self._store[self._path] = self.getvalue()
|
||||
|
||||
def close(self):
|
||||
self.flush()
|
||||
return StringIO.close(self)
|
||||
|
||||
def __del__(self):
|
||||
try:
|
||||
self.close()
|
||||
except (AttributeError, ValueError):
|
||||
pass
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, *_):
|
||||
self.close()
|
||||
|
||||
class Dir(object):
|
||||
pass
|
||||
|
||||
class Link(object):
|
||||
pass
|
||||
|
||||
def __init__(self):
|
||||
self.reset()
|
||||
|
||||
def __getitem__(self, key):
|
||||
return self.fs[key]
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
self.fs[key] = value
|
||||
|
||||
def reset(self):
|
||||
self.fs = {
|
||||
"/proc": self.Dir,
|
||||
"/proc/cmdline": "linux",
|
||||
}
|
||||
self._pwd = "/"
|
||||
|
||||
#Emulate file objects
|
||||
def open(self, filename, mode = "r"):
|
||||
path = os.path.join(self._pwd, filename)
|
||||
content = self.fs.get(path, None)
|
||||
if content == self.Dir:
|
||||
raise IOError("[Errno 21] Is a directory: '%s'" % (path))
|
||||
elif mode.startswith("w"):
|
||||
self.fs[path] = ""
|
||||
f = self.TestFile(self.fs, path, self.fs[path])
|
||||
elif mode.endswith("a"):
|
||||
if not path in self.fs:
|
||||
self.fs[path] = ""
|
||||
f = self.TestFile(self.fs, path, self.fs[path])
|
||||
f.seek(0, os.SEEK_END)
|
||||
elif content == None:
|
||||
raise IOError("[Errno 2] No such file or directory: '%s'" % (path,))
|
||||
elif mode.endswith("+"):
|
||||
f = self.TestFile(self.fs, path, content)
|
||||
if mode.startswith('r'):
|
||||
f.seek(0, os.SEEK_SET)
|
||||
else:
|
||||
f.seek(0, os.SEEK_END)
|
||||
else:
|
||||
f = self.TestFile(self.fs, path, content)
|
||||
|
||||
return f
|
||||
|
||||
#Emulate os calls
|
||||
def glob_glob(self, pattern):
|
||||
return fnmatch.filter(self.fs.keys(), pattern)
|
||||
|
||||
def os_listdir(self, path):
|
||||
return [entry[len(path):].lstrip('/') for entry in self.fs.keys()\
|
||||
if entry.startswith(path) and entry != path]
|
||||
|
||||
def os_path_exists(self, path):
|
||||
path = os.path.join(self._pwd, path)
|
||||
return self.fs.has_key(path)
|
||||
|
||||
def os_path_isdir(self, path):
|
||||
if not path.endswith("/"):
|
||||
path += "/"
|
||||
path += "*"
|
||||
return len(fnmatch.filter(self.fs.keys(), path)) > 0
|
||||
|
||||
def os_remove(self, path):
|
||||
path = os.path.join(self._pwd, path)
|
||||
try:
|
||||
del self.fs[path]
|
||||
except KeyError:
|
||||
raise OSError("[Errno 2] No such file or directory: '%s'" % (path,))
|
||||
|
||||
def os_access(self, path, mode):
|
||||
return self.os_path_exists(path)
|
@ -1,271 +0,0 @@
|
||||
# mock.py
|
||||
# Test tools for mocking and patching.
|
||||
# Copyright (C) 2007-2009 Michael Foord
|
||||
# E-mail: fuzzyman AT voidspace DOT org DOT uk
|
||||
|
||||
# mock 0.6.0
|
||||
# http://www.voidspace.org.uk/python/mock/
|
||||
|
||||
# Released subject to the BSD License
|
||||
# Please see http://www.voidspace.org.uk/python/license.shtml
|
||||
|
||||
# Scripts maintained at http://www.voidspace.org.uk/python/index.shtml
|
||||
# Comments, suggestions and bug reports welcome.
|
||||
|
||||
|
||||
__all__ = (
|
||||
'Mock',
|
||||
'patch',
|
||||
'patch_object',
|
||||
'sentinel',
|
||||
'DEFAULT'
|
||||
)
|
||||
|
||||
__version__ = '0.6.0'
|
||||
|
||||
class SentinelObject(object):
|
||||
def __init__(self, name):
|
||||
self.name = name
|
||||
|
||||
def __repr__(self):
|
||||
return '<SentinelObject "%s">' % self.name
|
||||
|
||||
|
||||
class Sentinel(object):
|
||||
def __init__(self):
|
||||
self._sentinels = {}
|
||||
|
||||
def __getattr__(self, name):
|
||||
return self._sentinels.setdefault(name, SentinelObject(name))
|
||||
|
||||
|
||||
sentinel = Sentinel()
|
||||
|
||||
DEFAULT = sentinel.DEFAULT
|
||||
|
||||
class OldStyleClass:
|
||||
pass
|
||||
ClassType = type(OldStyleClass)
|
||||
|
||||
def _is_magic(name):
|
||||
return '__%s__' % name[2:-2] == name
|
||||
|
||||
def _copy(value):
|
||||
if type(value) in (dict, list, tuple, set):
|
||||
return type(value)(value)
|
||||
return value
|
||||
|
||||
|
||||
class Mock(object):
|
||||
|
||||
def __init__(self, spec=None, side_effect=None, return_value=DEFAULT,
|
||||
name=None, parent=None, wraps=None):
|
||||
self._parent = parent
|
||||
self._name = name
|
||||
if spec is not None and not isinstance(spec, list):
|
||||
spec = [member for member in dir(spec) if not _is_magic(member)]
|
||||
|
||||
self._methods = spec
|
||||
self._children = {}
|
||||
self._return_value = return_value
|
||||
self.side_effect = side_effect
|
||||
self._wraps = wraps
|
||||
|
||||
self.reset_mock()
|
||||
|
||||
|
||||
def reset_mock(self):
|
||||
self.called = False
|
||||
self.call_args = None
|
||||
self.call_count = 0
|
||||
self.call_args_list = []
|
||||
self.method_calls = []
|
||||
for child in self._children.itervalues():
|
||||
child.reset_mock()
|
||||
if isinstance(self._return_value, Mock):
|
||||
self._return_value.reset_mock()
|
||||
|
||||
|
||||
def __get_return_value(self):
|
||||
if self._return_value is DEFAULT:
|
||||
self._return_value = Mock()
|
||||
return self._return_value
|
||||
|
||||
def __set_return_value(self, value):
|
||||
self._return_value = value
|
||||
|
||||
return_value = property(__get_return_value, __set_return_value)
|
||||
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
self.called = True
|
||||
self.call_count += 1
|
||||
self.call_args = (args, kwargs)
|
||||
self.call_args_list.append((args, kwargs))
|
||||
|
||||
parent = self._parent
|
||||
name = self._name
|
||||
while parent is not None:
|
||||
parent.method_calls.append((name, args, kwargs))
|
||||
if parent._parent is None:
|
||||
break
|
||||
name = parent._name + '.' + name
|
||||
parent = parent._parent
|
||||
|
||||
ret_val = DEFAULT
|
||||
if self.side_effect is not None:
|
||||
if (isinstance(self.side_effect, Exception) or
|
||||
isinstance(self.side_effect, (type, ClassType)) and
|
||||
issubclass(self.side_effect, Exception)):
|
||||
raise self.side_effect
|
||||
|
||||
ret_val = self.side_effect(*args, **kwargs)
|
||||
if ret_val is DEFAULT:
|
||||
ret_val = self.return_value
|
||||
|
||||
if self._wraps is not None and self._return_value is DEFAULT:
|
||||
return self._wraps(*args, **kwargs)
|
||||
if ret_val is DEFAULT:
|
||||
ret_val = self.return_value
|
||||
return ret_val
|
||||
|
||||
|
||||
def __getattr__(self, name):
|
||||
if self._methods is not None:
|
||||
if name not in self._methods:
|
||||
raise AttributeError("Mock object has no attribute '%s'" % name)
|
||||
elif _is_magic(name):
|
||||
raise AttributeError(name)
|
||||
|
||||
if name not in self._children:
|
||||
wraps = None
|
||||
if self._wraps is not None:
|
||||
wraps = getattr(self._wraps, name)
|
||||
self._children[name] = Mock(parent=self, name=name, wraps=wraps)
|
||||
|
||||
return self._children[name]
|
||||
|
||||
|
||||
def assert_called_with(self, *args, **kwargs):
|
||||
assert self.call_args == (args, kwargs), 'Expected: %s\nCalled with: %s' % ((args, kwargs), self.call_args)
|
||||
|
||||
|
||||
def _dot_lookup(thing, comp, import_path):
|
||||
try:
|
||||
return getattr(thing, comp)
|
||||
except AttributeError:
|
||||
__import__(import_path)
|
||||
return getattr(thing, comp)
|
||||
|
||||
|
||||
def _importer(target):
|
||||
components = target.split('.')
|
||||
import_path = components.pop(0)
|
||||
thing = __import__(import_path)
|
||||
|
||||
for comp in components:
|
||||
import_path += ".%s" % comp
|
||||
thing = _dot_lookup(thing, comp, import_path)
|
||||
return thing
|
||||
|
||||
|
||||
class _patch(object):
|
||||
def __init__(self, target, attribute, new, spec, create):
|
||||
self.target = target
|
||||
self.attribute = attribute
|
||||
self.new = new
|
||||
self.spec = spec
|
||||
self.create = create
|
||||
self.has_local = False
|
||||
|
||||
|
||||
def __call__(self, func):
|
||||
if hasattr(func, 'patchings'):
|
||||
func.patchings.append(self)
|
||||
return func
|
||||
|
||||
def patched(*args, **keywargs):
|
||||
# don't use a with here (backwards compatability with 2.5)
|
||||
extra_args = []
|
||||
for patching in patched.patchings:
|
||||
arg = patching.__enter__()
|
||||
if patching.new is DEFAULT:
|
||||
extra_args.append(arg)
|
||||
args += tuple(extra_args)
|
||||
try:
|
||||
return func(*args, **keywargs)
|
||||
finally:
|
||||
for patching in getattr(patched, 'patchings', []):
|
||||
patching.__exit__()
|
||||
|
||||
patched.patchings = [self]
|
||||
patched.__name__ = func.__name__
|
||||
patched.compat_co_firstlineno = getattr(func, "compat_co_firstlineno",
|
||||
func.func_code.co_firstlineno)
|
||||
return patched
|
||||
|
||||
|
||||
def get_original(self):
|
||||
target = self.target
|
||||
name = self.attribute
|
||||
create = self.create
|
||||
|
||||
original = DEFAULT
|
||||
if _has_local_attr(target, name):
|
||||
try:
|
||||
original = target.__dict__[name]
|
||||
except AttributeError:
|
||||
# for instances of classes with slots, they have no __dict__
|
||||
original = getattr(target, name)
|
||||
elif not create and not hasattr(target, name):
|
||||
raise AttributeError("%s does not have the attribute %r" % (target, name))
|
||||
return original
|
||||
|
||||
|
||||
def __enter__(self):
|
||||
new, spec, = self.new, self.spec
|
||||
original = self.get_original()
|
||||
if new is DEFAULT:
|
||||
# XXXX what if original is DEFAULT - shouldn't use it as a spec
|
||||
inherit = False
|
||||
if spec == True:
|
||||
# set spec to the object we are replacing
|
||||
spec = original
|
||||
if isinstance(spec, (type, ClassType)):
|
||||
inherit = True
|
||||
new = Mock(spec=spec)
|
||||
if inherit:
|
||||
new.return_value = Mock(spec=spec)
|
||||
self.temp_original = original
|
||||
setattr(self.target, self.attribute, new)
|
||||
return new
|
||||
|
||||
|
||||
def __exit__(self, *_):
|
||||
if self.temp_original is not DEFAULT:
|
||||
setattr(self.target, self.attribute, self.temp_original)
|
||||
else:
|
||||
delattr(self.target, self.attribute)
|
||||
del self.temp_original
|
||||
|
||||
|
||||
def patch_object(target, attribute, new=DEFAULT, spec=None, create=False):
|
||||
return _patch(target, attribute, new, spec, create)
|
||||
|
||||
|
||||
def patch(target, new=DEFAULT, spec=None, create=False):
|
||||
try:
|
||||
target, attribute = target.rsplit('.', 1)
|
||||
except (TypeError, ValueError):
|
||||
raise TypeError("Need a valid target to patch. You supplied: %r" % (target,))
|
||||
target = _importer(target)
|
||||
return _patch(target, attribute, new, spec, create)
|
||||
|
||||
|
||||
|
||||
def _has_local_attr(obj, name):
|
||||
try:
|
||||
return name in vars(obj)
|
||||
except TypeError:
|
||||
# objects without a __dict__
|
||||
return hasattr(obj, name)
|
@ -1,45 +0,0 @@
|
||||
# tests/pyanaconda_test/Makefile.am for anaconda
|
||||
#
|
||||
# Copyright (C) 2010 Red Hat, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published
|
||||
# by the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Author: Tomas Mlcoch <tmlcoch@redhat.com>
|
||||
|
||||
EXTRA_DIST = *.py
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
ANACDIR = $(top_builddir)/pyanaconda
|
||||
TESTS_ENVIRONMENT = PYTHONPATH=$(top_builddir)/tests:$(ANACDIR)/isys/.libs:$(ANACDIR):$(top_builddir)
|
||||
|
||||
TESTS = backend_test.py \
|
||||
bootloader_test.py \
|
||||
cmdline_test.py \
|
||||
desktop_test.py \
|
||||
flags_test.py \
|
||||
image_test.py \
|
||||
language_test.py \
|
||||
network_test.py \
|
||||
packages_test.py \
|
||||
packaging_test.py \
|
||||
partintfhelpers_test.py \
|
||||
product_test.py \
|
||||
rescue_test.py \
|
||||
security_test.py \
|
||||
simpleconfig_test.py \
|
||||
timezone_test.py \
|
||||
upgrade_test.py \
|
||||
users_test.py \
|
||||
vnc_test.py
|
@ -1,227 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import mock
|
||||
|
||||
class BackendTest(mock.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
import pykickstart.commands
|
||||
|
||||
self.setupModules(["_isys", "block", 'parted', 'storage',
|
||||
'pyanaconda.storage.formats', 'logging',
|
||||
'logging.config',
|
||||
'ConfigParser', 'pyanaconda.anaconda_log',
|
||||
'pyanaconda.storage.storage_log',
|
||||
'pyanaconda.yuminstall'])
|
||||
|
||||
import pyanaconda
|
||||
pyanaconda.anaconda_log = mock.Mock()
|
||||
|
||||
import logging
|
||||
self.logger = mock.Mock()
|
||||
logging.getLogger.return_value = self.logger
|
||||
|
||||
self.DD_EXTRACTED = '/tmp/DD'
|
||||
|
||||
import pyanaconda.backend
|
||||
pyanaconda.backend.os = mock.Mock()
|
||||
pyanaconda.backend.DD_EXTRACTED = self.DD_EXTRACTED
|
||||
pyanaconda.backend.glob = mock.Mock()
|
||||
pyanaconda.backend.shutil = mock.Mock()
|
||||
|
||||
self.logger.reset_mock()
|
||||
|
||||
def tearDown(self):
|
||||
self.tearDownModules()
|
||||
|
||||
def anaconda_backend_copy_firmware_test(self):
|
||||
import pyanaconda.backend
|
||||
FILE = 'foo'
|
||||
pyanaconda.backend.glob.glob.return_value = [FILE]
|
||||
|
||||
anaconda = mock.Mock()
|
||||
ab = pyanaconda.backend.AnacondaBackend(anaconda)
|
||||
ab.copyFirmware()
|
||||
self.assertEqual(pyanaconda.backend.shutil.copyfile.call_args[0][0], FILE)
|
||||
|
||||
def anaconda_backend_do_post_install_test(self):
|
||||
import pyanaconda.backend
|
||||
from pyanaconda.constants import ROOT_PATH
|
||||
FILE = 'foo'
|
||||
A = 'a'
|
||||
B = 'b'
|
||||
C = 'c'
|
||||
pyanaconda.backend.AnacondaBackend.copyFirmware = mock.Mock()
|
||||
pyanaconda.backend.AnacondaBackend.kernelVersionList = mock.Mock(
|
||||
return_value=[(A, B, C)])
|
||||
pyanaconda.backend.packages = mock.Mock()
|
||||
pyanaconda.backend.glob.glob.return_value = [FILE]
|
||||
|
||||
pyanaconda.backend.os.path.exists.return_value=True
|
||||
pyanaconda.backend.os.path.basename.return_value=""
|
||||
|
||||
pyanaconda.backend.storage = mock.Mock()
|
||||
pyanaconda.backend.sys = mock.Mock()
|
||||
|
||||
anaconda = mock.Mock()
|
||||
anaconda.extraModules = True
|
||||
|
||||
ab = pyanaconda.backend.AnacondaBackend(anaconda)
|
||||
ab.doPostInstall(anaconda)
|
||||
|
||||
self.assertEqual(pyanaconda.backend.packages.method_calls[0],
|
||||
('recreateInitrd', (A, ROOT_PATH), {}))
|
||||
self.assertEqual(pyanaconda.backend.shutil.method_calls[0],
|
||||
('copytree', (FILE, ROOT_PATH + '/root/'), {}))
|
||||
self.assertEqual(pyanaconda.backend.shutil.method_calls[1],
|
||||
('copytree', (self.DD_EXTRACTED, ROOT_PATH + '/root/DD'), {}))
|
||||
self.assertTrue(pyanaconda.backend.storage.writeEscrowPackets.called)
|
||||
|
||||
def anaconda_backend_do_install_test(self):
|
||||
import pyanaconda.backend
|
||||
anaconda = mock.Mock()
|
||||
ab = pyanaconda.backend.AnacondaBackend(anaconda)
|
||||
self.assertRaises(NotImplementedError, ab.doInstall, anaconda)
|
||||
|
||||
def anaconda_backend_kernel_version_list_test(self):
|
||||
import pyanaconda.backend
|
||||
anaconda = mock.Mock()
|
||||
ab = pyanaconda.backend.AnacondaBackend(anaconda)
|
||||
ret = ab.kernelVersionList()
|
||||
self.assertEqual([], ret)
|
||||
|
||||
def anaconda_backend_get_minimum_size_mb_test(self):
|
||||
import pyanaconda.backend
|
||||
PART = mock.Mock()
|
||||
anaconda = mock.Mock()
|
||||
ab = pyanaconda.backend.AnacondaBackend(anaconda)
|
||||
ret = ab.getMinimumSizeMB(PART)
|
||||
self.assertEqual(0, ret)
|
||||
|
||||
def anaconda_backend_do_backend_setup_test(self):
|
||||
import pyanaconda.backend
|
||||
anaconda = mock.Mock()
|
||||
ab = pyanaconda.backend.AnacondaBackend(anaconda)
|
||||
ab.doBackendSetup(anaconda)
|
||||
self.assertTrue(self.logger.warning.called)
|
||||
|
||||
def anaconda_backend_group_exists_test(self):
|
||||
import pyanaconda.backend
|
||||
GROUP = mock.Mock()
|
||||
anaconda = mock.Mock()
|
||||
ab = pyanaconda.backend.AnacondaBackend(anaconda)
|
||||
ab.groupExists(GROUP)
|
||||
self.assertTrue(self.logger.warning.called)
|
||||
|
||||
def anaconda_backend_select_group_test(self):
|
||||
import pyanaconda.backend
|
||||
GROUP = mock.Mock()
|
||||
anaconda = mock.Mock()
|
||||
ab = pyanaconda.backend.AnacondaBackend(anaconda)
|
||||
ab.selectGroup(GROUP)
|
||||
self.assertTrue(self.logger.warning.called)
|
||||
|
||||
def anaconda_backend_deselect_group_test(self):
|
||||
import pyanaconda.backend
|
||||
GROUP = mock.Mock()
|
||||
anaconda = mock.Mock()
|
||||
ab = pyanaconda.backend.AnacondaBackend(anaconda)
|
||||
ab.deselectGroup(GROUP)
|
||||
self.assertTrue(self.logger.warning.called)
|
||||
|
||||
def anaconda_backend_package_exists_test(self):
|
||||
import pyanaconda.backend
|
||||
PKG = mock.Mock()
|
||||
anaconda = mock.Mock()
|
||||
ab = pyanaconda.backend.AnacondaBackend(anaconda)
|
||||
ab.packageExists(PKG)
|
||||
self.assertTrue(self.logger.warning.called)
|
||||
|
||||
def anaconda_backend_select_package_test(self):
|
||||
import pyanaconda.backend
|
||||
PKG = mock.Mock()
|
||||
anaconda = mock.Mock()
|
||||
ab = pyanaconda.backend.AnacondaBackend(anaconda)
|
||||
ab.selectPackage(PKG)
|
||||
self.assertTrue(self.logger.warning.called)
|
||||
|
||||
def anaconda_backend_deselect_package_test(self):
|
||||
import pyanaconda.backend
|
||||
PKG = mock.Mock()
|
||||
anaconda = mock.Mock()
|
||||
ab = pyanaconda.backend.AnacondaBackend(anaconda)
|
||||
ab.deselectPackage(PKG)
|
||||
self.assertTrue(self.logger.warning.called)
|
||||
|
||||
def anaconda_backend_get_default_groups_test(self):
|
||||
import pyanaconda.backend
|
||||
anaconda = mock.Mock()
|
||||
ab = pyanaconda.backend.AnacondaBackend(anaconda)
|
||||
ab.getDefaultGroups(anaconda)
|
||||
self.assertTrue(self.logger.warning.called)
|
||||
|
||||
def anaconda_backend_write_configuration_test(self):
|
||||
import pyanaconda.backend
|
||||
anaconda = mock.Mock()
|
||||
ab = pyanaconda.backend.AnacondaBackend(anaconda)
|
||||
ab.writeConfiguration()
|
||||
self.assertTrue(self.logger.warning.called)
|
||||
|
||||
def do_backend_setup_1_test(self):
|
||||
import pyanaconda.backend
|
||||
RET = -1
|
||||
pyanaconda.backend.DISPATCH_BACK = RET
|
||||
anaconda = mock.Mock()
|
||||
anaconda.backend.doBackendSetup.return_value = RET
|
||||
ret = pyanaconda.backend.doBackendSetup(anaconda)
|
||||
self.assertEqual(RET, ret)
|
||||
|
||||
def do_post_selection_test(self):
|
||||
import pyanaconda.backend
|
||||
anaconda = mock.Mock()
|
||||
pyanaconda.backend.doPostSelection(anaconda)
|
||||
self.assertTrue(anaconda.backend.doPostSelection.called)
|
||||
|
||||
def do_pre_install_test(self):
|
||||
import pyanaconda.backend
|
||||
anaconda = mock.Mock()
|
||||
pyanaconda.backend.doPreInstall(anaconda)
|
||||
self.assertTrue(anaconda.backend.doPreInstall.called)
|
||||
|
||||
def do_post_install_test(self):
|
||||
import pyanaconda.backend
|
||||
anaconda = mock.Mock()
|
||||
pyanaconda.backend.doPostInstall(anaconda)
|
||||
self.assertTrue(anaconda.backend.doPostInstall.called)
|
||||
|
||||
def do_install_test(self):
|
||||
import pyanaconda.backend
|
||||
anaconda = mock.Mock()
|
||||
pyanaconda.backend.doInstall(anaconda)
|
||||
self.assertTrue(anaconda.backend.doInstall.called)
|
||||
|
||||
def do_base_package_select_1_test(self):
|
||||
import pyanaconda.backend
|
||||
pyanaconda.backend.kickstart = mock.Mock()
|
||||
anaconda = mock.Mock()
|
||||
anaconda.ksdata = True
|
||||
|
||||
pyanaconda.backend.doBasePackageSelect(anaconda)
|
||||
self.assertTrue(anaconda.backend.resetPackageSelections.called)
|
||||
|
||||
def do_base_package_select_2_test(self):
|
||||
import pyanaconda.backend
|
||||
anaconda = mock.Mock()
|
||||
anaconda.ksdata = False
|
||||
|
||||
pyanaconda.backend.doBasePackageSelect(anaconda)
|
||||
self.assertTrue(anaconda.backend.resetPackageSelections.called)
|
||||
self.assertTrue(anaconda.instClass.setPackageSelection.called)
|
||||
self.assertTrue(anaconda.instClass.setGroupSelection.called)
|
||||
|
||||
def write_configuration_test(self):
|
||||
import pyanaconda.backend
|
||||
anaconda = mock.Mock()
|
||||
pyanaconda.backend.writeConfiguration(anaconda)
|
||||
self.assertTrue(anaconda.write.called)
|
||||
self.assertTrue(anaconda.backend.writeConfiguration)
|
@ -1,59 +0,0 @@
|
||||
import mock
|
||||
|
||||
class ArgumentsTest(mock.TestCase):
|
||||
def setUp(self):
|
||||
self.setupModules(
|
||||
['_isys', 'logging', 'pyanaconda.anaconda_log', 'block',
|
||||
'pyanaconda.storage',
|
||||
'pyanaconda.storage.devicelibs',
|
||||
'pyanaconda.storage.errors'])
|
||||
|
||||
import pyanaconda
|
||||
pyanaconda.anaconda_log = mock.Mock()
|
||||
|
||||
def tearDown(self):
|
||||
self.tearDownModules()
|
||||
|
||||
def test_basic(self):
|
||||
from pyanaconda.bootloader import Arguments
|
||||
a = Arguments()
|
||||
a.update(set(["a", "b", "c"]))
|
||||
b = Arguments()
|
||||
b.add("b")
|
||||
diff = a - b
|
||||
self.assertEqual(diff, set(["a", "c"]))
|
||||
self.assertIsInstance(diff, Arguments)
|
||||
assert(str(diff) in ["a c", "c a"])
|
||||
|
||||
def test_merge_ip(self):
|
||||
from pyanaconda.bootloader import Arguments
|
||||
# test that _merge_ip() doesnt break the simple case:
|
||||
a = Arguments(["one", "two", "ip=eth0:dhcp"])
|
||||
a._merge_ip()
|
||||
self.assertEqual(a, Arguments(["one", "two", "ip=eth0:dhcp"]))
|
||||
|
||||
# test that it does what it's supposed to:
|
||||
a = Arguments(["one", "two", "ip=eth0:dhcp", "ip=eth0:auto6",
|
||||
"ip=wlan0:dhcp",
|
||||
"ip=10.34.102.102::10.34.39.255:24:aklab:eth2:none"])
|
||||
a._merge_ip()
|
||||
self.assertEqual(a, set([
|
||||
"one", "two",
|
||||
"ip=wlan0:dhcp",
|
||||
"ip=10.34.102.102::10.34.39.255:24:aklab:eth2:none",
|
||||
"ip=eth0:auto6,dhcp"]))
|
||||
|
||||
def test_output_with_merge(self):
|
||||
from pyanaconda.bootloader import Arguments
|
||||
a = Arguments(["ip=eth0:dhcp"])
|
||||
self.assertEqual(str(a), "ip=eth0:dhcp")
|
||||
a = Arguments(["ip=eth0:dhcp", "ip=eth0:auto6"])
|
||||
assert(str(a) in ["ip=eth0:auto6,dhcp", "ip=eth0:dhcp,auto6"])
|
||||
|
||||
def test_sorting(self):
|
||||
from pyanaconda.bootloader import Arguments
|
||||
a = Arguments(["ip=eth0:dhcp", "rhgb", "quiet",
|
||||
"root=/dev/mapper/destroyers-rubies", "rd.md=0",
|
||||
"rd.luks=0"])
|
||||
# 'rhgb quiet' should be the final entries:
|
||||
assert(str(a).endswith("rhgb quiet"))
|
@ -1,100 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import mock
|
||||
import sys
|
||||
|
||||
class DesktopTest(mock.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.setupModules(["_isys", "block", "ConfigParser"])
|
||||
self.fs = mock.DiskIO()
|
||||
|
||||
self.fs.open('/mnt/sysimage/etc/inittab', 'w').write('id:5:initdefault:')
|
||||
self.fs.open('/mnt/sysimage/etc/sysconfig/desktop', 'w').write('')
|
||||
|
||||
import pyanaconda.desktop
|
||||
pyanaconda.desktop.log = mock.Mock()
|
||||
pyanaconda.desktop.open = self.fs.open
|
||||
|
||||
def tearDown(self):
|
||||
self.tearDownModules()
|
||||
|
||||
def set_default_run_level_1_test(self):
|
||||
import pyanaconda.desktop
|
||||
dskt = pyanaconda.desktop.Desktop()
|
||||
self.assertRaises(RuntimeError, dskt.setDefaultRunLevel, 1)
|
||||
self.assertRaises(RuntimeError, dskt.setDefaultRunLevel, 2)
|
||||
self.assertRaises(RuntimeError, dskt.setDefaultRunLevel, 4)
|
||||
|
||||
def set_default_run_level_2_test(self):
|
||||
import pyanaconda.desktop
|
||||
dskt = pyanaconda.desktop.Desktop()
|
||||
dskt.setDefaultRunLevel(3)
|
||||
self.assertEqual(dskt.runlevel, 3)
|
||||
dskt.setDefaultRunLevel(5)
|
||||
self.assertEqual(dskt.runlevel, 5)
|
||||
|
||||
def get_default_run_level_test(self):
|
||||
import pyanaconda.desktop
|
||||
dskt = pyanaconda.desktop.Desktop()
|
||||
self.assertEqual(dskt.getDefaultRunLevel(), dskt.runlevel)
|
||||
|
||||
def set_get_default_run_level_1_test(self):
|
||||
import pyanaconda.desktop
|
||||
dskt = pyanaconda.desktop.Desktop()
|
||||
dskt.setDefaultRunLevel(3)
|
||||
self.assertEqual(dskt.getDefaultRunLevel(), 3)
|
||||
|
||||
def set_get_default_run_level_2_test(self):
|
||||
import pyanaconda.desktop
|
||||
dskt = pyanaconda.desktop.Desktop()
|
||||
dskt.setDefaultRunLevel(5)
|
||||
self.assertEqual(dskt.getDefaultRunLevel(), 5)
|
||||
|
||||
def set_default_desktop_test(self):
|
||||
import pyanaconda.desktop
|
||||
dskt = pyanaconda.desktop.Desktop()
|
||||
dskt.setDefaultDesktop('desktop')
|
||||
self.assertEqual(dskt.info['DESKTOP'], 'desktop')
|
||||
|
||||
def get_default_desktop_test(self):
|
||||
import pyanaconda.desktop
|
||||
dskt = pyanaconda.desktop.Desktop()
|
||||
dskt.info['DESKTOP'] = 'foobar'
|
||||
ret = dskt.getDefaultDesktop()
|
||||
self.assertEqual(ret, 'foobar')
|
||||
|
||||
def set_get_default_desktop_test(self):
|
||||
import pyanaconda.desktop
|
||||
dskt = pyanaconda.desktop.Desktop()
|
||||
dskt.setDefaultDesktop('foo')
|
||||
ret = dskt.getDefaultDesktop()
|
||||
self.assertEqual(ret, 'foo')
|
||||
|
||||
def write_1_test(self):
|
||||
import pyanaconda.desktop
|
||||
dskt = pyanaconda.desktop.Desktop()
|
||||
dskt.write()
|
||||
self.assertEqual(self.fs['/mnt/sysimage/etc/inittab'],
|
||||
'id:3:initdefault:')
|
||||
|
||||
def write_2_test(self):
|
||||
import pyanaconda.desktop
|
||||
dskt = pyanaconda.desktop.Desktop()
|
||||
dskt.setDefaultRunLevel(5)
|
||||
dskt.write()
|
||||
self.assertEqual(self.fs['/mnt/sysimage/etc/inittab'],
|
||||
'id:5:initdefault:')
|
||||
|
||||
def write_3_test(self):
|
||||
import pyanaconda.desktop
|
||||
pyanaconda.desktop.os = mock.Mock()
|
||||
pyanaconda.desktop.os.path.isdir.return_value = True
|
||||
dskt = pyanaconda.desktop.Desktop()
|
||||
dskt.setDefaultDesktop('foo')
|
||||
dskt.write()
|
||||
self.assertEqual(self.fs['/mnt/sysimage/etc/inittab'],
|
||||
'id:3:initdefault:')
|
||||
self.assertEqual(self.fs['/mnt/sysimage/etc/sysconfig/desktop'],
|
||||
'DESKTOP="foo"\n')
|
||||
|
@ -1,132 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# Test Bug 500198
|
||||
|
||||
import mock
|
||||
import sys
|
||||
|
||||
|
||||
class FlagsTest(mock.TestCase):
|
||||
"""Simulate /proc/cmdline parameters parsing (#500198)"""
|
||||
|
||||
def setUp(self):
|
||||
self.setupModules(["_isys", "block", "ConfigParser"])
|
||||
|
||||
self.fs = mock.DiskIO()
|
||||
|
||||
import pyanaconda.flags
|
||||
|
||||
self.mock2 = mock.Mock()
|
||||
pyanaconda.flags.open = mock.Mock(return_value=self.mock2)
|
||||
|
||||
def tearDown(self):
|
||||
self.tearDownModules()
|
||||
|
||||
def createcmdlinedict_1_test(self):
|
||||
"""/proc/cmdline without BOOT_IMAGE param"""
|
||||
import pyanaconda.flags
|
||||
|
||||
self.cmd = 'vmlinuz initrd=initrd.img stage2=hd:LABEL="Fedora" xdriver=vesa nomodeset'
|
||||
self.mock2.read = mock.Mock(return_value=self.cmd)
|
||||
cmddict = pyanaconda.flags.flags.createCmdlineDict()
|
||||
|
||||
self.assertEqual(set(cmddict.keys()),
|
||||
set(['vmlinuz', 'initrd', 'stage2', 'xdriver', 'nomodeset']))
|
||||
|
||||
def createcmdlinedict_2_test(self):
|
||||
"""/proc/cmdline param: quotes at end"""
|
||||
import pyanaconda.flags
|
||||
|
||||
self.cmd = 'vmlinuz BOOT_IMAGE=/boot/img initrd=initrd.img stage2=hd:LABEL="Fedora"'
|
||||
self.mock2.read = mock.Mock(return_value=self.cmd)
|
||||
try:
|
||||
cmddict = pyanaconda.flags.flags.createCmdlineDict()
|
||||
except (ValueError):
|
||||
self.assertTrue(False, "ValueError exception was raised.")
|
||||
|
||||
self.assertEqual(set(cmddict.keys()),
|
||||
set(['vmlinuz', 'BOOT_IMAGE', 'initrd', 'stage2']))
|
||||
|
||||
def createcmdlinedict_3_test(self):
|
||||
"""/proc/cmdline param BOOT_IMAGE with quotes (no quotes at end)"""
|
||||
import pyanaconda.flags
|
||||
|
||||
self.cmd = 'vmlinuz BOOT_IMAGE="img img" initrd=initrd.img'
|
||||
self.mock2.read = mock.Mock(return_value=self.cmd)
|
||||
cmddict = pyanaconda.flags.flags.createCmdlineDict()
|
||||
|
||||
self.assertEqual(set(cmddict.keys()),
|
||||
set(['vmlinuz', 'BOOT_IMAGE', 'initrd']))
|
||||
|
||||
def createcmdlinedict_4_test(self):
|
||||
"""/proc/cmdline param BOOT_IMAGE with quotes (no quotes at end) v2"""
|
||||
import pyanaconda.flags
|
||||
|
||||
self.cmd = 'vmlinuz BOOT_IMAGE="/boot/img" stage2=hd:LABEL="Fedora" initrd=initrd.img'
|
||||
self.mock2.read = mock.Mock(return_value=self.cmd)
|
||||
cmddict = pyanaconda.flags.flags.createCmdlineDict()
|
||||
|
||||
self.assertEqual(set(cmddict.keys()),
|
||||
set(['vmlinuz', 'BOOT_IMAGE', 'initrd', 'stage2']))
|
||||
|
||||
def createcmdlinedict_5_test(self):
|
||||
"""/proc/cmdline param: BOOT_IMAGE with quotes (+ quotes at end)"""
|
||||
import pyanaconda.flags
|
||||
|
||||
self.cmd = 'vmlinuz BOOT_IMAGE="/boot/img img" initrd=initrd.img stage2=hd:LABEL="Fedora"'
|
||||
self.mock2.read = mock.Mock(return_value=self.cmd)
|
||||
try:
|
||||
cmddict = pyanaconda.flags.flags.createCmdlineDict()
|
||||
except (ValueError):
|
||||
self.assertTrue(False, "ValueError exception was raised.")
|
||||
|
||||
self.assertEqual(set(cmddict.keys()),
|
||||
set(['vmlinuz', 'BOOT_IMAGE', 'initrd', 'stage2']))
|
||||
|
||||
def setattr_getattr_1_test(self):
|
||||
import pyanaconda.flags
|
||||
RET = 1
|
||||
self.cmd = 'vmlinuz initrd=initrd.img xdriver=vesa nomodeset'
|
||||
self.mock2.read = mock.Mock(return_value=self.cmd)
|
||||
pyanaconda.flags.flags.sshd = RET
|
||||
self.assertEqual(RET, pyanaconda.flags.flags.sshd)
|
||||
|
||||
def setattr_getattr_2_test(self):
|
||||
import pyanaconda.flags
|
||||
RET = 0
|
||||
self.cmd = 'vmlinuz initrd=initrd.img xdriver=vesa nomodeset'
|
||||
self.mock2.read = mock.Mock(return_value=self.cmd)
|
||||
pyanaconda.flags.flags.sshd = RET
|
||||
self.assertEqual(RET, pyanaconda.flags.flags.sshd)
|
||||
|
||||
def setattr_getattr_3_test(self):
|
||||
import pyanaconda.flags
|
||||
self.cmd = 'vmlinuz initrd=initrd.img xdriver=vesa nomodeset'
|
||||
self.mock2.read = mock.Mock(return_value=self.cmd)
|
||||
|
||||
def f(): return pyanaconda.flags.flags.fooattr
|
||||
self.assertRaises(AttributeError, f)
|
||||
|
||||
def setattr_getattr_4_test(self):
|
||||
import pyanaconda.flags
|
||||
self.cmd = 'vmlinuz initrd=initrd.img xdriver=vesa nomodeset'
|
||||
self.mock2.read = mock.Mock(return_value=self.cmd)
|
||||
|
||||
def f(): pyanaconda.flags.flags.fooattr = 1
|
||||
self.assertRaises(AttributeError, f)
|
||||
|
||||
def get_1_test(self):
|
||||
import pyanaconda.flags
|
||||
RET = 'text'
|
||||
self.cmd = 'vmlinuz initrd=initrd.img xdriver=vesa nomodeset'
|
||||
self.mock2.read = mock.Mock(return_value=self.cmd)
|
||||
ret = pyanaconda.flags.flags.get('foobar', RET)
|
||||
self.assertEqual(RET, ret)
|
||||
|
||||
def get_2_test(self):
|
||||
import pyanaconda.flags
|
||||
RET = 'text'
|
||||
self.cmd = 'vmlinuz initrd=initrd.img xdriver=vesa nomodeset'
|
||||
self.mock2.read = mock.Mock(return_value=self.cmd)
|
||||
ret = pyanaconda.flags.flags.get('sshd', RET)
|
||||
self.assertNotEqual(RET, ret)
|
@ -1,147 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import mock
|
||||
import sys
|
||||
|
||||
IMAGENAME = 'Fedora-13-i386-DVD.iso'
|
||||
|
||||
class ImageTest(mock.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.setupModules(["_isys", "block", "ConfigParser"])
|
||||
self.fs = mock.DiskIO()
|
||||
|
||||
DISCINFO = "1273712438.740122\n"
|
||||
DISCINFO += "Fedora 13\n"
|
||||
DISCINFO += "i386\n"
|
||||
DISCINFO += "ALL\n"
|
||||
|
||||
DISCINFO2 = "1273712438.740122\n"
|
||||
DISCINFO2 += "Fedora 13\n"
|
||||
DISCINFO2 += "i386\n"
|
||||
DISCINFO2 += "1,2\n"
|
||||
|
||||
self.fs.open('/mnt/install/cdimage/.discinfo', 'w').write(DISCINFO)
|
||||
self.fs.open('/tmp/.discinfo', 'w').write(DISCINFO2)
|
||||
|
||||
import pyanaconda.image
|
||||
pyanaconda.image.gettext = mock.Mock()
|
||||
pyanaconda.image.log = mock.Mock()
|
||||
pyanaconda.image.open = self.fs.open
|
||||
pyanaconda.image.isys = mock.Mock()
|
||||
pyanaconda.image._arch = 'i386'
|
||||
pyanaconda.image.stat = mock.Mock()
|
||||
pyanaconda.image.stat.ST_SIZE = 0
|
||||
|
||||
pyanaconda.image.os = mock.Mock()
|
||||
pyanaconda.image.os.R_OK = 0
|
||||
pyanaconda.image.os.stat.return_value = [2048]
|
||||
pyanaconda.image.os.listdir.return_value=[IMAGENAME]
|
||||
|
||||
def tearDown(self):
|
||||
self.tearDownModules()
|
||||
|
||||
def get_media_id_1_test(self):
|
||||
import pyanaconda.image
|
||||
ret = pyanaconda.image.getMediaId('/mnt/install/cdimage')
|
||||
self.assertEqual(ret, '1273712438.740122')
|
||||
|
||||
def get_media_id_2_test(self):
|
||||
import pyanaconda.image
|
||||
pyanaconda.image.os.access = mock.Mock(return_value=False)
|
||||
ret = pyanaconda.image.getMediaId('/')
|
||||
self.assertEqual(ret, None)
|
||||
|
||||
def mount_directory_1_test(self):
|
||||
import pyanaconda.image
|
||||
pyanaconda.image.os.path.ismount = mock.Mock(return_value=False)
|
||||
pyanaconda.image.mountDirectory('hd:/dev/sda1:/', mock.Mock())
|
||||
self.assertEqual(pyanaconda.image.isys.method_calls,
|
||||
[('mount', ('/dev/sda1', '/mnt/install/isodir'), {'fstype': 'auto', 'options':''})])
|
||||
|
||||
def mount_directory_2_test(self):
|
||||
import pyanaconda.image
|
||||
pyanaconda.image.os.path.ismount = mock.Mock(return_value=False)
|
||||
pyanaconda.image.mountDirectory('hd:sda1:/', mock.Mock())
|
||||
self.assertEqual(pyanaconda.image.isys.method_calls,
|
||||
[('mount', ('/dev/sda1', '/mnt/install/isodir'), {'fstype': 'auto', 'options':''})])
|
||||
|
||||
def mount_directory_3_test(self):
|
||||
import pyanaconda.image
|
||||
pyanaconda.image.os.path.ismount = mock.Mock(return_value=True)
|
||||
pyanaconda.image.mountDirectory('hd:sda1:/', mock.Mock())
|
||||
self.assertEqual(pyanaconda.image.isys.method_calls, [])
|
||||
|
||||
def mount_image_1_test(self):
|
||||
import pyanaconda.image
|
||||
self.assertRaises(SystemError, pyanaconda.image.mountImage, '', '/mnt/install/cdimage', mock.Mock())
|
||||
|
||||
def mount_image_2_test(self):
|
||||
import pyanaconda.image
|
||||
pyanaconda.image.os.path.ismount = mock.Mock(return_value=False)
|
||||
ret = pyanaconda.image.mountImage('', '/mnt/install/cdimage', mock.Mock())
|
||||
|
||||
self.assertEqual(pyanaconda.image.isys.method_calls,
|
||||
[('isIsoImage', ('/Fedora-13-i386-DVD.iso',), {}),
|
||||
('mount', ('/Fedora-13-i386-DVD.iso', '/mnt/install/cdimage'),
|
||||
{'readOnly': True, 'fstype': 'iso9660'}),
|
||||
('umount', ('/mnt/install/cdimage',), {'removeDir': False}),
|
||||
('mount', ('/Fedora-13-i386-DVD.iso', '/mnt/install/cdimage'),
|
||||
{'readOnly': True, 'fstype': 'iso9660'}),
|
||||
])
|
||||
|
||||
def scan_for_media_1_test(self):
|
||||
import pyanaconda.image
|
||||
storage = mock.Mock()
|
||||
storage.devicetree.devices = []
|
||||
ret = pyanaconda.image.scanForMedia(mock.Mock(), storage)
|
||||
self.assertEqual(ret, None)
|
||||
|
||||
def scan_for_media_2_test(self):
|
||||
import pyanaconda.image
|
||||
device = mock.Mock()
|
||||
device.type = 'cdrom'
|
||||
device.name = 'deviceName'
|
||||
storage = mock.Mock()
|
||||
storage.devicetree.devices = [device]
|
||||
ret = pyanaconda.image.scanForMedia('/tmp', storage)
|
||||
self.assertEqual(ret, 'deviceName')
|
||||
self.assertEqual(device.method_calls,
|
||||
[('format.mount', (), {'mountpoint': '/tmp'})])
|
||||
|
||||
def umount_image_1_test(self):
|
||||
import pyanaconda.image
|
||||
pyanaconda.image.umountImage('/tmp')
|
||||
self.assertEqual(pyanaconda.image.isys.method_calls,
|
||||
[('umount', ('/tmp',), {'removeDir': False})])
|
||||
|
||||
def unmount_cd_1_test(self):
|
||||
import pyanaconda.image
|
||||
window = mock.Mock()
|
||||
pyanaconda.image.unmountCD(None, window)
|
||||
self.assertEqual(window.method_calls, [])
|
||||
|
||||
def unmount_cd_2_test(self):
|
||||
import pyanaconda.image
|
||||
window = mock.Mock()
|
||||
device = mock.Mock()
|
||||
pyanaconda.image.unmountCD(device, window)
|
||||
self.assertEqual(window.method_calls, [])
|
||||
self.assertEqual(device.method_calls,
|
||||
[('format.unmount', (), {})])
|
||||
|
||||
def verify_media_1_test(self):
|
||||
import pyanaconda.image
|
||||
ret = pyanaconda.image.verifyMedia('/tmp')
|
||||
self.assertTrue(ret)
|
||||
|
||||
def verify_media_2_test(self):
|
||||
import pyanaconda.image
|
||||
ret = pyanaconda.image.verifyMedia('/tmp', timestamp=1337)
|
||||
self.assertFalse(ret)
|
||||
|
||||
def verify_media_3_test(self):
|
||||
import pyanaconda.image
|
||||
pyanaconda.image._arch = 'x86_64'
|
||||
ret = pyanaconda.image.verifyMedia('/tmp', 1)
|
||||
self.assertFalse(ret)
|
@ -1,49 +0,0 @@
|
||||
import mock
|
||||
|
||||
class IndexedDictTest(mock.TestCase):
|
||||
def setUp(self):
|
||||
self.setupModules(['_isys'])
|
||||
|
||||
def tearDown(self):
|
||||
self.tearDownModules()
|
||||
|
||||
def instantiation_test(self):
|
||||
from pyanaconda.indexed_dict import IndexedDict
|
||||
d = IndexedDict()
|
||||
self.assertIsInstance(d, IndexedDict)
|
||||
|
||||
def append_test(self):
|
||||
from pyanaconda.indexed_dict import IndexedDict
|
||||
d = IndexedDict()
|
||||
stored_data = [1, 2, 3]
|
||||
d["some_step"] = stored_data
|
||||
self.assertIs(d["some_step"], stored_data)
|
||||
|
||||
def cant_append_test(self):
|
||||
from pyanaconda.indexed_dict import IndexedDict
|
||||
def assign_int(indexed_dict):
|
||||
indexed_dict[3] = [1, 2, 3]
|
||||
d = IndexedDict()
|
||||
self.assertRaises(TypeError, d.__setitem__, 3, [1, 2, 3])
|
||||
|
||||
def referencing_test(self):
|
||||
from pyanaconda.indexed_dict import IndexedDict
|
||||
d = IndexedDict()
|
||||
d["first"] = 10
|
||||
d["second"] = 20
|
||||
d["third"] = 30
|
||||
self.assertEqual(d[0], 10)
|
||||
self.assertEqual(d[1], 20)
|
||||
self.assertEqual(d[2], 30)
|
||||
self.assertRaises(IndexError, d.__getitem__, 3)
|
||||
|
||||
def index_test(self):
|
||||
from pyanaconda.indexed_dict import IndexedDict
|
||||
d = IndexedDict()
|
||||
d["first"] = 10
|
||||
d["second"] = 20
|
||||
d["third"] = 30
|
||||
|
||||
self.assertEqual(d.index("first"), 0)
|
||||
self.assertEqual(d.index("second"), 1)
|
||||
self.assertEqual(d.index("third"), 2)
|
@ -1,37 +0,0 @@
|
||||
import mock
|
||||
import sys
|
||||
|
||||
class IutilTest(mock.TestCase):
|
||||
def setUp(self):
|
||||
self.setupModules(
|
||||
['_isys', 'logging', 'pyanaconda.anaconda_log', 'block'])
|
||||
|
||||
import pyanaconda
|
||||
pyanaconda.anaconda_log = mock.Mock()
|
||||
|
||||
def tearDown(self):
|
||||
self.tearDownModules()
|
||||
|
||||
def copy_to_sysimage_test(self):
|
||||
from pyanaconda import iutil
|
||||
fs = mock.DiskIO()
|
||||
self.take_over_io(fs, iutil)
|
||||
self.assertEqual(iutil.copy_to_sysimage("/etc/securetty"), False)
|
||||
|
||||
fs["/etc/securetty"] = "tty1"
|
||||
iutil.os.makedirs = mock.Mock()
|
||||
iutil.shutil.copy = mock.Mock()
|
||||
self.assertEqual(iutil.copy_to_sysimage("/etc/securetty"), True)
|
||||
iutil.os.makedirs.assert_called_with("/mnt/sysimage/etc")
|
||||
iutil.shutil.copy.assert_called_with("/etc/securetty",
|
||||
"/mnt/sysimage/etc/securetty")
|
||||
|
||||
def testExecCaptureNonZeroFatal (self):
|
||||
import iutil
|
||||
try:
|
||||
argv = ["-c", "import sys; sys.exit(3);"]
|
||||
iutil.execWithCapture(sys.executable, argv, root=None, fatal=True)
|
||||
except RuntimeError, ex:
|
||||
self.assertIn("return code: 3", str(ex))
|
||||
else:
|
||||
self.fail("RuntimeError not raised")
|
@ -1,389 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import mock
|
||||
import os
|
||||
|
||||
class NetworkTest(mock.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.setupModules(['_isys', 'block', 'logging', 'ConfigParser'])
|
||||
self.fs = mock.DiskIO()
|
||||
|
||||
self.OK = 22
|
||||
self.SYSCONFIGDIR = "/tmp/etc/sysconfig"
|
||||
self.NETSCRIPTSDIR = "%s/network-scripts" % (self.SYSCONFIGDIR)
|
||||
self.NETWORKCONFFILE = '%s/network' % self.SYSCONFIGDIR
|
||||
self.IFCFGLOG = '/tmp/ifcfg.log'
|
||||
self.DEFAULT_HOSTNAME = 'localhost.localdomain'
|
||||
|
||||
self.CONT = "DEVICE=eth0\nHWADDR=00:11:22:50:55:50\nTYPE=Ethernet\nBOOTPROTO=dhcp\n"
|
||||
self.DEVICE = 'eth0'
|
||||
self.DEV_FILE = self.NETSCRIPTSDIR + '/ifcfg-eth0'
|
||||
self.DEV_KEY_FILE = self.NETSCRIPTSDIR + '/keys-eth0'
|
||||
self.fs.open(self.DEV_FILE, 'w').write(self.CONT)
|
||||
|
||||
import pyanaconda
|
||||
pyanaconda.anaconda_log = mock.Mock()
|
||||
|
||||
import pyanaconda.network
|
||||
pyanaconda.network.socket = mock.Mock()
|
||||
pyanaconda.network.socket.gethostname.return_value = self.DEFAULT_HOSTNAME
|
||||
pyanaconda.network.open = self.fs.open
|
||||
pyanaconda.simpleconfig.open = self.fs.open
|
||||
pyanaconda.network.sysconfigDir = self.SYSCONFIGDIR
|
||||
pyanaconda.network.netscriptsDir = self.NETSCRIPTSDIR
|
||||
pyanaconda.network.networkConfFile = self.NETWORKCONFFILE
|
||||
pyanaconda.network.ifcfgLogFile = self.IFCFGLOG
|
||||
self.fs.open(self.IFCFGLOG, 'w')
|
||||
|
||||
# Network mock
|
||||
pyanaconda.network.Network.update = mock.Mock()
|
||||
self.setNMControlledDevices_backup = pyanaconda.network.Network.setNMControlledDevices
|
||||
pyanaconda.network.Network.setNMControlledDevices = mock.Mock()
|
||||
pyanaconda.network.Network.netdevices = {}
|
||||
|
||||
def tearDown(self):
|
||||
self.tearDownModules()
|
||||
|
||||
def sanity_check_hostname_1_test(self):
|
||||
import pyanaconda.network
|
||||
(valid, err) = pyanaconda.network.sanityCheckHostname('desktop')
|
||||
self.assertTrue(valid)
|
||||
|
||||
def sanity_check_hostname_2_test(self):
|
||||
import pyanaconda.network
|
||||
(valid, err) = pyanaconda.network.sanityCheckHostname('')
|
||||
self.assertFalse(valid)
|
||||
|
||||
def sanity_check_hostname_3_test(self):
|
||||
import pyanaconda.network
|
||||
(valid, err) = pyanaconda.network.sanityCheckHostname('c'*256)
|
||||
self.assertFalse(valid)
|
||||
|
||||
def sanity_check_hostname_4_test(self):
|
||||
import pyanaconda.network
|
||||
(valid, err) = pyanaconda.network.sanityCheckHostname('_asf')
|
||||
self.assertFalse(valid)
|
||||
|
||||
def sanity_check_hostname_5_test(self):
|
||||
import pyanaconda.network
|
||||
(valid, err) = pyanaconda.network.sanityCheckHostname('a?f')
|
||||
self.assertFalse(valid)
|
||||
|
||||
def get_default_hostname_1_test(self):
|
||||
import pyanaconda.network
|
||||
|
||||
HOSTNAME = 'host1'
|
||||
pyanaconda.network.getActiveNetDevs = mock.Mock(return_value=['dev'])
|
||||
pyanaconda.network.isys = mock.Mock()
|
||||
pyanaconda.network.isys.getIPAddresses.return_value = ['10.0.0.1']
|
||||
pyanaconda.network.socket = mock.Mock()
|
||||
pyanaconda.network.socket.gethostbyaddr.return_value = [HOSTNAME, '', '']
|
||||
|
||||
ret = pyanaconda.network.getDefaultHostname(mock.Mock())
|
||||
self.assertEqual(ret, HOSTNAME)
|
||||
|
||||
def get_default_hostname_2_test(self):
|
||||
import pyanaconda.network
|
||||
|
||||
HOSTNAME = 'host2'
|
||||
pyanaconda.network.getActiveNetDevs = mock.Mock(return_value=[])
|
||||
pyanaconda.network.isys = mock.Mock()
|
||||
pyanaconda.network.socket = mock.Mock()
|
||||
anaconda = mock.Mock()
|
||||
anaconda.network.hostname = HOSTNAME
|
||||
|
||||
ret = pyanaconda.network.getDefaultHostname(anaconda)
|
||||
self.assertEqual(ret, HOSTNAME)
|
||||
|
||||
def get_default_hostname_3_test(self):
|
||||
import pyanaconda.network
|
||||
|
||||
HOSTNAME = 'host3'
|
||||
pyanaconda.network.getActiveNetDevs = mock.Mock(return_value=[])
|
||||
pyanaconda.network.isys = mock.Mock()
|
||||
pyanaconda.network.socket = mock.Mock()
|
||||
pyanaconda.network.socket.gethostname.return_value = HOSTNAME
|
||||
anaconda = mock.Mock()
|
||||
anaconda.network.hostname = ''
|
||||
|
||||
ret = pyanaconda.network.getDefaultHostname(anaconda)
|
||||
self.assertEqual(ret, HOSTNAME)
|
||||
|
||||
def get_default_hostname_4_test(self):
|
||||
import pyanaconda.network
|
||||
|
||||
pyanaconda.network.getActiveNetDevs = mock.Mock(return_value=[])
|
||||
pyanaconda.network.isys = mock.Mock()
|
||||
pyanaconda.network.socket = mock.Mock()
|
||||
pyanaconda.network.socket.gethostname.return_value = ''
|
||||
anaconda = mock.Mock()
|
||||
anaconda.network.hostname = ''
|
||||
|
||||
ret = pyanaconda.network.getDefaultHostname(anaconda)
|
||||
self.assertEqual(ret, self.DEFAULT_HOSTNAME)
|
||||
|
||||
def sanity_check_ip_string_1_test(self):
|
||||
import pyanaconda.network
|
||||
|
||||
IPADDR = '10.0.0.5'
|
||||
pyanaconda.network.sanityCheckIPString(IPADDR)
|
||||
|
||||
def sanity_check_ip_string_2_test(self):
|
||||
import pyanaconda.network
|
||||
|
||||
IPADDR = "ff06:0:0:0:0:0:0:c3"
|
||||
pyanaconda.network.sanityCheckIPString(IPADDR)
|
||||
|
||||
def sanity_check_ip_string_3_test(self):
|
||||
import pyanaconda.network
|
||||
|
||||
IPADDR = "ff06:.:.:0:0:0:0:c3"
|
||||
self.assertRaises(pyanaconda.network.IPError,
|
||||
pyanaconda.network.sanityCheckIPString, IPADDR)
|
||||
|
||||
def sanity_check_ip_string_4_test(self):
|
||||
import pyanaconda.network
|
||||
import socket
|
||||
pyanaconda.network.socket.error = socket.error
|
||||
pyanaconda.network.socket.inet_pton = mock.Mock(side_effect=socket.error)
|
||||
|
||||
IPADDR = "1.8.64.512"
|
||||
self.assertRaises(pyanaconda.network.IPError,
|
||||
pyanaconda.network.sanityCheckIPString, IPADDR)
|
||||
|
||||
def sanity_check_ip_string_5_test(self):
|
||||
import pyanaconda.network
|
||||
import socket
|
||||
pyanaconda.network.socket.error = socket.error
|
||||
pyanaconda.network.socket.inet_pton = mock.Mock(side_effect=socket.error)
|
||||
|
||||
IPADDR = "top.secret.address"
|
||||
self.assertRaises(pyanaconda.network.IPError,
|
||||
pyanaconda.network.sanityCheckIPString, IPADDR)
|
||||
|
||||
def has_active_net_dev_1_test(self):
|
||||
import pyanaconda.network
|
||||
|
||||
pyanaconda.network.dbus = mock.Mock()
|
||||
pyanaconda.network.dbus.Interface().Get.return_value = \
|
||||
pyanaconda.network.isys.NM_STATE_CONNECTED_GLOBAL
|
||||
|
||||
ret = pyanaconda.network.hasActiveNetDev()
|
||||
self.assertTrue(ret)
|
||||
self.assertTrue(pyanaconda.network.dbus.Interface().Get.called)
|
||||
|
||||
def has_active_net_dev_2_test(self):
|
||||
import pyanaconda.network
|
||||
|
||||
pyanaconda.network.dbus = mock.Mock(side_effect=Exception)
|
||||
|
||||
ret = pyanaconda.network.hasActiveNetDev()
|
||||
self.assertFalse(ret)
|
||||
|
||||
def has_active_net_dev_3_test(self):
|
||||
import pyanaconda.network
|
||||
|
||||
pyanaconda.network.dbus = mock.Mock()
|
||||
pyanaconda.network.dbus.Interface().Get.return_value = self.OK
|
||||
pyanaconda.network.isys.NM_STATE_CONNECTED = (self.OK - 5)
|
||||
|
||||
ret = pyanaconda.network.hasActiveNetDev()
|
||||
self.assertFalse(ret)
|
||||
|
||||
def networkdevice_read_test(self):
|
||||
import pyanaconda.network
|
||||
|
||||
nd = pyanaconda.network.NetworkDevice(self.NETSCRIPTSDIR, self.DEVICE)
|
||||
ret = nd.read()
|
||||
self.assertEqual(ret, 4)
|
||||
self.assertEqual(nd.info,
|
||||
{'DEVICE': 'eth0', 'HWADDR': '00:11:22:50:55:50',
|
||||
'BOOTPROTO': 'dhcp', 'TYPE': 'Ethernet'})
|
||||
|
||||
def networkdevice_clear_test(self):
|
||||
import pyanaconda.network
|
||||
|
||||
nd = pyanaconda.network.NetworkDevice(self.NETSCRIPTSDIR, self.DEVICE)
|
||||
nd.info = {'DEVICE': 'eth0', 'HWADDR': '00:11:22:50:55:50', 'TYPE': 'Ethernet'}
|
||||
nd.clear()
|
||||
self.assertEqual(nd.info, {})
|
||||
|
||||
def networkdevice_str_test(self):
|
||||
import pyanaconda.network
|
||||
pyanaconda.network.arch = mock.Mock()
|
||||
pyanaconda.network.arch.isS390.return_value = False
|
||||
|
||||
nd = pyanaconda.network.NetworkDevice(self.NETSCRIPTSDIR, self.DEVICE)
|
||||
nd.info = {'HWADDR': '00:11:22:50:55:50', 'DEVICE': 'eth0', 'TYPE': 'Ethernet'}
|
||||
self.assertIn('DEVICE="eth0"', str(nd))
|
||||
self.assertIn('TYPE="Ethernet"', str(nd))
|
||||
|
||||
def networkdevice_load_ifcfg_file_test(self):
|
||||
import pyanaconda.network
|
||||
nd = pyanaconda.network.NetworkDevice(self.NETSCRIPTSDIR, self.DEVICE)
|
||||
nd.loadIfcfgFile()
|
||||
self.assertFalse(nd._dirty)
|
||||
self.assertEqual(nd.info,
|
||||
{'DEVICE': 'eth0', 'HWADDR': '00:11:22:50:55:50',
|
||||
'TYPE': 'Ethernet', 'BOOTPROTO': 'dhcp'})
|
||||
|
||||
def networkdevice_write_ifcfg_file_test(self):
|
||||
import pyanaconda.network
|
||||
nd = pyanaconda.network.NetworkDevice(self.NETSCRIPTSDIR, self.DEVICE)
|
||||
nd.info = {'HWADDR': '66:55:44:33:22:11', 'DEVICE': 'eth1', 'TYPE': 'Ethernet'}
|
||||
nd._dirty = True
|
||||
nd.writeIfcfgFile()
|
||||
self.assertIn('DEVICE="eth1"\n', self.fs[self.DEV_FILE])
|
||||
self.assertIn('HWADDR="66:55:44:33:22:11"', self.fs[self.DEV_FILE])
|
||||
self.assertIn('TYPE="Ethernet"', self.fs[self.DEV_FILE])
|
||||
|
||||
def networkdevice_set_1_test(self):
|
||||
import pyanaconda.network
|
||||
nd = pyanaconda.network.NetworkDevice(self.NETSCRIPTSDIR, self.DEVICE)
|
||||
nd.set(('key', 'value'))
|
||||
self.assertEqual(nd.info, {'KEY': 'value'})
|
||||
self.assertTrue(nd._dirty)
|
||||
|
||||
def networkdevice_set_2_test(self):
|
||||
import pyanaconda.network
|
||||
nd = pyanaconda.network.NetworkDevice(self.NETSCRIPTSDIR, self.DEVICE)
|
||||
nd.set(('key', 'value'))
|
||||
nd.set(('key', 'other_value'))
|
||||
self.assertEqual(nd.info, {'KEY': 'other_value'})
|
||||
self.assertTrue(nd._dirty)
|
||||
|
||||
def networkdevice_set_3_test(self):
|
||||
import pyanaconda.network
|
||||
nd = pyanaconda.network.NetworkDevice(self.NETSCRIPTSDIR, self.DEVICE)
|
||||
nd.set(('key', 'value'))
|
||||
nd._dirty = False
|
||||
nd.set(('key', 'other_value'))
|
||||
self.assertEqual(nd.info, {'KEY': 'other_value'})
|
||||
self.assertTrue(nd._dirty)
|
||||
|
||||
def networkdevice_set_gateway_test(self):
|
||||
import pyanaconda.network
|
||||
nd = pyanaconda.network.NetworkDevice(self.NETSCRIPTSDIR, self.DEVICE)
|
||||
nd.setGateway('10.0.0.1')
|
||||
self.assertEqual(nd.info, {'GATEWAY': '10.0.0.1'})
|
||||
self.assertTrue(nd._dirty)
|
||||
|
||||
def networkdevice_set_gateway_ipv6_test(self):
|
||||
import pyanaconda.network
|
||||
nd = pyanaconda.network.NetworkDevice(self.NETSCRIPTSDIR, self.DEVICE)
|
||||
nd.setGateway('fe80::5675:d0ff:feac:4d3f')
|
||||
self.assertEqual(nd.info, {'IPV6_DEFAULTGW': 'fe80::5675:d0ff:feac:4d3f'})
|
||||
self.assertTrue(nd._dirty)
|
||||
|
||||
def networkdevice_set_dns_test(self):
|
||||
import pyanaconda.network
|
||||
nd = pyanaconda.network.NetworkDevice(self.NETSCRIPTSDIR, self.DEVICE)
|
||||
nd.setDNS('10.0.0.1, 10.0.0.2')
|
||||
self.assertEqual(nd.info, {'DNS1': '10.0.0.1'})
|
||||
self.assertEqual(nd.info, {'DNS2': '10.0.0.2'})
|
||||
self.assertTrue(nd._dirty)
|
||||
|
||||
def networkdevice_keyfile_path_test(self):
|
||||
import pyanaconda.network
|
||||
nd = pyanaconda.network.NetworkDevice(self.NETSCRIPTSDIR, self.DEVICE)
|
||||
ret = nd.keyfilePath
|
||||
self.assertEqual(ret, self.DEV_KEY_FILE)
|
||||
|
||||
def networkdevice_write_wepkey_file_1_test(self):
|
||||
import pyanaconda.network
|
||||
nd = pyanaconda.network.NetworkDevice(self.NETSCRIPTSDIR, self.DEVICE)
|
||||
nd.wepkey = False
|
||||
ret = nd.writeWepkeyFile()
|
||||
self.assertFalse(ret)
|
||||
|
||||
def networkdevice_write_wepkey_file_2_test(self):
|
||||
import pyanaconda.network
|
||||
TMP_FILE = '/tmp/wep.key'
|
||||
TMP_DIR = '/tmp/wepkeyfiles'
|
||||
pyanaconda.network.tempfile = mock.Mock()
|
||||
pyanaconda.network.tempfile.mkstemp.return_value = (88, TMP_FILE)
|
||||
pyanaconda.network.os = mock.Mock()
|
||||
pyanaconda.network.os.path = os.path
|
||||
pyanaconda.network.shutil = mock.Mock()
|
||||
|
||||
nd = pyanaconda.network.NetworkDevice(self.NETSCRIPTSDIR, self.DEVICE)
|
||||
nd.iface = self.DEVICE
|
||||
nd.wepkey = '12345'
|
||||
|
||||
nd.writeWepkeyFile(dir=TMP_DIR)
|
||||
self.assertEqual(pyanaconda.network.os.write.call_args[0], (88, 'KEY1=12345\n'))
|
||||
self.assertEqual(pyanaconda.network.shutil.move.call_args[0],
|
||||
(TMP_FILE, '%s/keys-%s' % (TMP_DIR, self.DEVICE)))
|
||||
|
||||
def network_nm_controlled_devices_1_test(self):
|
||||
import pyanaconda.network
|
||||
nw = pyanaconda.network.Network()
|
||||
nw.netdevices = {'dev': mock.Mock()}
|
||||
pyanaconda.network.Network.setNMControlledDevices = self.setNMControlledDevices_backup
|
||||
nw.setNMControlledDevices()
|
||||
self.assertEqual(nw.netdevices['dev'].method_calls,
|
||||
[('set', (('NM_CONTROLLED', 'yes'),), {})])
|
||||
|
||||
def network_nm_controlled_devices_2_test(self):
|
||||
import pyanaconda.network
|
||||
nw = pyanaconda.network.Network()
|
||||
nw.netdevices = {'dev': mock.Mock()}
|
||||
pyanaconda.network.Network.setNMControlledDevices = self.setNMControlledDevices_backup
|
||||
nw.setNMControlledDevices([''])
|
||||
self.assertEqual(nw.netdevices['dev'].method_calls,
|
||||
[('set', (('NM_CONTROLLED', 'no'),), {})])
|
||||
|
||||
def network_write_ks_test(self):
|
||||
import pyanaconda.network
|
||||
TMPFILE = '/tmp/networkKS'
|
||||
f = self.fs.open(TMPFILE, 'w')
|
||||
|
||||
nw = pyanaconda.network.Network()
|
||||
nw.netdevices[self.DEVICE] = pyanaconda.network.NetworkDevice(
|
||||
self.NETSCRIPTSDIR, self.DEVICE)
|
||||
nw.netdevices[self.DEVICE].loadIfcfgFile()
|
||||
nw.writeKS(f)
|
||||
f.close()
|
||||
|
||||
self.assertEqual(self.fs[TMPFILE],
|
||||
'network --device eth0 --bootproto dhcp --noipv6\n')
|
||||
|
||||
def network_wait_for_connection_1_test(self):
|
||||
import pyanaconda.network
|
||||
pyanaconda.network.dbus = mock.Mock()
|
||||
pyanaconda.network.dbus.Interface().Get.return_value = \
|
||||
pyanaconda.network.isys.NM_STATE_CONNECTED_GLOBAL
|
||||
|
||||
ret = pyanaconda.network.waitForConnection()
|
||||
self.assertTrue(ret)
|
||||
|
||||
def network_wait_for_connection_2_test(self):
|
||||
import pyanaconda.network
|
||||
pyanaconda.network.dbus = mock.Mock()
|
||||
pyanaconda.network.dbus.Interface().Get.return_value = self.OK-5
|
||||
pyanaconda.network.isys = mock.Mock()
|
||||
pyanaconda.network.isys.NM_STATE_CONNECTED = self.OK
|
||||
pyanaconda.network.time.sleep = mock.Mock()
|
||||
|
||||
ret = pyanaconda.network.waitForConnection()
|
||||
self.assertFalse(ret)
|
||||
|
||||
def network_bring_up_test(self):
|
||||
import pyanaconda.network
|
||||
pyanaconda.network.Network.write = mock.Mock()
|
||||
pyanaconda.network.waitForConnection = mock.Mock()
|
||||
|
||||
nw = pyanaconda.network.Network()
|
||||
nw.bringUp()
|
||||
self.assertTrue(pyanaconda.network.Network.write.called)
|
||||
self.assertTrue(pyanaconda.network.waitForConnection.called)
|
||||
|
||||
def iface_for_host_ip_test(self):
|
||||
import pyanaconda.network
|
||||
pyanaconda.network.arch = mock.Mock()
|
||||
pyanaconda.network.arch.execWithCapture.return_value = \
|
||||
"10.0.0.2 dev eth0 src 10.0.0.1"
|
||||
|
||||
ret = pyanaconda.network.ifaceForHostIP('10.0.0.2')
|
||||
self.assertEqual(ret, 'eth0')
|
@ -1,25 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import mock
|
||||
|
||||
class PackagesTest(mock.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.setupModules(["_isys", "block", "logging", "parted", "storage",
|
||||
"pyanaconda.storage.formats", "ConfigParser",
|
||||
"pyanaconda.storage.storage_log"])
|
||||
self.fs = mock.DiskIO()
|
||||
|
||||
import pyanaconda
|
||||
pyanaconda.anaconda_log = mock.Mock()
|
||||
|
||||
import pyanaconda.packages
|
||||
|
||||
def tearDown(self):
|
||||
self.tearDownModules()
|
||||
|
||||
def do_post_action_test(self):
|
||||
import pyanaconda.packages
|
||||
anaconda = mock.Mock()
|
||||
pyanaconda.packages.doPostAction(anaconda)
|
||||
self.assertTrue(anaconda.instClass.postAction.called)
|
@ -1,126 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import mock
|
||||
|
||||
class PackagingTest(mock.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.setupModules(["_isys", "logging"])
|
||||
|
||||
import pyanaconda
|
||||
pyanaconda.anaconda_log = mock.Mock()
|
||||
|
||||
from pykickstart.version import makeVersion
|
||||
from pyanaconda.flags import flags
|
||||
|
||||
# set some things specially since we're just testing
|
||||
flags.testing = True
|
||||
|
||||
# set up ksdata
|
||||
self.ksdata = makeVersion()
|
||||
|
||||
from pyanaconda.packaging import Payload
|
||||
self.payload = Payload(self.ksdata)
|
||||
|
||||
def tearDown(self):
|
||||
self.tearDownModules()
|
||||
#os.system("rm -rf %s" % self.root)
|
||||
|
||||
def payload_abstract_test(self):
|
||||
self.assertRaises(NotImplementedError, self.payload.setup, None)
|
||||
self.assertRaises(NotImplementedError, self.payload.description, None)
|
||||
|
||||
def payload_repo_test(self):
|
||||
# ksdata repo list initially empty
|
||||
self.assertEqual(self.payload.data.repo.dataList(), [])
|
||||
|
||||
# create and add a new ksdata repo
|
||||
repo_name = "test1"
|
||||
repo = self.ksdata.RepoData(name=repo_name, baseurl="http://localhost/")
|
||||
self.payload.addRepo(repo)
|
||||
|
||||
# verify the repo was added
|
||||
self.assertEqual(self.payload.data.repo.dataList(), [repo])
|
||||
self.assertEqual(self.payload.getAddOnRepo(repo_name), repo)
|
||||
|
||||
# remove the repo
|
||||
self.payload.removeRepo(repo_name)
|
||||
|
||||
# verify the repo was removed
|
||||
self.assertEqual(self.payload.getAddOnRepo(repo_name), None)
|
||||
|
||||
def payload_group_test(self):
|
||||
import pykickstart.constants
|
||||
from pykickstart.parser import Group
|
||||
|
||||
# verify that ksdata group lists are initially empty
|
||||
self.assertEqual(self.payload.data.packages.groupList, [])
|
||||
self.assertEqual(self.payload.data.packages.excludedGroupList, [])
|
||||
|
||||
self.payload.deselectGroup("core")
|
||||
self.assertEqual(self.payload.groupSelected("core"), False)
|
||||
|
||||
# select a group and verify the selection is reflected afterward
|
||||
self.payload.selectGroup("core", optional=True)
|
||||
self.assertTrue(self.payload.groupSelected("core"))
|
||||
|
||||
# verify the group is not in the excluded group list
|
||||
self.assertTrue(Group("core") not in self.payload.data.packages.excludedGroupList)
|
||||
|
||||
# verify the include (optional/all) is recorded
|
||||
groups = self.payload.data.packages.groupList
|
||||
group = groups[[g.name for g in groups].index("core")]
|
||||
self.assertEqual(group.include, pykickstart.constants.GROUP_ALL)
|
||||
|
||||
# select more groups
|
||||
self.payload.selectGroup("base")
|
||||
self.payload.selectGroup("development", default=False)
|
||||
|
||||
# verify include types for newly selected groups
|
||||
group = groups[[g.name for g in groups].index("development")]
|
||||
self.assertEqual(group.include, pykickstart.constants.GROUP_REQUIRED)
|
||||
|
||||
group = groups[[g.name for g in groups].index("base")]
|
||||
self.assertEqual(group.include, pykickstart.constants.GROUP_DEFAULT)
|
||||
|
||||
# deselect a group and verify the set of groups is correct afterward
|
||||
self.payload.deselectGroup("base")
|
||||
self.assertFalse(self.payload.groupSelected("base"))
|
||||
self.assertTrue(self.payload.groupSelected("core"))
|
||||
self.assertTrue(self.payload.groupSelected("development"))
|
||||
|
||||
def payload_package_test(self):
|
||||
# verify that ksdata package lists are initially empty
|
||||
self.assertEqual(self.payload.data.packages.packageList, [])
|
||||
self.assertEqual(self.payload.data.packages.excludedList, [])
|
||||
|
||||
name = "vim-common"
|
||||
|
||||
# deselect a package
|
||||
self.payload.deselectPackage(name)
|
||||
self.assertEqual(self.payload.packageSelected(name), False)
|
||||
|
||||
# select the same package and verify it
|
||||
self.payload.selectPackage(name)
|
||||
self.assertEqual(self.payload.packageSelected(name), True)
|
||||
self.assertTrue(name in self.payload.data.packages.packageList)
|
||||
self.assertFalse(name in self.payload.data.packages.excludedList)
|
||||
|
||||
# select some other packages
|
||||
self.payload.selectPackage("bash")
|
||||
self.payload.selectPackage("gnote")
|
||||
|
||||
# deselect one of them and then verify the selection state of them all
|
||||
self.payload.deselectPackage("bash")
|
||||
self.assertFalse(self.payload.packageSelected("bash"))
|
||||
self.assertTrue(self.payload.packageSelected("gnote"))
|
||||
self.assertTrue(self.payload.packageSelected(name))
|
||||
|
||||
def payload_get_release_version_test(self):
|
||||
# Given no URL, _getReleaseVersion should be able to get a releasever
|
||||
# from pyanaconda.constants.productVersion. This trickery is due to the
|
||||
# fact that pyanaconda/packaging/__init__.py will have already imported
|
||||
# productVersion from pyanaconda.constants.
|
||||
import pyanaconda.packaging
|
||||
pyanaconda.packaging.productVersion = "17-Beta"
|
||||
self.assertEqual(self.payload._getReleaseVersion(None), "17")
|
@ -1,480 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import mock
|
||||
|
||||
class PartIntfHelpersTest(mock.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.setupModules(["_isys", "block", 'parted', 'storage',
|
||||
'pyanaconda.storage.formats', 'logging',
|
||||
'ConfigParser', 'pyanaconda.storage.storage_log'])
|
||||
|
||||
self.fs = mock.DiskIO()
|
||||
|
||||
import pyanaconda
|
||||
pyanaconda.anaconda_log = mock.Mock()
|
||||
|
||||
import pyanaconda.partIntfHelpers
|
||||
|
||||
def tearDown(self):
|
||||
self.tearDownModules()
|
||||
|
||||
# sanityCheckVolumeGroupName tests
|
||||
|
||||
def sanitycheckvolumegroupname_right_hostname_1_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
HOSTNAME = "hostname"
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckVolumeGroupName(HOSTNAME)
|
||||
self.assertEqual(ret, None)
|
||||
|
||||
def sanitycheckvolumegroupname_right_hostname_2_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
HOSTNAME = "h"
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckVolumeGroupName(HOSTNAME)
|
||||
self.assertEqual(ret, None)
|
||||
|
||||
def sanitycheckvolumegroupname_right_hostname_3_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
HOSTNAME = "a" * 127
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckVolumeGroupName(HOSTNAME)
|
||||
self.assertEqual(ret, None)
|
||||
|
||||
def sanitycheckvolumegroupname_right_hostname_4_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
HOSTNAME = "h-o_s-t.name"
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckVolumeGroupName(HOSTNAME)
|
||||
self.assertEqual(ret, None)
|
||||
|
||||
def sanitycheckvolumegroupname_empty_hostname_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
HOSTNAME = ""
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckVolumeGroupName(HOSTNAME)
|
||||
self.assertNotEqual(ret, None)
|
||||
|
||||
def sanitycheckvolumegroupname_long_hostname_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
HOSTNAME = "asdfasdfas" * 13
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckVolumeGroupName(HOSTNAME)
|
||||
self.assertNotEqual(ret, None)
|
||||
|
||||
def sanitycheckvolumegroupname_bad_hostname_1_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
HOSTNAME = 'lvm'
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckVolumeGroupName(HOSTNAME)
|
||||
self.assertNotEqual(ret, None)
|
||||
|
||||
def sanitycheckvolumegroupname_bad_hostname_2_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
HOSTNAME = 'root'
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckVolumeGroupName(HOSTNAME)
|
||||
self.assertNotEqual(ret, None)
|
||||
|
||||
def sanitycheckvolumegroupname_bad_hostname_3_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
HOSTNAME = '.'
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckVolumeGroupName(HOSTNAME)
|
||||
self.assertNotEqual(ret, None)
|
||||
|
||||
def sanitycheckvolumegroupname_bad_hostname_4_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
HOSTNAME = '..'
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckVolumeGroupName(HOSTNAME)
|
||||
self.assertNotEqual(ret, None)
|
||||
|
||||
def sanitycheckvolumegroupname_bad_hostname_5_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
HOSTNAME = 'foo bar'
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckVolumeGroupName(HOSTNAME)
|
||||
self.assertNotEqual(ret, None)
|
||||
|
||||
def sanitycheckvolumegroupname_bad_hostname_6_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
HOSTNAME = 'foob@r'
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckVolumeGroupName(HOSTNAME)
|
||||
self.assertNotEqual(ret, None)
|
||||
|
||||
# sanityCheckLogicalVolumeName test
|
||||
|
||||
def sanitychecklogicalvolumename_right_name_1_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
LOGVOLNAME = "name"
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckLogicalVolumeName(LOGVOLNAME)
|
||||
self.assertEqual(ret, None)
|
||||
|
||||
def sanitychecklogicalvolumename_right_name_2_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
LOGVOLNAME = "name_00.9"
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckLogicalVolumeName(LOGVOLNAME)
|
||||
self.assertEqual(ret, None)
|
||||
|
||||
def sanitychecklogicalvolumename_right_name_3_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
LOGVOLNAME = "a"
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckLogicalVolumeName(LOGVOLNAME)
|
||||
self.assertEqual(ret, None)
|
||||
|
||||
def sanitychecklogicalvolumename_empty_name_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
LOGVOLNAME = ""
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckLogicalVolumeName(LOGVOLNAME)
|
||||
self.assertNotEqual(ret, None)
|
||||
|
||||
def sanitychecklogicalvolumename_long_name_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
LOGVOLNAME = "b" * 129
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckLogicalVolumeName(LOGVOLNAME)
|
||||
self.assertNotEqual(ret, None)
|
||||
|
||||
def sanitychecklogicalvolumename_bad_name_1_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
LOGVOLNAME = "group"
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckLogicalVolumeName(LOGVOLNAME)
|
||||
self.assertNotEqual(ret, None)
|
||||
|
||||
def sanitychecklogicalvolumename_bad_name_2_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
LOGVOLNAME = "."
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckLogicalVolumeName(LOGVOLNAME)
|
||||
self.assertNotEqual(ret, None)
|
||||
|
||||
def sanitychecklogicalvolumename_bad_name_3_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
LOGVOLNAME = ".."
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckLogicalVolumeName(LOGVOLNAME)
|
||||
self.assertNotEqual(ret, None)
|
||||
|
||||
def sanitychecklogicalvolumename_bad_name_4_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
LOGVOLNAME = 'foo bar'
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckLogicalVolumeName(LOGVOLNAME)
|
||||
self.assertNotEqual(ret, None)
|
||||
|
||||
def sanitychecklogicalvolumename_bad_name_5_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
LOGVOLNAME = 'foob@r'
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckLogicalVolumeName(LOGVOLNAME)
|
||||
self.assertNotEqual(ret, None)
|
||||
|
||||
# sanityCheckMountPoint test
|
||||
|
||||
def sanitycheckmountpoint_right_name_1_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
MNTPT = '/foob@r'
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckMountPoint(MNTPT)
|
||||
self.assertEqual(ret, None)
|
||||
|
||||
def sanitycheckmountpoint_right_name_2_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
MNTPT = '/var'
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckMountPoint(MNTPT)
|
||||
self.assertEqual(ret, None)
|
||||
|
||||
def sanitycheckmountpoint_right_name_3_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
MNTPT = '/'
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckMountPoint(MNTPT)
|
||||
self.assertEqual(ret, None)
|
||||
|
||||
def sanitycheckmountpoint_bad_name_1_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
MNTPT = '//'
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckMountPoint(MNTPT)
|
||||
self.assertNotEqual(ret, None)
|
||||
|
||||
def sanitycheckmountpoint_bad_name_2_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
MNTPT = '/foo bar'
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckMountPoint(MNTPT)
|
||||
self.assertNotEqual(ret, None)
|
||||
|
||||
def sanitycheckmountpoint_bad_name_3_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
MNTPT = '/./'
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckMountPoint(MNTPT)
|
||||
self.assertNotEqual(ret, None)
|
||||
|
||||
def sanitycheckmountpoint_bad_name_4_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
MNTPT = '/../'
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckMountPoint(MNTPT)
|
||||
self.assertNotEqual(ret, None)
|
||||
|
||||
def sanitycheckmountpoint_bad_name_5_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
MNTPT = '/..'
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckMountPoint(MNTPT)
|
||||
self.assertNotEqual(ret, None)
|
||||
|
||||
def sanitycheckmountpoint_bad_name_6_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
MNTPT = '/.'
|
||||
ret = pyanaconda.partIntfHelpers.sanityCheckMountPoint(MNTPT)
|
||||
self.assertNotEqual(ret, None)
|
||||
|
||||
def dodeletedevice_1_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
INTF = mock.Mock()
|
||||
STORAGE = mock.Mock()
|
||||
DEVICE = None
|
||||
ret = pyanaconda.partIntfHelpers.doDeleteDevice(INTF, STORAGE, DEVICE)
|
||||
self.assertFalse(ret)
|
||||
|
||||
def dodeletedevice_2_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
INTF = mock.Mock()
|
||||
STORAGE = mock.Mock()
|
||||
STORAGE.deviceImmutable.return_value = True
|
||||
DEVICE = mock.Mock()
|
||||
ret = pyanaconda.partIntfHelpers.doDeleteDevice(INTF, STORAGE, DEVICE)
|
||||
self.assertFalse(ret)
|
||||
|
||||
def dodeletedevice_3_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
pyanaconda.partIntfHelpers.confirmDelete = mock.Mock(return_value=False)
|
||||
INTF = mock.Mock()
|
||||
STORAGE = mock.Mock()
|
||||
STORAGE.deviceImmutable.return_value = False
|
||||
DEVICE = mock.Mock()
|
||||
ret = pyanaconda.partIntfHelpers.doDeleteDevice(INTF, STORAGE, DEVICE)
|
||||
self.assertFalse(ret)
|
||||
|
||||
def dodeletedevice_4_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
pyanaconda.partIntfHelpers.confirmDelete = mock.Mock(return_value=False)
|
||||
INTF = mock.Mock()
|
||||
STORAGE = mock.Mock()
|
||||
STORAGE.deviceImmutable.return_value = False
|
||||
STORAGE.deviceDeps.return_value = []
|
||||
DEVICE = mock.Mock()
|
||||
ret = pyanaconda.partIntfHelpers.doDeleteDevice(INTF, STORAGE, DEVICE,
|
||||
confirm=0)
|
||||
self.assertTrue(ret)
|
||||
self.assertTrue(STORAGE.destroyDevice.called)
|
||||
|
||||
def dodeletedevice_5_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
pyanaconda.partIntfHelpers.confirmDelete = mock.Mock(return_value=True)
|
||||
INTF = mock.Mock()
|
||||
STORAGE = mock.Mock()
|
||||
STORAGE.deviceImmutable.return_value = False
|
||||
STORAGE.deviceDeps.return_value = []
|
||||
DEVICE = mock.Mock()
|
||||
ret = pyanaconda.partIntfHelpers.doDeleteDevice(INTF, STORAGE, DEVICE)
|
||||
self.assertTrue(ret)
|
||||
self.assertTrue(STORAGE.destroyDevice.called)
|
||||
|
||||
def doclearpartitioneddevice_1_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
INTF = mock.Mock()
|
||||
INTF.messageWindow.return_value = 0
|
||||
STORAGE = mock.Mock()
|
||||
DEVICE = mock.Mock()
|
||||
ret = pyanaconda.partIntfHelpers.doClearPartitionedDevice(INTF, STORAGE,
|
||||
DEVICE)
|
||||
self.assertFalse(ret)
|
||||
|
||||
def doclearpartitioneddevice_2_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
INTF = mock.Mock()
|
||||
INTF.messageWindow.return_value = 1
|
||||
STORAGE = mock.Mock()
|
||||
STORAGE.partitions = []
|
||||
DEVICE = mock.Mock()
|
||||
ret = pyanaconda.partIntfHelpers.doClearPartitionedDevice(INTF, STORAGE,
|
||||
DEVICE)
|
||||
self.assertFalse(ret)
|
||||
|
||||
def doclearpartitioneddevice_3_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
INTF = mock.Mock()
|
||||
INTF.messageWindow.return_value = 1
|
||||
DEVICE = mock.Mock()
|
||||
p = mock.Mock()
|
||||
p.disk = DEVICE
|
||||
p.partedPartition.number = 0
|
||||
STORAGE = mock.Mock()
|
||||
STORAGE.partitions = [p]
|
||||
STORAGE.deviceImmutable.return_value = False
|
||||
STORAGE.deviceDeps.return_value = []
|
||||
|
||||
ret = pyanaconda.partIntfHelpers.doClearPartitionedDevice(INTF, STORAGE,
|
||||
DEVICE)
|
||||
self.assertTrue(ret)
|
||||
|
||||
def checkforswapnomatch_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
pyanaconda.partIntfHelpers.parted.PARTITION_SWAP = 5
|
||||
device = mock.Mock()
|
||||
device.exists.return_value = True
|
||||
device.getFlag.return_value = True
|
||||
device.format.type == "swap"
|
||||
ANACONDA = mock.Mock()
|
||||
ANACONDA.storage.partitions = [device]
|
||||
ANACONDA.intf.messageWindow.return_value = 1
|
||||
pyanaconda.partIntfHelpers.checkForSwapNoMatch(ANACONDA)
|
||||
self.assertTrue(ANACONDA.storage.formatDevice.called)
|
||||
|
||||
def musthaveselecteddrive_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
INTF = mock.Mock()
|
||||
pyanaconda.partIntfHelpers.mustHaveSelectedDrive(INTF)
|
||||
self.assertTrue(INTF.messageWindow.called)
|
||||
|
||||
def querynoformatpreexisting_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
RET = 22
|
||||
INTF = mock.Mock()
|
||||
ret = INTF.messageWindow.return_value = RET
|
||||
self.assertEqual(RET, ret)
|
||||
|
||||
def partitionsanityerrors_1_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
INTF = mock.Mock()
|
||||
ERRORS = []
|
||||
ret = pyanaconda.partIntfHelpers.partitionSanityErrors(INTF, ERRORS)
|
||||
self.assertEqual(1, ret)
|
||||
|
||||
def partitionsanityerrors_2_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
RET = 5
|
||||
INTF = mock.Mock()
|
||||
INTF.messageWindow.return_value = RET
|
||||
ERRORS = ['err string', 'foo string']
|
||||
ret = pyanaconda.partIntfHelpers.partitionSanityErrors(INTF, ERRORS)
|
||||
self.assertEqual(RET, ret)
|
||||
self.assertTrue(ERRORS[0] in INTF.messageWindow.call_args[0][1])
|
||||
self.assertTrue(ERRORS[1] in INTF.messageWindow.call_args[0][1])
|
||||
|
||||
def partitionsanitywarnings_1_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
INTF = mock.Mock()
|
||||
WARNINGS = []
|
||||
ret = pyanaconda.partIntfHelpers.partitionSanityWarnings(INTF, WARNINGS)
|
||||
self.assertEqual(1, ret)
|
||||
|
||||
def partitionsanitywarnings_2_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
RET = 5
|
||||
INTF = mock.Mock()
|
||||
INTF.messageWindow.return_value = RET
|
||||
WARNINGS = ['warning string', 'foo string']
|
||||
ret = pyanaconda.partIntfHelpers.partitionSanityWarnings(INTF, WARNINGS)
|
||||
self.assertEqual(RET, ret)
|
||||
self.assertTrue(WARNINGS[0] in INTF.messageWindow.call_args[0][1])
|
||||
self.assertTrue(WARNINGS[1] in INTF.messageWindow.call_args[0][1])
|
||||
|
||||
def partitionpreexistformatwarnings_1_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
INTF = mock.Mock()
|
||||
WARNINGS = []
|
||||
ret = pyanaconda.partIntfHelpers.partitionPreExistFormatWarnings(INTF, WARNINGS)
|
||||
self.assertEqual(1, ret)
|
||||
|
||||
def partitionpreexistformatwarnings_2_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
RET = 10
|
||||
INTF = mock.Mock()
|
||||
INTF.messageWindow.return_value = RET
|
||||
WARNINGS = [('foo', 'foobar', '/foodir')]
|
||||
ret = pyanaconda.partIntfHelpers.partitionPreExistFormatWarnings(INTF, WARNINGS)
|
||||
self.assertEqual(RET, ret)
|
||||
self.assertTrue(WARNINGS[0][0] in INTF.messageWindow.call_args[0][1])
|
||||
|
||||
def getpreexistformatwarnings_1_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
STORAGE = mock.Mock()
|
||||
STORAGE.devicetree.devices = []
|
||||
ret = pyanaconda.partIntfHelpers.getPreExistFormatWarnings(STORAGE)
|
||||
self.assertEqual([], ret)
|
||||
|
||||
def getpreexistformatwarnings_2_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
STORAGE = mock.Mock()
|
||||
device = mock.Mock()
|
||||
device.exists = True
|
||||
device.name = 'foodev'
|
||||
device.path = '/foodevdir'
|
||||
device.format.name = 'fffoodev'
|
||||
device.format.mountpoint = '/mnt/foo'
|
||||
device.format.exists = False
|
||||
device.format.hidden = False
|
||||
STORAGE.devicetree.devices = [device]
|
||||
ret = pyanaconda.partIntfHelpers.getPreExistFormatWarnings(STORAGE)
|
||||
self.assertEqual([('/foodevdir', 'fffoodev', '/mnt/foo')], ret)
|
||||
|
||||
def confirmdelete_1_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
INTF = mock.Mock()
|
||||
DEVICE = False
|
||||
ret = pyanaconda.partIntfHelpers.confirmDelete(INTF, DEVICE)
|
||||
self.assertEqual(None, ret)
|
||||
|
||||
def confirmdelete_2_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
RET = 51
|
||||
INTF = mock.Mock()
|
||||
INTF.messageWindow.return_value = RET
|
||||
DEVICE = mock.Mock()
|
||||
DEVICE.type = "lvmvg"
|
||||
DEVICE.name = "devname"
|
||||
ret = pyanaconda.partIntfHelpers.confirmDelete(INTF, DEVICE)
|
||||
self.assertEqual(RET, ret)
|
||||
self.assertTrue(DEVICE.name in INTF.messageWindow.call_args[0][1])
|
||||
|
||||
def confirmdelete_3_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
RET = 52
|
||||
INTF = mock.Mock()
|
||||
INTF.messageWindow.return_value = RET
|
||||
DEVICE = mock.Mock()
|
||||
DEVICE.type = "lvmlv"
|
||||
DEVICE.name = "devname"
|
||||
ret = pyanaconda.partIntfHelpers.confirmDelete(INTF, DEVICE)
|
||||
self.assertEqual(RET, ret)
|
||||
self.assertTrue(DEVICE.name in INTF.messageWindow.call_args[0][1])
|
||||
|
||||
def confirmdelete_4_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
RET = 53
|
||||
INTF = mock.Mock()
|
||||
INTF.messageWindow.return_value = RET
|
||||
DEVICE = mock.Mock()
|
||||
DEVICE.type = "mdarray"
|
||||
DEVICE.name = "devname"
|
||||
ret = pyanaconda.partIntfHelpers.confirmDelete(INTF, DEVICE)
|
||||
self.assertEqual(RET, ret)
|
||||
|
||||
def confirmdelete_5_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
RET = 54
|
||||
INTF = mock.Mock()
|
||||
INTF.messageWindow.return_value = RET
|
||||
DEVICE = mock.Mock()
|
||||
DEVICE.type = "partition"
|
||||
DEVICE.name = "devname"
|
||||
DEVICE.path = "/dev/devname"
|
||||
ret = pyanaconda.partIntfHelpers.confirmDelete(INTF, DEVICE)
|
||||
self.assertEqual(RET, ret)
|
||||
self.assertTrue(DEVICE.path in INTF.messageWindow.call_args[0][1])
|
||||
|
||||
def confirmdelete_6_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
RET = 55
|
||||
INTF = mock.Mock()
|
||||
INTF.messageWindow.return_value = RET
|
||||
DEVICE = mock.Mock()
|
||||
DEVICE.type = "other"
|
||||
DEVICE.name = "devname"
|
||||
ret = pyanaconda.partIntfHelpers.confirmDelete(INTF, DEVICE)
|
||||
self.assertEqual(RET, ret)
|
||||
self.assertTrue(DEVICE.type in INTF.messageWindow.call_args[0][1])
|
||||
self.assertTrue(DEVICE.name in INTF.messageWindow.call_args[0][1])
|
||||
|
||||
def confirmresetpartitionstate_test(self):
|
||||
import pyanaconda.partIntfHelpers
|
||||
RET = 61
|
||||
INTF = mock.Mock()
|
||||
INTF.messageWindow.return_value = RET
|
||||
ret = pyanaconda.partIntfHelpers.confirmResetPartitionState(INTF)
|
||||
self.assertEqual(RET, ret)
|
||||
|
@ -1,82 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import mock
|
||||
import sys
|
||||
import __builtin__
|
||||
|
||||
import ConfigParser
|
||||
|
||||
class ProductTest(mock.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.setupModules(['_isys', 'block', 'os'])
|
||||
self.fs = mock.DiskIO()
|
||||
|
||||
# os module global mock
|
||||
self.modifiedModule("os")
|
||||
os = sys.modules['os']
|
||||
os.access = mock.Mock(return_value=False)
|
||||
os.uname.return_value = ('', '', '', '', 'i386')
|
||||
os.environ = {}
|
||||
|
||||
# fake /tmp/product/.buildstamp file
|
||||
self.BUGURL = 'http://bug.url'
|
||||
self.FINAL = 'false'
|
||||
self.ARCH = 'i386'
|
||||
self.NAME = '__anaconda'
|
||||
self.UUID = '123456.%s' % self.ARCH
|
||||
self.VERSION = '14'
|
||||
self.FILENAME = '/tmp/product/.buildstamp'
|
||||
self.FILE = \
|
||||
"[Main]\n"\
|
||||
"BugURL: %s\n"\
|
||||
"IsFinal: %s\n"\
|
||||
"Arch: %s\n"\
|
||||
"Product: %s\n"\
|
||||
"UUID: %s\n"\
|
||||
"Version: %s\n" % \
|
||||
(self.BUGURL, self.FINAL, self.ARCH, self.NAME, self.UUID, self.VERSION)
|
||||
|
||||
self.fs.open(self.FILENAME, 'w').write(self.FILE)
|
||||
|
||||
# mock builtin open function
|
||||
self.open = __builtin__.open
|
||||
__builtin__.open = self.fs.open
|
||||
|
||||
if 'pyanaconda.product' in sys.modules:
|
||||
del(sys.modules["pyanaconda.product"])
|
||||
|
||||
def tearDown(self):
|
||||
__builtin__.open = self.open
|
||||
self.tearDownModules()
|
||||
|
||||
def bug_url_test(self):
|
||||
sys.modules['os'].access = mock.Mock(return_value=True)
|
||||
import pyanaconda.product
|
||||
self.assertEqual(pyanaconda.product.bugUrl, self.BUGURL)
|
||||
|
||||
def is_final_test(self):
|
||||
sys.modules['os'].access = mock.Mock(return_value=True)
|
||||
import pyanaconda.product
|
||||
self.assertFalse(pyanaconda.product.isFinal)
|
||||
|
||||
def product_arch_test(self):
|
||||
sys.modules['os'].access = mock.Mock(return_value=True)
|
||||
import pyanaconda.product
|
||||
self.assertEqual(pyanaconda.product.productArch, self.ARCH)
|
||||
|
||||
def product_name_test(self):
|
||||
sys.modules['os'].access = mock.Mock(return_value=True)
|
||||
import pyanaconda.product
|
||||
self.assertEqual(pyanaconda.product.productName, self.NAME)
|
||||
|
||||
def product_stamp_test(self):
|
||||
sys.modules['os'].access = mock.Mock(return_value=True)
|
||||
import pyanaconda.product
|
||||
self.assertEqual(pyanaconda.product.productStamp, self.UUID)
|
||||
|
||||
def product_version_test(self):
|
||||
sys.modules['os'].access = mock.Mock(return_value=True)
|
||||
import pyanaconda.product
|
||||
self.assertEqual(pyanaconda.product.productVersion, self.VERSION)
|
||||
|
@ -1,297 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import mock
|
||||
|
||||
class RescueTest(mock.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.setupModules(
|
||||
['_isys', 'block', 'parted', 'storage', 'pyanaconda.storage.formats',
|
||||
'logging', 'add_drive_text', 'ConfigParser',
|
||||
'pyanaconda.storage.storage_log', 'pyanaconda.anaconda_log', 'snack'
|
||||
])
|
||||
|
||||
self.fs = mock.DiskIO()
|
||||
|
||||
import pyanaconda
|
||||
pyanaconda.anaconda_log = mock.Mock()
|
||||
import snack
|
||||
snack.SnackScreen = mock.Mock()
|
||||
|
||||
import pyanaconda.rescue
|
||||
pyanaconda.rescue.open = self.fs.open
|
||||
|
||||
def tearDown(self):
|
||||
self.tearDownModules()
|
||||
|
||||
#
|
||||
# RescueInterface class tests
|
||||
#
|
||||
|
||||
def rescueinterface_waitwindow_test(self):
|
||||
import pyanaconda.rescue
|
||||
RET = 'foo1'
|
||||
pyanaconda.rescue.WaitWindow = mock.Mock(return_value=RET)
|
||||
TITLE = 'title'
|
||||
TEXT = 'text'
|
||||
ri = pyanaconda.rescue.RescueInterface()
|
||||
ret = ri.waitWindow(TITLE, TEXT)
|
||||
self.assertEqual(ret, RET)
|
||||
|
||||
def rescueinterface_progresswindow_test(self):
|
||||
import pyanaconda.rescue
|
||||
RET = 'foo2'
|
||||
pyanaconda.rescue.ProgressWindow = mock.Mock(return_value=RET)
|
||||
TITLE = 'title'
|
||||
TEXT = 'text'
|
||||
TOTAL = 100
|
||||
ri = pyanaconda.rescue.RescueInterface()
|
||||
ret = ri.progressWindow(TITLE, TEXT, TOTAL)
|
||||
self.assertEqual(ret, RET)
|
||||
|
||||
def rescueinterface_detailedmessagewindow_test(self):
|
||||
import pyanaconda.rescue
|
||||
RET = 'foo3'
|
||||
pyanaconda.rescue.RescueInterface.messageWindow = mock.Mock(return_value=RET)
|
||||
TITLE = 'title'
|
||||
TEXT = 'text'
|
||||
ri = pyanaconda.rescue.RescueInterface()
|
||||
ret = ri.detailedMessageWindow(TITLE, TEXT)
|
||||
self.assertEqual(ret, RET)
|
||||
|
||||
def rescueinterface_messagewindow_1_test(self):
|
||||
import pyanaconda.rescue
|
||||
pyanaconda.rescue.ButtonChoiceWindow = mock.Mock()
|
||||
TITLE = 'title'
|
||||
TEXT = 'text'
|
||||
TYPE = 'ok'
|
||||
ri = pyanaconda.rescue.RescueInterface()
|
||||
ri.detailedMessageWindow(TITLE, TEXT, TYPE)
|
||||
self.assertTrue(pyanaconda.rescue.ButtonChoiceWindow.called)
|
||||
|
||||
def rescueinterface_messagewindow_2_test(self):
|
||||
import pyanaconda.rescue
|
||||
RET='yes'
|
||||
pyanaconda.rescue.ButtonChoiceWindow = mock.Mock(return_value=RET)
|
||||
TITLE = 'title'
|
||||
TEXT = 'text'
|
||||
TYPE = 'yesno'
|
||||
ri = pyanaconda.rescue.RescueInterface()
|
||||
ret = ri.messageWindow(TITLE, TEXT, TYPE)
|
||||
self.assertEqual(ret, 1)
|
||||
|
||||
def rescueinterface_messagewindow_3_test(self):
|
||||
import pyanaconda.rescue
|
||||
RET = 'barfoo'
|
||||
pyanaconda.rescue.ButtonChoiceWindow = mock.Mock(return_value=RET)
|
||||
TITLE = 'title'
|
||||
TEXT = 'text'
|
||||
TYPE = 'custom'
|
||||
CUSTOM_BUTT = ['foo_bar', 'bar_foo']
|
||||
ri = pyanaconda.rescue.RescueInterface()
|
||||
ret = ri.messageWindow(TITLE, TEXT, TYPE, custom_buttons=CUSTOM_BUTT)
|
||||
self.assertEqual(ret, 1)
|
||||
|
||||
def rescueinterface_messagewindow_4_test(self):
|
||||
import pyanaconda.rescue
|
||||
RET = 'foo4'
|
||||
pyanaconda.rescue.OkCancelWindow = mock.Mock(return_value=RET)
|
||||
TITLE = 'title'
|
||||
TEXT = 'text'
|
||||
TYPE = 'otherfoo'
|
||||
ri = pyanaconda.rescue.RescueInterface()
|
||||
ret = ri.messageWindow(TITLE, TEXT, TYPE)
|
||||
self.assertEqual(ret, RET)
|
||||
|
||||
def rescueinterface_enablenetwork_1_test(self):
|
||||
import pyanaconda.rescue
|
||||
anaconda = mock.Mock()
|
||||
anaconda.network.netdevices = {}
|
||||
|
||||
ri = pyanaconda.rescue.RescueInterface()
|
||||
ret = ri.enableNetwork(anaconda)
|
||||
self.assertFalse(ret)
|
||||
|
||||
def rescueinterface_passphraseentrywindow_test(self):
|
||||
import pyanaconda.rescue
|
||||
RET = ('secret', False)
|
||||
pyanaconda.rescue.PassphraseEntryWindow = mock.Mock()
|
||||
pyanaconda.rescue.PassphraseEntryWindow().run.return_value = RET
|
||||
DEVICE = 'dev'
|
||||
|
||||
ri = pyanaconda.rescue.RescueInterface()
|
||||
ret = ri.passphraseEntryWindow(DEVICE)
|
||||
self.assertEqual(ret, RET)
|
||||
self.assertTrue(pyanaconda.rescue.PassphraseEntryWindow().pop.called)
|
||||
|
||||
def rescueinterface_resetinitializediskquestion_test(self):
|
||||
import pyanaconda.rescue
|
||||
ri = pyanaconda.rescue.RescueInterface()
|
||||
ri._initLabelAnswers = {'foo': 'bar'}
|
||||
ri.resetInitializeDiskQuestion()
|
||||
|
||||
def rescueinterface_resetreinitinconsistentlvmquestion_test(self):
|
||||
import pyanaconda.rescue
|
||||
ri = pyanaconda.rescue.RescueInterface()
|
||||
ri._inconsistentLVMAnswers = {'foo': 'bar'}
|
||||
ri.resetReinitInconsistentLVMQuestion()
|
||||
self.assertEqual(ri._inconsistentLVMAnswers, {})
|
||||
|
||||
def rescueinterface_questioninitializedisk_test(self):
|
||||
import pyanaconda.rescue
|
||||
ri = pyanaconda.rescue.RescueInterface()
|
||||
ret = ri.questionInitializeDisk('/', '', 0)
|
||||
self.assertFalse(ret)
|
||||
|
||||
def rescueinterface_questionreinitinconsistentlvm_test(self):
|
||||
import pyanaconda.rescue
|
||||
ri = pyanaconda.rescue.RescueInterface()
|
||||
ret = ri.questionReinitInconsistentLVM()
|
||||
self.assertFalse(ret)
|
||||
|
||||
def rescueinterface_questioninitializedasd_test(self):
|
||||
import pyanaconda.rescue
|
||||
ri = pyanaconda.rescue.RescueInterface()
|
||||
ret = ri.questionInitializeDASD('', '')
|
||||
self.assertEqual(ret, 1)
|
||||
|
||||
#
|
||||
# module function tests
|
||||
#
|
||||
|
||||
def makefstab_test(self):
|
||||
import pyanaconda.rescue
|
||||
INSTPATH = '/tmp'
|
||||
FSTAB = 'rootfs / rootfs rw 0 0'
|
||||
pyanaconda.rescue.os = mock.Mock()
|
||||
pyanaconda.rescue.os.access.return_value = True
|
||||
self.fs.open('/proc/mounts', 'w').write(FSTAB)
|
||||
self.fs.open('%s/etc/fstab' % INSTPATH, 'w')
|
||||
|
||||
ret = pyanaconda.rescue.makeFStab(INSTPATH)
|
||||
self.assertEqual(self.fs['%s/etc/fstab' % INSTPATH], FSTAB)
|
||||
|
||||
def makeresolvconf_1_test(self):
|
||||
import pyanaconda.rescue
|
||||
INSTPATH = '/tmp'
|
||||
RESOLV = "nameserver 10.0.0.1"
|
||||
pyanaconda.rescue.os = mock.Mock()
|
||||
pyanaconda.rescue.os.access.return_value = False
|
||||
pyanaconda.rescue.shutil = mock.Mock()
|
||||
|
||||
pyanaconda.rescue.makeResolvConf(INSTPATH)
|
||||
self.assertFalse(pyanaconda.rescue.shutil.copyfile.called)
|
||||
|
||||
def makeresolvconf_2_test(self):
|
||||
import pyanaconda.rescue
|
||||
INSTPATH = '/tmp'
|
||||
RESOLV = "nameserver 10.0.0.1"
|
||||
pyanaconda.rescue.os = mock.Mock()
|
||||
pyanaconda.rescue.os.access.return_value = True
|
||||
pyanaconda.rescue.shutil = mock.Mock()
|
||||
self.fs.open('%s/etc/resolv.conf' % INSTPATH, 'w').write(RESOLV)
|
||||
|
||||
pyanaconda.rescue.makeResolvConf(INSTPATH)
|
||||
self.assertFalse(pyanaconda.rescue.shutil.copyfile.called)
|
||||
|
||||
def makeresolvconf_3_test(self):
|
||||
import pyanaconda.rescue
|
||||
INSTPATH = '/tmp'
|
||||
RESOLV = "nameserver 10.0.0.1"
|
||||
pyanaconda.rescue.os = mock.Mock()
|
||||
pyanaconda.rescue.os.access.return_value = True
|
||||
pyanaconda.rescue.shutil = mock.Mock()
|
||||
self.fs.open('%s/etc/resolv.conf' % INSTPATH, 'w').write('')
|
||||
self.fs.open('/etc/resolv.conf', 'w').write('')
|
||||
|
||||
pyanaconda.rescue.makeResolvConf(INSTPATH)
|
||||
self.assertFalse(pyanaconda.rescue.shutil.copyfile.called)
|
||||
self.assertEqual(self.fs['%s/etc/resolv.conf' % INSTPATH], '')
|
||||
|
||||
def makeresolvconf_4_test(self):
|
||||
import pyanaconda.rescue
|
||||
INSTPATH = '/tmp'
|
||||
RESOLV = "nameserver 10.0.0.1"
|
||||
pyanaconda.rescue.os = mock.Mock()
|
||||
pyanaconda.rescue.os.access.return_value = True
|
||||
pyanaconda.rescue.shutil = mock.Mock()
|
||||
self.fs.open('%s/etc/resolv.conf' % INSTPATH, 'w').write('')
|
||||
self.fs.open('/etc/resolv.conf', 'w').write(RESOLV)
|
||||
|
||||
pyanaconda.rescue.makeResolvConf(INSTPATH)
|
||||
self.assertTrue(pyanaconda.rescue.shutil.copyfile.called)
|
||||
self.assertEqual(self.fs['%s/etc/resolv.conf' % INSTPATH],
|
||||
'nameserver 10.0.0.1')
|
||||
|
||||
def startnetworking_test(self):
|
||||
import pyanaconda.rescue
|
||||
NETWORK = mock.Mock()
|
||||
pyanaconda.rescue.os = mock.Mock()
|
||||
pyanaconda.rescue.startNetworking(NETWORK, '')
|
||||
self.assertEqual(pyanaconda.rescue.os.system.call_args,
|
||||
(('/usr/sbin/ifconfig lo 127.0.0.1',), {}))
|
||||
self.assertTrue(NETWORK.bringUp.called)
|
||||
|
||||
def runshell_1_test(self):
|
||||
import pyanaconda.rescue
|
||||
import sys
|
||||
TMPFILE = '/tmp/abc'
|
||||
MSG = "foo bar"
|
||||
pyanaconda.rescue.os = mock.Mock()
|
||||
pyanaconda.rescue.os.path.exists.return_value = True
|
||||
pyanaconda.rescue.subprocess = mock.Mock()
|
||||
proc = mock.Mock()
|
||||
proc.returncode = 0
|
||||
pyanaconda.rescue.subprocess.Popen.return_value = proc
|
||||
|
||||
stdout = sys.stdout
|
||||
sys.stdout = self.fs.open(TMPFILE, 'w')
|
||||
pyanaconda.rescue.runShell(msg=MSG)
|
||||
sys.stdout.close()
|
||||
sys.stdout = stdout
|
||||
|
||||
self.assertTrue(MSG in self.fs[TMPFILE])
|
||||
self.assertEqual(pyanaconda.rescue.subprocess.Popen.call_args,
|
||||
((['/usr/bin/firstaidkit-qs'],), {}))
|
||||
|
||||
def runshell_2_test(self):
|
||||
import pyanaconda.rescue
|
||||
import sys
|
||||
TMPFILE = '/tmp/abc'
|
||||
MSG = "foo bar"
|
||||
|
||||
def fake_f(filename, _=""):
|
||||
return filename == "/bin/bash"
|
||||
|
||||
pyanaconda.rescue.os = mock.Mock()
|
||||
pyanaconda.rescue.os.path.exists = fake_f
|
||||
pyanaconda.rescue.iutil = mock.Mock()
|
||||
proc = mock.Mock()
|
||||
proc.returncode = 0
|
||||
pyanaconda.rescue.subprocess.Popen.return_value = proc
|
||||
|
||||
stdout = sys.stdout
|
||||
sys.stdout = self.fs.open(TMPFILE, 'w')
|
||||
pyanaconda.rescue.runShell(msg=MSG)
|
||||
sys.stdout.close()
|
||||
sys.stdout = stdout
|
||||
|
||||
self.assertTrue(MSG in self.fs[TMPFILE])
|
||||
self.assertTrue(pyanaconda.rescue.iutil.execConsole.called)
|
||||
|
||||
def runshell_3_test(self):
|
||||
import pyanaconda.rescue
|
||||
import sys
|
||||
TMPFILE = '/tmp/abc'
|
||||
SCREEN = mock.Mock()
|
||||
pyanaconda.rescue.os = mock.Mock()
|
||||
pyanaconda.rescue.os.path.exists.return_value = True
|
||||
pyanaconda.rescue.subprocess = mock.Mock()
|
||||
proc = mock.Mock()
|
||||
proc.returncode = 0
|
||||
pyanaconda.rescue.subprocess.Popen.return_value = proc
|
||||
|
||||
pyanaconda.rescue.runShell(screen=SCREEN)
|
||||
|
||||
self.assertTrue(SCREEN.suspend.called)
|
||||
self.assertTrue(SCREEN.finish.called)
|
@ -1,62 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import mock
|
||||
import sys
|
||||
|
||||
class SecurityTest(mock.TestCase):
|
||||
def setUp(self):
|
||||
self.setupModules(["_isys", "block", "ConfigParser"])
|
||||
|
||||
self.fs = mock.DiskIO()
|
||||
|
||||
import pyanaconda.security
|
||||
pyanaconda.security.log = mock.Mock()
|
||||
pyanaconda.security.open = self.fs.open
|
||||
pyanaconda.security.iutil = mock.Mock()
|
||||
|
||||
import pyanaconda.flags
|
||||
pyanaconda.flags.flags.selinux = 1
|
||||
|
||||
def tearDown(self):
|
||||
self.tearDownModules()
|
||||
|
||||
def set_get_selinux_test(self):
|
||||
import pyanaconda.security
|
||||
|
||||
states = pyanaconda.security.selinux_states
|
||||
scrt = pyanaconda.security.Security()
|
||||
|
||||
for state in states:
|
||||
scrt.setSELinux(state)
|
||||
self.assertEqual(scrt.getSELinux(), state)
|
||||
|
||||
def set_get_selinux_bad_sate_test(self):
|
||||
import pyanaconda.security
|
||||
|
||||
states = pyanaconda.security.selinux_states
|
||||
scrt = pyanaconda.security.Security()
|
||||
scrt.setSELinux('bad_state')
|
||||
self.assertTrue(scrt.getSELinux() in states)
|
||||
|
||||
def write_test(self):
|
||||
"""Simulate writing security (simulate executing lokkit and authconfig)"""
|
||||
import pyanaconda.security
|
||||
|
||||
scrt = pyanaconda.security.Security()
|
||||
pyanaconda.security.ROOT_PATH = "/tmp/security"
|
||||
scrt.write()
|
||||
|
||||
self.assertEqual(pyanaconda.security.iutil.method_calls,
|
||||
[('execWithRedirect',
|
||||
('/usr/sbin/lokkit', ['--selinux=enforcing']),
|
||||
{'root': '/tmp/security', 'stderr': '/dev/null', 'stdout': '/dev/null'}
|
||||
),
|
||||
('resetRpmDb', (), {}),
|
||||
('execWithRedirect',
|
||||
('/usr/sbin/authconfig',
|
||||
['--update', '--nostart', '--enableshadow', '--passalgo=sha512']
|
||||
),
|
||||
{'root': '/tmp/security', 'stderr': '/dev/tty5', 'stdout': '/dev/tty5'}
|
||||
)
|
||||
]
|
||||
)
|
@ -1,154 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import mock
|
||||
import os
|
||||
import sys
|
||||
|
||||
class SimpleconfigTest(mock.TestCase):
|
||||
def setUp(self):
|
||||
self.setupModules(["_isys", "block", "ConfigParser"])
|
||||
import pyanaconda.simpleconfig
|
||||
|
||||
# Stuff for IfcfgFile class tests
|
||||
self.DIR = '/tmp/'
|
||||
self.IFACE = 'eth0'
|
||||
self.PATH = "%sifcfg-%s" % (self.DIR, self.IFACE)
|
||||
self.CONTENT = '# Broadcom Corporation NetXtreme BCM5761 Gigabit Ethernet\n'
|
||||
self.CONTENT += 'DEVICE=eth0\n'
|
||||
self.CONTENT += 'HWADDR=00:10:18:61:35:98\n'
|
||||
self.CONTENT += 'ONBOOT=no\n'
|
||||
open(self.PATH, 'w').write(self.CONTENT)
|
||||
|
||||
def tearDown(self):
|
||||
self.tearDownModules()
|
||||
|
||||
def uppercase_ascii_string_letters_test(self):
|
||||
"""Converting to uppercase (letters)"""
|
||||
import pyanaconda.simpleconfig
|
||||
ret = pyanaconda.simpleconfig.uppercase_ASCII_string('abcd')
|
||||
self.assertEqual(ret, 'ABCD')
|
||||
ret = pyanaconda.simpleconfig.uppercase_ASCII_string('aBCD')
|
||||
self.assertEqual(ret, 'ABCD')
|
||||
ret = pyanaconda.simpleconfig.uppercase_ASCII_string('ABCD')
|
||||
self.assertEqual(ret, 'ABCD')
|
||||
|
||||
def uppercase_ascii_string_numbers_test(self):
|
||||
"""Converting to uppercase (numbers)"""
|
||||
import pyanaconda.simpleconfig
|
||||
ret = pyanaconda.simpleconfig.uppercase_ASCII_string('123')
|
||||
self.assertEqual(ret, '123')
|
||||
|
||||
def uppercase_ascii_string_others_test(self):
|
||||
"""Converting to uppercase (special chars)"""
|
||||
import pyanaconda.simpleconfig
|
||||
ret = pyanaconda.simpleconfig.uppercase_ASCII_string('--')
|
||||
self.assertEqual(ret, '--')
|
||||
ret = pyanaconda.simpleconfig.uppercase_ASCII_string(' ')
|
||||
self.assertEqual(ret, ' ')
|
||||
ret = pyanaconda.simpleconfig.uppercase_ASCII_string('')
|
||||
self.assertEqual(ret, '')
|
||||
|
||||
def unquote_test(self):
|
||||
from pyanaconda.simpleconfig import unquote
|
||||
self.assertEqual(unquote("plain string"), "plain string")
|
||||
self.assertEqual(unquote('"double quote"'), "double quote")
|
||||
self.assertEqual(unquote("'single quote'"), "single quote")
|
||||
|
||||
def quote_test(self):
|
||||
from pyanaconda.simpleconfig import quote
|
||||
self.assertEqual(quote("nospaces"), "nospaces")
|
||||
self.assertEqual(quote("plain string"), '"plain string"')
|
||||
self.assertEqual(quote("alwaysquote", always=True), '"alwaysquote"')
|
||||
|
||||
def set_and_get_test(self):
|
||||
"""Setting and getting values"""
|
||||
import pyanaconda.simpleconfig
|
||||
scf = pyanaconda.simpleconfig.SimpleConfigFile()
|
||||
scf.set(('key1', 'value1'))
|
||||
self.assertEqual(scf.get('key1'), 'value1')
|
||||
scf.set(('KEY2', 'value2'))
|
||||
self.assertEqual(scf.get('key2'), 'value2')
|
||||
scf.set(('KEY3', 'value3'))
|
||||
self.assertEqual(scf.get('KEY3'), 'value3')
|
||||
scf.set(('key4', 'value4'))
|
||||
self.assertEqual(scf.get('KEY4'), 'value4')
|
||||
|
||||
def unset_test(self):
|
||||
import pyanaconda.simpleconfig
|
||||
scf = pyanaconda.simpleconfig.SimpleConfigFile()
|
||||
scf.set(('key1', 'value1'))
|
||||
scf.unset(('key1'))
|
||||
self.assertEqual(scf.get('key1'), '')
|
||||
|
||||
def write_test(self):
|
||||
import pyanaconda.simpleconfig
|
||||
scf = pyanaconda.simpleconfig.SimpleConfigFile()
|
||||
scf.set(('key1', 'value1'))
|
||||
scf.write('/tmp/file')
|
||||
self.assertEqual(open('/tmp/file').read(), 'KEY1=value1\n')
|
||||
|
||||
def read_test(self):
|
||||
import pyanaconda.simpleconfig
|
||||
scf = pyanaconda.simpleconfig.SimpleConfigFile()
|
||||
open('/tmp/file', 'w').write('KEY1="value1"\n')
|
||||
scf.read('/tmp/file')
|
||||
self.assertEqual(scf.get('key1'), 'value1')
|
||||
|
||||
def read_write_test(self):
|
||||
from pyanaconda.simpleconfig import SimpleConfigFile
|
||||
scf = SimpleConfigFile()
|
||||
scf.read(self.PATH)
|
||||
scf.write("/tmp/file")
|
||||
self.assertEqual(open("/tmp/file").read(), self.CONTENT)
|
||||
|
||||
def write_new_keys_test(self):
|
||||
from pyanaconda.simpleconfig import SimpleConfigFile
|
||||
scf = SimpleConfigFile()
|
||||
scf.read(self.PATH)
|
||||
scf.set(("key1", "value1"))
|
||||
scf.write("/tmp/file")
|
||||
self.assertEqual(open("/tmp/file").read(),
|
||||
self.CONTENT+"KEY1=value1\n")
|
||||
|
||||
def remove_key_test(self):
|
||||
from pyanaconda.simpleconfig import SimpleConfigFile
|
||||
scf = SimpleConfigFile()
|
||||
scf.read(self.PATH)
|
||||
scf.unset("BOOT")
|
||||
scf.write("/tmp/file")
|
||||
scf.reset()
|
||||
scf.read("/tmp/file")
|
||||
self.assertEqual(scf.get("BOOT"), "")
|
||||
|
||||
def ifcfgfile_path_property_test(self):
|
||||
import pyanaconda.simpleconfig
|
||||
scf = pyanaconda.simpleconfig.IfcfgFile(self.DIR, self.IFACE)
|
||||
self.assertEqual(scf.path, self.PATH)
|
||||
|
||||
def ifcfgfile_read_test(self):
|
||||
import pyanaconda.simpleconfig
|
||||
scf = pyanaconda.simpleconfig.IfcfgFile(self.DIR, self.IFACE)
|
||||
scf.read()
|
||||
self.assertEqual(scf.get('device'), 'eth0')
|
||||
self.assertEqual(scf.get('hwaddr'), '00:10:18:61:35:98')
|
||||
self.assertEqual(scf.get('onboot'), 'no')
|
||||
|
||||
def ifcfgfile_read_and_clear_test(self):
|
||||
import pyanaconda.simpleconfig
|
||||
scf = pyanaconda.simpleconfig.IfcfgFile(self.DIR, self.IFACE)
|
||||
scf.read()
|
||||
scf.clear()
|
||||
self.assertEqual(scf.get('device'), '')
|
||||
self.assertEqual(scf.get('hwaddr'), '')
|
||||
self.assertEqual(scf.get('onboot'), '')
|
||||
|
||||
def ifcfgfile_write_test(self):
|
||||
import pyanaconda.simpleconfig
|
||||
scf = pyanaconda.simpleconfig.IfcfgFile(self.DIR, self.IFACE)
|
||||
scf.set(('device', 'eth0'))
|
||||
scf.set(('hwaddr', '00:11:22:33:44:55'))
|
||||
scf.set(('onboot', 'no'))
|
||||
scf.write()
|
||||
self.assertEqual(open(self.PATH).read(),
|
||||
'DEVICE="eth0"\nHWADDR="00:11:22:33:44:55"\nONBOOT="no"\n')
|
||||
|
@ -1,56 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import mock
|
||||
import sys
|
||||
|
||||
ZONE = 'Europe/Prague'
|
||||
UTC = 2
|
||||
|
||||
class TimeZoneTest(mock.TestCase):
|
||||
def setUp(self):
|
||||
self.setupModules(["_isys", "block", "ConfigParser"])
|
||||
|
||||
self.fs = mock.DiskIO()
|
||||
|
||||
import pyanaconda.timezone
|
||||
pyanaconda.timezone.log = mock.Mock()
|
||||
pyanaconda.timezone.open = self.fs.open
|
||||
pyanaconda.timezone.os.access = mock.Mock(return_value = True)
|
||||
pyanaconda.timezone.shutil.copyfile = mock.Mock()
|
||||
pyanaconda.timezone.os = mock.Mock()
|
||||
pyanaconda.timezone.os.access.return_value = True
|
||||
pyanaconda.timezone.shutil = mock.Mock()
|
||||
#pyanaconda.timezone.shutil.copyfile = mock.Mock()
|
||||
|
||||
def tearDown(self):
|
||||
self.tearDownModules()
|
||||
|
||||
def get_timezone_info_test(self):
|
||||
import pyanaconda.timezone
|
||||
tz = pyanaconda.timezone.Timezone()
|
||||
info = tz.getTimezoneInfo()
|
||||
self.assertEqual( (tz.tz, tz.utc), info )
|
||||
|
||||
def set_timezone_info_test(self):
|
||||
import pyanaconda.timezone
|
||||
tz = pyanaconda.timezone.Timezone()
|
||||
tz.setTimezoneInfo(ZONE, UTC)
|
||||
self.assertEqual((ZONE, UTC), (tz.tz, tz.utc))
|
||||
|
||||
def write_test(self):
|
||||
import pyanaconda.timezone
|
||||
|
||||
tz = pyanaconda.timezone.Timezone()
|
||||
tz.tz = ZONE
|
||||
tz.utc = True
|
||||
|
||||
PATH = ''
|
||||
ADJTIME = '0.013782 1279118821 0.000000\n1279118821\nUTC\n'
|
||||
f = self.fs.open('/mnt/sysimage/etc/adjtime', 'w')
|
||||
f.write(ADJTIME)
|
||||
f.close()
|
||||
|
||||
tz.write()
|
||||
self.assertEqual(self.fs['/mnt/sysimage/etc/adjtime'], ADJTIME)
|
||||
|
||||
|
@ -1,142 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import mock
|
||||
import sys
|
||||
|
||||
GIDNUMBER = 'pw_gid'
|
||||
HOMEDIRECTORY = 'pw_dir'
|
||||
|
||||
class UsersTest(mock.TestCase):
|
||||
def setUp(self):
|
||||
self.setupModules(["_isys", "block", "ConfigParser"])
|
||||
|
||||
self.fs = mock.DiskIO()
|
||||
self.anaconda = mock.Mock()
|
||||
self.anaconda.security.auth.find.return_value = -1
|
||||
|
||||
import pyanaconda.users
|
||||
pyanaconda.users.log = mock.Mock()
|
||||
pyanaconda.users.iutil = mock.Mock()
|
||||
pyanaconda.users.iutil.mkdirChain = mock.Mock()
|
||||
|
||||
pyanaconda.users.os = mock.Mock()
|
||||
pyanaconda.users.os.fork.return_value=False
|
||||
pyanaconda.users.os.waitpid.return_value=(1, 1)
|
||||
pyanaconda.users.os.WEXITSTATUS.return_value=0
|
||||
|
||||
pyanaconda.users.libuser.admin = mock.Mock()
|
||||
pyanaconda.users.libuser.GIDNUMBER = GIDNUMBER
|
||||
pyanaconda.users.libuser.HOMEDIRECTORY = HOMEDIRECTORY
|
||||
pyanaconda.users.libuser.admin().lookupGroupByName.return_value = False
|
||||
pyanaconda.users.libuser.admin().lookupUserByName.return_value = False
|
||||
pyanaconda.users.libuser.admin().initGroup().get.return_value = ['']
|
||||
pyanaconda.users.libuser.admin().initGroup().reset_mock()
|
||||
pyanaconda.users.libuser.admin().reset_mock()
|
||||
|
||||
def tearDown(self):
|
||||
self.tearDownModules()
|
||||
|
||||
def create_group_test(self):
|
||||
import pyanaconda.users
|
||||
|
||||
GROUP = 'Group'
|
||||
GID = 100
|
||||
group_dict = { "name" : GROUP,
|
||||
"gid" : GID,
|
||||
"root" : ""
|
||||
}
|
||||
|
||||
usr = pyanaconda.users.Users(self.anaconda)
|
||||
self.assertTrue(usr.createGroup(GROUP, **group_dict))
|
||||
|
||||
methods = pyanaconda.users.libuser.admin().method_calls[:]
|
||||
try:
|
||||
if methods[2][0] == 'addGroup':
|
||||
methods.pop()
|
||||
except:
|
||||
pass
|
||||
|
||||
self.assertEqual(methods,
|
||||
[('lookupGroupByName', (GROUP,), {}), ('initGroup', (GROUP,), {}),])
|
||||
|
||||
self.assertEqual(
|
||||
pyanaconda.users.libuser.admin().initGroup().method_calls,
|
||||
[('set', (GIDNUMBER, GID), {})])
|
||||
|
||||
def create_user_test(self):
|
||||
import pyanaconda.users
|
||||
|
||||
USER = 'TestUser'
|
||||
PASS = 'abcde'
|
||||
user_dict = { "name" : USER,
|
||||
"password" : PASS,
|
||||
"groups" : [],
|
||||
"homedir" : "",
|
||||
"isCrypted" : False,
|
||||
"shell" : "",
|
||||
"uid" : None,
|
||||
"root" : ""
|
||||
}
|
||||
|
||||
usr = pyanaconda.users.Users(self.anaconda)
|
||||
self.assertTrue(usr.createUser(USER, **user_dict))
|
||||
|
||||
self.assertTrue(pyanaconda.users.iutil.mkdirChain.called)
|
||||
methods = [x[0] for x in pyanaconda.users.libuser.admin().method_calls]
|
||||
|
||||
self.assertEqual(methods,
|
||||
['lookupUserByName', 'initUser', 'initGroup', 'addUser','addGroup',
|
||||
'setpassUser', 'lookupGroupByName'])
|
||||
|
||||
self.assertEqual(pyanaconda.users.libuser.admin().initUser.call_args_list,
|
||||
[((USER,), {})])
|
||||
|
||||
self.assertEqual(pyanaconda.users.libuser.admin().initGroup.call_args_list,
|
||||
[((USER,), {})])
|
||||
|
||||
self.assertEqual(pyanaconda.users.libuser.admin().initUser().method_calls,
|
||||
[('set', (GIDNUMBER, ['']), {}),
|
||||
('set', (HOMEDIRECTORY, '/home/%s' % USER), {})]
|
||||
)
|
||||
|
||||
self.assertEqual(pyanaconda.users.libuser.admin().initGroup().method_calls,
|
||||
[('get', (GIDNUMBER,), {})])
|
||||
|
||||
def check_user_exists_test(self):
|
||||
import pyanaconda.users
|
||||
|
||||
USER = 'TestUser'
|
||||
|
||||
usr = pyanaconda.users.Users(self.anaconda)
|
||||
self.assertTrue(usr.checkUserExists(USER, root=''))
|
||||
self.assertEqual(pyanaconda.users.libuser.admin().method_calls,
|
||||
[('lookupUserByName', (USER,), {})])
|
||||
|
||||
def get_pass_algo_md5_test(self):
|
||||
import pyanaconda.users
|
||||
usr = pyanaconda.users.Users(self.anaconda)
|
||||
self.assertEqual(usr.getPassAlgo(), None)
|
||||
|
||||
def set_user_password_test(self):
|
||||
import pyanaconda.users
|
||||
|
||||
USER = 'TestUser'
|
||||
PASS = 'abcde'
|
||||
CRYPTED = False
|
||||
LOCK = False
|
||||
|
||||
usr = pyanaconda.users.Users(self.anaconda)
|
||||
usr.setUserPassword(USER, PASS, CRYPTED, LOCK)
|
||||
|
||||
methods = [x[0] for x in pyanaconda.users.libuser.admin().method_calls]
|
||||
self.assertEqual(methods,
|
||||
['lookupUserByName', 'setpassUser', 'modifyUser'])
|
||||
|
||||
def set_root_password_test(self):
|
||||
import pyanaconda.users
|
||||
|
||||
usr = pyanaconda.users.Users(self.anaconda)
|
||||
usr.setRootPassword()
|
||||
methods = [x[0] for x in pyanaconda.users.libuser.admin().method_calls]
|
||||
self.assertEqual(methods,
|
||||
['lookupUserByName', 'setpassUser', 'modifyUser'])
|
@ -1,116 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import mock
|
||||
import os
|
||||
|
||||
class VncTest(mock.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.setupModules(["_isys", "block", "logging", "ConfigParser"])
|
||||
self.fs = mock.DiskIO()
|
||||
|
||||
self.anaconda = mock.Mock()
|
||||
self.anaconda.ksdata.vnc.password = ''
|
||||
|
||||
import pyanaconda
|
||||
pyanaconda.anaconda_log = mock.Mock()
|
||||
|
||||
self.OK = 22
|
||||
|
||||
import pyanaconda.vnc
|
||||
pyanaconda.vnc.log = mock.Mock()
|
||||
pyanaconda.vnc.os = mock.Mock()
|
||||
pyanaconda.vnc.subprocess = mock.Mock()
|
||||
pyanaconda.vnc.subprocess.Popen().communicate.return_value = (1, 2)
|
||||
pyanaconda.vnc.subprocess.Popen().returncode = self.OK
|
||||
pyanaconda.vnc.open = self.fs.open
|
||||
|
||||
self.ROOT = '/'
|
||||
self.DISPLAY = '2'
|
||||
self.DESKTOP = 'Desktop'
|
||||
self.PASS = ''
|
||||
self.LOG_FILE = '/tmp/vnc.log'
|
||||
self.PW_FILE = '/tmp/vncpassword'
|
||||
self.VNCCONNECTHOST = 'host'
|
||||
|
||||
def tearDown(self):
|
||||
self.tearDownModules()
|
||||
|
||||
def set_vnc_password_1_test(self):
|
||||
import pyanaconda.vnc
|
||||
server = pyanaconda.vnc.VncServer()
|
||||
server.anaconda = self.anaconda
|
||||
pyanaconda.vnc.iutil = mock.Mock()
|
||||
pyanaconda.vnc.os.pipe.return_value = (1, 2)
|
||||
|
||||
server.setVNCPassword()
|
||||
self.assertEqual(
|
||||
pyanaconda.vnc.iutil.execWithRedirect.call_args_list,
|
||||
[(('vncpasswd', ['-f']), {'stdin': 1, 'stdout': '/tmp/vncpassword'})])
|
||||
|
||||
def initialize_test(self):
|
||||
import pyanaconda.vnc
|
||||
|
||||
IP = '192.168.0.21'
|
||||
HOSTNAME = 'desktop'
|
||||
|
||||
dev = mock.Mock()
|
||||
dev.get.return_value = 'eth0'
|
||||
pyanaconda.vnc.network = mock.Mock()
|
||||
pyanaconda.vnc.network.Network().netdevices = [dev]
|
||||
pyanaconda.vnc.network.getActiveNetDevs.return_value = [0]
|
||||
pyanaconda.vnc.network.getDefaultHostname.return_value = HOSTNAME
|
||||
pyanaconda.vnc.isys = mock.Mock()
|
||||
pyanaconda.vnc.isys.getIPAddresses = mock.Mock(return_value=[IP])
|
||||
|
||||
server = pyanaconda.vnc.VncServer(display=self.DISPLAY)
|
||||
server.initialize()
|
||||
expected = "%s:%s (%s)" % (HOSTNAME, self.DISPLAY, IP)
|
||||
self.assertEqual(server.connxinfo, expected)
|
||||
|
||||
def openlogfile_test(self):
|
||||
import pyanaconda.vnc
|
||||
FILE = 'file'
|
||||
pyanaconda.vnc.os.O_RDWR = os.O_RDWR
|
||||
pyanaconda.vnc.os.O_CREAT = os.O_CREAT
|
||||
pyanaconda.vnc.os.open.return_value = FILE
|
||||
|
||||
server = pyanaconda.vnc.VncServer(log_file=self.LOG_FILE)
|
||||
ret = server.openlogfile()
|
||||
self.assertEqual(ret, FILE)
|
||||
self.assertEqual(pyanaconda.vnc.os.open.call_args,
|
||||
((self.LOG_FILE, os.O_RDWR | os.O_CREAT), {})
|
||||
)
|
||||
|
||||
def connect_to_view_test(self):
|
||||
import pyanaconda.vnc
|
||||
pyanaconda.vnc.subprocess.Popen().communicate.return_value = (self.OK, '')
|
||||
|
||||
server = pyanaconda.vnc.VncServer(vncconnecthost=self.VNCCONNECTHOST)
|
||||
ret = server.connectToView()
|
||||
self.assertTrue(ret)
|
||||
|
||||
params = pyanaconda.vnc.subprocess.Popen.call_args[0][0]
|
||||
self.assertTrue(self.VNCCONNECTHOST in params)
|
||||
self.assertTrue(params[params.index(self.VNCCONNECTHOST)-1] == "-connect")
|
||||
|
||||
def start_server_test(self):
|
||||
import pyanaconda.vnc
|
||||
pyanaconda.vnc.VncServer.initialize = mock.Mock()
|
||||
pyanaconda.vnc.VncServer.setVNCPassword = mock.Mock()
|
||||
pyanaconda.vnc.VncServer.VNCListen = mock.Mock()
|
||||
pyanaconda.vnc.subprocess.Popen().poll.return_value = None
|
||||
pyanaconda.vnc.os.environ = {}
|
||||
pyanaconda.vnc.time.sleep = mock.Mock()
|
||||
|
||||
server = pyanaconda.vnc.VncServer(root=self.ROOT, display=self.DISPLAY,
|
||||
desktop=self.DESKTOP, password=self.PASS, vncconnecthost="")
|
||||
server.openlogfile = mock.Mock()
|
||||
server.startServer()
|
||||
|
||||
params = pyanaconda.vnc.subprocess.Popen.call_args[0][0]
|
||||
self.assertTrue('desktop=%s'%self.DESKTOP in params)
|
||||
self.assertTrue(':%s'%self.DISPLAY in params)
|
||||
self.assertTrue(pyanaconda.vnc.VncServer.VNCListen.called)
|
||||
self.assertTrue("DISPLAY" in pyanaconda.vnc.os.environ)
|
||||
self.assertEqual(pyanaconda.vnc.os.environ['DISPLAY'], ":%s" % self.DISPLAY)
|
File diff suppressed because it is too large
Load Diff
@ -1,46 +0,0 @@
|
||||
# indexed_dict.py
|
||||
# Implements IndexedDictionary class.
|
||||
#
|
||||
# Copyright (C) 2009 Red Hat, Inc.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing to use,
|
||||
# modify, copy, or redistribute it subject to the terms and conditions of
|
||||
# the GNU General Public License v.2, or (at your option) any later version.
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY expressed or implied, including the implied warranties of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
# Public License for more details. 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
|
||||
# source code or documentation are not subject to the GNU General Public
|
||||
# License and may only be used or replicated with the express permission of
|
||||
# Red Hat, Inc.
|
||||
#
|
||||
|
||||
class IndexedDict(dict):
|
||||
""" Indexed dictionary that remembers order of the inserted elements.
|
||||
|
||||
Values can be inserted with string keys only, but referenced by both
|
||||
string keys or index.
|
||||
|
||||
There's a unit test for the class, please maintain it along.
|
||||
"""
|
||||
def __init__(self):
|
||||
super(IndexedDict, self).__init__()
|
||||
self._indexes = []
|
||||
|
||||
def __getitem__(self, key):
|
||||
if type(key) is int:
|
||||
key = self._indexes[key]
|
||||
return super(IndexedDict, self).__getitem__(key)
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
if type(key) is int:
|
||||
raise TypeError("IndexedDict only accepts strings as new keys")
|
||||
assert(len(self) == len(self._indexes))
|
||||
self._indexes.append(key)
|
||||
return super(IndexedDict, self).__setitem__(key, value)
|
||||
|
||||
def index(self, string_key):
|
||||
return self._indexes.index(string_key)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue