ThirdParty: improvements to the macros for the RPM-based installer
This commit is contained in:
parent
5802950830
commit
c1b4b1314e
1 changed files with 51 additions and 16 deletions
55
ThirdParty/tools/makeThirdPartyFunctionsForRPM
vendored
55
ThirdParty/tools/makeThirdPartyFunctionsForRPM
vendored
|
@ -59,6 +59,7 @@ rpm_make()
|
|||
_SPECFILE=''
|
||||
_PACKAGE_URL=''
|
||||
_ADDITIONALFLAGS=''
|
||||
_RPMFILENAME=''
|
||||
|
||||
while getopts p:s:u:f:n:a: flags
|
||||
do
|
||||
|
@ -86,7 +87,17 @@ rpm_make()
|
|||
# Shift options
|
||||
shift `expr $OPTIND - 1`
|
||||
|
||||
rpmName=$_PACKAGE-$WM_OPTIONS.$architecture
|
||||
# Make sure the ThirdParty environment is up-to-date
|
||||
echo "Updating the ThirdParty environment variables before building package $_PACKAGE"
|
||||
. $WM_PROJECT_DIR/etc/settings.sh
|
||||
|
||||
if [ "$_RPMFILENAME" = "" ]; then
|
||||
rpmName=$_PACKAGE-$WM_OPTIONS.$architecture
|
||||
else
|
||||
# Filename for the RPM was overridden from the command line
|
||||
rpmName=$_RPMFILENAME
|
||||
fi
|
||||
|
||||
rpmFile=$buildBase/RPMS/$architecture/$rpmName.rpm
|
||||
|
||||
echo "RPM file name : $rpmFile"
|
||||
|
@ -119,10 +130,16 @@ rpm_make()
|
|||
fi
|
||||
|
||||
# Install RPM package if not done already
|
||||
if [ ! -e "$WM_THIRD_PARTY_DIR/packages/$_PACKAGE/platforms/$WM_OPTIONS" ]; then
|
||||
if [ "$architecture" = "noarch" ]; then
|
||||
installDir=$WM_THIRD_PARTY_DIR/packages/$_PACKAGE/platforms/noarch
|
||||
else
|
||||
installDir=$WM_THIRD_PARTY_DIR/packages/$_PACKAGE/platforms/$WM_OPTIONS
|
||||
fi
|
||||
|
||||
if [ ! -e "$installDir" ]; then
|
||||
echo "Installing package: $_PACKAGE"
|
||||
rpm_uninstall $_PACKAGE
|
||||
rpm_install $_PACKAGE
|
||||
rpm_uninstall $_PACKAGE $rpmName
|
||||
rpm_install $_PACKAGE $rpmName $rpmFile
|
||||
else
|
||||
echo "Package $_PACKAGE is already installed"
|
||||
fi
|
||||
|
@ -131,6 +148,7 @@ rpm_make()
|
|||
unset _SPECFILE
|
||||
unset _PACKAGE_URL
|
||||
unset _ADDITIONALFLAGS
|
||||
unset _RPMFILENAME
|
||||
|
||||
echo "Done installing package $_PACKAGE"
|
||||
echo ""
|
||||
|
@ -148,8 +166,8 @@ rpm_build()
|
|||
cd $buildBase
|
||||
|
||||
[ -e ./SPECS/$specFile ] || {
|
||||
echo "rpm_build: missing SPEC file for package $package. Aborting."
|
||||
return 1
|
||||
echo "rpm_build: Error: missing SPEC file for package $package. Aborting."
|
||||
exit -1
|
||||
}
|
||||
|
||||
#Build RPM package
|
||||
|
@ -166,7 +184,7 @@ rpm_build()
|
|||
rpm_uninstall()
|
||||
{
|
||||
package="$1"
|
||||
rpmName=$package-$WM_OPTIONS.$architecture
|
||||
rpmName="$2"
|
||||
|
||||
cd $buildBase
|
||||
|
||||
|
@ -186,14 +204,13 @@ rpm_uninstall()
|
|||
rpm_install()
|
||||
{
|
||||
package="$1";
|
||||
rpmName=$package.$architecture;
|
||||
rpmFile=$buildBase/RPMS/$architecture/$rpmName.rpm;
|
||||
rpmName="$2";
|
||||
rpmFile="$3";
|
||||
|
||||
echo " Installing $package using RPM file: $rpmFile";
|
||||
${RPM_CMD} ${RPM_CMD_XTRA_OPTIONS} -ivh \
|
||||
$rpmFile \
|
||||
--dbpath $buildBase/rpmDB --force --nodeps;
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -216,4 +233,22 @@ rpm_populateRPMvault()
|
|||
echo ""
|
||||
|
||||
}
|
||||
#
|
||||
# Remove an installed package
|
||||
#
|
||||
uninstallPackage()
|
||||
{
|
||||
pkg="$1";
|
||||
if [ -d $WM_THIRD_PARTY_DIR/packages/${pkg} ]; then
|
||||
set -x
|
||||
rm -f $WM_THIRD_PARTY_DIR/rpmBuild/RPMS/$architecture/${pkg}*.rpm
|
||||
rm -f $WM_THIRD_PARTY_DIR/rpmBuild/TGZS/$architecture/${pkg}.tgz
|
||||
rm -rf $WM_THIRD_PARTY_DIR/rpmBuild/BUILD/${pkg}*
|
||||
rm -rf $WM_THIRD_PARTY_DIR/packages/$pkg
|
||||
set +x
|
||||
else
|
||||
echo "Package ${pkg} is already removed."
|
||||
fi
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
|
|
Reference in a new issue