From 297098a77d8698eebbe98ae6cb055d51fc4f3639 Mon Sep 17 00:00:00 2001 From: Wong Hoi Sing Edison Date: Wed, 7 Feb 2024 22:05:17 +0800 Subject: [PATCH] alvistack/v80 git clean -xdf tar zcvf ../ndctl_80.orig.tar.gz --exclude=.git . debuild -uc -us cp ndctl.spec ../ndctl_80-1.spec cp ndctl.rpmlintrc /osc/home\:alvistack/pmem-ndctl-80/ cp ../ndctl*80*.{gz,xz,spec,dsc} /osc/home\:alvistack/pmem-ndctl-80/ rm -rf ../*ndctl*80*.* ../*daxctl*80*.* ../*libcxl*80*.* See https://github.com/pmem/ndctl/pull/267 Signed-off-by: Wong Hoi Sing Edison --- cxl/json.c | 2 + cxl/lib/libcxl.sym | 1 - cxl/libcxl.h | 1 - debian/.gitignore | 13 ++ debian/90-daxctl-device.rules | 2 + debian/changelog | 5 + debian/control | 114 +++++++++++++++ debian/copyright | 199 ++++++++++++++++++++++++++ debian/daxctl.install | 5 + debian/libcxl-dev.install | 3 + debian/libcxl1.install | 1 + debian/libdaxctl-dev.install | 3 + debian/libdaxctl1.install | 1 + debian/libndctl-dev.install | 4 + debian/libndctl6.install | 1 + debian/ndctl.init | 12 ++ debian/ndctl.install | 8 ++ debian/rules | 34 +++++ debian/source/format | 1 + ndctl.rpmlintrc | 2 + ndctl.spec | 261 ++++++++++++++++++++++++++++++++++ 21 files changed, 671 insertions(+), 2 deletions(-) create mode 100644 debian/.gitignore create mode 100644 debian/90-daxctl-device.rules create mode 100644 debian/changelog create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/daxctl.install create mode 100644 debian/libcxl-dev.install create mode 100644 debian/libcxl1.install create mode 100644 debian/libdaxctl-dev.install create mode 100644 debian/libdaxctl1.install create mode 100644 debian/libndctl-dev.install create mode 100644 debian/libndctl6.install create mode 100644 debian/ndctl.init create mode 100644 debian/ndctl.install create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100644 ndctl.rpmlintrc create mode 100644 ndctl.spec diff --git a/cxl/json.c b/cxl/json.c index 5066d3be..f3e7c76d 100644 --- a/cxl/json.c +++ b/cxl/json.c @@ -9,7 +9,9 @@ #include #include #include +#ifdef ENABLE_LIBTRACEFS #include +#endif #include "filter.h" #include "json.h" diff --git a/cxl/lib/libcxl.sym b/cxl/lib/libcxl.sym index 0c155a40..763151fb 100644 --- a/cxl/lib/libcxl.sym +++ b/cxl/lib/libcxl.sym @@ -208,7 +208,6 @@ global: cxl_mapping_get_first; cxl_mapping_get_next; cxl_mapping_get_decoder; - cxl_mapping_get_region; cxl_mapping_get_position; cxl_decoder_get_by_name; cxl_decoder_get_memdev; diff --git a/cxl/libcxl.h b/cxl/libcxl.h index 0a5fd0e1..43c082ac 100644 --- a/cxl/libcxl.h +++ b/cxl/libcxl.h @@ -354,7 +354,6 @@ struct cxl_memdev_mapping *cxl_mapping_get_first(struct cxl_region *region); struct cxl_memdev_mapping * cxl_mapping_get_next(struct cxl_memdev_mapping *mapping); struct cxl_decoder *cxl_mapping_get_decoder(struct cxl_memdev_mapping *mapping); -struct cxl_region *cxl_mapping_get_region(struct cxl_memdev_mapping *mapping); unsigned int cxl_mapping_get_position(struct cxl_memdev_mapping *mapping); #define cxl_mapping_foreach(region, mapping) \ diff --git a/debian/.gitignore b/debian/.gitignore new file mode 100644 index 00000000..eecbd2e0 --- /dev/null +++ b/debian/.gitignore @@ -0,0 +1,13 @@ +*.substvars +*debhelper* +.debhelper +files +tmp +daxctl +libcxl-dev +libcxl1 +libdaxctl-dev +libdaxctl1 +libndctl-dev +libndctl6 +ndctl diff --git a/debian/90-daxctl-device.rules b/debian/90-daxctl-device.rules new file mode 100644 index 00000000..277a3910 --- /dev/null +++ b/debian/90-daxctl-device.rules @@ -0,0 +1,2 @@ +ACTION=="add", SUBSYSTEM=="dax",\ + RUN+="/usr/bin/daxctl -C $env{DEVNAME}" diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 00000000..cf836c0b --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +ndctl (100:80-1) UNRELEASED; urgency=medium + + * https://github.com/pmem/ndctl/releases/tag/v80 + + -- Wong Hoi Sing Edison Fri, 11 Oct 2024 14:08:08 +0800 diff --git a/debian/control b/debian/control new file mode 100644 index 00000000..665929cd --- /dev/null +++ b/debian/control @@ -0,0 +1,114 @@ +Source: ndctl +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Adam Borowski +Section: libs +Priority: optional +Standards-Version: 4.5.0 +Build-Depends: debhelper-compat (= 10), + debhelper, + pkg-config, + libkmod-dev, + libudev-dev, + uuid-dev, + libjson-c-dev, + bash-completion, + libkeyutils-dev, + libiniparser-dev, + meson, + cmake, +Rules-Requires-Root: no +Homepage: https://github.com/pmem/ndctl/tags +Vcs-Git: https://github.com/kilobyte/ndctl -b debian +Vcs-Browser: https://github.com/kilobyte/ndctl/tree/debian + +Package: ndctl +Section: misc +Architecture: linux-any +Multi-Arch: foreign +Depends: ${shlibs:Depends}, ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} +# RPM-world's name for cxl tools +Provides: cxl-cli +Description: Utility for managing the nvdimm subsystem + The nvdimm subsystem defines a kernel device model and control message + interface for platform NVDIMM resources like those defined by the ACPI 6+ NFIT + (NVDIMM Firmware Interface Table). + . + This package contains a utility for managing the nvdimm (non-volatile memory + device) subsystem in the Linux kernel. + +Package: libndctl6 +Architecture: linux-any +Multi-Arch: same +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Utility library for managing the libnvdimm subsystem + The nvdimm subsystem defines a kernel device model and control message + interface for platform NVDIMM resources like those defined by the ACPI 6+ NFIT + (NVDIMM Firmware Interface Table). + . + This package contains a utility library for managing the libnvdimm + (non-volatile memory device) sub-system in the Linux kernel. + +Package: libndctl-dev +Section: libdevel +Architecture: linux-any +Multi-Arch: same +Depends: libndctl6 (= ${binary:Version}), ${misc:Depends} +Description: Development files for libndctl + Header files and development library for compiling C programs to link + with the libndctl library and manage the libnvdimm sub-system in the + Linux kernel. + +Package: daxctl +Section: misc +Architecture: linux-any +Multi-Arch: foreign +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Utility for managing the device DAX subsystem + "DAX" are file system extensions to bypass the page cache and block layer to + mmap persistent memory, from a PMEM block device, directly into a process + address space. + . + This package contains a utility for managing the device DAX subsystem in the + Linux kernel. + +Package: libdaxctl1 +Architecture: linux-any +Multi-Arch: same +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Utility library for managing the device DAX subsystem + "DAX" are file system extensions to bypass the page cache and block layer to + mmap persistent memory, from a PMEM block device, directly into a process + address space. + . + This package contains a utility library used by applications to manage the + device DAX subsystem in the Linux kernel. + +Package: libdaxctl-dev +Section: libdevel +Architecture: linux-any +Multi-Arch: same +Depends: libdaxctl1 (= ${binary:Version}), ${misc:Depends} +Description: Development files for libdaxctl + Header files and development library for compiling C programs to link + with the libdaxctl library and manage the device DAX subsystem in the + Linux kernel. + +Package: libcxl1 +Architecture: linux-any +Multi-Arch: same +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: utility library for managing Compute Express Link devices + CXL (Compute Express Link) is a family of PCIe-based protocols that can be + used to connect high-speed I/O and memory devices. This library includes + code to enumerate/query/configure such devices. + +Package: libcxl-dev +Section: libdevel +Architecture: linux-any +Multi-Arch: same +Depends: libcxl1 (= ${binary:Version}), ${misc:Depends} +Description: Development files for libcxl + Header files and development library for compiling C programs to link + with the libcxl library and manage the Compute Express Link subsystem in + the Linux kernel. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 00000000..f912e0a4 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,199 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: ndctl +Source: https://github.com/pmem/ndctl +Copyright: 2013-2018 Intel Corporation +License: LGPL-2.1 + +Files: * +Copyright: 2014-2018 Intel Corporation +License: LGPL-2.1 + +Files: test.h + daxctl/list.c +Copyright: (c) 2015-2017 Intel Corporation + (c) 2013-2016 Intel Corporation +License: GPL-2 + +Files: ccan/* +Copyright: Unknown +License: CC0-1.0 + +Files: ccan/list/* +Copyright: Unknown +License: Expat + +Files: daxctl/daxctl.c +Copyright: (c) 2005 Andreas Ericsson. + (c) 2015-2017 Intel Corporation. All rights reserved +License: GPL-2 + +Files: daxctl/libdaxctl.h + daxctl/lib/libdaxctl-private.h + daxctl/lib/libdaxctl.c +Copyright: (c) 2016, Intel Corporation. + (c) 2014-2016, Intel Corporation. +License: LGPL-2.1 + +Files: ndctl/dimm.c + ndctl/lib/ars.c + ndctl/lib/dimm.c + ndctl/lib/hpe1.c + ndctl/lib/hpe1.h + ndctl/lib/inject.c + ndctl/lib/intel.c + ndctl/lib/intel.h + ndctl/lib/libndctl.c + ndctl/lib/msft.c + ndctl/lib/msft.h + ndctl/lib/nfit.c + ndctl/lib/private.h + ndctl/lib/smart.c + ndctl/libndctl-nfit.h + ndctl/libndctl.h + ndctl/namespace.h + ndctl/ndctl.h +Copyright: 2014-2015, Intel Corporation. + 2014-2016, Intel Corporation. + 2014-2017, Intel Corporation. + 2016, Hewlett Packard Enterprise Development LP + 2016, Intel Corporation. + 2016-2017, Dell, Inc. + 2016-2017, Intel Corporation. + 2017, FUJITSU LIMITED. + 2017, Hewlett Packard Enterprise Development LP + 2017, Intel Corporation. +License: LGPL-2.1 + +Files: ndctl/inject-error.c + ndctl/list.c + ndctl/namespace.c + ndctl/region.c + ndctl/test.c + ndctl/inject-smart.c + ndctl/lib/firmware.c + ndctl/bat.c + ndctl/create-nfit.c + ndctl/check.c + ndctl/action.h + ndctl/bus.c +Copyright: (c) 2015-2017 Intel Corporation. + (c) 2015-2016 Intel Corporation. + (c) 2018 Intel Corporation. + (c) 2014 Intel Corporation. +License: GPL-2 + +Files: ndctl/ndctl.c +Copyright: (c) 2005 Andreas Ericsson. + (c) 2015-2017 Intel Corporation. +License: GPL-2 + +Files: util/* +Copyright: (c) 2015-2017 Intel Corporation. + (c) 2005 Junio C Hamano. + (c) 2005 Linus Torvalds. + (c) 2006 Linus Torvalds. + (c) 2007 Pierre Habouzit. + (c) 2008 Miklos Vajna. + (c) 2009 Akinobu Mita. +License: GPL-2 + +Files: util/log.c + util/log.h + util/sysfs.c + util/sysfs.h +Copyright: 2014-2016, Intel Corporation. + 2016, Intel Corporation. +License: LGPL-2.1 + +Files: Documentation/* +Copyright: 2005, Jonas Fonseca + 2005, Sergey Vlasov + (c) 2017, Intel Corporation + (c) 2016 - 2017, Intel Corporation + 2006, Sean Estabrooks + 2009, Chris Johnsen + (c) 2018, Intel Corporation + (c) 2015-2017 Intel Corporation. +License: GPL-2 + +Files: + test/btt-check.sh + test/btt-errors.sh + test/btt-pad-compat.sh + test/clear.sh + test/core.c + test/create.sh + test/dax-errors.c + test/dax-pmd.c + test/dax.sh + test/daxdev-errors.c + test/daxdev-errors.sh + test/device-dax-fio.sh + test/device-dax.c + test/inject-error.sh + test/firmware-update.sh + test/label-compat.sh + test/mmap.sh + test/multi-dax.sh + test/pmem-errors.sh + test/sector-mode.sh + test/smart-listen.c + test/smart-notify.c + test/ack-shutdown-count-set.c + test/rescan-partitions.sh +Copyright: (c) 2015-2017 Intel Corporation. + (c) 2018 Intel Corporation. +License: GPL-2 + +Files: + test/dax-dev.c + test/dsm-fail.c + test/libndctl.c + test/pmem_namespaces.c +Copyright: 2014-2016, Intel Corporation. + 2015, Intel Corporation. +License: LGPL-2.1 + +Files: test/mmap.c +Copyright: (c) 2015 Toshi Kani, Hewlett Packard Enterprise. +License: GPL-2 + +License: GPL-2 + On Debian systems, the full text of the GNU General Public + License version 2 can be found in the file + `/usr/share/common-licenses/GPL-2'. + +License: LGPL-2.1 + On Debian systems, the full text of the GNU Lesser General Public + License version 2.1 can be found in the file + `/usr/share/common-licenses/LGPL-2.1'. + +License: CC0-1.0 + To the extent possible under law, the author(s) have dedicated all copyright + and related and neighboring rights to this software to the public domain + worldwide. This software is distributed without any warranty. + . + You should have received a copy of the CC0 Public Domain Dedication along with + this software. If not, see . + . + On Debian systems, the complete text of the CC0 1.0 Universal license can be + found in "/usr/share/common-licenses/CC0-1.0". + +License: Expat + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. diff --git a/debian/daxctl.install b/debian/daxctl.install new file mode 100644 index 00000000..ad1181c1 --- /dev/null +++ b/debian/daxctl.install @@ -0,0 +1,5 @@ +etc/daxctl.conf.d +usr/bin/daxctl +usr/share/bash-completion/completions/daxctl +usr/share/daxctl/daxctl.conf +debian/90-daxctl-device.rules lib/udev/rules.d diff --git a/debian/libcxl-dev.install b/debian/libcxl-dev.install new file mode 100644 index 00000000..516da746 --- /dev/null +++ b/debian/libcxl-dev.install @@ -0,0 +1,3 @@ +usr/include/cxl/*.h +usr/lib/*/libcxl.so +usr/lib/*/pkgconfig/libcxl.pc diff --git a/debian/libcxl1.install b/debian/libcxl1.install new file mode 100644 index 00000000..353bd8e5 --- /dev/null +++ b/debian/libcxl1.install @@ -0,0 +1 @@ +usr/lib/*/libcxl*so.1* diff --git a/debian/libdaxctl-dev.install b/debian/libdaxctl-dev.install new file mode 100644 index 00000000..8cda915d --- /dev/null +++ b/debian/libdaxctl-dev.install @@ -0,0 +1,3 @@ +usr/include/daxctl/libdaxctl.h +usr/lib/*/libdaxctl.so +usr/lib/*/pkgconfig/libdaxctl.pc diff --git a/debian/libdaxctl1.install b/debian/libdaxctl1.install new file mode 100644 index 00000000..1d4657de --- /dev/null +++ b/debian/libdaxctl1.install @@ -0,0 +1 @@ +usr/lib/*/libdaxctl*so.1* diff --git a/debian/libndctl-dev.install b/debian/libndctl-dev.install new file mode 100644 index 00000000..1582a8fa --- /dev/null +++ b/debian/libndctl-dev.install @@ -0,0 +1,4 @@ +usr/include/ndctl/ndctl.h +usr/include/ndctl/libndctl.h +usr/lib/*/libndctl.so +usr/lib/*/pkgconfig/libndctl.pc diff --git a/debian/libndctl6.install b/debian/libndctl6.install new file mode 100644 index 00000000..37060d43 --- /dev/null +++ b/debian/libndctl6.install @@ -0,0 +1 @@ +usr/lib/*/libndctl*so.6* diff --git a/debian/ndctl.init b/debian/ndctl.init new file mode 100644 index 00000000..fa27b362 --- /dev/null +++ b/debian/ndctl.init @@ -0,0 +1,12 @@ +#!/lib/init/init-d-script +### BEGIN INIT INFO +# Provides: ndctl-monitor +# Required-Start: $syslog $time $remote_fs +# Required-Stop: $syslog $time $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Ndctl Monitor Daemon +# Description: monitoring of smart events of nvdimm objects +### END INIT INFO +DAEMON=/usr/bin/ndctl +DAEMON_ARGS="monitor --daemon" diff --git a/debian/ndctl.install b/debian/ndctl.install new file mode 100644 index 00000000..b42bc79d --- /dev/null +++ b/debian/ndctl.install @@ -0,0 +1,8 @@ +etc/ndctl +etc/ndctl.conf.d +etc/modprobe.d/nvdimm-security.conf +ndctl/*.service lib/systemd/system +usr/bin/ndctl +usr/bin/cxl +usr/share/bash-completion/completions/ndctl +usr/share/bash-completion/completions/cxl diff --git a/debian/rules b/debian/rules new file mode 100755 index 00000000..3453fd75 --- /dev/null +++ b/debian/rules @@ -0,0 +1,34 @@ +#!/usr/bin/make -f + +export DEB_BUILD_MAINT_OPTIONS = hardening=+all +export DEB_CPPFLAGS_MAINT_APPEND = -I/usr/include/iniparser/ +include /usr/share/dpkg/architecture.mk + +%: + dh $@ --buildsystem=meson + +override_dh_auto_configure: + dh_auto_configure \ + -- \ + -Dasciidoctor=disabled \ + -Ddocs=disabled \ + -Dlibtracefs=disabled \ + -Dsystemd=disabled \ + -Dtest=disabled + +override_dh_auto_test: + +override_dh_auto_clean: + +override_dh_installinit: + dh_installinit -p ndctl --init-script=ndctl-monitor + +override_dh_install: + mv debian/tmp/usr/$(DEB_HOST_MULTIARCH)/* debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/ + dh_install + +override_dh_makeshlibs: + dh_makeshlibs -- -c4 + +override_dh_missing: + dh_missing --fail-missing diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 00000000..163aaf8d --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/ndctl.rpmlintrc b/ndctl.rpmlintrc new file mode 100644 index 00000000..7aba6cb6 --- /dev/null +++ b/ndctl.rpmlintrc @@ -0,0 +1,2 @@ +addFilter("devel-file-in-non-devel-package") +addFilter("shlib-policy-name-error") diff --git a/ndctl.spec b/ndctl.spec new file mode 100644 index 00000000..fe583699 --- /dev/null +++ b/ndctl.spec @@ -0,0 +1,261 @@ +%global debug_package %{nil} + +%global source_date_epoch_from_changelog 0 + +%if 0%{?suse_version} +%global DAX_DNAME libdaxctl-devel +%global CXL_DNAME libcxl-devel +%global DNAME libndctl-devel +%global DAX_LNAME libdaxctl +%global CXL_LNAME libcxl +%global LNAME libndctl +%endif +%if !(0%{?suse_version}) +%global DAX_DNAME daxctl-devel +%global CXL_DNAME cxl-devel +%global DNAME ndctl-devel +%global DAX_LNAME daxctl-libs +%global CXL_LNAME cxl-libs +%global LNAME ndctl-libs +%endif + +Name: ndctl +Epoch: 100 +Version: 80 +Release: 1%{?dist} +Summary: Manage "libnvdimm" subsystem devices (Non-volatile Memory) +License: GPLv2 +Url: https://github.com/pmem/ndctl/tags +Source0: %{name}_%{version}.orig.tar.gz +Source99: %{name}.rpmlintrc + +Requires: %{LNAME}%{?_isa} = %{epoch}:%{version}-%{release} +Requires: %{DAX_LNAME}%{?_isa} = %{epoch}:%{version}-%{release} +Requires: %{CXL_LNAME}%{?_isa} = %{epoch}:%{version}-%{release} +BuildRequires: autoconf +BuildRequires: xmlto +BuildRequires: automake +BuildRequires: libtool +BuildRequires: pkgconfig +BuildRequires: pkgconfig(libkmod) +BuildRequires: pkgconfig(libudev) +BuildRequires: pkgconfig(uuid) +BuildRequires: pkgconfig(json-c) +BuildRequires: pkgconfig(bash-completion) +BuildRequires: pkgconfig(systemd) +BuildRequires: pkgconfig(udev) +BuildRequires: keyutils-libs-devel +BuildRequires: systemd-rpm-macros +BuildRequires: iniparser-devel +BuildRequires: meson +BuildRequires: cmake + +%description +Utility library for managing the "libnvdimm" subsystem. The "libnvdimm" +subsystem defines a kernel device model and control message interface for +platform NVDIMM resources like those defined by the ACPI 6+ NFIT (NVDIMM +Firmware Interface Table). + +%if 0%{?flatpak} +%global _udevrulesdir %{_prefix}/lib/udev/rules.d +%endif + +%package -n %{DNAME} +Summary: Development files for libndctl +License: LGPLv2 +Requires: %{LNAME}%{?_isa} = %{epoch}:%{version}-%{release} + +%description -n %{DNAME} +The %{name}-devel package contains libraries and header files for +developing applications that use %{name}. + +%package -n daxctl +Summary: Manage Device-DAX instances +License: GPLv2 +Requires: %{DAX_LNAME}%{?_isa} = %{epoch}:%{version}-%{release} + +%description -n daxctl +The daxctl utility provides enumeration and provisioning commands for +the Linux kernel Device-DAX facility. This facility enables DAX mappings +of performance / feature differentiated memory without need of a +filesystem. + +%package -n cxl-cli +Summary: Manage CXL devices +License: GPLv2 +Requires: %{CXL_LNAME}%{?_isa} = %{epoch}:%{version}-%{release} + +%description -n cxl-cli +The cxl utility provides enumeration and provisioning commands for +the Linux kernel CXL devices. + +%package -n %{CXL_DNAME} +Summary: Development files for libcxl +License: LGPLv2 +Requires: %{CXL_LNAME}%{?_isa} = %{epoch}:%{version}-%{release} + +%description -n %{CXL_DNAME} +This package contains libraries and header files for developing applications +that use libcxl, a library for enumerating and communicating with CXL devices. + +%package -n %{DAX_DNAME} +Summary: Development files for libdaxctl +License: LGPLv2 +Requires: %{DAX_LNAME}%{?_isa} = %{epoch}:%{version}-%{release} + +%description -n %{DAX_DNAME} +The %{name}-devel package contains libraries and header files for +developing applications that use %{name}, a library for enumerating +"Device DAX" devices. Device DAX is a facility for establishing DAX +mappings of performance / feature-differentiated memory. + + +%package -n %{LNAME} +Summary: Management library for "libnvdimm" subsystem devices (Non-volatile Memory) +License: LGPLv2 +Requires: %{DAX_LNAME}%{?_isa} = %{epoch}:%{version}-%{release} + + +%description -n %{LNAME} +Libraries for %{name}. + +%package -n %{DAX_LNAME} +Summary: Management library for "Device DAX" devices +License: LGPLv2 + +%description -n %{DAX_LNAME} +Device DAX is a facility for establishing DAX mappings of performance / +feature-differentiated memory. %{DAX_LNAME} provides an enumeration / +control API for these devices. + +%package -n %{CXL_LNAME} +Summary: Management library for CXL devices +License: LGPLv2 + +%description -n %{CXL_LNAME} +libcxl is a library for enumerating and communicating with CXL devices. + + +%prep +%autosetup -T -c -n %{name}_%{version}-%{release} +tar -zx -f %{S:0} --strip-components=1 -C . + +%build +%meson \ + -Dasciidoctor=disabled \ + -Ddocs=disabled \ + -Dlibtracefs=disabled \ + -Dsystemd=disabled \ + -Dtest=disabled +%meson_build + +%install +%meson_install + +%check + +%ldconfig_scriptlets -n %{LNAME} + +%ldconfig_scriptlets -n %{DAX_LNAME} + +%ldconfig_scriptlets -n %{CXL_LNAME} + +%define bashcompdir %(pkg-config --variable=completionsdir bash-completion) + +%pre +if [ -f %{_sysconfdir}/ndctl/monitor.conf ] ; then + if ! [ -f %{_sysconfdir}/ndctl.conf.d/monitor.conf ] ; then + cp -a %{_sysconfdir}/ndctl/monitor.conf /var/run/ndctl-monitor.conf-migration + fi +fi + +%post +if [ -f /var/run/ndctl-monitor.conf-migration ] ; then + config_found=false + while read line ; do + [ -n "$line" ] || continue + case "$line" in + \#*) continue ;; + esac + config_found=true + break + done < /var/run/ndctl-monitor.conf-migration + if $config_found ; then + echo "[monitor]" > %{_sysconfdir}/ndctl.conf.d/monitor.conf + cat /var/run/ndctl-monitor.conf-migration >> %{_sysconfdir}/ndctl.conf.d/monitor.conf + fi + rm /var/run/ndctl-monitor.conf-migration +fi + +%files +%defattr(-,root,root) +%license LICENSES/preferred/GPL-2.0 LICENSES/other/MIT LICENSES/other/CC0-1.0 +%{_bindir}/ndctl +%{bashcompdir}/ndctl + +%dir %{_sysconfdir}/ndctl +%dir %{_sysconfdir}/ndctl/keys +%{_sysconfdir}/ndctl/keys/keys.readme + +%{_sysconfdir}/modprobe.d/nvdimm-security.conf + +%dir %{_sysconfdir}/ndctl.conf.d +%config(noreplace) %{_sysconfdir}/ndctl.conf.d/monitor.conf +%config(noreplace) %{_sysconfdir}/ndctl.conf.d/ndctl.conf + +%files -n daxctl +%defattr(-,root,root) +%license LICENSES/preferred/GPL-2.0 LICENSES/other/MIT LICENSES/other/CC0-1.0 +%{_bindir}/daxctl +%{_datadir}/daxctl +%{bashcompdir}/daxctl +%dir %{_sysconfdir}/daxctl.conf.d/ +%config(noreplace) %{_sysconfdir}/daxctl.conf.d/daxctl.example.conf + +%files -n cxl-cli +%defattr(-,root,root) +%license LICENSES/preferred/GPL-2.0 LICENSES/other/MIT LICENSES/other/CC0-1.0 +%{_bindir}/cxl +%{bashcompdir}/cxl + +%files -n %{LNAME} +%defattr(-,root,root) +%doc README.md +%license LICENSES/preferred/LGPL-2.1 LICENSES/other/MIT LICENSES/other/CC0-1.0 +%{_libdir}/libndctl.so.* + +%files -n %{DAX_LNAME} +%defattr(-,root,root) +%doc README.md +%license LICENSES/preferred/LGPL-2.1 LICENSES/other/MIT LICENSES/other/CC0-1.0 +%{_libdir}/libdaxctl.so.* + +%files -n %{CXL_LNAME} +%defattr(-,root,root) +%doc README.md +%license LICENSES/preferred/LGPL-2.1 LICENSES/other/MIT LICENSES/other/CC0-1.0 +%{_libdir}/libcxl.so.* + +%files -n %{DNAME} +%defattr(-,root,root) +%license LICENSES/preferred/LGPL-2.1 +%{_includedir}/ndctl/ +%{_libdir}/libndctl.so +%{_libdir}/pkgconfig/libndctl.pc + +%files -n %{DAX_DNAME} +%defattr(-,root,root) +%license LICENSES/preferred/LGPL-2.1 +%{_includedir}/daxctl/ +%{_libdir}/libdaxctl.so +%{_libdir}/pkgconfig/libdaxctl.pc + +%files -n %{CXL_DNAME} +%defattr(-,root,root) +%license LICENSES/preferred/LGPL-2.1 +%{_includedir}/cxl/ +%{_libdir}/libcxl.so +%{_libdir}/pkgconfig/libcxl.pc + + +%changelog