summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Cordoba <erich.cordoba.malibran@intel.com>2019-01-30 12:29:08 -0600
committerErich Cordoba <erich.cordoba.malibran@intel.com>2019-01-30 12:31:51 -0600
commit26563288d1443e47ce72622a4cfd96c8933019a1 (patch)
tree8748303464f93c98fd83962ff6c6624abb1bf524
parentd911b3972aea8458f7dbc01daba88e80857d2b82 (diff)
Standardize makefile for snmp-ext
Changes made: - Simplify spec file. - Rename install_non_bb target. - Change tarball creation process. - mibs folder moved into source folder. Story: 2004043 Task: 27545 Change-Id: I9cc026aa9c2dbe3f4171ee6b0639a2be6653420c Signed-off-by: Marcela Rosales <marcela.a.rosales.jimenez@intel.com> Signed-off-by: Erich Cordoba <erich.cordoba.malibran@intel.com>
Notes
Notes (review): Code-Review+2: Al Bailey <al.bailey@windriver.com> Code-Review+2: Tao Liu <tao.liu@windriver.com> Workflow+1: Tao Liu <tao.liu@windriver.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Thu, 31 Jan 2019 17:47:11 +0000 Reviewed-on: https://review.openstack.org/634026 Project: openstack/stx-fault Branch: refs/heads/master
-rw-r--r--snmp-ext/centos/build_srpm.data1
-rw-r--r--snmp-ext/centos/snmp-ext.spec35
-rw-r--r--snmp-ext/sources/Makefile26
-rw-r--r--snmp-ext/sources/mibs/wrsAlarmMib.mib.txt (renamed from snmp-ext/mibs/wrsAlarmMib.mib.txt)0
-rw-r--r--snmp-ext/sources/mibs/wrsEnterpriseReg.mib.txt (renamed from snmp-ext/mibs/wrsEnterpriseReg.mib.txt)0
5 files changed, 36 insertions, 26 deletions
diff --git a/snmp-ext/centos/build_srpm.data b/snmp-ext/centos/build_srpm.data
index 706c821..ece454f 100644
--- a/snmp-ext/centos/build_srpm.data
+++ b/snmp-ext/centos/build_srpm.data
@@ -1,3 +1,2 @@
1SRC_DIR="sources" 1SRC_DIR="sources"
2COPY_LIST="mibs/*"
3TIS_PATCH_VER=1 2TIS_PATCH_VER=1
diff --git a/snmp-ext/centos/snmp-ext.spec b/snmp-ext/centos/snmp-ext.spec
index 2c8e859..362ca8a 100644
--- a/snmp-ext/centos/snmp-ext.spec
+++ b/snmp-ext/centos/snmp-ext.spec
@@ -13,9 +13,6 @@ BuildRequires: libuuid-devel
13Requires: fm-common 13Requires: fm-common
14Requires: net-snmp 14Requires: net-snmp
15 15
16Source1: wrsAlarmMib.mib.txt
17Source2: wrsEnterpriseReg.mib.txt
18
19%define mib_ver 2.0 16%define mib_ver 2.0
20%define cgcs_sdk_deploy_dir /opt/deploy/cgcs_sdk 17%define cgcs_sdk_deploy_dir /opt/deploy/cgcs_sdk
21 18
@@ -45,28 +42,20 @@ Group: devel
45%setup 42%setup
46 43
47%build 44%build
48VER=%{version} 45MAJOR=`echo %{version} | awk -F . '{print $1}'`
49MAJOR=`echo $VER | awk -F . '{print $1}'` 46MINOR=`echo %{version} | awk -F . '{print $2}'`
50MINOR=`echo $VER | awk -F . '{print $2}'` 47make MAJOR=$MAJOR MINOR=$MINOR PATCH=%{tis_patch_ver} %{?_smp_mflags}
51PATCHVER=` echo %{release} | awk -F r '{print $2}' | awk -F . '{print $1}'`
52make MAJOR=$MAJOR MINOR=$MINOR PATCH=$PATCHVER %{?_smp_mflags}
53 48
54%install 49%install
55rm -rf $RPM_BUILD_ROOT 50MAJOR=`echo %{version} | awk -F . '{print $1}'`
56VER=%{version} 51MINOR=`echo %{version} | awk -F . '{print $2}'`
57MAJOR=`echo $VER | awk -F . '{print $1}'` 52make DEST_DIR=%{buildroot} \
58MINOR=`echo $VER | awk -F . '{print $2}'` 53 LIB_DIR=%{_libdir} \
59 54 MAJOR=$MAJOR \
60PATCHVER=` echo %{release} | awk -F r '{print $2}' | awk -F . '{print $1}'` 55 MINOR=$MINOR \
61make DEST_DIR=$RPM_BUILD_ROOT LIB_DIR=%{_libdir} MAJOR=$MAJOR MINOR=$MINOR PATCH=$PATCHVER install_non_bb 56 SDK_DEPLOY_DIR=%{buildroot}%{cgcs_sdk_deploy_dir} \
62 57 MIBVER=%{mib_ver} \
63MIBDIR=wrs-snmp-mib-${MAJOR}.%{mib_ver} 58 PATCH=%{tis_patch_ver} install
64mkdir -p $RPM_BUILD_ROOT%{_datadir}/snmp/mibs
65install -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/snmp/mibs
66install -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_datadir}/snmp/mibs
67tar -zc --transform=s/^mibs/${MIBDIR}/ -f wrs-snmp-mib-${MAJOR}.%{mib_ver}.tgz -C $RPM_BUILD_ROOT%{_datadir}/snmp mibs
68mkdir -p $RPM_BUILD_ROOT%{cgcs_sdk_deploy_dir}
69install -m 644 wrs-snmp-mib-${MAJOR}.%{mib_ver}.tgz $RPM_BUILD_ROOT%{cgcs_sdk_deploy_dir}
70 59
71%files 60%files
72%defattr(-,root,root,-) 61%defattr(-,root,root,-)
diff --git a/snmp-ext/sources/Makefile b/snmp-ext/sources/Makefile
index 07d004f..a1e3f62 100644
--- a/snmp-ext/sources/Makefile
+++ b/snmp-ext/sources/Makefile
@@ -1,3 +1,17 @@
1#
2# SPDX-License-Identifier: Apache-2.0
3#
4
5MAJOR ?= 1
6MINOR ?= 0
7PATCH ?= 0
8MIBVER ?= 2.0
9
10DEST_DIR ?= /
11DATA_DIR ?= /usr/share
12LIB_DIR ?= /usr/lib64
13SDK_DEPLOY_DIR ?= /opt/deploy/cgcs_sdk
14
1SRCS = cgtsActiveAlarms.c cgtsAgentPlugin.c cgtsEventLogs.c 15SRCS = cgtsActiveAlarms.c cgtsAgentPlugin.c cgtsEventLogs.c
2 16
3OBJS = $(SRCS:.c=.o) 17OBJS = $(SRCS:.c=.o)
@@ -5,7 +19,10 @@ LDLIBS = -lfmcommon -lnetsnmp -lnetsnmpagent -luuid
5INCLUDES += -I./ 19INCLUDES += -I./
6CCFLAGS = -fPIC -g -O2 -Wall -Werror -Wformat -Wformat-security 20CCFLAGS = -fPIC -g -O2 -Wall -Werror -Wformat -Wformat-security
7LIBCGTSAGENT_SO := libcgtsAgentPlugin.so 21LIBCGTSAGENT_SO := libcgtsAgentPlugin.so
22MIBDIR = wrs-snmp-mib-$(MAJOR).$(MIBVER)
23
8build: lib 24build: lib
25 tar -zc --transform=s/^mibs/$(MIBDIR)/ -f wrs-snmp-mib-$(MAJOR).$(MIBVER).tgz mibs
9 26
10.c.o: 27.c.o:
11 $(CXX) $(CCFLAGS) $(INCLUDES) -c $< -o $@ 28 $(CXX) $(CCFLAGS) $(INCLUDES) -c $< -o $@
@@ -16,10 +33,15 @@ lib: $(OBJS)
16 ln -sf $(LIBCGTSAGENT_SO).$(MAJOR).$(MINOR).$(PATCH) $(LIBCGTSAGENT_SO) 33 ln -sf $(LIBCGTSAGENT_SO).$(MAJOR).$(MINOR).$(PATCH) $(LIBCGTSAGENT_SO)
17 34
18clean: 35clean:
19 @rm -f $(OBJ) *.o *.so.* 36 @rm -f $(OBJ) *.o *.so.* *.tgz
20 37
21install_non_bb: 38install:
22 install -m 755 -d $(DEST_DIR)$(LIB_DIR) 39 install -m 755 -d $(DEST_DIR)$(LIB_DIR)
23 install -m 755 $(LIBCGTSAGENT_SO).$(MAJOR).$(MINOR).$(PATCH) $(DEST_DIR)$(LIB_DIR) 40 install -m 755 $(LIBCGTSAGENT_SO).$(MAJOR).$(MINOR).$(PATCH) $(DEST_DIR)$(LIB_DIR)
41 install -m 755 -d $(DEST_DIR)$(DATA_DIR)/snmp/mibs
42 install -m 644 mibs/wrsAlarmMib.mib.txt $(DEST_DIR)$(DATA_DIR)/snmp/mibs/
43 install -m 644 mibs/wrsEnterpriseReg.mib.txt $(DEST_DIR)$(DATA_DIR)/snmp/mibs/
44 install -m 755 -d $(SDK_DEPLOY_DIR)
45 install -m 644 wrs-snmp-mib-$(MAJOR).$(MIBVER).tgz $(SDK_DEPLOY_DIR)/
24 ln -s $(LIBCGTSAGENT_SO).$(MAJOR).$(MINOR).$(PATCH) $(DEST_DIR)$(LIB_DIR)/$(LIBCGTSAGENT_SO).$(MAJOR) 46 ln -s $(LIBCGTSAGENT_SO).$(MAJOR).$(MINOR).$(PATCH) $(DEST_DIR)$(LIB_DIR)/$(LIBCGTSAGENT_SO).$(MAJOR)
25 ln -s $(LIBCGTSAGENT_SO).$(MAJOR).$(MINOR).$(PATCH) $(DEST_DIR)$(LIB_DIR)/$(LIBCGTSAGENT_SO) 47 ln -s $(LIBCGTSAGENT_SO).$(MAJOR).$(MINOR).$(PATCH) $(DEST_DIR)$(LIB_DIR)/$(LIBCGTSAGENT_SO)
diff --git a/snmp-ext/mibs/wrsAlarmMib.mib.txt b/snmp-ext/sources/mibs/wrsAlarmMib.mib.txt
index 7c5fb7f..7c5fb7f 100644
--- a/snmp-ext/mibs/wrsAlarmMib.mib.txt
+++ b/snmp-ext/sources/mibs/wrsAlarmMib.mib.txt
diff --git a/snmp-ext/mibs/wrsEnterpriseReg.mib.txt b/snmp-ext/sources/mibs/wrsEnterpriseReg.mib.txt
index f009cac..f009cac 100644
--- a/snmp-ext/mibs/wrsEnterpriseReg.mib.txt
+++ b/snmp-ext/sources/mibs/wrsEnterpriseReg.mib.txt