diff --git a/0001-bash-Fix-nvme-completion.patch b/0001-bash-Fix-nvme-completion.patch deleted file mode 100644 index 38c58cbb390cb0f28d0acec39500f4f7029a67aa..0000000000000000000000000000000000000000 --- a/0001-bash-Fix-nvme-completion.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 821935cccfcad6b18da78d42f9ddf49f4cbe0b8e Mon Sep 17 00:00:00 2001 -From: Daniel Wagner -Date: Thu, 9 Dec 2021 15:40:26 +0100 -Subject: [PATCH] bash: Fix nvme completion - -Signed-off-by: Daniel Wagner ---- - completions/bash-nvme-completion.sh | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/completions/bash-nvme-completion.sh b/completions/bash-nvme-completion.sh -index 41938d77..902da01c 100644 ---- a/completions/bash-nvme-completion.sh -+++ b/completions/bash-nvme-completion.sh -@@ -101,8 +101,7 @@ _cmds="list list-subsys id-ctrl id-ns \ - connect disconnect disconnect-all gen-hostnqn \ - show-hostnqn dir-receive dir-send virt-mgmt \ - rpmb boot-part-log fid-support-effects-log \ -- supported-log-pages lockdown" -- supported-log-pages list-endgrp" -+ supported-log-pages lockdown list-endgrp" - - # Add plugins: - for plugin in "${!_plugin_subcmds[@]}"; do -@@ -1368,7 +1367,7 @@ plugin_ymtc_opts () { - opts+=" --namespace-id= -n --raw-binary -b" - ;; - "help") -- opts+=NO_OPTS -+ opts+=$NO_OPTS - ;; - esac - --- -2.33.0 - diff --git a/backport-Bash-completion-move-global-declare-into-function.patch b/backport-Bash-completion-move-global-declare-into-function.patch new file mode 100644 index 0000000000000000000000000000000000000000..e4e8679a7881d3fb98d1a4166e2904c16441976a --- /dev/null +++ b/backport-Bash-completion-move-global-declare-into-function.patch @@ -0,0 +1,256 @@ +From 3d5f7bcb1257e1d88140bad4ab556e1670650408 Mon Sep 17 00:00:00 2001 +From: Qiang Wei +Date: Fri, 30 Dec 2022 22:52:38 +0800 +Subject: [PATCH] Bash completion: move global declare into function +References: https://github.com/linux-nvme/nvme-cli/pull/1751 +Modified-by-SEL: Yes, Remove nvme-vendor-log and plugin_inspur_opts which are in master. + +* To fix completion issue by moving global vairables into +function _nvme_subcmds. It is not only suite for bash +completion system but also support manually source bash script. +* Fix pluginx_sfx_opts spell error to plugin_sfx_opts. +* Correct variable NO_OPTS used in bash assginment. + +Signed-off-by: Qiang Wei +--- + completions/bash-nvme-completion.sh | 219 ++++++++++++++-------------- + 1 file changed, 108 insertions(+), 111 deletions(-) + +--- a/completions/bash-nvme-completion.sh ++++ b/completions/bash-nvme-completion.sh +@@ -4,114 +4,6 @@ + # (unfortunately, bash won't let me add descriptions to cmds) + # Kelly Kaoudis kelly.n.kaoudis at intel.com, Aug. 2015 + +-# Constant to indicate command has no options +-NO_OPTS="" +-readonly NO_OPTS +- +-# Associative array of plugins and associated subcommands +-# Order here is same as PLUGIN_OBJS in Makefile +-typeset -Ar _plugin_subcmds=( +- [intel]="id-ctrl internal-log lat-stats \ +- set-bucket-thresholds lat-stats-tracking \ +- market-name smart-log-add temp-stats" +- [amzn]="id-ctrl" +- [memblaze]="smart-log-add get-pm-status set-pm-status \ +- select-download lat-stats lat-stats-print lat-log \ +- lat-log-print clear-error-log" +- [wdc]="cap-diag drive-log get-crash-dump get-pfail-dump \ +- id-ctrl purge purge-monitor vs-internal-log \ +- vs-nand-stats vs-smart-add-log clear-pcie-correctable-errors \ +- drive-essentials get-drive-status clear-assert-dump \ +- drive-resize vs-fw-activate-history clear-fw-activate-history \ +- enc-get-log vs-telemetry-controller-option \ +- vs-error-reason-identifier log-page-directory \ +- namespace-resize vs-drive-info vs-temperature-stats \ +- capabilities cloud-SSD-plugin-version vs-pcie-stats" +- [huawei]="list id-ctrl" +- [netapp]="smdevices ontapdevices" +- [toshiba]="vs-smart-add-log vs-internal-log \ +- clear-pcie-correctable-errors" +- [micron]="select-download vs-temperature-stats vs-pcie-stats \ +- clear-pcie-correctable-errors vs-internal-log \ +- vs-telemetry-controller-option vs-nand-stats \ +- vs-drive-info plugin-version cloud-SSD-plugin-version \ +- log-page-directory vs-fw-activate-history \ +- vs-error-reason-identifier vs-smart-add-log \ +- clear-fw-activate-history vs-smbus-option" +- [seagate]="vs-temperature-stats vs-log-page-sup \ +- vs-smart-add-log vs-pcie-stats clear-pcie-correctable-errors \ +- get-host-tele get-ctrl-tele vs-internal-log \ +- plugin-version" +- [virtium]="save-smart-to-vtview-log show-identify" +- [shannon]="smart-log-add get-feature-add set-feature-add id-ctrl" +- [dera]="smart-log-add" +- [sfx]="smart-log-add lat-stats get-bad-block query-cap \ +- change-cap set-feature get-feature" +- [transcend]="healthvalue badblock" +- [zns]="id-ctrl id-ns zone-mgmt-recv \ +- zone-mgmt-send report-zones close-zone \ +- finish-zone open-zone reset-zone offline-zone \ +- set-zone-desc zone-append changed-zone-list" +- [nvidia]="id-ctrl" +- [ymtc]="smart-log-add" +-) +-readonly _plugin_subcmds +- +-# Associative array mapping plugins to coresponding option completions +-typeset -Ar _plugin_funcs=( +- [intel]="plugin_intel_opts" +- [amzn]="plugin_amzn_opts" +- [memblaze]="plugin_memblaze_opts" +- [wdc]="plugin_wdc_opts" +- [huawei]="plugin_huawei_opts" +- [toshiba]="plugin_toshiba_opts" +- [micron]="plugin_micron_opts" +- [seagate]="plugin_seagate_opts" +- [virtium]="plugin_virtium_opts" +- [shannon]="plugin_shannon_opts" +- [dera]="plugin_dera_opts" +- [sfx]="pluginx_sfx_opts" +- [transcend]="plugin_transcend_opts" +- [zns]="plugin_zns_opts" +- [nvidia]="plugin_nvidia_opts" +- [ymtc]="plugin_ymtc_opts" +-) +-readonly _plugin_funcs +- +-# Top level commands +-_cmds="list list-subsys id-ctrl id-ns \ +- id-ns-granularity list-ns list-ctrl \ +- id-ns-lba-format nvm-id-ns nvm-id-ns-lba-format \ +- nvm-id-ctrl primary-ctrl-caps list-secondary \ +- ns-descs id-nvmset id-uuid id-iocs create-ns \ +- delete-ns get-ns-id get-log telemetry-log \ +- fw-log changed-ns-list-log smart-log ana-log \ +- error-log effects-log endurance-log \ +- predictable-lat-log pred-lat-event-agg-log \ +- persistent-event-log endurance-agg-log \ +- lba-status-log resv-notif-log get-feature \ +- device-self-test self-test-log set-feature \ +- set-property get-property format fw-commit \ +- fw-download admin-passthru io-passthru \ +- security-send security-recv get-lba-status \ +- resv-acquire resv-register resv-release \ +- resv-report dsm copy flush compare read \ +- write write-zeros write-uncor verify \ +- sanitize sanitize-log reset subsystem-reset \ +- ns-rescan show-regs discover connect-all \ +- connect disconnect disconnect-all gen-hostnqn \ +- show-hostnqn dir-receive dir-send virt-mgmt \ +- rpmb boot-part-log fid-support-effects-log \ +- supported-log-pages lockdown media-unit-stat-log \ +- supported-cap-config-log dim show-topology" +- +-# Add plugins: +-for plugin in "${!_plugin_subcmds[@]}"; do +- _cmds+=" $plugin" +-done +- +-cmds+=" version help" +- + nvme_list_opts () { + local opts="" + local compargs="" +@@ -1333,7 +1225,7 @@ plugin_ymtc_opts () { + opts+=" --namespace-id= -n --raw-binary -b" + ;; + "help") +- opts+=NO_OPTS ++ opts+=$NO_OPTS + ;; + esac + +@@ -1346,6 +1238,111 @@ _nvme_subcmds () { + local cur prev words cword + _init_completion || return + ++ # Constant to indicate command has no options ++ NO_OPTS="" ++ ++ # Associative array of plugins and associated subcommands ++ # Order here is same as PLUGIN_OBJS in Makefile ++ typeset -Ar _plugin_subcmds=( ++ [intel]="id-ctrl internal-log lat-stats \ ++ set-bucket-thresholds lat-stats-tracking \ ++ market-name smart-log-add temp-stats" ++ [amzn]="id-ctrl" ++ [memblaze]="smart-log-add get-pm-status set-pm-status \ ++ select-download lat-stats lat-stats-print lat-log \ ++ lat-log-print clear-error-log" ++ [wdc]="cap-diag drive-log get-crash-dump get-pfail-dump \ ++ id-ctrl purge purge-monitor vs-internal-log \ ++ vs-nand-stats vs-smart-add-log clear-pcie-correctable-errors \ ++ drive-essentials get-drive-status clear-assert-dump \ ++ drive-resize vs-fw-activate-history clear-fw-activate-history \ ++ enc-get-log vs-telemetry-controller-option \ ++ vs-error-reason-identifier log-page-directory \ ++ namespace-resize vs-drive-info vs-temperature-stats \ ++ capabilities cloud-SSD-plugin-version vs-pcie-stats" ++ [huawei]="list id-ctrl" ++ [netapp]="smdevices ontapdevices" ++ [toshiba]="vs-smart-add-log vs-internal-log \ ++ clear-pcie-correctable-errors" ++ [micron]="select-download vs-temperature-stats vs-pcie-stats \ ++ clear-pcie-correctable-errors vs-internal-log \ ++ vs-telemetry-controller-option vs-nand-stats \ ++ vs-drive-info plugin-version cloud-SSD-plugin-version \ ++ log-page-directory vs-fw-activate-history \ ++ vs-error-reason-identifier vs-smart-add-log \ ++ clear-fw-activate-history vs-smbus-option" ++ [seagate]="vs-temperature-stats vs-log-page-sup \ ++ vs-smart-add-log vs-pcie-stats clear-pcie-correctable-errors \ ++ get-host-tele get-ctrl-tele vs-internal-log \ ++ plugin-version" ++ [virtium]="save-smart-to-vtview-log show-identify" ++ [shannon]="smart-log-add get-feature-add set-feature-add id-ctrl" ++ [dera]="smart-log-add" ++ [sfx]="smart-log-add lat-stats get-bad-block query-cap \ ++ change-cap set-feature get-feature" ++ [transcend]="healthvalue badblock" ++ [zns]="id-ctrl id-ns zone-mgmt-recv \ ++ zone-mgmt-send report-zones close-zone \ ++ finish-zone open-zone reset-zone offline-zone \ ++ set-zone-desc zone-append changed-zone-list" ++ [nvidia]="id-ctrl" ++ [ymtc]="smart-log-add" ++ ) ++ ++ # Associative array mapping plugins to coresponding option completions ++ typeset -Ar _plugin_funcs=( ++ [intel]="plugin_intel_opts" ++ [amzn]="plugin_amzn_opts" ++ [memblaze]="plugin_memblaze_opts" ++ [wdc]="plugin_wdc_opts" ++ [huawei]="plugin_huawei_opts" ++ [toshiba]="plugin_toshiba_opts" ++ [micron]="plugin_micron_opts" ++ [seagate]="plugin_seagate_opts" ++ [virtium]="plugin_virtium_opts" ++ [shannon]="plugin_shannon_opts" ++ [dera]="plugin_dera_opts" ++ [sfx]="plugin_sfx_opts" ++ [transcend]="plugin_transcend_opts" ++ [zns]="plugin_zns_opts" ++ [nvidia]="plugin_nvidia_opts" ++ [ymtc]="plugin_ymtc_opts" ++ ) ++ ++ # Top level commands ++ _cmds="list list-subsys id-ctrl id-ns \ ++ id-ns-granularity list-ns list-ctrl \ ++ id-ns-lba-format nvm-id-ns nvm-id-ns-lba-format \ ++ nvm-id-ctrl primary-ctrl-caps list-secondary \ ++ ns-descs id-nvmset id-uuid id-iocs create-ns \ ++ delete-ns get-ns-id get-log telemetry-log \ ++ fw-log changed-ns-list-log smart-log ana-log \ ++ error-log effects-log endurance-log \ ++ predictable-lat-log pred-lat-event-agg-log \ ++ persistent-event-log endurance-agg-log \ ++ lba-status-log resv-notif-log get-feature \ ++ device-self-test self-test-log set-feature \ ++ set-property get-property format fw-commit \ ++ fw-download admin-passthru io-passthru \ ++ security-send security-recv get-lba-status \ ++ resv-acquire resv-register resv-release \ ++ resv-report dsm copy flush compare read \ ++ write write-zeros write-uncor verify \ ++ sanitize sanitize-log reset subsystem-reset \ ++ ns-rescan show-regs discover connect-all \ ++ connect disconnect disconnect-all gen-hostnqn \ ++ show-hostnqn dir-receive dir-send virt-mgmt \ ++ rpmb boot-part-log fid-support-effects-log \ ++ supported-log-pages lockdown media-unit-stat-log \ ++ supported-cap-config-log dim show-topology list-endgrp" ++ ++ # Add plugins: ++ for plugin in "${!_plugin_subcmds[@]}"; do ++ _cmds+=" $plugin" ++ done ++ ++ cmds+=" version help" ++ + if [[ ${#words[*]} -lt 3 ]]; then + COMPREPLY+=( $(compgen -W "$_cmds" -- $cur ) ) + else diff --git a/nvme-cli.spec b/nvme-cli.spec index 903767dc7fbf05bc18e7e2060349df617774ed77..c4e6527bb589815d5ed76840b163b30a3927154a 100644 --- a/nvme-cli.spec +++ b/nvme-cli.spec @@ -1,14 +1,20 @@ Name: nvme-cli -Version: 1.16 -Release: 2 +Version: 2.2.1 +Release: 1 Summary: NVMe management command line interface License: GPLv2+ URL: https://github.com/linux-nvme/nvme-cli Source0: https://github.com/linux-nvme/%{name}/archive/v%{version}.tar.gz -Patch1: 0001-bash-Fix-nvme-completion.patch +Patch1: backport-Bash-completion-move-global-declare-into-function.patch -BuildRequires: libuuid-devel gcc make systemd-devel +Requires: libnvme + +BuildRequires: gcc-g++ +BuildRequires: libnvme-devel +BuildRequires: make +BuildRequires: meson +BuildRequires: systemd %description nvme-cli provides NVM-Express user space tooling for Linux. @@ -19,38 +25,47 @@ nvme-cli provides NVM-Express user space tooling for Linux. %autosetup -p1 %build -%make_build PREFIX=%{_prefix} CFLAGS="%{optflags}" LDFLAGS="%{__global_ldflags}" +%meson -Ddocs=man -Dsystemddir=%{_unitdir} -Dudevrulesdir=%{_udevrulesdir} +%meson_build %install -%make_install PREFIX=%{_prefix} +%meson_install # hostid and hostnqn are supposed to be unique per machine. We obviously # can't package them. rm -f %{buildroot}%{_sysconfdir}/nvme/hostid rm -f %{buildroot}%{_sysconfdir}/nvme/hostnqn - + # Do not install the dracut rule yet. See rhbz 1742764 rm -f %{buildroot}/usr/lib/dracut/dracut.conf.d/70-nvmf-autoconnect.conf %files %license LICENSE %{_sbindir}/nvme -%{_datadir}/bash-completion/completions/nvme -%{_datadir}/zsh/site-functions/_nvme -%dir %{_sysconfdir}/nvme -%{_sysconfdir}/nvme/discovery.conf -%{_unitdir}/nvmefc-boot-connections.service -%{_unitdir}/nvmf-autoconnect.service -%{_unitdir}/nvmf-connect.target -%{_unitdir}/nvmf-connect@.service -%{_sysconfdir}/udev/rules.d/70-nvmf-autoconnect.rules -%{_sysconfdir}/udev/rules.d/71-nvmf-iopolicy-netapp.rules +%{_datadir}/bash-completion/completions/nvme +%{_datadir}/zsh/site-functions/_nvme +%dir %{_sysconfdir}/nvme +%{_sysconfdir}/nvme/discovery.conf +%{_unitdir}/nvmefc-boot-connections.service +%{_unitdir}/nvmf-autoconnect.service +%{_unitdir}/nvmf-connect.target +%{_unitdir}/nvmf-connect@.service +%{_udevrulesdir}/70-nvmf-autoconnect.rules +%{_udevrulesdir}/71-nvmf-iopolicy-netapp.rules %files help %doc README.md %{_mandir}/man1/nvme*.gz %changelog +* Mon Dec 19 2022 Qiang Wei - 2.2.1-1 +- Update to version 2.2.1. + * Remove 0001-bash-Fix-nvme-completion.patch, it is fixed in upstream. + * backport upstream patch: Bash completion: move global declare into function. + +* Wed Apr 20 2022 Kai Liu - 2.0-1 +- Update to version 2.0. + * Sat Oct 8 2022 zhanghongtao - 1.16-2 - bash Fix nvme completion diff --git a/v1.16.tar.gz b/v1.16.tar.gz deleted file mode 100644 index dad51d42ae3cde4c62b004a3cc8792c7e84884dc..0000000000000000000000000000000000000000 Binary files a/v1.16.tar.gz and /dev/null differ diff --git a/v2.2.1.tar.gz b/v2.2.1.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..b23366e4a08d886180307f24ac2b87209a161d46 Binary files /dev/null and b/v2.2.1.tar.gz differ