From 670e486c48f9b0cd0c06d67ff36671eb65f112ea Mon Sep 17 00:00:00 2001 From: Leonardo Fagundes Luz Serrano Date: Mon, 18 Oct 2021 14:18:59 +0000 Subject: [PATCH] Add debian package for service-mgmt/sm-common Add debian packaging infrastructure for service-mgmt/sm-common to build a debian package. Story: 2009101 Task: 43666 Signed-off-by: Leonardo Fagundes Luz Serrano Change-Id: I2f804e3882d44bd17e6eebc69529f729f83243cf --- .../sm-common/debian/deb_folder/changelog | 5 +++ .../sm-common/debian/deb_folder/compat | 1 + .../sm-common/debian/deb_folder/control | 37 ++++++++++++++++ .../sm-common/debian/deb_folder/copyright | 44 +++++++++++++++++++ .../sm-common/debian/deb_folder/rules | 30 +++++++++++++ .../debian/deb_folder/sm-common-dev.install | 3 ++ .../debian/deb_folder/sm-common-libs.dirs | 3 ++ .../debian/deb_folder/sm-common-libs.install | 2 + .../sm-common-libs.lintian-overrides | 1 + .../debian/deb_folder/sm-common.install | 4 ++ .../debian/deb_folder/sm-eru.install | 5 +++ .../sm-common/debian/deb_folder/source/format | 1 + service-mgmt/sm-common/debian/dl_hook | 11 +++++ service-mgmt/sm-common/debian/meta_data.yaml | 7 +++ service-mgmt/sm-common/src/Makefile | 3 +- service-mgmt/sm-common/src/sm_debug.c | 2 + 16 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 service-mgmt/sm-common/debian/deb_folder/changelog create mode 100644 service-mgmt/sm-common/debian/deb_folder/compat create mode 100644 service-mgmt/sm-common/debian/deb_folder/control create mode 100644 service-mgmt/sm-common/debian/deb_folder/copyright create mode 100755 service-mgmt/sm-common/debian/deb_folder/rules create mode 100644 service-mgmt/sm-common/debian/deb_folder/sm-common-dev.install create mode 100644 service-mgmt/sm-common/debian/deb_folder/sm-common-libs.dirs create mode 100644 service-mgmt/sm-common/debian/deb_folder/sm-common-libs.install create mode 100644 service-mgmt/sm-common/debian/deb_folder/sm-common-libs.lintian-overrides create mode 100644 service-mgmt/sm-common/debian/deb_folder/sm-common.install create mode 100644 service-mgmt/sm-common/debian/deb_folder/sm-eru.install create mode 100644 service-mgmt/sm-common/debian/deb_folder/source/format create mode 100755 service-mgmt/sm-common/debian/dl_hook create mode 100644 service-mgmt/sm-common/debian/meta_data.yaml diff --git a/service-mgmt/sm-common/debian/deb_folder/changelog b/service-mgmt/sm-common/debian/deb_folder/changelog new file mode 100644 index 00000000..fd1f44e0 --- /dev/null +++ b/service-mgmt/sm-common/debian/deb_folder/changelog @@ -0,0 +1,5 @@ +sm-common (1.0.0-1) unstable; urgency=medium + + * Initial release. + + -- Leonardo Fagundes Luz Serrano Tue, 21 Sep 2021 19:52:46 +0000 diff --git a/service-mgmt/sm-common/debian/deb_folder/compat b/service-mgmt/sm-common/debian/deb_folder/compat new file mode 100644 index 00000000..f599e28b --- /dev/null +++ b/service-mgmt/sm-common/debian/deb_folder/compat @@ -0,0 +1 @@ +10 diff --git a/service-mgmt/sm-common/debian/deb_folder/control b/service-mgmt/sm-common/debian/deb_folder/control new file mode 100644 index 00000000..0d4e2bc6 --- /dev/null +++ b/service-mgmt/sm-common/debian/deb_folder/control @@ -0,0 +1,37 @@ +Source: sm-common +Section: admin +Priority: optional +Maintainer: StarlingX Developers +Build-Depends: debhelper (>= 13), + libsqlite3-dev, + libglib2.0-dev, + uuid-dev, + libsystemd-dev +Standards-Version: 4.1.2 +Homepage: https://www.starlingx.io + +Package: sm-common +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, sm-common-libs +Description: Service Management Common + This package handles Service Management Common files + +Package: sm-common-libs +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, + mtce-pmon, sqlite3, systemd +Description: Service Management Common - shared library files + This package contains shared libraries. + +Package: sm-common-dev +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, sm-common-libs +Description: Service Management Common - Development files + This package contains symbolic links, header files, + and related items necessary for software development. + +Package: sm-eru +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, sm-common-libs +Description: Service Management ERU + Service Management Event Recorder Unit diff --git a/service-mgmt/sm-common/debian/deb_folder/copyright b/service-mgmt/sm-common/debian/deb_folder/copyright new file mode 100644 index 00000000..5c61620d --- /dev/null +++ b/service-mgmt/sm-common/debian/deb_folder/copyright @@ -0,0 +1,44 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: sm-common +Upstream-Contact: StarlingX Developers +Source: https://opendev.org/starlingx/ha + +Files: * +Copyright: + (c) 2013-2021 Wind River Systems, Inc + (c) Others (See individual files for more details) +License: Apache-2 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + . + https://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + . + On Debian-based systems the full text of the Apache version 2.0 license + can be found in `/usr/share/common-licenses/Apache-2.0'. + +# If you want to use GPL v2 or later for the /debian/* files use +# the following clauses, or change it to suit. Delete these two lines +Files: debian/* +Copyright: 2021 Wind River Systems, Inc +License: Apache-2 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + . + https://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + . + On Debian-based systems the full text of the Apache version 2.0 license + can be found in `/usr/share/common-licenses/Apache-2.0'. diff --git a/service-mgmt/sm-common/debian/deb_folder/rules b/service-mgmt/sm-common/debian/deb_folder/rules new file mode 100755 index 00000000..fec96232 --- /dev/null +++ b/service-mgmt/sm-common/debian/deb_folder/rules @@ -0,0 +1,30 @@ +#!/usr/bin/make -f + +export ROOT = $(CURDIR)/debian/tmp + +export VER = $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ') +export VER_MJR = $(shell echo $(VER) | cut -d. -f1) + +%: + dh $@ + +override_dh_auto_install: + rm -rf ${ROOT} + $(MAKE) DEST_DIR=${ROOT} \ + BIN_DIR=usr/bin \ + UNIT_DIR=usr/lib/systemd/system \ + LIB_DIR=/usr/lib64 \ + INC_DIR=/usr/include \ + BUILDSUBDIR=$(CURDIR) \ + ETC_DIR=etc \ + VER=${VER} \ + VER_MJR=${VER_MJR} \ + install + +# Prevents dh_fixperms from changing the permissions defined in the makefiles +override_dh_fixperms: + dh_fixperms \ + -Xsm-watchdog* \ + -Xlibsm_common.so.* \ + -Xlibsm_watchdog_nfs.so.* \ + -Xsm-eru* diff --git a/service-mgmt/sm-common/debian/deb_folder/sm-common-dev.install b/service-mgmt/sm-common/debian/deb_folder/sm-common-dev.install new file mode 100644 index 00000000..d2eee9df --- /dev/null +++ b/service-mgmt/sm-common/debian/deb_folder/sm-common-dev.install @@ -0,0 +1,3 @@ +usr/include/* +usr/lib64/*.so +var/lib/sm/watchdog/modules/libsm_watchdog_nfs.so diff --git a/service-mgmt/sm-common/debian/deb_folder/sm-common-libs.dirs b/service-mgmt/sm-common/debian/deb_folder/sm-common-libs.dirs new file mode 100644 index 00000000..c9f53c45 --- /dev/null +++ b/service-mgmt/sm-common/debian/deb_folder/sm-common-libs.dirs @@ -0,0 +1,3 @@ +/var/lib/sm +/var/lib/sm/watchdog +/var/lib/sm/watchdog/modules diff --git a/service-mgmt/sm-common/debian/deb_folder/sm-common-libs.install b/service-mgmt/sm-common/debian/deb_folder/sm-common-libs.install new file mode 100644 index 00000000..d79884cc --- /dev/null +++ b/service-mgmt/sm-common/debian/deb_folder/sm-common-libs.install @@ -0,0 +1,2 @@ +usr/lib64/*.so.* +var/lib/sm/watchdog/modules/*.so.* diff --git a/service-mgmt/sm-common/debian/deb_folder/sm-common-libs.lintian-overrides b/service-mgmt/sm-common/debian/deb_folder/sm-common-libs.lintian-overrides new file mode 100644 index 00000000..1f7ef235 --- /dev/null +++ b/service-mgmt/sm-common/debian/deb_folder/sm-common-libs.lintian-overrides @@ -0,0 +1 @@ +shared-library-is-executable diff --git a/service-mgmt/sm-common/debian/deb_folder/sm-common.install b/service-mgmt/sm-common/debian/deb_folder/sm-common.install new file mode 100644 index 00000000..a50f53a9 --- /dev/null +++ b/service-mgmt/sm-common/debian/deb_folder/sm-common.install @@ -0,0 +1,4 @@ +etc/init.d/sm-watchdog +etc/pmon.d/sm-watchdog.conf +usr/bin/sm-watchdog +usr/lib/systemd/system/sm-watchdog.service diff --git a/service-mgmt/sm-common/debian/deb_folder/sm-eru.install b/service-mgmt/sm-common/debian/deb_folder/sm-eru.install new file mode 100644 index 00000000..e9173081 --- /dev/null +++ b/service-mgmt/sm-common/debian/deb_folder/sm-eru.install @@ -0,0 +1,5 @@ +etc/init.d/sm-eru +etc/pmon.d/sm-eru.conf +usr/bin/sm-eru +usr/bin/sm-eru-dump +usr/lib/systemd/system/sm-eru.service diff --git a/service-mgmt/sm-common/debian/deb_folder/source/format b/service-mgmt/sm-common/debian/deb_folder/source/format new file mode 100644 index 00000000..163aaf8d --- /dev/null +++ b/service-mgmt/sm-common/debian/deb_folder/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/service-mgmt/sm-common/debian/dl_hook b/service-mgmt/sm-common/debian/dl_hook new file mode 100755 index 00000000..5c1b7464 --- /dev/null +++ b/service-mgmt/sm-common/debian/dl_hook @@ -0,0 +1,11 @@ +#!/bin/bash +set -x + +PKG_BUILD_NAME=$1 +PKG_BUILD_ROOT=$(realpath `pwd`/${PKG_BUILD_NAME}) +STX_BASE=$(realpath ${MY_REPO}/stx) +SRC=$(realpath ${STX_BASE}/ha/service-mgmt/sm-common) + +mkdir ${PKG_BUILD_NAME} +pushd ${PKG_BUILD_NAME} +cp -pr ${SRC}/{src,scripts,Makefile} ${PKG_BUILD_ROOT}/ diff --git a/service-mgmt/sm-common/debian/meta_data.yaml b/service-mgmt/sm-common/debian/meta_data.yaml new file mode 100644 index 00000000..e8e3bc48 --- /dev/null +++ b/service-mgmt/sm-common/debian/meta_data.yaml @@ -0,0 +1,7 @@ +--- +debname: sm-common +debver: 1.0.0-1 +dl_hook: dl_hook +revision: + dist: $STX_DIST + PKG_GITREVCOUNT: true diff --git a/service-mgmt/sm-common/src/Makefile b/service-mgmt/sm-common/src/Makefile index 0d5fb3af..3629f8f3 100644 --- a/service-mgmt/sm-common/src/Makefile +++ b/service-mgmt/sm-common/src/Makefile @@ -6,6 +6,7 @@ INCLUDES =-I$(STAGING_DIR)/usr/include/glib-2.0 INCLUDES+=-I$(STAGING_DIR)/usr/lib64/glib-2.0/include -I. +INCLUDES+=-I$(STAGING_DIR)/usr/lib/x86_64-linux-gnu/glib-2.0/include SRCS=sm_types.c SRCS+=sm_debug.c @@ -27,7 +28,7 @@ SRCS+=sm_eru_db.c SRCS+=sm_util_types.c OBJS = $(SRCS:.c=.o) -CCFLAGS= -fPIC -g -O2 -Wall -Werror -std=c++11 +CCFLAGS= -fPIC -g -O2 -Wall -Werror -Wno-restrict -Wno-format-truncation -std=c++11 EXTRACCFLAGS= -D__STDC_FORMAT_MACROS -DSW_VERSION=\"$(SW_VERSION)\" EXTRACCFLAGS+= -Wformat -Wformat-security LDLIBS= -lsqlite3 -lglib-2.0 -lgmodule-2.0 -luuid -lrt -lpthread diff --git a/service-mgmt/sm-common/src/sm_debug.c b/service-mgmt/sm-common/src/sm_debug.c index b85f91cb..9d9c6c13 100644 --- a/service-mgmt/sm-common/src/sm_debug.c +++ b/service-mgmt/sm-common/src/sm_debug.c @@ -236,9 +236,11 @@ void sm_debug_sched_log_done( char* domain ) } else { if (_print_sched_log) + { sm_debug_log( SM_DEBUG_SCHED_LOG, "%s: no scheduling changes " "required.", domain ); _print_sched_log = false; + } } } }