From b091500aa816c17f70ef8e4fbd14121c9d2c240e Mon Sep 17 00:00:00 2001 From: Leonardo Fagundes Luz Serrano Date: Wed, 20 Oct 2021 13:40:45 +0000 Subject: [PATCH] Add debian package for service-mgmt/sm-db Add debian packaging infrastructure for service-mgmt/sm-db to build a debian package. Story: 2009101 Task: 43700 Signed-off-by: Leonardo Fagundes Luz Serrano Change-Id: I88004efa3755c6af008d7fb0707388d4c8c824e8 --- .../sm-db/debian/deb_folder/changelog | 5 +++ service-mgmt/sm-db/debian/deb_folder/compat | 1 + service-mgmt/sm-db/debian/deb_folder/control | 25 +++++++++++ .../sm-db/debian/deb_folder/copyright | 44 +++++++++++++++++++ service-mgmt/sm-db/debian/deb_folder/rules | 26 +++++++++++ .../sm-db/debian/deb_folder/sm-db-dev.install | 2 + .../sm-db/debian/deb_folder/sm-db.install | 6 +++ .../debian/deb_folder/sm-db.lintian-overrides | 1 + .../sm-db/debian/deb_folder/source/format | 1 + service-mgmt/sm-db/debian/dl_hook | 11 +++++ service-mgmt/sm-db/debian/meta_data.yaml | 7 +++ service-mgmt/sm-db/src/Makefile | 3 +- 12 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 service-mgmt/sm-db/debian/deb_folder/changelog create mode 100644 service-mgmt/sm-db/debian/deb_folder/compat create mode 100644 service-mgmt/sm-db/debian/deb_folder/control create mode 100644 service-mgmt/sm-db/debian/deb_folder/copyright create mode 100755 service-mgmt/sm-db/debian/deb_folder/rules create mode 100644 service-mgmt/sm-db/debian/deb_folder/sm-db-dev.install create mode 100644 service-mgmt/sm-db/debian/deb_folder/sm-db.install create mode 100644 service-mgmt/sm-db/debian/deb_folder/sm-db.lintian-overrides create mode 100644 service-mgmt/sm-db/debian/deb_folder/source/format create mode 100755 service-mgmt/sm-db/debian/dl_hook create mode 100644 service-mgmt/sm-db/debian/meta_data.yaml diff --git a/service-mgmt/sm-db/debian/deb_folder/changelog b/service-mgmt/sm-db/debian/deb_folder/changelog new file mode 100644 index 00000000..62cf7dd5 --- /dev/null +++ b/service-mgmt/sm-db/debian/deb_folder/changelog @@ -0,0 +1,5 @@ +sm-db (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-db/debian/deb_folder/compat b/service-mgmt/sm-db/debian/deb_folder/compat new file mode 100644 index 00000000..f599e28b --- /dev/null +++ b/service-mgmt/sm-db/debian/deb_folder/compat @@ -0,0 +1 @@ +10 diff --git a/service-mgmt/sm-db/debian/deb_folder/control b/service-mgmt/sm-db/debian/deb_folder/control new file mode 100644 index 00000000..d87a33e7 --- /dev/null +++ b/service-mgmt/sm-db/debian/deb_folder/control @@ -0,0 +1,25 @@ +Source: sm-db +Section: admin +Priority: optional +Maintainer: StarlingX Developers +Build-Depends: debhelper (>= 13), + sm-common-dev, + libglib2.0-dev, + libsqlite3-dev, + uuid-dev, + sqlite3 +Standards-Version: 4.1.2 +Homepage: https://www.starlingx.io + +Package: sm-db +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Service Management Databases + This package handles the Service Management Databases + +Package: sm-db-dev +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, sm-db +Description: Service Management Databases - Development files + This package contains symbolic links, header files, + and related items necessary for software development. diff --git a/service-mgmt/sm-db/debian/deb_folder/copyright b/service-mgmt/sm-db/debian/deb_folder/copyright new file mode 100644 index 00000000..cad101c8 --- /dev/null +++ b/service-mgmt/sm-db/debian/deb_folder/copyright @@ -0,0 +1,44 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: sm-db +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-db/debian/deb_folder/rules b/service-mgmt/sm-db/debian/deb_folder/rules new file mode 100755 index 00000000..8b1fbc92 --- /dev/null +++ b/service-mgmt/sm-db/debian/deb_folder/rules @@ -0,0 +1,26 @@ +#!/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_build: + sqlite3 database/sm.db < database/create_sm_db.sql + sqlite3 database/sm.hb.db < database/create_sm_hb_db.sql + dh_auto_build + +override_dh_auto_install: + rm -rf ${ROOT} + $(MAKE) DEST_DIR=${ROOT} \ + VER=$(VER) \ + VER_MJR=$(VER_MJR) \ + install + +# Prevents dh_fixperms from changing the permissions defined in the makefiles +override_dh_fixperms: + dh_fixperms \ + -Xlibsm_db.so.* + diff --git a/service-mgmt/sm-db/debian/deb_folder/sm-db-dev.install b/service-mgmt/sm-db/debian/deb_folder/sm-db-dev.install new file mode 100644 index 00000000..f1fd7d42 --- /dev/null +++ b/service-mgmt/sm-db/debian/deb_folder/sm-db-dev.install @@ -0,0 +1,2 @@ +usr/lib64/libsm_db.so +usr/include/*.h diff --git a/service-mgmt/sm-db/debian/deb_folder/sm-db.install b/service-mgmt/sm-db/debian/deb_folder/sm-db.install new file mode 100644 index 00000000..1c04a895 --- /dev/null +++ b/service-mgmt/sm-db/debian/deb_folder/sm-db.install @@ -0,0 +1,6 @@ +usr/lib64/libsm_db.so.* +var/lib/sm/patches/sm-patch.sql + +# Marked on centos .spec file as "%config(noreplace)" +var/lib/sm/sm.hb.db +var/lib/sm/sm.db diff --git a/service-mgmt/sm-db/debian/deb_folder/sm-db.lintian-overrides b/service-mgmt/sm-db/debian/deb_folder/sm-db.lintian-overrides new file mode 100644 index 00000000..1f7ef235 --- /dev/null +++ b/service-mgmt/sm-db/debian/deb_folder/sm-db.lintian-overrides @@ -0,0 +1 @@ +shared-library-is-executable diff --git a/service-mgmt/sm-db/debian/deb_folder/source/format b/service-mgmt/sm-db/debian/deb_folder/source/format new file mode 100644 index 00000000..163aaf8d --- /dev/null +++ b/service-mgmt/sm-db/debian/deb_folder/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/service-mgmt/sm-db/debian/dl_hook b/service-mgmt/sm-db/debian/dl_hook new file mode 100755 index 00000000..22dc0c04 --- /dev/null +++ b/service-mgmt/sm-db/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-db) + +mkdir ${PKG_BUILD_NAME} +pushd ${PKG_BUILD_NAME} +cp -pr ${SRC}/{src,database,Makefile} ${PKG_BUILD_ROOT}/ diff --git a/service-mgmt/sm-db/debian/meta_data.yaml b/service-mgmt/sm-db/debian/meta_data.yaml new file mode 100644 index 00000000..cad497ef --- /dev/null +++ b/service-mgmt/sm-db/debian/meta_data.yaml @@ -0,0 +1,7 @@ +--- +debname: sm-db +debver: 1.0.0-1 +dl_hook: dl_hook +revision: + dist: $STX_DIST + PKG_GITREVCOUNT: true diff --git a/service-mgmt/sm-db/src/Makefile b/service-mgmt/sm-db/src/Makefile index a29b1aca..e30ecaff 100644 --- a/service-mgmt/sm-db/src/Makefile +++ b/service-mgmt/sm-db/src/Makefile @@ -5,6 +5,7 @@ # INCLUDES =-I$(STAGING_DIR)/usr/include/glib-2.0 INCLUDES+=-I$(STAGING_DIR)/usr/lib64/glib-2.0/include +INCLUDES+=-I$(STAGING_DIR)/usr/lib/x86_64-linux-gnu/glib-2.0/include SRCS=sm_db.c SRCS+=sm_db_iterator.c @@ -28,7 +29,7 @@ SRCS+=sm_db_build.c SRCS+=sm_db_configuration.c OBJS = $(SRCS:.c=.o) -CCFLAGS= -fPIC -g -O2 -Wall -Werror -std=c++11 -Wformat -Wformat-security +CCFLAGS= -fPIC -g -O2 -Wall -Werror -std=c++11 -Wformat -Wformat-security -Wno-stringop-truncation EXTRACCFLAGS= -D__STDC_FORMAT_MACROS LDLIBS= -lsqlite3 -lglib-2.0 -luuid -lrt -lsm_common LDFLAGS = -shared -rdynamic