Fix several package issues (#4801)

* Make the structure of the server pkg match 6.2.28

* Fix OSX lib path

* Fix install destinations in client

Previously, backup_agent would map to fdbmonitor installation dir -
which is incorrect in the sense that it disagrees with where the default
foundationdb.conf expects to find backup_agent. Add a new backupagent
installation dir and install there, matching foundationdb.conf's
expectations.

Also fix an issue where several of the versions of fdbbackup weren't
being installed

* Update packaging/osx/buildpkg.sh for cmake

* Update README instructions for pkg file

* Remove osx cpack config

* Remove pm install destinations

* Fix weird syntax

* Remove cpack reference to PM

* Address review comments
This commit is contained in:
Andrew Noyes 2021-05-12 09:41:26 -07:00 committed by GitHub
parent 947eace82d
commit 061afda2ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 61 additions and 89 deletions

View File

@ -157,11 +157,11 @@ The build under MacOS will work the same way as on Linux. To get boost and ninja
cmake -G Ninja <PATH_TO_FOUNDATIONDB_SOURCE>
```
To generate a installable package, you can use cpack:
To generate a installable package,
```sh
ninja
cpack -G productbuild
$SRCDIR/packaging/osx/buildpkg.sh . $SRCDIR
```
### Windows

View File

@ -9,24 +9,6 @@ elseif(CPACK_GENERATOR MATCHES "DEB")
set(CPACK_COMPONENTS_ALL clients-deb server-deb clients-versioned server-versioned)
set(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/README.md)
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE)
elseif(CPACK_GENERATOR MATCHES "productbuild")
set(CPACK_PACKAGING_INSTALL_PREFIX "/")
set(CPACK_COMPONENTS_ALL clients-pm server-pm)
set(CPACK_STRIP_FILES TRUE)
set(CPACK_PREFLIGHT_SERVER_SCRIPT ${CMAKE_SOURCE_DIR}/packaging/osx/scripts-server/preinstall)
set(CPACK_POSTFLIGHT_SERVER_SCRIPT ${CMAKE_SOURCE_DIR}/packaging/osx/scripts-server/postinstall)
set(CPACK_POSTFLIGHT_CLIENTS_SCRIPT ${CMAKE_SOURCE_DIR}/packaging/osx/scripts-server/preinstall)
# Commenting out this readme file until it works within packaging
set(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/packaging/osx/resources/conclusion.rtf)
set(CPACK_PRODUCTBUILD_RESOURCES_DIR ${CMAKE_SOURCE_DIR}/packaging/osx/resources)
# Changing the path of this file as CMAKE_BINARY_DIR does not seem to be defined
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_BINARY_DIR}/License.txt)
if(NOT FDB_RELEASE)
set(prerelease_string "-PRERELEASE")
else()
set(prerelease_string "")
endif()
set(CPACK_PACKAGE_FILE_NAME "FoundationDB-${PROJECT_VERSION}${prerelease_string}")
elseif(CPACK_GENERATOR MATCHES "TGZ")
set(CPACK_STRIP_FILES TRUE)
set(CPACK_COMPONENTS_ALL clients-tgz server-tgz)

View File

@ -214,7 +214,7 @@ endfunction()
function(fdb_install)
if(NOT WIN32 AND NOT OPEN_FOR_IDE)
set(one_value_options COMPONENT DESTINATION EXPORT DESTINATION_SUFFIX)
set(one_value_options COMPONENT DESTINATION EXPORT DESTINATION_SUFFIX RENAME)
set(multi_value_options TARGETS FILES PROGRAMS DIRECTORY)
cmake_parse_arguments(IN "${options}" "${one_value_options}" "${multi_value_options}" "${ARGN}")
@ -237,6 +237,9 @@ function(fdb_install)
get_install_dest(${pkg} ${destination} install_path)
string(TOLOWER "${pkg}" package)
if(install_export)
if(IN_RENAME)
message(FATAL_ERROR "RENAME for EXPORT target not implemented")
endif()
install(
EXPORT "${IN_EXPORT}-${package}"
DESTINATION "${install_path}${IN_DESTINATION_SUFFIX}"
@ -248,11 +251,20 @@ function(fdb_install)
set(export_args EXPORT "${IN_EXPORT}-${package}")
endif()
if(NOT ${install_path} STREQUAL "")
install(
${args}
${export_args}
DESTINATION "${install_path}${IN_DESTINATION_SUFFIX}"
COMPONENT "${IN_COMPONENT}-${package}")
if(IN_RENAME)
install(
${args}
${export_args}
DESTINATION "${install_path}${IN_DESTINATION_SUFFIX}"
COMPONENT "${IN_COMPONENT}-${package}"
RENAME ${IN_RENAME})
else()
install(
${args}
${export_args}
DESTINATION "${install_path}${IN_DESTINATION_SUFFIX}"
COMPONENT "${IN_COMPONENT}-${package}")
endif()
endif()
endif()
endforeach()

View File

@ -46,10 +46,6 @@ function(install_symlink)
TO "../${rel_path}bin/${IN_FILE_NAME}"
DESTINATION "usr/lib64/${IN_LINK_NAME}"
COMPONENTS "${IN_COMPONENT}-deb")
install_symlink_impl(
TO "../${rel_path}local/bin/${IN_FILE_NAME}"
DESTINATION "usr/lib64/${IN_LINK_NAME}"
COMPONENTS "${IN_COMPONENT}-pm")
elseif("${IN_LINK_DIR}" MATCHES "bin")
install_symlink_impl(
TO "../${rel_path}bin/${IN_FILE_NAME}"
@ -61,10 +57,6 @@ function(install_symlink)
COMPONENTS "${IN_COMPONENT}-el6"
"${IN_COMPONENT}-el7"
"${IN_COMPONENT}-deb")
install_symlink_impl(
TO "../${rel_path}/bin/${IN_FILE_NAME}"
DESTINATION "usr/local/bin/${IN_LINK_NAME}"
COMPONENTS "${IN_COMPONENT}-pm")
elseif("${IN_LINK_DIR}" MATCHES "fdbmonitor")
install_symlink_impl(
TO "../../${rel_path}bin/${IN_FILE_NAME}"
@ -76,10 +68,6 @@ function(install_symlink)
COMPONENTS "${IN_COMPONENT}-el6"
"${IN_COMPONENT}-el7"
"${IN_COMPONENT}-deb")
install_symlink_impl(
TO "../../${rel_path}/bin/${IN_FILE_NAME}"
DESTINATION "usr/local/lib/foundationdb/${IN_LINK_NAME}"
COMPONENTS "${IN_COMPONENT}-pm")
else()
message(FATAL_ERROR "Unknown LINK_DIR ${IN_LINK_DIR}")
endif()
@ -103,8 +91,8 @@ function(symlink_files)
endif()
endfunction()
fdb_install_packages(TGZ DEB EL7 PM VERSIONED)
fdb_install_dirs(BIN SBIN LIB FDBMONITOR INCLUDE ETC LOG DATA)
fdb_install_packages(TGZ DEB EL7 VERSIONED)
fdb_install_dirs(BIN SBIN LIB FDBMONITOR INCLUDE ETC LOG DATA BACKUPAGENT)
message(STATUS "FDB_INSTALL_DIRS -> ${FDB_INSTALL_DIRS}")
install_destinations(TGZ
@ -112,6 +100,7 @@ install_destinations(TGZ
SBIN sbin
LIB lib
FDBMONITOR sbin
BACKUPAGENT usr/lib/foundationdb
INCLUDE include
ETC etc/foundationdb
LOG log/foundationdb
@ -122,19 +111,13 @@ install_destinations(DEB
SBIN usr/sbin
LIB usr/lib
FDBMONITOR usr/lib/foundationdb
BACKUPAGENT usr/lib/foundationdb
INCLUDE usr/include
ETC etc/foundationdb
LOG var/log/foundationdb
DATA var/lib/foundationdb/data)
copy_install_destinations(DEB EL7)
install_destinations(EL7 LIB usr/lib64)
install_destinations(PM
BIN usr/local/bin
SBIN usr/local/sbin
LIB lib
FDBMONITOR usr/local/libexec
INCLUDE usr/local/include
ETC usr/local/etc/foundationdb)
# This can be used for debugging in case above is behaving funky
#print_install_destinations()
@ -142,7 +125,7 @@ install_destinations(PM
set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
if(APPLE)
set(CPACK_GENERATOR TGZ productbuild)
set(CPACK_GENERATOR TGZ)
else()
set(CPACK_GENERATOR RPM DEB TGZ)
endif()
@ -212,19 +195,16 @@ set(CPACK_PACKAGE_CONTACT "The FoundationDB Community")
set(CPACK_COMPONENT_SERVER-EL7_DEPENDS clients-el7)
set(CPACK_COMPONENT_SERVER-DEB_DEPENDS clients-deb)
set(CPACK_COMPONENT_SERVER-TGZ_DEPENDS clients-tgz)
set(CPACK_COMPONENT_SERVER-PM_DEPENDS clients-pm)
set(CPACK_COMPONENT_SERVER-VERSIONED_DEPENDS clients-versioned)
set(CPACK_COMPONENT_SERVER-EL7_DISPLAY_NAME "foundationdb-server")
set(CPACK_COMPONENT_SERVER-DEB_DISPLAY_NAME "foundationdb-server")
set(CPACK_COMPONENT_SERVER-TGZ_DISPLAY_NAME "foundationdb-server")
set(CPACK_COMPONENT_SERVER-PM_DISPLAY_NAME "foundationdb-server")
set(CPACK_COMPONENT_SERVER-VERSIONED_DISPLAY_NAME "foundationdb-server-${PROJECT_VERSION}")
set(CPACK_COMPONENT_CLIENTS-EL7_DISPLAY_NAME "foundationdb-clients")
set(CPACK_COMPONENT_CLIENTS-DEB_DISPLAY_NAME "foundationdb-clients")
set(CPACK_COMPONENT_CLIENTS-TGZ_DISPLAY_NAME "foundationdb-clients")
set(CPACK_COMPONENT_CLIENTS-PM_DISPLAY_NAME "foundationdb-clients")
set(CPACK_COMPONENT_CLIENTS-VERSIONED_DISPLAY_NAME "foundationdb-clients-${PROJECT_VERSION}")
@ -382,19 +362,6 @@ set(CPACK_DEBIAN_SERVER-VERSIONED_PACKAGE_CONTROL_EXTRA
${CMAKE_BINARY_DIR}/packaging/multiversion/server/postinst
${CMAKE_BINARY_DIR}/packaging/multiversion/server/prerm)
################################################################################
# MacOS configuration
################################################################################
if(APPLE)
install(PROGRAMS ${CMAKE_SOURCE_DIR}/packaging/osx/uninstall-FoundationDB.sh
DESTINATION "usr/local/foundationdb"
COMPONENT clients-pm)
install(FILES ${CMAKE_SOURCE_DIR}/packaging/osx/com.foundationdb.fdbmonitor.plist
DESTINATION "Library/LaunchDaemons"
COMPONENT server-pm)
endif()
################################################################################
# Configuration for DEB
################################################################################
@ -413,9 +380,6 @@ set(CLUSTER_DESCRIPTION1 ${description1} CACHE STRING "Cluster description")
set(CLUSTER_DESCRIPTION2 ${description2} CACHE STRING "Cluster description")
if(NOT WIN32)
install(FILES ${CMAKE_SOURCE_DIR}/packaging/osx/foundationdb.conf.new
DESTINATION "usr/local/etc"
COMPONENT server-pm)
fdb_install(FILES ${CMAKE_SOURCE_DIR}/packaging/foundationdb.conf
DESTINATION etc
COMPONENT server)

View File

@ -23,14 +23,14 @@ target_link_libraries(fdbdecode PRIVATE fdbclient)
if(NOT OPEN_FOR_IDE)
if(GENERATE_DEBUG_PACKAGES)
fdb_install(TARGETS fdbbackup DESTINATION bin COMPONENT clients)
fdb_install(PROGRAMS $<TARGET_FILE:fdbbackup> DESTINATION fdbmonitor COMPONENT clients RENAME backup_agent/backup_agent)
fdb_install(PROGRAMS $<TARGET_FILE:fdbbackup> DESTINATION backupagent COMPONENT clients RENAME backup_agent/backup_agent)
fdb_install(PROGRAMS $<TARGET_FILE:fdbbackup> DESTINATION bin COMPONENT clients RENAME fdbrestore)
fdb_install(PROGRAMS $<TARGET_FILE:fdbbackup> DESTINATION bin COMPONENT clients RENAME dr_agent)
fdb_install(PROGRAMS $<TARGET_FILE:fdbbackup> DESTINATION bin COMPONENT clients RENAME fdbdr)
else()
add_custom_target(prepare_fdbbackup_install ALL DEPENDS strip_only_fdbbackup)
fdb_install(PROGRAMS ${CMAKE_BINARY_DIR}/packages/bin/fdbbackup DESTINATION bin COMPONENT clients)
fdb_install(PROGRAMS ${CMAKE_BINARY_DIR}/packages/bin/fdbbackup DESTINATION fdbmonitor COMPONENT clients RENAME backup_agent/backup_agent)
fdb_install(PROGRAMS ${CMAKE_BINARY_DIR}/packages/bin/fdbbackup DESTINATION backupagent COMPONENT clients RENAME backup_agent/backup_agent)
fdb_install(PROGRAMS ${CMAKE_BINARY_DIR}/packages/bin/fdbbackup DESTINATION bin COMPONENT clients RENAME fdbrestore)
fdb_install(PROGRAMS ${CMAKE_BINARY_DIR}/packages/bin/fdbbackup DESTINATION bin COMPONENT clients RENAME dr_agent)
fdb_install(PROGRAMS ${CMAKE_BINARY_DIR}/packages/bin/fdbbackup DESTINATION bin COMPONENT clients RENAME fdbdr)

View File

@ -1,12 +1,26 @@
#!/bin/bash
set -e
set -Eeuo pipefail
umask 0022
PKGFILE=$1
VERSION=$2
RELEASE=$3
if [ "$#" -ne 2 ] ; then
echo "Usage: $0 <BUILDDIR> <SRCDIR>"
exit 1
fi
# BUILDDIR is the path to the cmake build directory
# SRCDIR is the path to the source directory
#
# e.g. If your current directory is the project root and the build directory is _build, then you want to do
# $ ./packaging/osx/buildpkg.sh _build .
#
BUILDDIR="$1"
SRCDIR="$2"
VERSION="$(grep 'CMAKE_PROJECT_VERSION[^_]' "$BUILDDIR/CMakeCache.txt" | sed -e 's/[^=]*=//')"
PKGFILE="$BUILDDIR/packages/FoundationDB-$VERSION.pkg"
CLIENTSDIR=$( mktemp -d -t fdb-clients-pkg )
SERVERDIR=$( mktemp -d -t fdb-server-pkg )
@ -23,20 +37,20 @@ mkdir -p -m 0755 $CLIENTSDIR/Library/Python/2.7/site-packages/fdb
mkdir -p -m 0775 $CLIENTSDIR/usr/local/etc/foundationdb
mkdir -p -m 0755 $CLIENTSDIR/usr/local/foundationdb/backup_agent
install -m 0755 bin/fdbcli $CLIENTSDIR/usr/local/bin
install -m 0644 bindings/c/foundationdb/fdb_c.h bindings/c/foundationdb/fdb_c_options.g.h fdbclient/vexillographer/fdb.options $CLIENTSDIR/usr/local/include/foundationdb
install -m 0755 lib/libfdb_c.dylib $CLIENTSDIR/usr/local/lib
install -m 0644 bindings/python/fdb/*.py $CLIENTSDIR/Library/Python/2.7/site-packages/fdb
install -m 0755 bin/fdbbackup $CLIENTSDIR/usr/local/foundationdb/backup_agent/backup_agent
install -m 0755 packaging/osx/uninstall-FoundationDB.sh $CLIENTSDIR/usr/local/foundationdb
dos2unix README.md $CLIENTSDIR/usr/local/foundationdb/README
install -m 0755 "$BUILDDIR"/bin/fdbcli $CLIENTSDIR/usr/local/bin
install -m 0644 "$SRCDIR"/bindings/c/foundationdb/fdb_c.h "$BUILDDIR"/bindings/c/foundationdb/fdb_c_options.g.h "$SRCDIR"/fdbclient/vexillographer/fdb.options $CLIENTSDIR/usr/local/include/foundationdb
install -m 0755 "$BUILDDIR"/lib/libfdb_c.dylib $CLIENTSDIR/usr/local/lib
install -m 0644 "$BUILDDIR"/bindings/python/fdb/*.py $CLIENTSDIR/Library/Python/2.7/site-packages/fdb
install -m 0755 "$BUILDDIR"/bin/fdbbackup $CLIENTSDIR/usr/local/foundationdb/backup_agent/backup_agent
install -m 0755 "$SRCDIR"/packaging/osx/uninstall-FoundationDB.sh $CLIENTSDIR/usr/local/foundationdb
dos2unix "$SRCDIR"/README.md $CLIENTSDIR/usr/local/foundationdb/README
chmod 0644 $CLIENTSDIR/usr/local/foundationdb/README
ln -s /usr/local/foundationdb/backup_agent/backup_agent $CLIENTSDIR/usr/local/bin/fdbbackup
ln -s /usr/local/foundationdb/backup_agent/backup_agent $CLIENTSDIR/usr/local/bin/fdbrestore
ln -s /usr/local/foundationdb/backup_agent/backup_agent $CLIENTSDIR/usr/local/bin/fdbdr
ln -s /usr/local/foundationdb/backup_agent/backup_agent $CLIENTSDIR/usr/local/bin/dr_agent
pkgbuild --root $CLIENTSDIR --identifier FoundationDB-clients --version $VERSION.$RELEASE --scripts packaging/osx/scripts-clients FoundationDB-clients.pkg
pkgbuild --root $CLIENTSDIR --identifier FoundationDB-clients --version $VERSION --scripts "$SRCDIR"/packaging/osx/scripts-clients FoundationDB-clients.pkg
rm -rf $CLIENTSDIR
@ -46,14 +60,14 @@ mkdir -p -m 0755 $SERVERDIR/Library/LaunchDaemons
mkdir -p -m 0700 $SERVERDIR/usr/local/foundationdb/data
mkdir -p -m 0700 $SERVERDIR/usr/local/foundationdb/logs
install -m 0664 packaging/osx/foundationdb.conf.new $SERVERDIR/usr/local/etc/foundationdb
install -m 0755 bin/fdbserver bin/fdbmonitor $SERVERDIR/usr/local/libexec
install -m 0644 packaging/osx/com.foundationdb.fdbmonitor.plist $SERVERDIR/Library/LaunchDaemons
install -m 0664 "$SRCDIR"/packaging/osx/foundationdb.conf.new $SERVERDIR/usr/local/etc/foundationdb
install -m 0755 "$BUILDDIR"/bin/fdbserver "$BUILDDIR"/bin/fdbmonitor $SERVERDIR/usr/local/libexec
install -m 0644 "$SRCDIR"/packaging/osx/com.foundationdb.fdbmonitor.plist $SERVERDIR/Library/LaunchDaemons
pkgbuild --root $SERVERDIR --identifier FoundationDB-server --version $VERSION.$RELEASE --scripts packaging/osx/scripts-server FoundationDB-server.pkg
pkgbuild --root $SERVERDIR --identifier FoundationDB-server --version "$VERSION" --scripts "$SRCDIR"/packaging/osx/scripts-server FoundationDB-server.pkg
rm -rf $SERVERDIR
productbuild --distribution packaging/osx/Distribution.xml --resources packaging/osx/resources --package-path . $PKGFILE
productbuild --distribution "$SRCDIR"/packaging/osx/Distribution.xml --resources "$SRCDIR"/packaging/osx/resources --package-path . "$PKGFILE"
rm FoundationDB-clients.pkg FoundationDB-server.pkg

View File

@ -1,10 +1,10 @@
#!/bin/bash
if [ ! -f /usr/local/etc/foundationdb/fdb.cluster ]; then
description=`LC_CTYPE=C tr -dc A-Za-z0-9 < /dev/urandom | head -c 8`
random_str=`LC_CTYPE=C tr -dc A-Za-z0-9 < /dev/urandom | head -c 8`
description=`LC_CTYPE=C tr -dc '[:lower:][:upper:][:digit:]' < /dev/urandom | head -c 8`
random_str=`LC_CTYPE=C tr -dc '[:lower:][:upper:][:digit:]' < /dev/urandom | head -c 8`
echo $description:$random_str@127.0.0.1:4689 > /usr/local/etc/foundationdb/fdb.cluster
chmod 0664 /etc/foundationdb/fdb.cluster
chmod 0664 /usr/local/etc/foundationdb/fdb.cluster
NEWDB=1
fi