Compare commits

...

4 Commits
master ... f28

Author SHA1 Message Date
David Cantrell aa38733447 Include the _sortCommand to the _setCommand method (vponcova, #1578930)
Remove call to xgettext_werror.sh during build
2018-05-22 16:16:51 -04:00
David Cantrell f7ac832c9b Include the _sortCommand to the _setCommand method (vponcova, #1578930) 2018-05-22 16:03:20 -04:00
David Cantrell ff55c1aabd Upstream patches to support '--autovlan' option on fcoe command (#1564096) 2018-04-16 17:04:04 -04:00
David Cantrell 63eee5013a 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
2018-04-16 16:54:32 -04:00
5 changed files with 325 additions and 22 deletions

View File

@ -0,0 +1,113 @@
From 2e3c65c0631033d9952925e59b13897f5b1cc186 Mon Sep 17 00:00:00 2001
From: Radek Vykydal <rvykydal@redhat.com>
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

View File

@ -0,0 +1,74 @@
From fd46d8289eba963a18f198f67a06a869426cf178 Mon Sep 17 00:00:00 2001
From: Radek Vykydal <rvykydal@redhat.com>
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

View File

@ -0,0 +1,56 @@
commit f618b966fe3358b89412e58b9b249edb35b154dc
Author: Vendula Poncova <vponcova@redhat.com>
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):

View File

@ -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

View File

@ -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: 4%{?dist}
License: GPLv2 and MIT
Group: System Environment/Libraries
Summary: Python utilities for manipulating kickstart files.
@ -9,16 +20,22 @@ 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
Patch2: pykickstart-rhbz1578930.patch
Patch3: pykickstart-translation-canary.patch
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 +53,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 +66,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 +82,45 @@ the pykickstart package.
%prep
%setup -q
# For https://bugzilla.redhat.com/show_bug.cgi?id=1564096
%patch0 -p1
%patch1 -p1
# For https://bugzilla.redhat.com/show_bug.cgi?id=1578930
%patch2 -p1
%patch3 -p1
%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 +131,43 @@ 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
* Tue May 22 2018 David Cantrell <dcantrell@redhat.com> - 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 <dcantrell@redhat.com> - 3.12-3
- Upstream patches to support '--autovlan' option on fcoe command (#1564096)
* Mon Apr 16 2018 David Cantrell <dcantrell@redhat.com> - 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 <clumens@redhat.com> - 3.12-1
- Sync spec file back up. (clumens)
- Don't use deprecated formatErrorMsg (vponcova)