diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e72da9c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/nvmetcli-0.6.tar.gz diff --git a/.nvmetcli.metadata b/.nvmetcli.metadata new file mode 100644 index 0000000..2b8b896 --- /dev/null +++ b/.nvmetcli.metadata @@ -0,0 +1 @@ +0ecc5e3c3b7181659a8dd3852c928b37df95f6c4 SOURCES/nvmetcli-0.6.tar.gz diff --git a/SOURCES/0001-Support-python3-dictionary-access.patch b/SOURCES/0001-Support-python3-dictionary-access.patch new file mode 100644 index 0000000..a9559cb --- /dev/null +++ b/SOURCES/0001-Support-python3-dictionary-access.patch @@ -0,0 +1,62 @@ +From 531d63d4e6acf6f4959e20f61f300921f764690c Mon Sep 17 00:00:00 2001 +From: Lee Duncan +Date: Fri, 13 Apr 2018 11:56:29 -0700 +Subject: [PATCH] Support python3 dictionary access. + +Support python2 and python3 dictionary access by using the iteritems +function the 'python-six' module. + +Also, add info to the README about supporting both Python2 and Python3. + +Signed-off-by: Lee Duncan +Reviewed-by: Sagi Grimberg +Reviewed-by: Johannes Thumshirn +Signed-off-by: Christoph Hellwig +--- + README | 8 +++++--- + nvmet/nvme.py | 3 ++- + 2 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/README b/README +index cd4bd78..c8717e8 100644 +--- a/README ++++ b/README +@@ -14,9 +14,11 @@ using setup.py. + + Common Package Dependencies and Problems + ----------------------------------------- +-nvmetcli uses the 'python-six' and 'pyparsing' packages +-(running nvmetcli without these packages may produce +-hard-to-decipher errors). ++Both python2 and python3 are supported via use of the 'python-six' ++package. ++ ++nvmetcli uses the 'pyparsing' package -- running nvmetcli without this ++package may produce hard-to-decipher errors. + + Usage + ----- +diff --git a/nvmet/nvme.py b/nvmet/nvme.py +index f5d0555..89bf9cd 100644 +--- a/nvmet/nvme.py ++++ b/nvmet/nvme.py +@@ -23,6 +23,7 @@ import stat + import uuid + import json + from glob import iglob as glob ++from six import iteritems + + DEFAULT_SAVE_FILE = '/etc/nvmet/config.json' + +@@ -219,7 +220,7 @@ class CFSNode(object): + + def _setup_attrs(self, attr_dict, err_func): + for group in self.attr_groups: +- for name, value in attr_dict.get(group, {}).iteritems(): ++ for name, value in iteritems(attr_dict.get(group, {})): + try: + self.set_attr(group, name, value) + except CFSError as e: +-- +1.8.3.1 + diff --git a/SPECS/nvmetcli.spec b/SPECS/nvmetcli.spec new file mode 100644 index 0000000..3f19d3a --- /dev/null +++ b/SPECS/nvmetcli.spec @@ -0,0 +1,76 @@ +Name: nvmetcli +License: ASL 2.0 +Group: Applications/System +Summary: An adminstration shell for NVMe storage targets +Version: 0.6 +Release: 2%{?dist} +URL: ftp://ftp.infradead.org/pub/nvmetcli/ +Source: ftp://ftp.infradead.org/pub/nvmetcli/%{name}-%{version}.tar.gz +Patch0: 0001-Support-python3-dictionary-access.patch +BuildArch: noarch +BuildRequires: python3-devel python3-setuptools systemd-units asciidoc xmlto +Requires: python3-configshell python3-kmod +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd + +%description +This package contains the command line interface to the NVMe over Fabrics +nvmet in the Linux kernel. It allows configuring the nvmet interactively +as well as saving / restoring the configuration to / from a json file. + +%prep +%setup -q +%patch0 -p1 + +%build +%{__python3} setup.py build +cd Documentation +make +gzip --stdout nvmetcli.8 > nvmetcli.8.gz + +%install +%{__python3} setup.py install --skip-build --root %{buildroot} +mkdir -p %{buildroot}%{_unitdir} +mkdir -p %{buildroot}%{_sysconfdir}/nvmet +install -m 644 nvmet.service %{buildroot}%{_unitdir}/nvmet.service +mkdir -p %{buildroot}%{_mandir}/man8/ +install -m 644 Documentation/nvmetcli.8.gz %{buildroot}%{_mandir}/man8/ + +%post +%systemd_post nvmet.service + +%preun +%systemd_preun nvmet.service + +%postun +%systemd_postun_with_restart nvmet.service + +%files +%{python3_sitelib}/* +%dir %{_sysconfdir}/nvmet +%{_sbindir}/nvmetcli +%{_unitdir}/nvmet.service +%doc README +%license COPYING +%{_mandir}/man8/nvmetcli.8.gz + +%changelog +* Fri Sep 14 2018 Maurizio Lombardi - 0.6-2 +- Support python3 dictionary access. + +* Fri Jul 06 2018 Maurizio Lombardi - 0.6-1 +- Update for new upstream release + +* Thu Jul 27 2017 Fedora Release Engineering - 0.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Tue May 9 2017 Andy Grover - 0.4-1 +- Update for new upstream release +- Remove fix-setup.patch + +* Tue Feb 21 2017 Andy Grover - 0.3-1 +- Update for new upstream release + +* Wed Oct 12 2016 Andy Grover - 0.2-1 +- Initial packaging