Standardize install target for fm-common.

The `install_non_bb` target was changed to `install`, also some
variable names in the Makefile and spec file were changed. There
was a hardcoded path in fmConstants.h and that was updated as well.

Story: 2004043
Task: 27543

Change-Id: I431b733030444185cc51a8b5352492926170a4c3
Signed-off-by: Erich Cordoba <erich.cordoba.malibran@intel.com>
This commit is contained in:
Erich Cordoba 2018-12-05 15:04:11 -06:00
parent aebc9ee1fa
commit f6d95a0a9d
3 changed files with 41 additions and 36 deletions

View File

@ -55,34 +55,26 @@ make MAJOR=$MAJOR MINOR=$MINOR %{?_smp_mflags}
%py2_build_wheel %py2_build_wheel
%install %install
rm -rf $RPM_BUILD_ROOT rm -rf %{buildroot}
VER=%{version} VER=%{version}
MAJOR=`echo $VER | awk -F . '{print $1}'` MAJOR=`echo $VER | awk -F . '{print $1}'`
MINOR=`echo $VER | awk -F . '{print $2}'` MINOR=`echo $VER | awk -F . '{print $2}'`
make DEST_DIR=$RPM_BUILD_ROOT BIN_DIR=%{local_bindir} LIB_DIR=%{_libdir} INC_DIR=%{_includedir} MAJOR=$MAJOR MINOR=$MINOR install_non_bb make DESTDIR=%{buildroot} \
BINDIR=%{local_bindir} \
LIBDIR=%{_libdir} \
INCDIR=%{_includedir} \
CGCS_DOC_DEPLOY=%{cgcs_doc_deploy_dir} \
MAJOR=$MAJOR MINOR=$MINOR install
%{__python} setup.py install --root=%{buildroot} \ %{__python} setup.py install --root=%{buildroot} \
--install-lib=%{pythonroot} \ --install-lib=%{pythonroot} \
--prefix=/usr \ --prefix=/usr \
--install-data=/usr/share --install-data=/usr/share
mkdir -p $RPM_BUILD_ROOT/wheels mkdir -p %{buildroot}/wheels
install -m 644 dist/*.whl $RPM_BUILD_ROOT/wheels/ install -m 644 dist/*.whl %{buildroot}/wheels/
install -d $RPM_BUILD_ROOT/usr/bin
install -m 755 fm_db_sync_event_suppression.py $RPM_BUILD_ROOT/usr/bin/fm_db_sync_event_suppression.py
# install the headers that used by fm-mgr package
install -m 644 -p -D fmConfig.h %{buildroot}%{_includedir}/fmConfig.h
install -m 644 -p -D fmLog.h %{buildroot}%{_includedir}/fmLog.h
CGCS_DOC_DEPLOY=$RPM_BUILD_ROOT/%{cgcs_doc_deploy_dir}
install -d $CGCS_DOC_DEPLOY
# install fmAlarm.h in CGCS_DOC_DEPLOY_DIR
# used by fm-doc package to validate the Alarms & Logs Doc Yaml file
install -m 644 fmAlarm.h $CGCS_DOC_DEPLOY
%clean %clean
rm -rf $RPM_BUILD_ROOT rm -rf %{buildroot}
%files %files
@ -90,7 +82,6 @@ rm -rf $RPM_BUILD_ROOT
%doc LICENSE %doc LICENSE
%{local_bindir}/* %{local_bindir}/*
%{_libdir}/*.so.* %{_libdir}/*.so.*
/usr/bin/fm_db_sync_event_suppression.py
%{pythonroot}/fm_core.so %{pythonroot}/fm_core.so
%{pythonroot}/fm_core-*.egg-info %{pythonroot}/fm_core-*.egg-info

View File

@ -8,6 +8,15 @@ LDLIBS = -lstdc++ -lrt -luuid -lpq -lpthread -lpython2.7
INCLUDES = -I./ -I$(shell pg_config --includedir) INCLUDES = -I./ -I$(shell pg_config --includedir)
CCFLAGS = -g -O2 -Wall -Werror -fPIC CCFLAGS = -g -O2 -Wall -Werror -fPIC
MAJOR ?= 1
MINOR ?= 0
DESTDIR ?= /
BINDIR ?= /usr/local/bin
LIBDIR ?= /usr/local/lib64
INCDIR ?= /usr/local/include
CGCS_DOC_DEPLOY ?= /opt/deploy/cgcs_doc
LIBFMCOMMON_SO := libfmcommon.so LIBFMCOMMON_SO := libfmcommon.so
build: lib fmClientCli build: lib fmClientCli
@ -25,15 +34,20 @@ fmClientCli: $(CLI_OBJS) lib
clean: clean:
@rm -f $(OBJ) *.o *.so fmClientCli @rm -f $(OBJ) *.o *.so fmClientCli
install_non_bb: install:
install -m 755 -d $(DEST_DIR)$(BIN_DIR) install -m 755 -d $(DESTDIR)$(BINDIR)
install -m 755 -d $(DEST_DIR)$(LIB_DIR) install -m 755 -d $(DESTDIR)$(LIBDIR)
install -m 755 -d $(DEST_DIR)$(INC_DIR) install -m 755 -d $(DESTDIR)$(INCDIR)
install -m 755 fmClientCli $(DEST_DIR)$(BIN_DIR) install -m 755 -d $(DESTDIR)$(CGCS_DOC_DEPLOY)
install -m 644 fmDbAPI.h $(DEST_DIR)$(INC_DIR) install -m 755 fmClientCli $(DESTDIR)$(BINDIR)
install -m 644 fmAPI.h $(DEST_DIR)$(INC_DIR) install -m 755 fm_db_sync_event_suppression.py $(DESTDIR)$(BINDIR)
install -m 644 fmThread.h $(DEST_DIR)$(INC_DIR) install -m 644 fmDbAPI.h $(DESTDIR)$(INCDIR)
install -m 644 fmAlarm.h $(DEST_DIR)$(INC_DIR) install -m 644 fmAPI.h $(DESTDIR)$(INCDIR)
install -m 755 $(LIBFMCOMMON_SO).$(MAJOR).$(MINOR) $(DEST_DIR)$(LIB_DIR) install -m 644 fmThread.h $(DESTDIR)$(INCDIR)
ln -sf $(LIBFMCOMMON_SO).$(MAJOR).$(MINOR) $(DEST_DIR)$(LIB_DIR)/$(LIBFMCOMMON_SO).$(MAJOR) install -m 644 fmAlarm.h $(DESTDIR)$(INCDIR)
ln -sf $(LIBFMCOMMON_SO).$(MAJOR).$(MINOR) $(DEST_DIR)$(LIB_DIR)/$(LIBFMCOMMON_SO) install -m 644 fmConfig.h $(DESTDIR)$(INCDIR)
install -m 644 fmLog.h $(DESTDIR)$(INCDIR)
install -m 644 fmAlarm.h $(DESTDIR)$(CGCS_DOC_DEPLOY)
install -m 755 $(LIBFMCOMMON_SO).$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)
ln -sf $(LIBFMCOMMON_SO).$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/$(LIBFMCOMMON_SO).$(MAJOR)
ln -sf $(LIBFMCOMMON_SO).$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/$(LIBFMCOMMON_SO)

View File

@ -25,7 +25,7 @@
#define FM_EVENT_SUPPRESSION_TABLE_NAME "event_suppression" #define FM_EVENT_SUPPRESSION_TABLE_NAME "event_suppression"
/* Event suppression table sync script */ /* Event suppression table sync script */
#define FM_DB_SYNC_EVENT_SUPPRESSION "/usr/bin/fm_db_sync_event_suppression.py" #define FM_DB_SYNC_EVENT_SUPPRESSION "/usr/local/bin/fm_db_sync_event_suppression.py"
/* Alarm Table Columns */ /* Alarm Table Columns */
#define FM_ALARM_COLUMN_CREATED_AT "created_at" #define FM_ALARM_COLUMN_CREATED_AT "created_at"