Move build system tools to separate directory

Separate tools used internally by build system from utilities that are
part of Open CAS installation package.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Robert Baldyga
2021-03-19 13:35:54 +01:00
parent feaafdfe06
commit e58dae02ac
17 changed files with 12 additions and 12 deletions

View File

@@ -0,0 +1,11 @@
PACKAGE_NAME="<CAS_NAME>-modules"
PACKAGE_VERSION="#MODULE_VERSION#"
BUILT_MODULE_NAME[0]="cas_disk"
BUILT_MODULE_NAME[1]="cas_cache"
BUILT_MODULE_LOCATION[0]="modules/cas_disk/"
BUILT_MODULE_LOCATION[1]="modules/cas_cache/"
DEST_MODULE_LOCATION[0]="/extra"
DEST_MODULE_LOCATION[1]="/extra"
PRE_BUILD="./configure"
MAKE[0]="make -j -C modules/ KERNEL_VERSION=$kernelver"
AUTOINSTALL=yes

View File

@@ -0,0 +1,9 @@
./.metadata/* usr/src/<CAS_NAME>-modules-<CAS_VERSION>/.metadata/
./modules/* usr/src/<CAS_NAME>-modules-<CAS_VERSION>/modules/
./ocf/* usr/src/<CAS_NAME>-modules-<CAS_VERSION>/ocf/
./utils/* usr/src/<CAS_NAME>-modules-<CAS_VERSION>/utils/
./configure.d/* usr/src/<CAS_NAME>-modules-<CAS_VERSION>/configure.d/
./configure usr/src/<CAS_NAME>-modules-<CAS_VERSION>/
./Makefile usr/src/<CAS_NAME>-modules-<CAS_VERSION>/
./LICENSE usr/src/<CAS_NAME>-modules-<CAS_VERSION>/
./version usr/src/<CAS_NAME>-modules-<CAS_VERSION>/

View File

@@ -0,0 +1 @@
README.md

View File

@@ -0,0 +1,8 @@
etc/
lib/opencas/
lib/udev/
sbin/
var/
utils/open-cas.shutdown lib/systemd/system-shutdown/
utils/open-cas.service lib/systemd/system/
utils/open-cas-shutdown.service lib/systemd/system/

View File

@@ -0,0 +1,3 @@
utils/opencas.conf.5
utils/casadm.8
utils/casctl.8

View File

@@ -0,0 +1,17 @@
<CAS_NAME> (<CAS_VERSION>-1) trusty; urgency=medium
* pckgen: automated package generation
-- <PACKAGE_MAINTAINER> <PACKAGE_DATE>
open-cas-linux (20.03.3.0303-1) trusty; urgency=medium
* Add DKMS support
-- Robert Baldyga <robert.baldyga@intel.com> Mon, 02 Nov 2020 18:47:04 +0200
open-cas-linux (20.03.2.0295-1) trusty; urgency=medium
* Initial OpenCAS DEB package release
-- Rafal Stefanowski <rafal.stefanowski@intel.com> Mon, 07 Sep 2020 14:17:04 +0200

View File

@@ -0,0 +1 @@
12

View File

@@ -0,0 +1,30 @@
Source: <CAS_NAME>
Section: utils
Priority: optional
Maintainer: <PACKAGE_MAINTAINER>
Build-Depends: debhelper (>= 11), gawk, libelf-dev, linux-headers-generic, dkms
Standards-Version: 4.1.2
Homepage: <CAS_HOMEPAGE>
Vcs-Git: <CAS_GIT>
Package: <CAS_NAME>
Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends}, python3,
<CAS_NAME>-modules (= <CAS_VERSION>-1)
Description: Open Cache Acceleration Software
Open Cache Acceleration Software (Open CAS) is an open source project
encompassing block caching software libraries, adapters, tools and more.
The main goal of this cache acceleration software is to accelerate a
backend block device(s) by utilizing a higher performance device(s).
This package contains tools and utilities for managing CAS and monitor
running cache instances (no kernel modules).
Package: <CAS_NAME>-modules
Architecture: amd64
Depends: ${misc:Depends}, debhelper (>= 9), dkms
Description: Open Cache Acceleration Software kernel modules (${kver})
Open Cache Acceleration Software (Open CAS) is an open source project
encompassing block caching software libraries, adapters, tools and more.
The main goal of this cache acceleration software is to accelerate a
backend block device(s) by utilizing a higher performance device(s).
This package contains only CAS kernel modules.

View File

@@ -0,0 +1,7 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Intel Corporation
Source: <CAS_GIT>
Files: *
Copyright: 2019-2021 Intel Corporation
License: <CAS_LICENSE_NAME>

31
tools/pckgen.d/deb/debian/rules Executable file
View File

@@ -0,0 +1,31 @@
#!/usr/bin/make -f
# output every command that modifies files on the build system
#export DH_VERBOSE = 1
%:
dh $@ --with dkms
override_dh_auto_configure :
override_dh_auto_build :
(cd utils/; ./cas_version_gen build)
make -C casadm
override_dh_auto_install :
make -C casadm install_files DESTDIR="$(shell pwd)/debian/tmp"
make -C utils install_files DESTDIR="$(shell pwd)/debian/tmp"
# clean and generate version again before installing sources for DKMS
make distclean
(cd utils/; ./cas_version_gen)
override_dh_dkms :
dh_dkms -V $(DEB_VERSION_UPSTREAM)
override_dh_installsystemd :
dh_installsystemd --no-start
override_dh_missing :
override_dh_gencontrol :
dh_gencontrol -- -Vkver="$(shell uname -r)"

View File

@@ -0,0 +1 @@
3.0 (quilt)

View File

@@ -0,0 +1,175 @@
#
# Copyright(c) 2020-2021 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
#
# This is a template SPEC file for generating OpenCAS RPMs automatically.
# It contains tags in form of <TAG> which are substituted with particular
# values in the build time.
#
%global __python %{__python3}
%define debug_package %{nil}
%define kver %(uname -r)
%define kver_filename k%{expand:%(kname="%{kver}"; echo "${kname%.*}" | sed -r "y/-/_/;")}
Name: <CAS_NAME>
Version: <CAS_VERSION>
Release: 1%{?dist}
Summary: Open Cache Acceleration Software
Group: System
Vendor: Intel Corporation
License: <CAS_LICENSE_NAME>
URL: <CAS_HOMEPAGE>
Source0: https://github.com/Open-CAS/open-cas-linux/releases/download/v%{version}/%{name}-%{version}.tar.gz
Packager: <PACKAGE_MAINTAINER>
BuildRequires: coreutils, gawk, gcc, kernel-devel, kernel-headers, make
Requires: <CAS_NAME>-modules-%{version}, python3, sed
%description
Open Cache Acceleration Software (Open CAS) is an open source project
encompassing block caching software libraries, adapters, tools and more.
The main goal of this cache acceleration software is to accelerate a
backend block device(s) by utilizing a higher performance device(s).
This package contains tools and utilities for managing CAS and monitor
running cache instances.
%package modules_%{kver_filename}
Summary: Open Cache Acceleration Software kernel modules
Group: System
Requires: kmod
Provides: <CAS_NAME>-modules-%{version}
%description modules_%{kver_filename}
Open Cache Acceleration Software (Open CAS) is an open source project
encompassing block caching software libraries, adapters, tools and more.
The main goal of this cache acceleration software is to accelerate a
backend block device(s) by utilizing a higher performance device(s).
This package contains only CAS kernel modules.
%prep
%setup -q
%build
./configure
%make_build
%install
rm -rf $RPM_BUILD_ROOT
/usr/bin/make install_files DESTDIR=$RPM_BUILD_ROOT
%post
systemctl daemon-reload
systemctl -q enable open-cas-shutdown
systemctl -q enable open-cas
%preun
if [ $1 -eq 0 ]; then
systemctl -q disable open-cas-shutdown
systemctl -q disable open-cas
rm -rf /lib/opencas/{__pycache__,*.py[co]} &>/dev/null
fi
%postun
if [ $1 -eq 0 ]; then
systemctl daemon-reload
fi
%post modules_%{kver_filename}
depmod
. /etc/os-release
if [[ ! "$ID_LIKE" =~ suse|sles ]]; then
# Determine the exact location of installed modules to add them to weak-modules
for file in $(rpm -ql $(rpm -qa | grep <CAS_NAME>-modules)); do
if [[ "$file" =~ cas_.*\.ko$ ]]; then
# realpath to resolve any possible symlinks (needed for weak-modules)
modules+=( $(realpath "$file") )
fi
done
printf "%s\n" "${modules[@]}" | weak-modules --no-initramfs --add-modules
fi
%preun modules_%{kver_filename}
if [ $1 -eq 0 ]; then
. /etc/os-release
if [[ ! "$ID_LIKE" =~ suse|sles ]]; then
# 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
fi
fi
%postun modules_%{kver_filename}
if [ $1 -eq 0 ]; then
. /etc/os-release
if [[ ! "$ID_LIKE" =~ suse|sles ]]; then
# realpath to resolve any possible symlinks (needed for weak-modules)
modules=( $(realpath $(cat /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
fi
depmod
fi
%files
%defattr(-, root, root)
%license LICENSE
%doc README.md
%dir /etc/opencas/
%dir /lib/opencas/
%dir /var/lib/opencas
%config /etc/opencas/opencas.conf
/etc/opencas/ioclass-config.csv
/etc/dracut.conf.d/opencas.conf
/var/lib/opencas/cas_version
/lib/opencas/casctl
/lib/opencas/open-cas-loader
/lib/opencas/opencas.py
/lib/udev/rules.d/60-persistent-storage-cas-load.rules
/lib/udev/rules.d/60-persistent-storage-cas.rules
/sbin/casadm
/sbin/casctl
/usr/lib/systemd/system-shutdown/open-cas.shutdown
/usr/lib/systemd/system/open-cas-shutdown.service
/usr/lib/systemd/system/open-cas.service
/usr/share/man/man5/opencas.conf.5.gz
/usr/share/man/man8/casadm.8.gz
/usr/share/man/man8/casctl.8.gz
%ghost /var/log/opencas.log
%ghost /lib/opencas/opencas.pyc
%ghost /lib/opencas/opencas.pyo
%ghost /lib/opencas/__pycache__
%files modules_%{kver_filename}
%defattr(-, root, root)
/lib/modules/%{kver}/extra/cas_cache.ko
/lib/modules/%{kver}/extra/cas_disk.ko
%changelog
* Mon Feb 8 2021 Rafal Stefanowski <rafal.stefanowski@intel.com> - 21.03-1
- Improve python files handling
* Tue Jan 5 2021 Rafal Stefanowski <rafal.stefanowski@intel.com> - 20.12-1
- Fix resolving modules path for weak-modules
* Fri Sep 11 2020 Rafal Stefanowski <rafal.stefanowski@intel.com> - 20.09-1
- SLES related modifications
- Add some missing info about a package
* Thu Jul 30 2020 Rafal Stefanowski <rafal.stefanowski@intel.com> - 20.09-1
- Improve adding and removing modules with weak-modules
* Wed Jun 10 2020 Rafal Stefanowski <rafal.stefanowski@intel.com> - 20.06-1
- Add cas_version file
- Join Release into Version
- Simplify prep setup
* Tue Feb 25 2020 Rafal Stefanowski <rafal.stefanowski@intel.com> - 20.3-1
- Minor improvements in SPEC file
- Update files list for releases > 20.1
* Thu Feb 06 2020 Rafal Stefanowski <rafal.stefanowski@intel.com> - 20.1-1
- Create this SPEC file for OpenCAS release 20.1