packaging: Fix debug package build
For debug symbols packages to build properly, we need to instruct the compiler to produce debugging information during the compilation process by adding a proper flag. Additionally there is no point to create packages with debug info in normal build, because it may crash the package creation process if no debug info is found. Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
This commit is contained in:
parent
8938310b61
commit
63f1c162b6
6
Makefile
6
Makefile
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2012-2021 Intel Corporation
|
# Copyright(c) 2012-2022 Intel Corporation
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -30,13 +30,13 @@ archives:
|
|||||||
@tools/pckgen $(PWD) tar zip
|
@tools/pckgen $(PWD) tar zip
|
||||||
|
|
||||||
rpm:
|
rpm:
|
||||||
@tools/pckgen $(PWD) rpm
|
@tools/pckgen $(PWD) rpm --debug
|
||||||
|
|
||||||
srpm:
|
srpm:
|
||||||
@tools/pckgen $(PWD) srpm
|
@tools/pckgen $(PWD) srpm
|
||||||
|
|
||||||
deb:
|
deb:
|
||||||
@tools/pckgen $(PWD) deb
|
@tools/pckgen $(PWD) deb --debug
|
||||||
|
|
||||||
dsc:
|
dsc:
|
||||||
@tools/pckgen $(PWD) dsc
|
@tools/pckgen $(PWD) dsc
|
||||||
|
@ -78,6 +78,9 @@ CFLAGS += -O0 -g
|
|||||||
else
|
else
|
||||||
CFLAGS += -O2 -D_FORTIFY_SOURCE=2
|
CFLAGS += -O2 -D_FORTIFY_SOURCE=2
|
||||||
endif
|
endif
|
||||||
|
ifdef DEBUG_PACKAGE
|
||||||
|
CFLAGS += -g3
|
||||||
|
endif
|
||||||
CFLAGS += -Wall -Werror -z relro -z now -fstack-protector -fPIC -Wformat -Wformat-security -fno-strict-aliasing
|
CFLAGS += -Wall -Werror -z relro -z now -fstack-protector -fPIC -Wformat -Wformat-security -fno-strict-aliasing
|
||||||
|
|
||||||
#
|
#
|
||||||
|
24
tools/pckgen
24
tools/pckgen
@ -72,7 +72,7 @@ print_help() {
|
|||||||
echo " -a, --arch <ARCH> target platform architecture for packages"
|
echo " -a, --arch <ARCH> target platform architecture for packages"
|
||||||
echo " -o, --output-dir <DIR> put all created files in the given directory;"
|
echo " -o, --output-dir <DIR> put all created files in the given directory;"
|
||||||
echo " default: 'SOURCES_PATH/packages/'"
|
echo " default: 'SOURCES_PATH/packages/'"
|
||||||
echo " -d, --debug create all debug files and packages as well"
|
echo " -d, --debug include debug information and create debug packages"
|
||||||
echo " -c, --clean clean all temporary files and folders that"
|
echo " -c, --clean clean all temporary files and folders that"
|
||||||
echo " may have been left around if $THIS ended"
|
echo " may have been left around if $THIS ended"
|
||||||
echo " unexpectedly in the previous run"
|
echo " unexpectedly in the previous run"
|
||||||
@ -302,12 +302,18 @@ rpm_spec_prepare() {
|
|||||||
sed -i "s|<CAS_MODULES_DIR>|$CAS_MODULES_DIR|g" "$RPM_SPECS_DIR/$CAS_NAME.spec"
|
sed -i "s|<CAS_MODULES_DIR>|$CAS_MODULES_DIR|g" "$RPM_SPECS_DIR/$CAS_NAME.spec"
|
||||||
sed -i "s/<CAS_HOMEPAGE>/${CAS_HOMEPAGE//\//\\/}/g" "$RPM_SPECS_DIR/$CAS_NAME.spec"
|
sed -i "s/<CAS_HOMEPAGE>/${CAS_HOMEPAGE//\//\\/}/g" "$RPM_SPECS_DIR/$CAS_NAME.spec"
|
||||||
sed -i "s/<PACKAGE_MAINTAINER>/$PACKAGE_MAINTAINER/g" "$RPM_SPECS_DIR/$CAS_NAME.spec"
|
sed -i "s/<PACKAGE_MAINTAINER>/$PACKAGE_MAINTAINER/g" "$RPM_SPECS_DIR/$CAS_NAME.spec"
|
||||||
|
|
||||||
if [ "$DEBUG" ]; then
|
if [ "$DEBUG" ]; then
|
||||||
echo "--- Debug RPMs will be built as well"
|
echo "--- Debug info will be included and debug packages created as well"
|
||||||
sed -i "s/%define debug_package %{nil}//g" "$RPM_SPECS_DIR/$CAS_NAME.spec"
|
|
||||||
|
sed -i "s/<MAKE_BUILD>/%make_build DEBUG_PACKAGE=1/g" "$RPM_SPECS_DIR/$CAS_NAME.spec"
|
||||||
|
sed -i "/<DEBUG_PACKAGE>/d" "$RPM_SPECS_DIR/$CAS_NAME.spec"
|
||||||
if [[ $(check_os) =~ suse|sles ]]; then
|
if [[ $(check_os) =~ suse|sles ]]; then
|
||||||
sed -i "s/%prep/%debug_package\n\n\n%prep/g" "$RPM_SPECS_DIR/$CAS_NAME.spec"
|
sed -i "/%prep/i %debug_package\n\n" "$RPM_SPECS_DIR/$CAS_NAME.spec"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
sed -i "s/<MAKE_BUILD>/%make_build/g" "$RPM_SPECS_DIR/$CAS_NAME.spec"
|
||||||
|
sed -i "s/<DEBUG_PACKAGE>/%define debug_package %{nil}/g" "$RPM_SPECS_DIR/$CAS_NAME.spec"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "$RPM_SPECS_DIR/$CAS_NAME.spec" ]; then
|
if [ ! -f "$RPM_SPECS_DIR/$CAS_NAME.spec" ]; then
|
||||||
@ -349,6 +355,16 @@ deb_control_files_prepare() {
|
|||||||
sed -i "s/<PACKAGE_MAINTAINER>/$PACKAGE_MAINTAINER/g" "$file"
|
sed -i "s/<PACKAGE_MAINTAINER>/$PACKAGE_MAINTAINER/g" "$file"
|
||||||
sed -i "s/<PACKAGE_DATE>/$PACKAGE_DATE/g" "$file"
|
sed -i "s/<PACKAGE_DATE>/$PACKAGE_DATE/g" "$file"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ "$DEBUG" ]; then
|
||||||
|
echo "--- Debug info will be included and debug packages created as well"
|
||||||
|
|
||||||
|
sed -i "s/<MAKE_BUILD>/make -C casadm DEBUG_PACKAGE=1/g" "$DEB_SOURCES_DIR/debian/rules"
|
||||||
|
sed -i "s/<DEBUG_PACKAGE>/dh_strip --ddebs/g" "$DEB_SOURCES_DIR/debian/rules"
|
||||||
|
else
|
||||||
|
sed -i "s/<MAKE_BUILD>/make -C casadm/g" "$DEB_SOURCES_DIR/debian/rules"
|
||||||
|
sed -i "s/<DEBUG_PACKAGE>/dh_strip --no-ddebs/g" "$DEB_SOURCES_DIR/debian/rules"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_rpm() {
|
generate_rpm() {
|
||||||
|
@ -4,6 +4,12 @@
|
|||||||
|
|
||||||
-- <PACKAGE_MAINTAINER> <PACKAGE_DATE>
|
-- <PACKAGE_MAINTAINER> <PACKAGE_DATE>
|
||||||
|
|
||||||
|
open-cas-linux (22.03.0.0683-1) trusty; urgency=medium
|
||||||
|
|
||||||
|
* Fix debug packages creation
|
||||||
|
|
||||||
|
-- Rafal Stefanowski <rafal.stefanowski@intel.com> Wed, 18 May 2022 12:03:22 +0100
|
||||||
|
|
||||||
open-cas-linux (20.03.3.0303-1) trusty; urgency=medium
|
open-cas-linux (20.03.3.0303-1) trusty; urgency=medium
|
||||||
|
|
||||||
* Update dependencies
|
* Update dependencies
|
||||||
|
@ -10,26 +10,29 @@
|
|||||||
%:
|
%:
|
||||||
dh $@ --with dkms
|
dh $@ --with dkms
|
||||||
|
|
||||||
override_dh_auto_configure :
|
override_dh_auto_configure:
|
||||||
|
|
||||||
override_dh_auto_build :
|
override_dh_auto_build:
|
||||||
(cd tools/; ./cas_version_gen build)
|
(cd tools/; ./cas_version_gen build)
|
||||||
make -C casadm
|
<MAKE_BUILD>
|
||||||
|
|
||||||
override_dh_auto_install :
|
override_dh_auto_install:
|
||||||
(cd casadm; make install_files DESTDIR="$(shell pwd)/debian/tmp")
|
(cd casadm; make install_files DESTDIR="$(shell pwd)/debian/tmp")
|
||||||
(cd utils; make install_files DESTDIR="$(shell pwd)/debian/tmp")
|
(cd utils; make install_files DESTDIR="$(shell pwd)/debian/tmp")
|
||||||
# clean and generate version again before installing sources for DKMS
|
# clean and generate version again before installing sources for DKMS
|
||||||
make distclean
|
make distclean
|
||||||
(cd tools/; ./cas_version_gen)
|
(cd tools/; ./cas_version_gen)
|
||||||
|
|
||||||
override_dh_dkms :
|
override_dh_dkms:
|
||||||
dh_dkms -V $(DEB_VERSION_UPSTREAM)
|
dh_dkms -V $(DEB_VERSION_UPSTREAM)
|
||||||
|
|
||||||
override_dh_installsystemd :
|
override_dh_installsystemd:
|
||||||
dh_installsystemd --no-start
|
dh_installsystemd --no-start
|
||||||
|
|
||||||
override_dh_missing :
|
override_dh_strip:
|
||||||
|
<DEBUG_PACKAGE>
|
||||||
|
|
||||||
override_dh_gencontrol :
|
override_dh_missing:
|
||||||
|
|
||||||
|
override_dh_gencontrol:
|
||||||
dh_gencontrol -- -Vkver="$(shell uname -r)"
|
dh_gencontrol -- -Vkver="$(shell uname -r)"
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
|
|
||||||
%global __python %{__python3}
|
%global __python %{__python3}
|
||||||
%define debug_package %{nil}
|
<DEBUG_PACKAGE>
|
||||||
%define kver %(uname -r)
|
%define kver %(uname -r)
|
||||||
%define kver_filename k%{expand:%(kname="%{kver}"; echo "${kname%.*}" | sed -r "y/-/_/;")}
|
%define kver_filename k%{expand:%(kname="%{kver}"; echo "${kname%.*}" | sed -r "y/-/_/;")}
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ This package contains only CAS kernel modules.
|
|||||||
|
|
||||||
%build
|
%build
|
||||||
./configure
|
./configure
|
||||||
%make_build
|
<MAKE_BUILD>
|
||||||
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
|
Loading…
Reference in New Issue
Block a user