[PATCH] Tweak parallel args.
by Chris Lumens
(1) --filter-hosts is currently alpha-level and filters out localhost when
"--sshlogin :" is used, but only on one system here.
(2) Don't print out all that introductory text.
---
tests/kickstart_tests/run_kickstart_tests.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/kickstart_tests/run_kickstart_tests.sh b/tests/kickstart_tests/run_kickstart_tests.sh
index 2f4c124..2024cdd 100755
--- a/tests/kickstart_tests/run_kickstart_tests.sh
+++ b/tests/kickstart_tests/run_kickstart_tests.sh
@@ -103,7 +103,7 @@ if [[ "$TEST_REMOTES" != "" ]]; then
remote_args="${remote_args} --sshlogin kstest@${remote}"
done
- parallel --filter-hosts ${remote_args} \
+ parallel --no-notice ${remote_args} \
${env_args} --jobs ${TEST_JOBS:-2} \
sudo kickstart_tests/run_one_ks.sh -i ${_IMAGE} -k ${KEEPIT} {}
rc=$?
@@ -131,7 +131,7 @@ if [[ "$TEST_REMOTES" != "" ]]; then
# code will be caught outside and converted into the overall exit code.
exit ${rc}
else
- parallel ${env_args} --jobs ${TEST_JOBS:-2} \
+ parallel --no-notice ${env_args} --jobs ${TEST_JOBS:-2} \
sudo kickstart_tests/run_one_ks.sh -i ${IMAGE} -k ${KEEPIT} {}
# For future expansion - any cleanup code can go in between the variable
--
2.2.2
9 years, 3 months
[PATCH][python-meh] Add option to remove the 'Debug' option/button for mainExceptionWindow
by Vojtěch Trefný
Default is the sys.stdout.isatty function which causes the debug option is not present when there is no terminal/tty to display the debugger.
---
meh/ui/__init__.py | 3 ++-
meh/ui/gui.py | 10 ++++++++--
meh/ui/text.py | 9 ++++++---
3 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/meh/ui/__init__.py b/meh/ui/__init__.py
index 8c174e1..053025f 100644
--- a/meh/ui/__init__.py
+++ b/meh/ui/__init__.py
@@ -47,12 +47,13 @@ class AbstractIntf(object):
"""
raise NotImplementedError
- def mainExceptionWindow(self, text, exnFile, *args, **kwargs):
+ def mainExceptionWindow(self, text, exnFile, allowDebug, *args, **kwargs):
"""Create and return an instance of the initial execption handling
dialog. This method must be provided by all subclasses.
text -- The short traceback (usually, just the stack trace).
exnFile -- A file containing the output of ExceptionDump.write().
+ allowDebug -- A function to decide whether allow using of debug option.
"""
raise NotImplementedError
diff --git a/meh/ui/gui.py b/meh/ui/gui.py
index ab6f56a..5e8c95a 100644
--- a/meh/ui/gui.py
+++ b/meh/ui/gui.py
@@ -19,6 +19,7 @@
from meh import *
from meh.ui import *
import os
+import sys
import report
from gi.repository import Gtk
@@ -47,8 +48,8 @@ class GraphicalIntf(AbstractIntf):
win.run()
win.destroy()
- def mainExceptionWindow(self, text, exnFile, *args, **kwargs):
- win = MainExceptionWindow(text, exnFile, *args, **kwargs)
+ def mainExceptionWindow(self, text, exnFile, allowDebug=sys.stdout.isatty, *args, **kwargs):
+ win = MainExceptionWindow(text, exnFile, allowDebug=allowDebug, *args, **kwargs)
return win
def messageWindow(self, title, message, *args, **kwargs):
@@ -86,6 +87,11 @@ class MainExceptionWindow(AbstractMainExceptionWindow):
self._traceback_buffer.set_text(longTraceback)
self._response = MAIN_RESPONSE_QUIT
+ self._debug_button = builder.get_object("debugButton")
+
+ if not kwargs["allowDebug"]():
+ self._debug_button.set_sensitive(False)
+
@property
def main_window(self):
return self._main_window
diff --git a/meh/ui/text.py b/meh/ui/text.py
index 7a28b3e..8a4bbd2 100644
--- a/meh/ui/text.py
+++ b/meh/ui/text.py
@@ -26,6 +26,7 @@ import report.io.TextIO
from report import LIBREPORT_WAIT, LIBREPORT_RUN_CLI
import os
+import sys
import gettext
_ = lambda x: gettext.ldgettext("python-meh", x)
@@ -116,9 +117,9 @@ class TextIntf(AbstractIntf):
win.run()
win.destroy()
- def mainExceptionWindow(self, text, exnFile, *args, **kwargs):
+ def mainExceptionWindow(self, text, exnFile, allowDebug=sys.stdout.isatty, *args, **kwargs):
kwargs["io_handler"] = self._io
- win = MainExceptionWindow(text, exnFile, *args, **kwargs)
+ win = MainExceptionWindow(text, exnFile, allowDebug=allowDebug, *args, **kwargs)
return win
def messageWindow(self, title, message, *args, **kwargs):
@@ -154,10 +155,12 @@ class MainExceptionWindow(TextWindow, AbstractMainExceptionWindow):
*args, **kwargs)
self._short_traceback = shortTraceback
self._menu_items = [(_("Report Bug"), MAIN_RESPONSE_SAVE),
- (_("Debug"), MAIN_RESPONSE_DEBUG),
(_("Run shell"), MAIN_RESPONSE_SHELL),
(_("Quit"), MAIN_RESPONSE_QUIT)]
+ if kwargs["allowDebug"]():
+ self._menu_items.append((_("Debug"), MAIN_RESPONSE_DEBUG))
+
def run(self, *args, **kwargs):
self.print_header()
self._io.print(self._short_traceback)
--
2.1.0
9 years, 3 months
[lorax] os-release moved to /usr/lib (#1191713)
by Brian C. Lane
Don't remove it or the symlink to it.
---
share/runtime-cleanup.tmpl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/share/runtime-cleanup.tmpl b/share/runtime-cleanup.tmpl
index 72fa6a9..5fed1a5 100644
--- a/share/runtime-cleanup.tmpl
+++ b/share/runtime-cleanup.tmpl
@@ -27,7 +27,7 @@ removefrom dracut --allbut /usr/lib/dracut/modules.d/30convertfs/convertfs.sh \
## we don't run SELinux (not in enforcing, anyway)
removepkg checkpolicy selinux-policy libselinux-utils
## anaconda has its own repo files
-removefrom fedora-release --allbut /etc/os-release
+removefrom fedora-release --allbut /etc/os-release /usr/lib/os-release
removepkg fedora-release-rawhide
## no user accounts = no account management
removepkg usermode usermode-gtk passwd shadow-utils
--
2.1.0
9 years, 3 months
[makeupdates][master][PATCH] Make it possible to ignore individual newly added dependencies
by Martin Kolman
The -f flag makes it possible to automatically fetch packages
for newly added dependencies. This usually works fine as long as the
packages are available from Koji. But in case the given dependency is
not yet available, the slow Koji package lookup holds back every such
makeupdates run considerably.
So add a new -i/--ignore option that makes it possible to ignore individual
package dependencies. Both exact match and globs are supported.
Signed-off-by: Martin Kolman <mkolman(a)redhat.com>
---
scripts/makeupdates | 30 +++++++++++++++++++++++++++---
1 file changed, 27 insertions(+), 3 deletions(-)
diff --git a/scripts/makeupdates b/scripts/makeupdates
index 70a0794..ad83291 100755
--- a/scripts/makeupdates
+++ b/scripts/makeupdates
@@ -32,6 +32,7 @@ import threading
import multiprocessing
import argparse
import tempfile
+import fnmatch
from collections import namedtuple
try:
from rpmUtils import miscutils # available from the yum-utils package
@@ -511,7 +512,7 @@ def createUpdatesImage(cwd, updates):
os.system("find . | cpio -c -o | pigz -9cv > %s/updates.img" % (cwd,))
sys.stdout.write("updates.img ready\n")
-def check_for_new_packages(tag, arch, added_rpms, specfile_path):
+def check_for_new_packages(tag, arch, args, specfile_path):
"""Download any new packages added to Requires and Defines
since the given tag, return list of RPM paths
"""
@@ -651,6 +652,25 @@ def check_for_new_packages(tag, arch, added_rpms, specfile_path):
print("%s %s %s" % (p.name, p.version_request, p.version))
else:
print(p.name)
+
+ # remove ignored packages
+
+ # convert the list of lists to a flat list
+ flatly_ignored_packages = []
+ for component_list in args.ignored_packages:
+ flatly_ignored_packages.extend(component_list)
+
+ ignored_count = 0
+ for ignored_package in flatly_ignored_packages:
+ matches = fnmatch.filter(new_packages, ignored_package)
+ # the ignored package specifications support glob
+ for match in matches:
+ print("the new package %s matches %s and will be ignored" % (match, ignored_package))
+ del new_packages[match]
+ ignored_count += 1
+ if ignored_count:
+ print("%d new packages have been ignored" % ignored_count)
+
else:
print("no new Requires or updated %%defines for Requires found")
return []
@@ -660,7 +680,7 @@ def check_for_new_packages(tag, arch, added_rpms, specfile_path):
# get package names for RPMs added by the -a/--add flags
added_names = {}
- for path in added_rpms:
+ for path in args.add_rpms:
try:
basename = os.path.basename(path)
name = get_pkg_tuple(basename)[0]
@@ -981,6 +1001,10 @@ def main():
parser.add_argument('-f', '--fetch', action='store', type=str, metavar="ARCH",
help='autofetch new dependencies from Koji for ARCH')
+ parser.add_argument('-i', '--ignore', action='append', type=str, metavar="PACKAGE_NAME",
+ dest="ignored_packages", nargs='+', default=[],
+ help='ignore this package when autofetching dependencies (glob supported)')
+
parser.add_argument('-b', '--builddir', action='store', type=str,
metavar='BUILDDIR', help='build directory for shared objects')
@@ -1046,7 +1070,7 @@ def main():
if args.fetch:
arch = args.fetch
- rpm_paths = check_for_new_packages(args.tag, arch, args.add_rpms, spec)
+ rpm_paths = check_for_new_packages(args.tag, arch, args, spec)
args.add_rpms.extend(rpm_paths)
if args.add_rpms:
--
2.1.0
9 years, 3 months
[initial-setup][master][PATCH] Split scriptlets for the gui subpackage
by Martin Kolman
Run the systemd macros concerning the initial-setup-graphical.service
in scriptlets specific to the gui subpackage.
This should prevent errors caused by referencing the initial-setup-graphical.service
from the main package even though it might not be installed.
---
initial-setup.spec | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/initial-setup.spec b/initial-setup.spec
index 884fca0..eddfff3 100644
--- a/initial-setup.spec
+++ b/initial-setup.spec
@@ -78,19 +78,25 @@ if [ $1 -ne 2 -a ! -f /etc/sysconfig/initial-setup ]; then
if [ "$platform" = "s390" -o "$platform" = "s390x" ]; then
echo "RUN_INITIAL_SETUP=YES" > /etc/sysconfig/initial-setup
else
- %systemd_post initial-setup-graphical.service
%systemd_post initial-setup-text.service
fi
fi
%preun
-%systemd_preun initial-setup-graphical.service
%systemd_preun initial-setup-text.service
%postun
-%systemd_postun_with_restart initial-setup-graphical.service
%systemd_postun_with_restart initial-setup-text.service
+%post gui
+%systemd_post initial-setup-graphical.service
+
+%preun gui
+%systemd_preun initial-setup-graphical.service
+
+%postun gui
+%systemd_postun_with_restart initial-setup-graphical.service
+
%files -f %{name}.lang
%doc COPYING README.rst
%{python_sitelib}/initial_setup*
--
2.1.0
9 years, 3 months
[PATCH 1/3] Support kickstart test jobs out to multiple computers with parallel.
by Chris Lumens
Basically, you pass TEST_REMOTES= as a space separated list of hostnames to
run on. You will need to have root access on each of those hosts, and root's
ssh keys will need to be set up to allow logging in without a password. lmc
requires running as root.
Do not add localhost to TEST_REMOTES. It will be added automatically.
Adding this support required breaking run_kickstart_tests.sh out into a script
that does the work of calling lmc, and a script that interfaces with make and
fires off parallel. This is because parallel really wants a single command to
run, and having the part that does the actual work be bash function in
run_kickstart_tests.sh was not working out.
A later commit is going to add an awful lot of documentation here.
---
tests/kickstart_tests/run_kickstart_tests.sh | 160 +++++++++++----------------
tests/kickstart_tests/run_one_ks.sh | 150 +++++++++++++++++++++++++
2 files changed, 215 insertions(+), 95 deletions(-)
create mode 100755 tests/kickstart_tests/run_one_ks.sh
diff --git a/tests/kickstart_tests/run_kickstart_tests.sh b/tests/kickstart_tests/run_kickstart_tests.sh
index 8b076f3..30e7f77 100755
--- a/tests/kickstart_tests/run_kickstart_tests.sh
+++ b/tests/kickstart_tests/run_kickstart_tests.sh
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright (C) 2014 Red Hat, Inc.
+# Copyright (C) 2014, 2015 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
@@ -45,102 +45,72 @@ fi
# 2 - Keep log files and disk images (will take up a lot of space)
KEEPIT=${KEEPIT:-0}
-export IMAGE KEEPIT
-
-cleanup() {
- d=$1
-
- if [[ ${KEEPIT} == 2 ]]; then
- return
- elif [[ ${KEEPIT} == 1 ]]; then
- rm -f ${d}/*img ${d}/*ks
- elif [[ ${KEEPIT} == 0 ]]; then
- rm -rf ${d}
- fi
-}
-
-runone() {
- t=$1
-
- ks=${t/.sh/.ks}
- . $t
-
- name=$(basename ${t%.sh})
-
- echo
- echo ============================================================
- echo ${ks}
- echo ============================================================
-
- # qemu user needs to be able to read the directory.
- tmpdir=$(mktemp -d --tmpdir=/var/tmp kstest-${name}.XXXXXXXX)
- chmod 755 ${tmpdir}
-
- ksfile=$(prepare ${ks} ${tmpdir})
- if [[ $? != 0 ]]; then
- echo Test prep failed: ${ksfile}
- cleanup ${tmpdir}
- unset kernel_args prep validate
- return 1
- fi
-
- kargs=$(kernel_args)
- if [[ "${kargs}" != "" ]]; then
- kargs="--kernel-args \"$kargs\""
- fi
-
- eval livemedia-creator ${kargs} \
- --make-disk \
- --iso "${IMAGE}" \
- --ks ${ksfile} \
- --tmp ${tmpdir} \
- --logfile ${tmpdir}/livemedia.log \
- --title Fedora \
- --project Fedora \
- --releasever 22 \
- --ram 2048 \
- --vcpus 2 \
- --vnc vnc \
- --timeout 60
- if [[ $? != 0 ]]; then
- echo $(grep CRIT ${tmpdir}/virt-install.log)
- cleanup ${tmpdir}
- unset kernel_args prep validate
- return 1
- elif [[ -f ${tmpdir}/livemedia.log ]]; then
- img=$(grep disk_img ${tmpdir}/livemedia.log | cut -d= -f2)
- trimmed=${img## }
-
- if [[ $(grep "due to timeout" ${tmpdir}/livemedia.log) != "" ]]; then
- echo FAILED - Test timed out.
- cleanup ${tmpdir}
- unset kernel_args prep validate
- return 1
- elif [[ ! -f ${trimmed} ]]; then
- echo FAILED - Disk image ${trimmed} does not exist.
- cleanup ${tmpdir}
- unset kernel_args prep validate
- return 1
+# Round up all the kickstart tests we want to run, skipping those that are not
+# executable as well as this file itself.
+find kickstart_tests -name '*sh' -a -perm -o+x -a \! -wholename 'kickstart_tests/run_*.sh' | \
+if [[ "$TEST_REMOTES" != "" ]]; then
+ _IMAGE=kickstart_tests/$(basename ${IMAGE})
+
+ # (1) Copy everything to the remote systems. We do this ourselves because
+ # parallel doesn't like globs, and we need to put the boot image somewhere
+ # that qemu on the remote systems can read.
+ for remote in ${TEST_REMOTES}; do
+ scp -r kickstart_tests ${remote}:
+ scp ${IMAGE} ${remote}:kickstart_tests/
+ done
+
+ # (1a) We also need to copy the provided image to under kickstart_tests/ on
+ # the local system too. This is because parallel will attempt to run the
+ # same command line on every system and that requires the image to also be
+ # in the same location.
+ cp ${IMAGE} ${_IMAGE}
+
+ # (2) Run parallel. We always add the local system to the list of machines
+ # being passed to parallel. Don't add it yourself.
+ remote_args="--sshlogin :"
+ for remote in ${TEST_REMOTES}; do
+ remote_args="${remote_args} --sshlogin ${remote}"
+ done
+
+ parallel --filter-hosts ${remote_args} \
+ --env TEST_OSTREE_REPO --jobs ${TEST_JOBS:-2} \
+ kickstart_tests/run_one_ks.sh -i ${_IMAGE} -k ${KEEPIT} {}
+ rc=$?
+
+ # (3) Get all the results back from the remote systems, which will have already
+ # applied the KEEPIT setting. However if KEEPIT is 0 (meaning, don't save
+ # anything) there's no point in trying. We do this ourselves because, again,
+ # parallel doesn't like globs.
+ #
+ # We also need to clean up the stuff we copied over in step 1, and then clean up
+ # the results from the remotes too. We don't want to keep things scattered all
+ # over the place.
+ for remote in ${TEST_REMOTES}; do
+ if [[ ${KEEPIT} > 0 ]]; then
+ scp -r ${remote}:/var/tmp/kstest-\* /var/tmp/
fi
- result=$(validate ${trimmed})
- if [[ $? != 0 ]]; then
- echo FAILED - "${result}"
- cleanup ${tmpdir}
- unset kernel_args prep validate
- return 1
- fi
- fi
+ ssh ${remote} rm -rf kickstart_tests /var/tmp/kstest-\*
+ done
- echo SUCCESS
- cleanup ${tmpdir}
- unset kernel_args prep validate
- return 0
-}
+ # (3a) And then also remove the copy of the image we made earlier.
+ rm ${_IMAGE}
-export -f cleanup runone
+ # (4) Exit the subshell defined by "find ... | " way up at the top. The exit
+ # code will be caught outside and converted into the overall exit code.
+ exit ${rc}
+else
+ parallel --env TEST_OSTREE_REPO --jobs ${TEST_JOBS:-2} \
+ kickstart_tests/run_one_ks.sh -i ${IMAGE} -k ${KEEPIT} {}
-# Round up all the kickstart tests we want to run, skipping those that are not
-# executable as well as this file itself.
-find kickstart_tests -name '*sh' -a -perm -o+x -a \! -wholename 'kickstart_tests/run_kickstart_tests.sh' | \
-parallel --jobs ${TEST_JOBS:-2} runone {}
+ # For future expansion - any cleanup code can go in between the variable
+ # setting and the exit, like in the other branch of the if-else above.
+ rc=$?
+ exit ${rc}
+fi
+
+# Catch the exit code of the subshell and return it. This is structured for
+# future expansion, too. Any extra global cleanup code can go in between the
+# variable setting and the exit.
+rc=$?
+exit ${rc}
diff --git a/tests/kickstart_tests/run_one_ks.sh b/tests/kickstart_tests/run_one_ks.sh
new file mode 100755
index 0000000..b61b9b5
--- /dev/null
+++ b/tests/kickstart_tests/run_one_ks.sh
@@ -0,0 +1,150 @@
+#!/bin/bash
+#
+# Copyright (C) 2015 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.
+#
+# Red Hat Author(s): Chris Lumens <clumens(a)redhat.com>
+
+IMAGE=
+KEEPIT=0
+
+cleanup() {
+ d=$1
+
+ # Always remove the copy of the boot.iso.
+ rm ${d}/$(basename ${IMAGE})
+
+ if [[ ${KEEPIT} == 2 ]]; then
+ return
+ elif [[ ${KEEPIT} == 1 ]]; then
+ rm -f ${d}/*img ${d}/*ks
+ elif [[ ${KEEPIT} == 0 ]]; then
+ rm -rf ${d}
+ fi
+}
+
+runone() {
+ t=$1
+
+ ks=${t/.sh/.ks}
+ . $t
+
+ name=$(basename ${t%.sh})
+
+ echo
+ echo ===========================================================================
+ echo ${ks} on $(hostname)
+ echo ===========================================================================
+
+ # qemu user needs to be able to read the directory and the boot.iso, so put that
+ # into this directory as well. It will get deleted later, regardless of the
+ # KEEPIT setting.
+ tmpdir=$(mktemp -d --tmpdir=/var/tmp kstest-${name}.XXXXXXXX)
+ chmod 755 ${tmpdir}
+ cp ${IMAGE} ${tmpdir}
+
+ ksfile=$(prepare ${ks} ${tmpdir})
+ if [[ $? != 0 ]]; then
+ echo Test prep failed: ${ksfile}
+ cleanup ${tmpdir}
+ return 1
+ fi
+
+ kargs=$(kernel_args)
+ if [[ "${kargs}" != "" ]]; then
+ kargs="--kernel-args \"$kargs\""
+ fi
+
+ eval livemedia-creator ${kargs} \
+ --make-disk \
+ --iso "${tmpdir}/$(basename ${IMAGE})" \
+ --ks ${ksfile} \
+ --tmp ${tmpdir} \
+ --logfile ${tmpdir}/livemedia.log \
+ --title Fedora \
+ --project Fedora \
+ --releasever 22 \
+ --ram 2048 \
+ --vcpus 2 \
+ --vnc vnc \
+ --timeout 60
+ if [[ $? != 0 ]]; then
+ echo $(grep CRIT ${tmpdir}/virt-install.log)
+ cleanup ${tmpdir}
+ return 1
+ elif [[ -f ${tmpdir}/livemedia.log ]]; then
+ img=$(grep disk_img ${tmpdir}/livemedia.log | cut -d= -f2)
+ trimmed=${img## }
+
+ if [[ $(grep "due to timeout" ${tmpdir}/livemedia.log) != "" ]]; then
+ echo FAILED - Test timed out.
+ cleanup ${tmpdir}
+ return 1
+ elif [[ ! -f ${trimmed} ]]; then
+ echo FAILED - Disk image ${trimmed} does not exist.
+ cleanup ${tmpdir}
+ return 1
+ fi
+
+ result=$(validate ${trimmed})
+ if [[ $? != 0 ]]; then
+ echo FAILED - "${result}"
+ cleanup ${tmpdir}
+ return 1
+ fi
+ fi
+
+ echo SUCCESS
+ cleanup ${tmpdir}
+ return 0
+}
+
+# Have to be root to run this test, as it requires creating disk images.
+if [[ ${EUID} != 0 ]]; then
+ echo "You must be root to run this test."
+ exit 77
+fi
+
+while getopts ":i:k:" opt; do
+ case $opt in
+ i)
+ IMAGE=$OPTARG
+ ;;
+
+ k)
+ KEEPIT=$OPTARG
+ ;;
+
+ *)
+ echo "Usage: run_one_ks.sh -i ISO [-k KEEPIT] ks.cfg"
+ exit 1
+ ;;
+ esac
+done
+
+shift $((OPTIND - 1))
+
+if [[ ! -e "${IMAGE}" ]]; then
+ echo "Required boot.iso does not exist."
+ exit 77
+fi
+
+if [[ $# == 0 || ! -x $1 ]]; then
+ echo "Test not provided or is not executable."
+ exit 1
+fi
+
+runone $1
--
2.2.2
9 years, 3 months
[PATCH 0/9] Fix thread safety issues in the environment
by David Shea
Short version: environment variables cannot be set in a multi-threaded
environment. It is ridiculous, and it has been a problem since the environment
was invented, and no one has a solution for it, and computers are the absolute
worst.
There is one environment variable that was cannot get around having to set.
Python's gettext module, to determine the language to return, searches
$LANGUAGE, $LC_ALL, $LC_MESSAGES, and $LANG. This is completely different from
gettext() and friends in glibc, which, if there is nothing in $LANGUAGE, uses
the locale data set by setlocale, which is thread-safe. This means that if we
want translations to work in any python module that we do not control, we need
to modify the environment.
So, possible solutions:
1) write thread-safe versions of get/set/put/unsetenv, shoehorn it in with
$LD_PRELOAD
2) don't set any environment variables at all after starting threads,
monkey-patch the gettext module to do the right thing
3) don't set most environment variables, cross fingers and burn some sage
before setting environment variables
These patches implement #3.
The last one is just a bonus. Did you know that nm-connection-editor wasn't run
in the language the user selected, but it totally could be? Now it is.
All this needs to be ported to RHEL 7.2 with Related: rhbz#1188287
David Shea (9):
Add a pylint module to look for modifications to the environment
Set $DISPLAY before threads are started.
Add a method to set environment variables for child processes
Add a parameter to iutil.startProgram to extend the environment
Avoid setting $LANG and $LANGUAGE, except where we can't
Assume that a bunch of digits in a version number is a timestamp
Do not set $TZ
Set $LIBUSER_CONF early
Add an option to startProgram to not reset the locale
anaconda | 61 +++++++++-------
pyanaconda/constants.py | 3 +
pyanaconda/ihelp.py | 2 +-
pyanaconda/isys/__init__.py | 17 +++--
pyanaconda/iutil.py | 34 +++++++--
pyanaconda/kickstart.py | 11 ++-
pyanaconda/localization.py | 11 ++-
pyanaconda/packaging/__init__.py | 4 +-
pyanaconda/rescue.py | 6 +-
pyanaconda/timezone.py | 9 +++
pyanaconda/ui/gui/__init__.py | 2 +-
pyanaconda/ui/gui/spokes/datetime_spoke.py | 10 +--
pyanaconda/ui/gui/spokes/network.py | 4 +-
pyanaconda/ui/gui/spokes/welcome.py | 36 ++++++++--
pyanaconda/users.py | 25 +++----
pyanaconda/vnc.py | 19 +++--
scripts/anaconda-yum | 1 +
tests/pylint/environ.py | 107 +++++++++++++++++++++++++++++
tests/pylint/pylint-one.sh | 2 +-
utils/handle-sshpw | 2 -
widgets/configure.ac | 2 +-
widgets/src/BaseWindow.c | 6 +-
widgets/src/BaseWindow.h | 2 +-
widgets/src/StandaloneWindow.c | 5 +-
widgets/src/StandaloneWindow.h | 2 +-
25 files changed, 284 insertions(+), 99 deletions(-)
create mode 100644 tests/pylint/environ.py
--
2.1.0
9 years, 3 months
[blivet] Use /usr/bin/python2 in scripts
by Brian C. Lane
New packaging guidelines:
https://fedoraproject.org/wiki/Packaging:Python#Multiple_Python_Runtimes
https://fedorahosted.org/fpc/ticket/327#comment:9
---
scripts/makebumpver | 2 +-
scripts/makeupdates | 2 +-
scripts/pylintcodediff | 2 +-
tests/action_test.py | 2 +-
tests/devicefactory_test.py | 2 +-
tests/devicelibs_test/btrfs_test.py | 2 +-
tests/devicelibs_test/crypto_test.py | 2 +-
tests/devicelibs_test/dasd_test.py | 2 +-
tests/devicelibs_test/lvm_test.py | 2 +-
tests/devicelibs_test/mdraid_interrogate_test.py | 2 +-
tests/devicelibs_test/mdraid_test.py | 2 +-
tests/devicelibs_test/raid_test.py | 2 +-
tests/devicelibs_test/swap_test.py | 2 +-
tests/devices_test.py | 2 +-
tests/formats_test/fs_test.py | 2 +-
tests/formats_test/fslabeling.py | 2 +-
tests/formats_test/fstesting.py | 2 +-
tests/formats_test/init_test.py | 2 +-
tests/formats_test/labeling_test.py | 2 +-
tests/formats_test/selinux_test.py | 2 +-
tests/partitioning_test.py | 2 +-
tests/size_test.py | 2 +-
tests/storagetestcase.py | 2 +-
tests/udev_test.py | 2 +-
tests/util_test.py | 2 +-
25 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/scripts/makebumpver b/scripts/makebumpver
index 52e5be8..6f4110a 100755
--- a/scripts/makebumpver
+++ b/scripts/makebumpver
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
#
# makebumpver - Increment version number and add in RPM spec file changelog
# block. Ensures rhel*-branch commits reference RHEL bugs.
diff --git a/scripts/makeupdates b/scripts/makeupdates
index e3e6a0c..8dbbab6 100755
--- a/scripts/makeupdates
+++ b/scripts/makeupdates
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
#
# makeupdates - Generate an updates.img containing changes since the last
# tag.
diff --git a/scripts/pylintcodediff b/scripts/pylintcodediff
index 4e30453..7d584c5 100755
--- a/scripts/pylintcodediff
+++ b/scripts/pylintcodediff
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
#
# pylintcodediff --- Locate pylint errors corresponding to changed lines
#
diff --git a/tests/action_test.py b/tests/action_test.py
index 6440832..1dfd5b1 100644
--- a/tests/action_test.py
+++ b/tests/action_test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
import unittest
diff --git a/tests/devicefactory_test.py b/tests/devicefactory_test.py
index 8ea43cb..f35164d 100644
--- a/tests/devicefactory_test.py
+++ b/tests/devicefactory_test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
import unittest
diff --git a/tests/devicelibs_test/btrfs_test.py b/tests/devicelibs_test/btrfs_test.py
index e3f658e..96d7da8 100755
--- a/tests/devicelibs_test/btrfs_test.py
+++ b/tests/devicelibs_test/btrfs_test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
import os
import os.path
import subprocess
diff --git a/tests/devicelibs_test/crypto_test.py b/tests/devicelibs_test/crypto_test.py
index cd7de7a..851cd5f 100755
--- a/tests/devicelibs_test/crypto_test.py
+++ b/tests/devicelibs_test/crypto_test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
import unittest
import tempfile
diff --git a/tests/devicelibs_test/dasd_test.py b/tests/devicelibs_test/dasd_test.py
index 98f2cd1..86ba852 100644
--- a/tests/devicelibs_test/dasd_test.py
+++ b/tests/devicelibs_test/dasd_test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
import unittest
import blivet.devicelibs.dasd as dasd
diff --git a/tests/devicelibs_test/lvm_test.py b/tests/devicelibs_test/lvm_test.py
index d88c451..e61a1d2 100755
--- a/tests/devicelibs_test/lvm_test.py
+++ b/tests/devicelibs_test/lvm_test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
import unittest
import glob
diff --git a/tests/devicelibs_test/mdraid_interrogate_test.py b/tests/devicelibs_test/mdraid_interrogate_test.py
index cee2421..bb72137 100755
--- a/tests/devicelibs_test/mdraid_interrogate_test.py
+++ b/tests/devicelibs_test/mdraid_interrogate_test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
import unittest
import time
import uuid
diff --git a/tests/devicelibs_test/mdraid_test.py b/tests/devicelibs_test/mdraid_test.py
index 4cd50a3..ebbb4e1 100755
--- a/tests/devicelibs_test/mdraid_test.py
+++ b/tests/devicelibs_test/mdraid_test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
import unittest
import time
diff --git a/tests/devicelibs_test/raid_test.py b/tests/devicelibs_test/raid_test.py
index ba1a580..6dac706 100644
--- a/tests/devicelibs_test/raid_test.py
+++ b/tests/devicelibs_test/raid_test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
import unittest
import blivet.devicelibs.raid as raid
diff --git a/tests/devicelibs_test/swap_test.py b/tests/devicelibs_test/swap_test.py
index 1b8e1aa..1080b87 100755
--- a/tests/devicelibs_test/swap_test.py
+++ b/tests/devicelibs_test/swap_test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
import unittest
import blivet.devicelibs.swap as swap
diff --git a/tests/devices_test.py b/tests/devices_test.py
index c526c74..9d88661 100644
--- a/tests/devices_test.py
+++ b/tests/devices_test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
# vim:set fileencoding=utf-8
import os
diff --git a/tests/formats_test/fs_test.py b/tests/formats_test/fs_test.py
index 6bbafeb..ea2c60f 100755
--- a/tests/formats_test/fs_test.py
+++ b/tests/formats_test/fs_test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
import unittest
import blivet.formats.fs as fs
diff --git a/tests/formats_test/fslabeling.py b/tests/formats_test/fslabeling.py
index 9c6dabb..89cebdb 100644
--- a/tests/formats_test/fslabeling.py
+++ b/tests/formats_test/fslabeling.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
import abc
from six import add_metaclass
diff --git a/tests/formats_test/fstesting.py b/tests/formats_test/fstesting.py
index 491e8b2..a5040fe 100644
--- a/tests/formats_test/fstesting.py
+++ b/tests/formats_test/fstesting.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
import abc
from six import add_metaclass
diff --git a/tests/formats_test/init_test.py b/tests/formats_test/init_test.py
index 6fc11c6..f6a27ce 100644
--- a/tests/formats_test/init_test.py
+++ b/tests/formats_test/init_test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
import copy
import unittest
diff --git a/tests/formats_test/labeling_test.py b/tests/formats_test/labeling_test.py
index 25206b1..f21e167 100755
--- a/tests/formats_test/labeling_test.py
+++ b/tests/formats_test/labeling_test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
import unittest
from tests import loopbackedtestcase
diff --git a/tests/formats_test/selinux_test.py b/tests/formats_test/selinux_test.py
index 0c9d4c1..a04119c 100755
--- a/tests/formats_test/selinux_test.py
+++ b/tests/formats_test/selinux_test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
import os
import selinux
import tempfile
diff --git a/tests/partitioning_test.py b/tests/partitioning_test.py
index f31154a..8c16cff 100644
--- a/tests/partitioning_test.py
+++ b/tests/partitioning_test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
import unittest
from mock import Mock
diff --git a/tests/size_test.py b/tests/size_test.py
index e60c6d1..a7b3916 100644
--- a/tests/size_test.py
+++ b/tests/size_test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
#
# tests/storage/size_tests.py
# Size test cases for the blivet module
diff --git a/tests/storagetestcase.py b/tests/storagetestcase.py
index 0b3f26d..06ef738 100644
--- a/tests/storagetestcase.py
+++ b/tests/storagetestcase.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
import unittest
from mock import Mock
diff --git a/tests/udev_test.py b/tests/udev_test.py
index e3e817d..28686e0 100644
--- a/tests/udev_test.py
+++ b/tests/udev_test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
import unittest
import mock
diff --git a/tests/util_test.py b/tests/util_test.py
index 13b8d06..5ce6ed2 100644
--- a/tests/util_test.py
+++ b/tests/util_test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
import unittest
from decimal import Decimal
--
2.1.0
9 years, 3 months
[PATCH] Cleanup some pylint errors in analog
by Brian C. Lane
---
scripts/analog | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/scripts/analog b/scripts/analog
index eb1962e..6a426a7 100755
--- a/scripts/analog
+++ b/scripts/analog
@@ -24,11 +24,9 @@
from __future__ import print_function
import getpass
-import errno
import optparse
import os
import os.path
-import signal
import sys
DEFAULT_PORT = 6080
@@ -194,9 +192,9 @@ def pid_location(unique_id):
os.mkdir(directory)
return location
-if __name__ == "__main__":
+def main():
try:
- (options, args) = get_opts()
+ (options, _args) = get_opts()
except OptParserError as exc:
exc.parser.error(str(exc))
sys.exit(1)
@@ -205,9 +203,9 @@ if __name__ == "__main__":
if options.output:
options.output = os.path.abspath(options.output)
try:
- with open(options.output, 'w') as file:
- file.write(config)
- except IOError as e:
+ with open(options.output, 'w') as f:
+ f.write(config)
+ except IOError:
print("Can't write into file %s" % options.output, file=sys.stderr)
sys.exit(1)
if options.stdout:
@@ -218,3 +216,6 @@ if __name__ == "__main__":
})
else:
print(config)
+
+if __name__ == "__main__":
+ main()
--
2.1.0
9 years, 3 months
[lorax-rhel7/master] Add bridge-utils (#1188812)
by Brian C. Lane
This allows dracut's bridge commands to be used.
---
share/runtime-install.tmpl | 1 +
1 file changed, 1 insertion(+)
diff --git a/share/runtime-install.tmpl b/share/runtime-install.tmpl
index 805ad9b..a9cded7 100644
--- a/share/runtime-install.tmpl
+++ b/share/runtime-install.tmpl
@@ -102,6 +102,7 @@ installpkg tigervnc-server-minimal
installpkg tigervnc-server-module
%endif
installpkg net-tools
+installpkg bridge-utils
## hardware utilities/libraries
installpkg pciutils usbutils ipmitool
--
2.1.0
9 years, 3 months