2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-29 17:23:08 +00:00

Merge pull request #2380 from whowutwut/xcat_probe

Move the copy/cleanup code for xCAT-probe to their own functions in makerpm
This commit is contained in:
Weihua Hu 2017-01-11 11:22:12 +08:00 committed by GitHub
commit b8e3be7464

39
makerpm
View File

@ -9,7 +9,29 @@
# set -x
# Make one of the following rpms: perl-xCAT, xCAT-server, xCAT-client, xCAT-IBMhpc, xCAT-rmc, xCAT-UI, xCAT-test
function xcat_probe_copy {
# xCAT-probe uses some functions shipped with xCAT, copying for the following reasons:
# 1. make xCAT-probe code be self-contained
# 2. do not maintain two files for each script
# 3. symbolic link can't work during packaging
RPMNAME=${1}
if [ $RPMNAME = "xCAT-probe" ]; then
mkdir -p ${RPMNAME}/lib/perl/xCAT/
files=("NetworkUtils.pm" "GlobalDef.pm" "ServiceNodeUtils.pm")
for f in "${files[@]}"; do
cp perl-xCAT/xCAT/$f ${RPMNAME}/lib/perl/xCAT/
done
fi
}
function xcat_probe_cleanup {
RPMNAME=${1}
if [ $RPMNAME = "xCAT-probe" ]; then
rm -rf ${RPMNAME}/lib/perl/xCAT/
fi
}
# Make the noarch rpms
function makenoarch {
RPMNAME=$1
if [ "$OSNAME" = "AIX" ]; then
@ -41,17 +63,7 @@ function makenoarch {
fi
fi
#xcat probe use some functions shipped by xCAT, for below reasons we need to copy files to xCAT-probe directory
#1 make xcat probe code to be self-contained
#2 don't maintain two files for each script
#3 symbolic link can't work during package
if [ $RPMNAME = "xCAT-probe" ]; then
CURDIR=$(pwd)
mkdir -p ${CURDIR}/xCAT-probe/lib/perl/xCAT/
cp -f ${CURDIR}/perl-xCAT/xCAT/NetworkUtils.pm ${CURDIR}/xCAT-probe/lib/perl/xCAT/
cp -f ${CURDIR}/perl-xCAT/xCAT/GlobalDef.pm ${CURDIR}/xCAT-probe/lib/perl/xCAT/
cp -f ${CURDIR}/perl-xCAT/xCAT/ServiceNodeUtils.pm ${CURDIR}/xCAT-probe/lib/perl/xCAT/
fi
xcat_probe_copy ${RPMNAME}
tar --exclude .svn -czf $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz $RPMNAME
rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm
@ -62,6 +74,9 @@ function makenoarch {
# undo the modifications above to leave the sandbox prestine on the build machine
git checkout xCAT-UI/xCAT-UI.spec
fi
xcat_probe_cleanup ${RPMNAME}
fi
}