Improve package creation

- ddiskit related modifications
- fix for resolving weak-modules symlinks

Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
This commit is contained in:
Rafal Stefanowski 2022-03-24 12:18:40 +01:00
parent cb8d1cffae
commit d19fc94d14
3 changed files with 16 additions and 11 deletions

View File

@ -26,7 +26,7 @@ OCFDIR=$(PWD)/../ocf
PWD=$(shell pwd) PWD=$(shell pwd)
KERNEL_VERSION ?= "$(shell uname -r)" KERNEL_VERSION ?= "$(shell uname -r)"
KERNEL_DIR ?= "/lib/modules/$(KERNEL_VERSION)/build" KERNEL_DIR ?= "/lib/modules/$(KERNEL_VERSION)/build"
MODULES_DIR=/lib/modules/$(shell uname -r)/extra MODULES_DIR=/lib/modules/$(KERNEL_VERSION)/extra/block/opencas
DISK_MODULE = cas_disk DISK_MODULE = cas_disk
CACHE_MODULE = cas_cache CACHE_MODULE = cas_cache
@ -68,6 +68,7 @@ uninstall:
$(call remove-file,$(DESTDIR)$(MODULES_DIR)/$(CACHE_MODULE).ko) $(call remove-file,$(DESTDIR)$(MODULES_DIR)/$(CACHE_MODULE).ko)
$(call remove-file,$(DESTDIR)$(MODULES_DIR)/$(DISK_MODULE).ko) $(call remove-file,$(DESTDIR)$(MODULES_DIR)/$(DISK_MODULE).ko)
$(call remove-directory,$(DESTDIR)$(MODULES_DIR))
@$(DEPMOD) @$(DEPMOD)

View File

@ -4,8 +4,8 @@ BUILT_MODULE_NAME[0]="cas_disk"
BUILT_MODULE_NAME[1]="cas_cache" BUILT_MODULE_NAME[1]="cas_cache"
BUILT_MODULE_LOCATION[0]="modules/cas_disk/" BUILT_MODULE_LOCATION[0]="modules/cas_disk/"
BUILT_MODULE_LOCATION[1]="modules/cas_cache/" BUILT_MODULE_LOCATION[1]="modules/cas_cache/"
DEST_MODULE_LOCATION[0]="/extra" DEST_MODULE_LOCATION[0]="/extra/block/opencas"
DEST_MODULE_LOCATION[1]="/extra" DEST_MODULE_LOCATION[1]="/extra/block/opencas"
PRE_BUILD="./configure" PRE_BUILD="./configure"
MAKE[0]="make -j -C modules/ KERNEL_VERSION=$kernelver" MAKE[0]="make -j -C modules/ KERNEL_VERSION=$kernelver"
AUTOINSTALL=yes AUTOINSTALL=yes

View File

@ -1,5 +1,5 @@
# #
# Copyright(c) 2020-2021 Intel Corporation # Copyright(c) 2020-2022 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause
# #
@ -108,7 +108,8 @@ if [ $1 -eq 0 ]; then
. /etc/os-release . /etc/os-release
if [[ ! "$ID_LIKE" =~ suse|sles ]]; then if [[ ! "$ID_LIKE" =~ suse|sles ]]; then
# Search for all CAS modules to remove them from weak-modules # Search for all CAS modules to remove them from weak-modules
find /lib/modules/*/extra/ -name "cas_*.ko" >/var/run/rpm-open-cas-linux-modules # Use realpath to resolve any possible symlinks (needed for weak-modules)
realpath $(find /lib/modules/*/extra/block/opencas/ -name "cas_*.ko") >/var/run/rpm-open-cas-linux-modules
fi fi
fi fi
@ -116,8 +117,7 @@ fi
if [ $1 -eq 0 ]; then if [ $1 -eq 0 ]; then
. /etc/os-release . /etc/os-release
if [[ ! "$ID_LIKE" =~ suse|sles ]]; then if [[ ! "$ID_LIKE" =~ suse|sles ]]; then
# realpath to resolve any possible symlinks (needed for weak-modules) modules=( $(cat /var/run/rpm-open-cas-linux-modules) )
modules=( $(realpath $(cat /var/run/rpm-open-cas-linux-modules)) )
rm -f /var/run/rpm-open-cas-linux-modules rm -f /var/run/rpm-open-cas-linux-modules
printf "%s\n" "${modules[@]}" | weak-modules --no-initramfs --remove-modules printf "%s\n" "${modules[@]}" | weak-modules --no-initramfs --remove-modules
fi fi
@ -126,7 +126,7 @@ fi
%files %files
%defattr(-, root, root) %defattr(-, root, root, 755)
%license LICENSE %license LICENSE
%doc README.md %doc README.md
%dir /etc/opencas/ %dir /etc/opencas/
@ -155,12 +155,16 @@ fi
%ghost /lib/opencas/__pycache__ %ghost /lib/opencas/__pycache__
%files modules_%{kver_filename} %files modules_%{kver_filename}
%defattr(-, root, root) %defattr(644, root, root, 755)
/lib/modules/%{kver}/extra/cas_cache.ko %license LICENSE
/lib/modules/%{kver}/extra/cas_disk.ko /lib/modules/%{kver}
%changelog %changelog
* Mon Mar 21 2022 Rafal Stefanowski <rafal.stefanowski@intel.com> - 22.03-1
- Update modules destination directory and permissions
- Add license to modules package
- Fix resolving of weak-modules symlinks
* Mon Nov 22 2021 Michal Mielewczyk <michal.mielewczyk@intel.com> - 21.06-1 * Mon Nov 22 2021 Michal Mielewczyk <michal.mielewczyk@intel.com> - 21.06-1
- Update dependencies - Update dependencies
* Mon Feb 8 2021 Rafal Stefanowski <rafal.stefanowski@intel.com> - 21.03-1 * Mon Feb 8 2021 Rafal Stefanowski <rafal.stefanowski@intel.com> - 21.03-1