diff --git a/Makefile b/Makefile index 6d8c2e4..7a6791a 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # -# Copyright(c) 2012-2021 Intel Corporation +# Copyright(c) 2012-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -30,13 +30,13 @@ archives: @tools/pckgen $(PWD) tar zip rpm: - @tools/pckgen $(PWD) rpm + @tools/pckgen $(PWD) rpm --debug srpm: @tools/pckgen $(PWD) srpm deb: - @tools/pckgen $(PWD) deb + @tools/pckgen $(PWD) deb --debug dsc: @tools/pckgen $(PWD) dsc diff --git a/casadm/Makefile b/casadm/Makefile index d48a18f..3d44ee9 100644 --- a/casadm/Makefile +++ b/casadm/Makefile @@ -78,6 +78,9 @@ CFLAGS += -O0 -g else CFLAGS += -O2 -D_FORTIFY_SOURCE=2 endif +ifdef DEBUG_PACKAGE +CFLAGS += -g3 +endif CFLAGS += -Wall -Werror -z relro -z now -fstack-protector -fPIC -Wformat -Wformat-security -fno-strict-aliasing # diff --git a/tools/pckgen b/tools/pckgen index 7446e9c..518c511 100755 --- a/tools/pckgen +++ b/tools/pckgen @@ -72,7 +72,7 @@ print_help() { echo " -a, --arch target platform architecture for packages" echo " -o, --output-dir put all created files in the given directory;" 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 " may have been left around if $THIS ended" echo " unexpectedly in the previous run" @@ -302,12 +302,18 @@ rpm_spec_prepare() { sed -i "s||$CAS_MODULES_DIR|g" "$RPM_SPECS_DIR/$CAS_NAME.spec" sed -i "s//${CAS_HOMEPAGE//\//\\/}/g" "$RPM_SPECS_DIR/$CAS_NAME.spec" sed -i "s//$PACKAGE_MAINTAINER/g" "$RPM_SPECS_DIR/$CAS_NAME.spec" + if [ "$DEBUG" ]; then - echo "--- Debug RPMs will be built as well" - sed -i "s/%define debug_package %{nil}//g" "$RPM_SPECS_DIR/$CAS_NAME.spec" + echo "--- Debug info will be included and debug packages created as well" + + sed -i "s//%make_build DEBUG_PACKAGE=1/g" "$RPM_SPECS_DIR/$CAS_NAME.spec" + sed -i "//d" "$RPM_SPECS_DIR/$CAS_NAME.spec" 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 + else + sed -i "s//%make_build/g" "$RPM_SPECS_DIR/$CAS_NAME.spec" + sed -i "s//%define debug_package %{nil}/g" "$RPM_SPECS_DIR/$CAS_NAME.spec" fi if [ ! -f "$RPM_SPECS_DIR/$CAS_NAME.spec" ]; then @@ -349,6 +355,16 @@ deb_control_files_prepare() { sed -i "s//$PACKAGE_MAINTAINER/g" "$file" sed -i "s//$PACKAGE_DATE/g" "$file" done + + if [ "$DEBUG" ]; then + echo "--- Debug info will be included and debug packages created as well" + + sed -i "s//make -C casadm DEBUG_PACKAGE=1/g" "$DEB_SOURCES_DIR/debian/rules" + sed -i "s//dh_strip --ddebs/g" "$DEB_SOURCES_DIR/debian/rules" + else + sed -i "s//make -C casadm/g" "$DEB_SOURCES_DIR/debian/rules" + sed -i "s//dh_strip --no-ddebs/g" "$DEB_SOURCES_DIR/debian/rules" + fi } generate_rpm() { diff --git a/tools/pckgen.d/deb/debian/changelog b/tools/pckgen.d/deb/debian/changelog index d12584b..34c7a94 100644 --- a/tools/pckgen.d/deb/debian/changelog +++ b/tools/pckgen.d/deb/debian/changelog @@ -4,6 +4,12 @@ -- +open-cas-linux (22.03.0.0683-1) trusty; urgency=medium + + * Fix debug packages creation + + -- Rafal Stefanowski Wed, 18 May 2022 12:03:22 +0100 + open-cas-linux (20.03.3.0303-1) trusty; urgency=medium * Update dependencies diff --git a/tools/pckgen.d/deb/debian/rules b/tools/pckgen.d/deb/debian/rules index 005e82c..eec70ba 100755 --- a/tools/pckgen.d/deb/debian/rules +++ b/tools/pckgen.d/deb/debian/rules @@ -10,26 +10,29 @@ %: 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) - make -C casadm + -override_dh_auto_install : +override_dh_auto_install: (cd casadm; 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 make distclean (cd tools/; ./cas_version_gen) -override_dh_dkms : +override_dh_dkms: dh_dkms -V $(DEB_VERSION_UPSTREAM) -override_dh_installsystemd : +override_dh_installsystemd: dh_installsystemd --no-start -override_dh_missing : +override_dh_strip: + -override_dh_gencontrol : +override_dh_missing: + +override_dh_gencontrol: dh_gencontrol -- -Vkver="$(shell uname -r)" diff --git a/tools/pckgen.d/rpm/CAS_NAME.spec b/tools/pckgen.d/rpm/CAS_NAME.spec index 43fc2b8..39f54a8 100644 --- a/tools/pckgen.d/rpm/CAS_NAME.spec +++ b/tools/pckgen.d/rpm/CAS_NAME.spec @@ -11,7 +11,7 @@ %global __python %{__python3} -%define debug_package %{nil} + %define kver %(uname -r) %define kver_filename k%{expand:%(kname="%{kver}"; echo "${kname%.*}" | sed -r "y/-/_/;")} @@ -56,7 +56,7 @@ This package contains only CAS kernel modules. %build ./configure -%make_build + %install