Removed Python 2 and Python 3.5- support

Deprecation of Python versions below 3.6 gives opportunity to unify the
build and install requirements for OpenZFS packages. The minimal
supported Python version is 3.6 as this is the most recent Python
package CentOS/RHEL 7 users can get.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Signed-off-by: szubersk <szuberskidamian@gmail.com>
Closes #12925
This commit is contained in:
Damian Szuberski 2022-01-13 17:51:12 +01:00 committed by GitHub
parent da9c6c0333
commit 8a7c4efd3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 66 additions and 1320 deletions

View File

@ -15,7 +15,7 @@ jobs:
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install --yes -qq build-essential autoconf libtool gawk alien fakeroot linux-headers-$(uname -r) sudo apt-get install --yes -qq build-essential autoconf libtool gawk alien fakeroot linux-headers-$(uname -r)
sudo apt-get install --yes -qq zlib1g-dev uuid-dev libattr1-dev libblkid-dev libselinux-dev libudev-dev libssl-dev python-dev python-setuptools python-cffi python3 python3-dev python3-setuptools python3-cffi sudo apt-get install --yes -qq zlib1g-dev uuid-dev libattr1-dev libblkid-dev libselinux-dev libudev-dev libssl-dev python3 python3-dev python3-setuptools python3-cffi
# packages for tests # packages for tests
sudo apt-get install --yes -qq parted lsscsi ksh attr acl nfs-kernel-server fio sudo apt-get install --yes -qq parted lsscsi ksh attr acl nfs-kernel-server fio
sudo apt-get install --yes -qq mandoc cppcheck pax-utils devscripts sudo apt-get install --yes -qq mandoc cppcheck pax-utils devscripts

View File

@ -25,9 +25,8 @@ jobs:
zlib1g-dev uuid-dev libblkid-dev libselinux-dev \ zlib1g-dev uuid-dev libblkid-dev libselinux-dev \
xfslibs-dev libattr1-dev libacl1-dev libudev-dev libdevmapper-dev \ xfslibs-dev libattr1-dev libacl1-dev libudev-dev libdevmapper-dev \
libssl-dev libffi-dev libaio-dev libelf-dev libmount-dev \ libssl-dev libffi-dev libaio-dev libelf-dev libmount-dev \
libpam0g-dev pamtester python-dev python-setuptools python-cffi \ libpam0g-dev pamtester libcurl4-openssl-dev \
python-packaging python3 python3-dev python3-setuptools python3-cffi \ python3 python3-dev python3-setuptools python3-cffi python3-packaging
libcurl4-openssl-dev python3-packaging
- name: Autogen.sh - name: Autogen.sh
run: | run: |
sh autogen.sh sh autogen.sh

View File

@ -21,9 +21,8 @@ jobs:
zlib1g-dev uuid-dev libblkid-dev libselinux-dev \ zlib1g-dev uuid-dev libblkid-dev libselinux-dev \
xfslibs-dev libattr1-dev libacl1-dev libudev-dev libdevmapper-dev \ xfslibs-dev libattr1-dev libacl1-dev libudev-dev libdevmapper-dev \
libssl-dev libffi-dev libaio-dev libelf-dev libmount-dev \ libssl-dev libffi-dev libaio-dev libelf-dev libmount-dev \
libpam0g-dev pamtester python-dev python-setuptools python-cffi \ libpam0g-dev pamtester libcurl4-openssl-dev \
python-packaging python3 python3-dev python3-setuptools python3-cffi \ python3 python3-dev python3-setuptools python3-cffi python3-packaging
python3-packaging libcurl4-openssl-dev
- name: Autogen.sh - name: Autogen.sh
run: | run: |
sh autogen.sh sh autogen.sh

View File

@ -22,7 +22,6 @@ jobs:
xfslibs-dev libattr1-dev libacl1-dev libudev-dev libdevmapper-dev \ xfslibs-dev libattr1-dev libacl1-dev libudev-dev libdevmapper-dev \
libssl-dev libffi-dev libaio-dev libelf-dev libmount-dev \ libssl-dev libffi-dev libaio-dev libelf-dev libmount-dev \
libpam0g-dev \ libpam0g-dev \
python-dev python-setuptools python-cffi python-packaging \
python3 python3-dev python3-setuptools python3-cffi python3-packaging python3 python3-dev python3-setuptools python3-cffi python3-packaging
- name: Autogen.sh - name: Autogen.sh
run: | run: |

View File

@ -1,13 +1,8 @@
bin_SCRIPTS = arc_summary bin_SCRIPTS = arc_summary
CLEANFILES = arc_summary CLEANFILES = arc_summary
EXTRA_DIST = arc_summary2 arc_summary3 EXTRA_DIST = arc_summary3
if USING_PYTHON_2
SCRIPT = arc_summary2
else
SCRIPT = arc_summary3 SCRIPT = arc_summary3
endif
arc_summary: $(SCRIPT) arc_summary: $(SCRIPT)
cp $< $@ cp $< $@

File diff suppressed because it is too large Load Diff

View File

@ -191,21 +191,13 @@ elif sys.platform.startswith('linux'):
# there, so we fall back on modinfo # there, so we fall back on modinfo
command = ["/sbin/modinfo", request, "-0"] command = ["/sbin/modinfo", request, "-0"]
# The recommended way to do this is with subprocess.run(). However,
# some installed versions of Python are < 3.5, so we offer them
# the option of doing it the old way (for now)
info = '' info = ''
try: try:
if 'run' in dir(subprocess): info = subprocess.run(command, stdout=subprocess.PIPE,
info = subprocess.run(command, stdout=subprocess.PIPE, check=True, universal_newlines=True)
universal_newlines=True) raw_output = info.stdout.split('\0')
raw_output = info.stdout.split('\0')
else:
info = subprocess.check_output(command,
universal_newlines=True)
raw_output = info.split('\0')
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
print("Error: Descriptions not available", print("Error: Descriptions not available",

View File

@ -47,7 +47,7 @@
# @hdr is the array of fields that needs to be printed, so we # @hdr is the array of fields that needs to be printed, so we
# just iterate over this array and print the values using our pretty printer. # just iterate over this array and print the values using our pretty printer.
# #
# This script must remain compatible with Python 2.6+ and Python 3.4+. # This script must remain compatible with Python 3.6+.
# #
import sys import sys

View File

@ -27,7 +27,7 @@
# Copyright (C) 2013 Lawrence Livermore National Security, LLC. # Copyright (C) 2013 Lawrence Livermore National Security, LLC.
# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). # Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
# #
# This script must remain compatible with Python 2.6+ and Python 3.4+. # This script must remain compatible with and Python 3.6+.
# #
import sys import sys

View File

@ -1,7 +1,6 @@
dnl # dnl #
dnl # The majority of the python scripts are written to be compatible dnl # The majority of the python scripts are written to be compatible
dnl # with Python 2.6 and Python 3.4. Therefore, they may be installed dnl # with Python 3.6. This option is intended to
dnl # and used with either interpreter. This option is intended to
dnl # to provide a method to specify the default system version, and dnl # to provide a method to specify the default system version, and
dnl # set the PYTHON environment variable accordingly. dnl # set the PYTHON environment variable accordingly.
dnl # dnl #
@ -13,9 +12,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYTHON], [
[with_python=check]) [with_python=check])
AS_CASE([$with_python], AS_CASE([$with_python],
[check], [AC_CHECK_PROGS([PYTHON], [python3 python2], [:])], [check], [AC_CHECK_PROGS([PYTHON], [python3], [:])],
[2*], [PYTHON="python${with_python}"],
[*python2*], [PYTHON="${with_python}"],
[3*], [PYTHON="python${with_python}"], [3*], [PYTHON="python${with_python}"],
[*python3*], [PYTHON="${with_python}"], [*python3*], [PYTHON="${with_python}"],
[no], [PYTHON=":"], [no], [PYTHON=":"],
@ -23,8 +20,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYTHON], [
) )
dnl # dnl #
dnl # Minimum supported Python versions for utilities: dnl # Minimum supported Python versions for utilities: Python 3.6
dnl # Python 2.6 or Python 3.4
dnl # dnl #
AM_PATH_PYTHON([], [], [:]) AM_PATH_PYTHON([], [], [:])
AS_IF([test -z "$PYTHON_VERSION"], [ AS_IF([test -z "$PYTHON_VERSION"], [
@ -33,25 +29,16 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYTHON], [
PYTHON_MINOR=${PYTHON_VERSION#*\.} PYTHON_MINOR=${PYTHON_VERSION#*\.}
AS_CASE([$PYTHON_VERSION], AS_CASE([$PYTHON_VERSION],
[2.*], [
AS_IF([test $PYTHON_MINOR -lt 6],
[AC_MSG_ERROR("Python >= 2.6 is required")])
],
[3.*], [ [3.*], [
AS_IF([test $PYTHON_MINOR -lt 4], AS_IF([test $PYTHON_MINOR -lt 6],
[AC_MSG_ERROR("Python >= 3.4 is required")]) [AC_MSG_ERROR("Python >= 3.6 is required")])
], ],
[:|2|3], [], [:|2|3], [],
[PYTHON_VERSION=3] [PYTHON_VERSION=3]
) )
AM_CONDITIONAL([USING_PYTHON], [test "$PYTHON" != :]) AM_CONDITIONAL([USING_PYTHON], [test "$PYTHON" != :])
AM_CONDITIONAL([USING_PYTHON_2], [test "x${PYTHON_VERSION%%\.*}" = x2]) AC_SUBST([PYTHON_SHEBANG], [python3])
AM_CONDITIONAL([USING_PYTHON_3], [test "x${PYTHON_VERSION%%\.*}" = x3])
AM_COND_IF([USING_PYTHON_2],
[AC_SUBST([PYTHON_SHEBANG], [python2])],
[AC_SUBST([PYTHON_SHEBANG], [python3])])
dnl # dnl #
dnl # Request that packages be built for a specific Python version. dnl # Request that packages be built for a specific Python version.

View File

@ -18,7 +18,7 @@ AC_DEFUN([ZFS_AC_PYTHON_MODULE], [
]) ])
dnl # dnl #
dnl # Determines if pyzfs can be built, requires Python 2.7 or later. dnl # Determines if pyzfs can be built, requires Python 3.6 or later.
dnl # dnl #
AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYZFS], [ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYZFS], [
AC_ARG_ENABLE([pyzfs], AC_ARG_ENABLE([pyzfs],
@ -62,12 +62,11 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYZFS], [
]) ])
dnl # dnl #
dnl # Require python-devel libraries dnl # Require python3-devel libraries
dnl # dnl #
AS_IF([test "x$enable_pyzfs" = xcheck -o "x$enable_pyzfs" = xyes], [ AS_IF([test "x$enable_pyzfs" = xcheck -o "x$enable_pyzfs" = xyes], [
AS_CASE([$PYTHON_VERSION], AS_CASE([$PYTHON_VERSION],
[3.*], [PYTHON_REQUIRED_VERSION=">= '3.4.0'"], [3.*], [PYTHON_REQUIRED_VERSION=">= '3.6.0'"],
[2.*], [PYTHON_REQUIRED_VERSION=">= '2.7.0'"],
[AC_MSG_ERROR("Python $PYTHON_VERSION unknown")] [AC_MSG_ERROR("Python $PYTHON_VERSION unknown")]
) )

View File

@ -29,13 +29,12 @@ setup(
"Development Status :: 4 - Beta", "Development Status :: 4 - Beta",
"Intended Audience :: Developers", "Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License", "License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3", "Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: System :: Filesystems", "Topic :: System :: Filesystems",
"Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries",
], ],
@ -53,7 +52,7 @@ setup(
setup_requires=[ setup_requires=[
"cffi", "cffi",
], ],
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,<4', python_requires='>=3.6,<4',
zip_safe=False, zip_safe=False,
test_suite="libzfs_core.test", test_suite="libzfs_core.test",
) )

View File

@ -3,7 +3,7 @@
# Set the default udev directory based on distribution. # Set the default udev directory based on distribution.
%if %{undefined _udevdir} %if %{undefined _udevdir}
%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 || 0%{?centos} >= 7 %if 0%{?fedora}%{?rhel}%{?centos}
%global _udevdir %{_prefix}/lib/udev %global _udevdir %{_prefix}/lib/udev
%else %else
%global _udevdir /lib/udev %global _udevdir /lib/udev
@ -12,7 +12,7 @@
# Set the default udevrule directory based on distribution. # Set the default udevrule directory based on distribution.
%if %{undefined _udevruledir} %if %{undefined _udevruledir}
%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 || 0%{?centos} >= 7 %if 0%{?fedora}%{?rhel}%{?centos}
%global _udevruledir %{_prefix}/lib/udev/rules.d %global _udevruledir %{_prefix}/lib/udev/rules.d
%else %else
%global _udevruledir /lib/udev/rules.d %global _udevruledir /lib/udev/rules.d
@ -21,7 +21,7 @@
# Set the default dracut directory based on distribution. # Set the default dracut directory based on distribution.
%if %{undefined _dracutdir} %if %{undefined _dracutdir}
%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 || 0%{?centos} >= 7 %if 0%{?fedora}%{?rhel}%{?centos}
%global _dracutdir %{_prefix}/lib/dracut %global _dracutdir %{_prefix}/lib/dracut
%else %else
%global _dracutdir %{_prefix}/share/dracut %global _dracutdir %{_prefix}/share/dracut
@ -57,59 +57,28 @@
%bcond_with asan %bcond_with asan
%bcond_with systemd %bcond_with systemd
%bcond_with pam %bcond_with pam
%bcond_without pyzfs
# Generic enable switch for systemd # Generic enable switch for systemd
%if %{with systemd} %if %{with systemd}
%define _systemd 1 %define _systemd 1
%endif %endif
# RHEL >= 7 comes with systemd # Distros below support systemd
%if 0%{?rhel} >= 7 %if 0%{?rhel}%{?fedora}%{?centos}%{?suse_version}
%define _systemd 1 %define _systemd 1
%endif %endif
# Fedora >= 15 comes with systemd, but only >= 18 has # When not specified default to distribution provided version.
# the proper macros
%if 0%{?fedora} >= 18
%define _systemd 1
%endif
# opensuse >= 12.1 comes with systemd, but only >= 13.1
# has the proper macros
%if 0%{?suse_version} >= 1310
%define _systemd 1
%endif
# When not specified default to distribution provided version. This
# is normally Python 3, but for RHEL <= 7 only Python 2 is provided.
%if %{undefined __use_python} %if %{undefined __use_python}
%if 0%{?rhel} && 0%{?rhel} <= 7
%define __python /usr/bin/python2
%define __python_pkg_version 2
%define __python_cffi_pkg python-cffi
%define __python_setuptools_pkg python-setuptools
%else
%define __python /usr/bin/python3 %define __python /usr/bin/python3
%define __python_pkg_version 3 %define __python_pkg_version 3
%define __python_cffi_pkg python3-cffi
%define __python_setuptools_pkg python3-setuptools
%endif
%else %else
%define __python %{__use_python} %define __python %{__use_python}
%define __python_pkg_version %{__use_python_pkg_version} %define __python_pkg_version %{__use_python_pkg_version}
%define __python_cffi_pkg python%{__python_pkg_version}-cffi
%define __python_setuptools_pkg python%{__python_pkg_version}-setuptools
%endif %endif
%define __python_sitelib %(%{__python} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib())") %define __python_sitelib %(%{__python} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
# By default python-pyzfs is enabled, with the exception of
# RHEL 6 which by default uses Python 2.6 which is too old.
%if 0%{?rhel} == 6
%bcond_with pyzfs
%else
%bcond_without pyzfs
%endif
Name: @PACKAGE@ Name: @PACKAGE@
Version: @VERSION@ Version: @VERSION@
Release: @RELEASE@%{?dist} Release: @RELEASE@%{?dist}
@ -132,7 +101,7 @@ Obsoletes: spl
# Renaming those on either side would conflict with all available documentation. # Renaming those on either side would conflict with all available documentation.
Conflicts: zfs-fuse Conflicts: zfs-fuse
%if 0%{?rhel}%{?fedora}%{?suse_version} %if 0%{?rhel}%{?centos}%{?fedora}%{?suse_version}
BuildRequires: gcc, make BuildRequires: gcc, make
BuildRequires: zlib-devel BuildRequires: zlib-devel
BuildRequires: libuuid-devel BuildRequires: libuuid-devel
@ -144,7 +113,7 @@ BuildRequires: openssl-devel
# crash+corrupt rpmdb # crash+corrupt rpmdb
# See issue #12071 # See issue #12071
BuildRequires: ncompress BuildRequires: ncompress
%if 0%{?fedora} >= 28 || 0%{?rhel} >= 8 || 0%{?centos} >= 8 %if 0%{?fedora} || 0%{?rhel} >= 8 || 0%{?centos} >= 8
BuildRequires: libtirpc-devel BuildRequires: libtirpc-devel
%endif %endif
@ -277,7 +246,7 @@ Requires: sudo
Requires: sysstat Requires: sysstat
Requires: libaio Requires: libaio
Requires: python%{__python_pkg_version} Requires: python%{__python_pkg_version}
%if 0%{?rhel}%{?fedora}%{?suse_version} %if 0%{?rhel}%{?centos}%{?fedora}%{?suse_version}
BuildRequires: libaio-devel BuildRequires: libaio-devel
%endif %endif
AutoReqProv: no AutoReqProv: no
@ -300,6 +269,8 @@ This package contains a dracut module used to construct an initramfs
image which is ZFS aware. image which is ZFS aware.
%if %{with pyzfs} %if %{with pyzfs}
# Enforce `python36-` package prefix for CentOS 7
# since dependencies come from EPEL and are named this way
%package -n python%{__python_pkg_version}-pyzfs %package -n python%{__python_pkg_version}-pyzfs
Summary: Python %{python_version} wrapper for libzfs_core Summary: Python %{python_version} wrapper for libzfs_core
Group: Development/Languages/Python Group: Development/Languages/Python
@ -309,16 +280,26 @@ Requires: libzfs5 = %{version}
Requires: libnvpair3 = %{version} Requires: libnvpair3 = %{version}
Requires: libffi Requires: libffi
Requires: python%{__python_pkg_version} Requires: python%{__python_pkg_version}
Requires: %{__python_cffi_pkg}
%if 0%{?rhel}%{?fedora}%{?suse_version} %if 0%{?centos} == 7
%if 0%{?rhel} >= 8 || 0%{?centos} >= 8 || 0%{?fedora} >= 28 Requires: python36-cffi
BuildRequires: python3-packaging
%else %else
BuildRequires: python-packaging Requires: python%{__python_pkg_version}-cffi
%endif %endif
%if 0%{?rhel}%{?centos}%{?fedora}%{?suse_version}
%if 0%{?centos} == 7
BuildRequires: python36-packaging
BuildRequires: python36-devel
BuildRequires: python36-cffi
BuildRequires: python36-setuptools
%else
BuildRequires: python%{__python_pkg_version}-packaging
BuildRequires: python%{__python_pkg_version}-devel BuildRequires: python%{__python_pkg_version}-devel
BuildRequires: %{__python_cffi_pkg} BuildRequires: python%{__python_pkg_version}-cffi
BuildRequires: %{__python_setuptools_pkg} BuildRequires: python%{__python_pkg_version}-setuptools
%endif
BuildRequires: libffi-devel BuildRequires: libffi-devel
%endif %endif
@ -478,7 +459,7 @@ systemctl --system daemon-reload >/dev/null || true
%{_bindir}/raidz_test %{_bindir}/raidz_test
%{_sbindir}/zgenhostid %{_sbindir}/zgenhostid
%{_bindir}/zvol_wait %{_bindir}/zvol_wait
# Optional Python 2/3 scripts # Optional Python 3 scripts
%{_bindir}/arc_summary %{_bindir}/arc_summary
%{_bindir}/arcstat %{_bindir}/arcstat
%{_bindir}/dbufstat %{_bindir}/dbufstat

View File

@ -15,19 +15,14 @@
# Copyright (c) 2012, 2018 by Delphix. All rights reserved. # Copyright (c) 2012, 2018 by Delphix. All rights reserved.
# Copyright (c) 2019 Datto Inc. # Copyright (c) 2019 Datto Inc.
# #
# This script must remain compatible with Python 2.6+ and Python 3.4+. # This script must remain compatible with Python 3.6+.
# #
# some python 2.7 system don't have a configparser shim
try:
import configparser
except ImportError:
import ConfigParser as configparser
import os import os
import sys import sys
import ctypes import ctypes
import re import re
import configparser
from datetime import datetime from datetime import datetime
from optparse import OptionParser from optparse import OptionParser
@ -37,7 +32,7 @@ from select import select
from subprocess import PIPE from subprocess import PIPE
from subprocess import Popen from subprocess import Popen
from threading import Timer from threading import Timer
from time import time from time import time, CLOCK_MONOTONIC_RAW
BASEDIR = '/var/tmp/test_results' BASEDIR = '/var/tmp/test_results'
TESTDIR = '/usr/share/zfs/' TESTDIR = '/usr/share/zfs/'
@ -49,9 +44,6 @@ LOG_OUT = 'LOG_OUT'
LOG_ERR = 'LOG_ERR' LOG_ERR = 'LOG_ERR'
LOG_FILE_OBJ = None LOG_FILE_OBJ = None
# some python 2.7 system don't have a concept of monotonic time
CLOCK_MONOTONIC_RAW = 4 # see <linux/time.h>
class timespec(ctypes.Structure): class timespec(ctypes.Structure):
_fields_ = [ _fields_ = [

View File

@ -15,7 +15,7 @@
# Copyright (c) 2017 by Delphix. All rights reserved. # Copyright (c) 2017 by Delphix. All rights reserved.
# Copyright (c) 2018 by Lawrence Livermore National Security, LLC. # Copyright (c) 2018 by Lawrence Livermore National Security, LLC.
# #
# This script must remain compatible with Python 2.6+ and Python 3.4+. # This script must remain compatible with Python 3.6+.
# #
import os import os
@ -62,13 +62,13 @@ known_reason = 'Known issue'
exec_reason = 'Test user execute permissions required for utilities' exec_reason = 'Test user execute permissions required for utilities'
# #
# Some tests require a minimum python version of 3.5 and will be skipped when # Some tests require a minimum python version of 3.6 and will be skipped when
# the default system version is too old. There may also be tests which require # the default system version is too old. There may also be tests which require
# additional python modules be installed, for example python-cffi is required # additional python modules be installed, for example python3-cffi is required
# by the pyzfs tests. # by the pyzfs tests.
# #
python_reason = 'Python v3.5 or newer required' python_reason = 'Python v3.6 or newer required'
python_deps_reason = 'Python modules missing: python-cffi' python_deps_reason = 'Python modules missing: python3-cffi'
# #
# Some tests require the O_TMPFILE flag which was first introduced in the # Some tests require the O_TMPFILE flag which was first introduced in the

View File

@ -71,8 +71,6 @@ export SYSTEM_FILES_COMMON='arp
printf printf
ps ps
pwd pwd
python
python2
python3 python3
quotaon quotaon
readlink readlink

View File

@ -92,27 +92,13 @@ typeset -a pos_cmds_out=(
} }
}") }")
#
# N.B. json.tool is needed to guarantee consistent ordering of fields,
# sed is needed to trim trailing space in CentOS 6's json.tool output
#
# As of Python 3.5 the behavior of json.tool changed to keep the order
# the same as the input and the --sort-keys option was added. Detect when
# --sort-keys is supported and apply the option to ensure the expected order.
#
if python -m json.tool --sort-keys <<< "{}"; then
JSON_TOOL_CMD="python -m json.tool --sort-keys"
else
JSON_TOOL_CMD="python -m json.tool"
fi
typeset -i cnt=0 typeset -i cnt=0
typeset cmd typeset cmd
for cmd in ${pos_cmds[@]}; do for cmd in ${pos_cmds[@]}; do
log_must zfs program $TESTPOOL $TESTZCP $TESTDS $cmd 2>&1 log_must zfs program $TESTPOOL $TESTZCP $TESTDS $cmd 2>&1
log_must zfs program -j $TESTPOOL $TESTZCP $TESTDS $cmd 2>&1 log_must zfs program -j $TESTPOOL $TESTZCP $TESTDS $cmd 2>&1
OUTPUT=$(zfs program -j $TESTPOOL $TESTZCP $TESTDS $cmd 2>&1 | OUTPUT=$(zfs program -j $TESTPOOL $TESTZCP $TESTDS $cmd 2>&1 |
$JSON_TOOL_CMD | sed 's/[[:space:]]*$//') python3 -m json.tool --sort-keys)
if [ "$OUTPUT" != "${pos_cmds_out[$cnt]}" ]; then if [ "$OUTPUT" != "${pos_cmds_out[$cnt]}" ]; then
log_note "Got :$OUTPUT" log_note "Got :$OUTPUT"
log_note "Expected:${pos_cmds_out[$cnt]}" log_note "Expected:${pos_cmds_out[$cnt]}"

View File

@ -30,7 +30,7 @@ verify_runnable "global"
# Verify that the required dependencies for testing are installed. # Verify that the required dependencies for testing are installed.
@PYTHON@ -c "import cffi" 2>/dev/null @PYTHON@ -c "import cffi" 2>/dev/null
if [ $? -eq 1 ]; then if [ $? -eq 1 ]; then
log_unsupported "python-cffi not found by Python" log_unsupported "python3-cffi not found by Python"
fi fi
# We don't just try to "import libzfs_core" because we want to skip these tests # We don't just try to "import libzfs_core" because we want to skip these tests

View File

@ -87,7 +87,7 @@ log_must xattrtest -f 10 -x 3 -s 32768 -r -k -p /$TESTPOOL/$TESTFS2/xattrsadir
# OpenZFS issue #7432 # OpenZFS issue #7432
log_must zfs set compression=on xattr=sa $TESTPOOL/$TESTFS2 log_must zfs set compression=on xattr=sa $TESTPOOL/$TESTFS2
log_must touch /$TESTPOOL/$TESTFS2/attrs log_must touch /$TESTPOOL/$TESTFS2/attrs
log_must eval "python -c 'print \"a\" * 4096' | \ log_must eval "python3 -c 'print \"a\" * 4096' | \
set_xattr_stdin bigval /$TESTPOOL/$TESTFS2/attrs" set_xattr_stdin bigval /$TESTPOOL/$TESTFS2/attrs"
log_must zfs set compression=off xattr=on $TESTPOOL/$TESTFS2 log_must zfs set compression=off xattr=on $TESTPOOL/$TESTFS2

View File

@ -88,7 +88,7 @@ log_must zfs snapshot $POOL/fs@c
# 4. Create an empty file and add xattrs to it to exercise reclaiming a # 4. Create an empty file and add xattrs to it to exercise reclaiming a
# dnode that requires more than 1 slot for its bonus buffer (Zol #7433) # dnode that requires more than 1 slot for its bonus buffer (Zol #7433)
log_must zfs set compression=on xattr=sa $POOL/fs log_must zfs set compression=on xattr=sa $POOL/fs
log_must eval "python -c 'print \"a\" * 512' | log_must eval "python3 -c 'print \"a\" * 512' |
set_xattr_stdin bigval /$POOL/fs/attrs" set_xattr_stdin bigval /$POOL/fs/attrs"
log_must zfs snapshot $POOL/fs@d log_must zfs snapshot $POOL/fs@d