From 63eee5013ac297cea1ef65add80e4694ad2ee0e9 Mon Sep 17 00:00:00 2001 From: David Cantrell Date: Mon, 16 Apr 2018 16:54:32 -0400 Subject: [PATCH 1/5] Re-enable python2 subpackage builds. (#1564347) Disable tests by default because they fail in mock right now. Conditionalize out python2 subpackage builds on Fedora releases after 28 and EL releases after 7 --- pykickstart.spec | 71 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 49 insertions(+), 22 deletions(-) diff --git a/pykickstart.spec b/pykickstart.spec index e8d0c2b..b30d85f 100644 --- a/pykickstart.spec +++ b/pykickstart.spec @@ -1,6 +1,17 @@ +%if 0%{?rhel} > 7 +%bcond_with python2 +%else +%bcond_without python2 +%endif + +# Disable tests by default because they fail to run inside mock builds +# at the moment, but can run locally. To build and run tests, do: +# rpmbuild -ba --with runtests pykickstart.spec +%bcond_with runtests + Name: pykickstart Version: 3.12 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2 and MIT Group: System Environment/Libraries Summary: Python utilities for manipulating kickstart files. @@ -13,12 +24,14 @@ Source0: %{name}-%{version}.tar.gz BuildArch: noarch BuildRequires: gettext +%if %{with python2} BuildRequires: python2-coverage BuildRequires: python2-devel BuildRequires: python2-nose -BuildRequires: python2-ordered-set +BuildRequires: python-ordered-set BuildRequires: python2-setuptools BuildRequires: python2-requests +%endif BuildRequires: python3-coverage BuildRequires: python3-devel @@ -36,6 +49,7 @@ Python utilities for manipulating kickstart files. The Python 2 and 3 libraries can be found in the packages python-kickstart and python3-kickstart respectively. +%if %{with python2} # Python 2 library %package -n python2-kickstart %{?python_provide:%python_provide python2-kickstart} @@ -48,6 +62,7 @@ Requires: python2-ordered-set %description -n python2-kickstart Python 2 library for manipulating kickstart files. The binaries are found in the pykickstart package. +%endif # Python 3 library %package -n python3-kickstart @@ -63,29 +78,36 @@ the pykickstart package. %prep %setup -q +%if %{with python2} rm -rf %{py3dir} mkdir %{py3dir} cp -a . %{py3dir} +%endif %build +%if %{with python2} make PYTHON=%{__python2} - -pushd %{py3dir} +make -C %{py3dir} PYTHON=%{__python3} +%else make PYTHON=%{__python3} -popd +%endif %install -rm -rf %{buildroot} +%if %{with python2} make PYTHON=%{__python2} DESTDIR=%{buildroot} install - -pushd %{py3dir} +make -C %{py3dir} PYTHON=%{__python3} DESTDIR=%{buildroot} install +%else make PYTHON=%{__python3} DESTDIR=%{buildroot} install -popd +%endif %check -pushd %{py3dir} +%if %{with runtests} +%if %{with python2} +make -C %{py3dir} PYTHON=%{__python3} test +%else make PYTHON=%{__python3} test -popd +%endif +%endif %files %defattr(-,root,root,-) @@ -96,31 +118,36 @@ popd %{_bindir}/ksflatten %{_bindir}/ksverdiff %{_bindir}/ksshell -%{_mandir}/man1/* +%{_mandir}/man1/ksflatten.1.gz +%{_mandir}/man1/ksshell.1.gz +%{_mandir}/man1/ksvalidator.1.gz +%{_mandir}/man1/ksverdiff.1.gz +%if %{with python2} %files -n python2-kickstart %defattr(-,root,root,-) %doc docs/2to3 %doc docs/programmers-guide %doc docs/kickstart-docs.txt -%{python2_sitelib}/pykickstart*egg* -%{python2_sitelib}/pykickstart/ -%{python2_sitelib}/pykickstart/commands/ -%{python2_sitelib}/pykickstart/handlers/ -%{python2_sitelib}/pykickstart/locale/ +%{python2_sitelib}/pykickstart*.egg-info +%{python2_sitelib}/pykickstart +%endif %files -n python3-kickstart %defattr(-,root,root,-) %doc docs/2to3 %doc docs/programmers-guide %doc docs/kickstart-docs.txt -%{python3_sitelib}/pykickstart*egg* -%{python3_sitelib}/pykickstart/ -%{python3_sitelib}/pykickstart/commands/ -%{python3_sitelib}/pykickstart/handlers/ -%{python3_sitelib}/pykickstart/locale/ +%{python3_sitelib}/pykickstart +%{python3_sitelib}/pykickstart*.egg-info %changelog +* Mon Apr 16 2018 David Cantrell - 3.12-2 +- Re-enable python2 subpackage builds. (#1564347) +- Disable tests by default because they fail in mock right now. +- Conditionalize out python2 subpackage builds on Fedora releases + after 28 and EL releases after 7 + * Mon Feb 19 2018 Chris Lumens - 3.12-1 - Sync spec file back up. (clumens) - Don't use deprecated formatErrorMsg (vponcova) From ff55c1aabd0967111210bf134cc03904cec51df9 Mon Sep 17 00:00:00 2001 From: David Cantrell Date: Mon, 16 Apr 2018 17:04:04 -0400 Subject: [PATCH 2/5] Upstream patches to support '--autovlan' option on fcoe command (#1564096) --- 0001-Add-support-for-fcoe-autovlan.patch | 113 +++++++++++++++++++++++ 0002-Update-fcoe-command-help.patch | 74 +++++++++++++++ pykickstart.spec | 11 ++- 3 files changed, 197 insertions(+), 1 deletion(-) create mode 100644 0001-Add-support-for-fcoe-autovlan.patch create mode 100644 0002-Update-fcoe-command-help.patch diff --git a/0001-Add-support-for-fcoe-autovlan.patch b/0001-Add-support-for-fcoe-autovlan.patch new file mode 100644 index 0000000..f414995 --- /dev/null +++ b/0001-Add-support-for-fcoe-autovlan.patch @@ -0,0 +1,113 @@ +From 2e3c65c0631033d9952925e59b13897f5b1cc186 Mon Sep 17 00:00:00 2001 +From: Radek Vykydal +Date: Tue, 10 Apr 2018 11:22:12 +0200 +Subject: [PATCH 1/2] Add support for fcoe --autovlan + +Related: rhbz#1564096 + +This option is actually not required since RHEL7 where autovlan is used by +default. We just need to parse kickstarts used for RHEL7 and RHEL6 (where the +option may have some effect). +--- + pykickstart/commands/fcoe.py | 32 +++++++++++++++++++++++++++++--- + pykickstart/handlers/f28.py | 4 ++-- + tests/commands/fcoe.py | 7 +++++++ + 3 files changed, 38 insertions(+), 5 deletions(-) + +diff --git a/pykickstart/commands/fcoe.py b/pykickstart/commands/fcoe.py +index f2b4d17..beca517 100644 +--- a/pykickstart/commands/fcoe.py ++++ b/pykickstart/commands/fcoe.py +@@ -17,7 +17,7 @@ + # subject to the GNU General Public License and may only be used or replicated + # with the express permission of Red Hat, Inc. + # +-from pykickstart.version import F12, F13, RHEL7 ++from pykickstart.version import F12, F13, F28, RHEL7 + from pykickstart.base import BaseData, KickstartCommand + from pykickstart.options import KSOptionParser + +@@ -86,7 +86,23 @@ class RHEL7_FcoeData(F13_FcoeData): + + return retval + +-class RHEL8_FcoeData(F13_FcoeData): ++class F28_FcoeData(F13_FcoeData): ++ removedKeywords = F13_FcoeData.removedKeywords ++ removedAttrs = F13_FcoeData.removedAttrs ++ ++ def __init__(self, *args, **kwargs): ++ F13_FcoeData.__init__(self, *args, **kwargs) ++ self.autovlan = kwargs.get("autovlan", False) ++ ++ def _getArgsAsStr(self): ++ retval = F13_FcoeData._getArgsAsStr(self) ++ ++ if self.autovlan: ++ retval += " --autovlan" ++ ++ return retval ++ ++class RHEL8_FcoeData(F28_FcoeData): + pass + + class F12_Fcoe(KickstartCommand): +@@ -150,5 +166,15 @@ class RHEL7_Fcoe(F13_Fcoe): + help="", version=RHEL7) + return op + +-class RHEL8_Fcoe(F13_Fcoe): ++class F28_Fcoe(F13_Fcoe): ++ removedKeywords = F13_Fcoe.removedKeywords ++ removedAttrs = F13_Fcoe.removedAttrs ++ ++ def _getParser(self): ++ op = F13_Fcoe._getParser(self) ++ op.add_argument("--autovlan", action="store_true", default=False, ++ help="", version=F28) ++ return op ++ ++class RHEL8_Fcoe(F28_Fcoe): + pass +diff --git a/pykickstart/handlers/f28.py b/pykickstart/handlers/f28.py +index 9921d1e..70c66d6 100644 +--- a/pykickstart/handlers/f28.py ++++ b/pykickstart/handlers/f28.py +@@ -42,7 +42,7 @@ class F28Handler(BaseHandler): + "dmraid": commands.dmraid.F24_DmRaid, + "driverdisk": commands.driverdisk.F14_DriverDisk, + "eula": commands.eula.F20_Eula, +- "fcoe": commands.fcoe.F13_Fcoe, ++ "fcoe": commands.fcoe.F28_Fcoe, + "firewall": commands.firewall.F28_Firewall, + "firstboot": commands.firstboot.FC3_Firstboot, + "graphical": commands.displaymode.F26_DisplayMode, +@@ -102,7 +102,7 @@ class F28Handler(BaseHandler): + "DriverDiskData": commands.driverdisk.F14_DriverDiskData, + "DeviceData": commands.device.F8_DeviceData, + "DmRaidData": commands.dmraid.FC6_DmRaidData, +- "FcoeData": commands.fcoe.F13_FcoeData, ++ "FcoeData": commands.fcoe.F28_FcoeData, + "GroupData": commands.group.F12_GroupData, + "IscsiData": commands.iscsi.F17_IscsiData, + "LogVolData": commands.logvol.F23_LogVolData, +diff --git a/tests/commands/fcoe.py b/tests/commands/fcoe.py +index 6f268fa..ebd346e 100644 +--- a/tests/commands/fcoe.py ++++ b/tests/commands/fcoe.py +@@ -95,5 +95,12 @@ class RHEL7_TestCase(F13_TestCase): + self.assert_parse("fcoe --nic=eth0 --autovlan", + "fcoe --nic=eth0 --autovlan\n") + ++class F28_TestCase(F13_TestCase): ++ def runTest(self): ++ F13_TestCase.runTest(self) ++ ++ self.assert_parse("fcoe --nic=eth0 --autovlan", ++ "fcoe --nic=eth0 --autovlan\n") ++ + if __name__ == "__main__": + unittest.main() +-- +2.14.3 + diff --git a/0002-Update-fcoe-command-help.patch b/0002-Update-fcoe-command-help.patch new file mode 100644 index 0000000..d0ceb3b --- /dev/null +++ b/0002-Update-fcoe-command-help.patch @@ -0,0 +1,74 @@ +From fd46d8289eba963a18f198f67a06a869426cf178 Mon Sep 17 00:00:00 2001 +From: Radek Vykydal +Date: Tue, 10 Apr 2018 11:54:08 +0200 +Subject: [PATCH 2/2] Update fcoe command help + +Related: rhbz#1564096 +--- + pykickstart/commands/fcoe.py | 29 +++++++++++++++++++++-------- + 1 file changed, 21 insertions(+), 8 deletions(-) + +diff --git a/pykickstart/commands/fcoe.py b/pykickstart/commands/fcoe.py +index beca517..78e86a2 100644 +--- a/pykickstart/commands/fcoe.py ++++ b/pykickstart/commands/fcoe.py +@@ -122,8 +122,12 @@ class F12_Fcoe(KickstartCommand): + return retval + + def _getParser(self): +- op = KSOptionParser(prog="fcoe", description="", version=F12) +- op.add_argument("--nic", required=True, version=F12, help="") ++ op = KSOptionParser(prog="fcoe", description=""" ++ Discover and attach FCoE storage devices accessible via ++ specified network interface ++ """, version=F12) ++ op.add_argument("--nic", required=True, version=F12, help=""" ++ Name of the network device connected to the FCoE switch""") + return op + + def parse(self, args): +@@ -152,8 +156,13 @@ class F13_Fcoe(F12_Fcoe): + + def _getParser(self): + op = F12_Fcoe._getParser(self) +- op.add_argument("--dcb", action="store_true", default=False, help="", +- version=F13) ++ op.add_argument("--dcb", action="store_true", default=False, version=F13, help=""" ++ Enable Data Center Bridging awareness in installer. This option ++ should only be enabled for network interfaces that ++ require a host-based DCBX client. Configurations on ++ interfaces that implement a hardware DCBX client should ++ not use it. ++ """) + return op + + class RHEL7_Fcoe(F13_Fcoe): +@@ -162,8 +171,10 @@ class RHEL7_Fcoe(F13_Fcoe): + + def _getParser(self): + op = F13_Fcoe._getParser(self) +- op.add_argument("--autovlan", action="store_true", default=False, +- help="", version=RHEL7) ++ op.add_argument("--autovlan", action="store_true", default=False, version=RHEL7, help=""" ++ Perform automatic VLAN discovery and setup. This option is enabled ++ by default. ++ """) + return op + + class F28_Fcoe(F13_Fcoe): +@@ -172,8 +183,10 @@ class F28_Fcoe(F13_Fcoe): + + def _getParser(self): + op = F13_Fcoe._getParser(self) +- op.add_argument("--autovlan", action="store_true", default=False, +- help="", version=F28) ++ op.add_argument("--autovlan", action="store_true", default=False, version=F28, help=""" ++ Perform automatic VLAN discovery and setup. This option is enabled ++ by default. ++ """) + return op + + class RHEL8_Fcoe(F28_Fcoe): +-- +2.14.3 + diff --git a/pykickstart.spec b/pykickstart.spec index b30d85f..1761145 100644 --- a/pykickstart.spec +++ b/pykickstart.spec @@ -11,7 +11,7 @@ Name: pykickstart Version: 3.12 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2 and MIT Group: System Environment/Libraries Summary: Python utilities for manipulating kickstart files. @@ -20,6 +20,8 @@ Url: http://fedoraproject.org/wiki/pykickstart # our distribution. Thus the source is only available from # within this srpm. Source0: %{name}-%{version}.tar.gz +Patch0: 0001-Add-support-for-fcoe-autovlan.patch +Patch1: 0002-Update-fcoe-command-help.patch BuildArch: noarch @@ -78,6 +80,10 @@ the pykickstart package. %prep %setup -q +# For https://bugzilla.redhat.com/show_bug.cgi?id=1564096 +%patch0 -p1 +%patch1 -p1 + %if %{with python2} rm -rf %{py3dir} mkdir %{py3dir} @@ -142,6 +148,9 @@ make PYTHON=%{__python3} test %{python3_sitelib}/pykickstart*.egg-info %changelog +* Mon Apr 16 2018 David Cantrell - 3.12-3 +- Upstream patches to support '--autovlan' option on fcoe command (#1564096) + * Mon Apr 16 2018 David Cantrell - 3.12-2 - Re-enable python2 subpackage builds. (#1564347) - Disable tests by default because they fail in mock right now. From f7ac832c9bf457bdbf5a5a714593a03700ea8104 Mon Sep 17 00:00:00 2001 From: David Cantrell Date: Tue, 22 May 2018 16:03:20 -0400 Subject: [PATCH 3/5] Include the _sortCommand to the _setCommand method (vponcova, #1578930) --- pykickstart-rhbz1578930.patch | 56 +++++++++++++++++++++++++++++++++++ pykickstart.spec | 9 +++++- 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 pykickstart-rhbz1578930.patch diff --git a/pykickstart-rhbz1578930.patch b/pykickstart-rhbz1578930.patch new file mode 100644 index 0000000..7ac5242 --- /dev/null +++ b/pykickstart-rhbz1578930.patch @@ -0,0 +1,56 @@ +commit f618b966fe3358b89412e58b9b249edb35b154dc +Author: Vendula Poncova +Date: Thu May 17 20:38:22 2018 +0200 + + Include the _sortCommand to the _setCommand method (#1578930) + + The _sortCommand method should be part of the _setCommand method, + otherwise we might set the command without changing the _writeOrder + dictionary. + + This should fix the resetCommand method, where the dictionary wasn't + updated, so the old instance of the command was used to generate the + kickstart representation. + + Resolves: rhbz#1578930 + +diff --git a/pykickstart/base.py b/pykickstart/base.py +index 00b5c8f..f695dcc 100644 +--- a/pykickstart/base.py ++++ b/pykickstart/base.py +@@ -306,7 +306,6 @@ class KickstartHandler(KickstartObject): + + setattr(self, name.lower(), cmdObj) + +- def _sortCommand(self, cmdObj): + # Also, add the object into the _writeOrder dict in the right place. + if cmdObj.writePriority is not None: + if cmdObj.writePriority in self._writeOrder: +@@ -332,7 +331,6 @@ class KickstartHandler(KickstartObject): + if cmdObj is None: + cmdObj = cmdClass() + self._setCommand(cmdObj) +- self._sortCommand(cmdObj) + + # Finally, add the mapping to the commands dict. + self.commands[cmdName] = cmdObj +diff --git a/tests/base.py b/tests/base.py +index 2d3961c..e1f4689 100644 +--- a/tests/base.py ++++ b/tests/base.py +@@ -232,6 +232,7 @@ class HandlerResetCommand_TestCase(ParserTest): + self.assertTrue(self.handler.autopart.encrypted) + self.assertEqual(self.handler.autopart.passphrase, "something") + self.assertTrue(self.handler.autopart.bogus) ++ self.assertTrue("autopart" in str(self.handler)) + + self.handler.resetCommand("autopart") + self.assertFalse(self.handler.autopart.autopart) +@@ -239,6 +240,7 @@ class HandlerResetCommand_TestCase(ParserTest): + self.assertFalse(self.handler.autopart.encrypted) + self.assertEqual(self.handler.autopart.passphrase, "") + self.assertNotIn("bogus", self.handler.autopart.__dict__) ++ self.assertFalse("autopart" in str(self.handler)) + + class HandlerDispatch_TestCase(ParserTest): + def runTest(self): diff --git a/pykickstart.spec b/pykickstart.spec index 1761145..71f0de6 100644 --- a/pykickstart.spec +++ b/pykickstart.spec @@ -11,7 +11,7 @@ Name: pykickstart Version: 3.12 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv2 and MIT Group: System Environment/Libraries Summary: Python utilities for manipulating kickstart files. @@ -22,6 +22,7 @@ Url: http://fedoraproject.org/wiki/pykickstart Source0: %{name}-%{version}.tar.gz Patch0: 0001-Add-support-for-fcoe-autovlan.patch Patch1: 0002-Update-fcoe-command-help.patch +Patch2: pykickstart-rhbz1578930.patch BuildArch: noarch @@ -84,6 +85,9 @@ the pykickstart package. %patch0 -p1 %patch1 -p1 +# For https://bugzilla.redhat.com/show_bug.cgi?id=1578930 +%patch2 -p1 + %if %{with python2} rm -rf %{py3dir} mkdir %{py3dir} @@ -148,6 +152,9 @@ make PYTHON=%{__python3} test %{python3_sitelib}/pykickstart*.egg-info %changelog +* Tue May 22 2018 David Cantrell - 3.12-4 +- Include the _sortCommand to the _setCommand method (vponcova, #1578930) + * Mon Apr 16 2018 David Cantrell - 3.12-3 - Upstream patches to support '--autovlan' option on fcoe command (#1564096) From aa38733447d70e6ce5c62d19b6e6ba3c2aa4dcfd Mon Sep 17 00:00:00 2001 From: David Cantrell Date: Tue, 22 May 2018 16:16:51 -0400 Subject: [PATCH 4/5] Include the _sortCommand to the _setCommand method (vponcova, #1578930) Remove call to xgettext_werror.sh during build --- pykickstart-translation-canary.patch | 13 +++++++++++++ pykickstart.spec | 4 ++++ 2 files changed, 17 insertions(+) create mode 100644 pykickstart-translation-canary.patch diff --git a/pykickstart-translation-canary.patch b/pykickstart-translation-canary.patch new file mode 100644 index 0000000..1730ec8 --- /dev/null +++ b/pykickstart-translation-canary.patch @@ -0,0 +1,13 @@ +diff -up pykickstart-3.12/po/Makefile.orig pykickstart-3.12/po/Makefile +--- pykickstart-3.12/po/Makefile.orig 2018-02-19 11:41:09.000000000 -0500 ++++ pykickstart-3.12/po/Makefile 2018-05-22 16:15:46.650917679 -0400 +@@ -12,8 +12,7 @@ INSTALL_NLS_DIR = $(DESTDIR)/`$(PYTHON) + + # PO catalog handling + MSGMERGE = msgmerge -v +-XGETTEXT = ../translation-canary/xgettext_werror.sh --default-domain=$(NLSPACKAGE) \ +- --add-comments ++XGETTEXT = xgettext --default-domain=$(NLSPACKAGE) --add-comments + MSGFMT = msgfmt --statistics --verbose + + # What do we need to do diff --git a/pykickstart.spec b/pykickstart.spec index 71f0de6..311a153 100644 --- a/pykickstart.spec +++ b/pykickstart.spec @@ -23,6 +23,7 @@ Source0: %{name}-%{version}.tar.gz Patch0: 0001-Add-support-for-fcoe-autovlan.patch Patch1: 0002-Update-fcoe-command-help.patch Patch2: pykickstart-rhbz1578930.patch +Patch3: pykickstart-translation-canary.patch BuildArch: noarch @@ -88,6 +89,8 @@ the pykickstart package. # For https://bugzilla.redhat.com/show_bug.cgi?id=1578930 %patch2 -p1 +%patch3 -p1 + %if %{with python2} rm -rf %{py3dir} mkdir %{py3dir} @@ -154,6 +157,7 @@ make PYTHON=%{__python3} test %changelog * Tue May 22 2018 David Cantrell - 3.12-4 - Include the _sortCommand to the _setCommand method (vponcova, #1578930) +- Remove call to xgettext_werror.sh during build * Mon Apr 16 2018 David Cantrell - 3.12-3 - Upstream patches to support '--autovlan' option on fcoe command (#1564096) From a1b92615213d246ef6b5ba4c6f027c8d8cd31f17 Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Mon, 16 Jul 2018 16:32:56 -0400 Subject: [PATCH 5/5] Fix deprecated commands with data (vponcova, gh#232) --- pykickstart-deprecated-commands-data.patch | 67 ++++++++++++++++++++++ pykickstart.spec | 7 ++- 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 pykickstart-deprecated-commands-data.patch diff --git a/pykickstart-deprecated-commands-data.patch b/pykickstart-deprecated-commands-data.patch new file mode 100644 index 0000000..d7dec64 --- /dev/null +++ b/pykickstart-deprecated-commands-data.patch @@ -0,0 +1,67 @@ +commit 086e82ce2516e2c18ec6be237cb6df67cb6c3b4d +Author: Vendula Poncova +Date: Thu Apr 19 14:59:17 2018 +0200 + + Fix deprecated commands with data + + It wasn't possible to parse deprecated commands with data, + for example device, dmraid and multipath in Fedora 28. + + Added a test that will try to parse all deprecated commands. + +diff --git a/pykickstart/base.py b/pykickstart/base.py +index a49adf5..00b5c8f 100644 +--- a/pykickstart/base.py ++++ b/pykickstart/base.py +@@ -196,6 +196,15 @@ class DeprecatedCommand(KickstartCommand): + # Create a new DeprecatedCommand instance. + KickstartCommand.__init__(self, writePriority, *args, **kwargs) + ++ def dataList(self): ++ """Override the method of the deprecated command.""" ++ return None ++ ++ @property ++ def dataClass(self): ++ """Override the attribute of the deprecated command.""" ++ return None ++ + def __str__(self): + """Placeholder since DeprecatedCommands don't work anymore.""" + return "" +diff --git a/tests/misc.py b/tests/misc.py +index 1e14638..63a70da 100644 +--- a/tests/misc.py ++++ b/tests/misc.py +@@ -1,4 +1,8 @@ + import unittest ++import warnings ++ ++from pykickstart.parser import KickstartParser ++from pykickstart.version import makeVersion + from tests.baseclass import ParserTest + from pykickstart.handlers import control + from pykickstart.base import DeprecatedCommand +@@ -53,5 +57,22 @@ class WritePriority_TestCase(unittest.TestCase): + else: + self.assertEqual(0, cmd.writePriority, command_class) + ++class DeprecatedCommandsParsing_TestCase(unittest.TestCase): ++ def runTest(self): ++ for version, command_map in control.commandMap.items(): ++ ++ handler = makeVersion(version) ++ parser = KickstartParser(handler) ++ ++ for command_name, command_class in command_map.items(): ++ if not issubclass(command_class, DeprecatedCommand): ++ continue ++ ++ with warnings.catch_warnings(record=True): ++ # The deprecated commands should be ignored with ++ # a warning when they are parsed. Make sure that ++ # they will not cause any errors. ++ parser.readKickstartFromString(command_name) ++ + if __name__ == "__main__": + unittest.main() diff --git a/pykickstart.spec b/pykickstart.spec index 311a153..6261f13 100644 --- a/pykickstart.spec +++ b/pykickstart.spec @@ -11,7 +11,7 @@ Name: pykickstart Version: 3.12 -Release: 4%{?dist} +Release: 5%{?dist} License: GPLv2 and MIT Group: System Environment/Libraries Summary: Python utilities for manipulating kickstart files. @@ -24,6 +24,7 @@ Patch0: 0001-Add-support-for-fcoe-autovlan.patch Patch1: 0002-Update-fcoe-command-help.patch Patch2: pykickstart-rhbz1578930.patch Patch3: pykickstart-translation-canary.patch +Patch4: pykickstart-deprecated-commands-data.patch BuildArch: noarch @@ -90,6 +91,7 @@ the pykickstart package. %patch2 -p1 %patch3 -p1 +%patch4 -p1 %if %{with python2} rm -rf %{py3dir} @@ -155,6 +157,9 @@ make PYTHON=%{__python3} test %{python3_sitelib}/pykickstart*.egg-info %changelog +* Mon Jul 16 2018 Chris Lumens - 3.12-5 +- Fix deprecated commands with data (vponcova, gh#232) + * Tue May 22 2018 David Cantrell - 3.12-4 - Include the _sortCommand to the _setCommand method (vponcova, #1578930) - Remove call to xgettext_werror.sh during build