Unverified Commit 75e486a6 authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[R-package] quote path variables in build-cran-package.sh (#4499)

parent 661bde10
...@@ -9,13 +9,13 @@ ...@@ -9,13 +9,13 @@
set -e set -e
ORIG_WD=$(pwd) ORIG_WD="$(pwd)"
TEMP_R_DIR=$(pwd)/lightgbm_r TEMP_R_DIR="$(pwd)/lightgbm_r"
if test -d ${TEMP_R_DIR}; then if test -d "${TEMP_R_DIR}"; then
rm -r ${TEMP_R_DIR} rm -r "${TEMP_R_DIR}"
fi fi
mkdir -p ${TEMP_R_DIR} mkdir -p "${TEMP_R_DIR}"
CURRENT_DATE=$(date +'%Y-%m-%d') CURRENT_DATE=$(date +'%Y-%m-%d')
...@@ -24,41 +24,41 @@ CURRENT_DATE=$(date +'%Y-%m-%d') ...@@ -24,41 +24,41 @@ CURRENT_DATE=$(date +'%Y-%m-%d')
LGB_VERSION=$(cat VERSION.txt | sed "s/rc/-/g") LGB_VERSION=$(cat VERSION.txt | sed "s/rc/-/g")
# move relevant files # move relevant files
cp -R R-package/* ${TEMP_R_DIR} cp -R R-package/* "${TEMP_R_DIR}"
cp -R include ${TEMP_R_DIR}/src/ cp -R include "${TEMP_R_DIR}/src/"
cp -R src/* ${TEMP_R_DIR}/src/ cp -R src/* "${TEMP_R_DIR}/src/"
cp \ cp \
external_libs/fast_double_parser/include/fast_double_parser.h \ external_libs/fast_double_parser/include/fast_double_parser.h \
${TEMP_R_DIR}/src/include/LightGBM "${TEMP_R_DIR}/src/include/LightGBM"
mkdir -p ${TEMP_R_DIR}/src/include/LightGBM/fmt mkdir -p "${TEMP_R_DIR}/src/include/LightGBM/fmt"
cp \ cp \
external_libs/fmt/include/fmt/*.h \ external_libs/fmt/include/fmt/*.h \
${TEMP_R_DIR}/src/include/LightGBM/fmt/ "${TEMP_R_DIR}/src/include/LightGBM/fmt/"
# including only specific files from Eigen, to keep the R package # including only specific files from Eigen, to keep the R package
# small and avoid redistributing code with licenses incompatible with # small and avoid redistributing code with licenses incompatible with
# LightGBM's license # LightGBM's license
EIGEN_R_DIR=${TEMP_R_DIR}/src/include/Eigen EIGEN_R_DIR="${TEMP_R_DIR}/src/include/Eigen"
mkdir -p ${EIGEN_R_DIR} mkdir -p "${EIGEN_R_DIR}"
modules="Cholesky Core Dense Eigenvalues Geometry Householder Jacobi LU QR SVD" modules="Cholesky Core Dense Eigenvalues Geometry Householder Jacobi LU QR SVD"
for eigen_module in ${modules}; do for eigen_module in ${modules}; do
cp external_libs/eigen/Eigen/${eigen_module} ${EIGEN_R_DIR}/${eigen_module} cp external_libs/eigen/Eigen/${eigen_module} "${EIGEN_R_DIR}/${eigen_module}"
if [ ${eigen_module} != "Dense" ]; then if [ ${eigen_module} != "Dense" ]; then
mkdir -p ${EIGEN_R_DIR}/src/${eigen_module}/ mkdir -p "${EIGEN_R_DIR}/src/${eigen_module}/"
cp -R external_libs/eigen/Eigen/src/${eigen_module}/* ${EIGEN_R_DIR}/src/${eigen_module}/ cp -R external_libs/eigen/Eigen/src/${eigen_module}/* "${EIGEN_R_DIR}/src/${eigen_module}/"
fi fi
done done
mkdir -p ${EIGEN_R_DIR}/src/misc mkdir -p "${EIGEN_R_DIR}/src/misc"
cp -R external_libs/eigen/Eigen/src/misc/* ${EIGEN_R_DIR}/src/misc/ cp -R external_libs/eigen/Eigen/src/misc/* "${EIGEN_R_DIR}/src/misc/"
mkdir -p ${EIGEN_R_DIR}/src/plugins mkdir -p "${EIGEN_R_DIR}/src/plugins"
cp -R external_libs/eigen/Eigen/src/plugins/* ${EIGEN_R_DIR}/src/plugins/ cp -R external_libs/eigen/Eigen/src/plugins/* "${EIGEN_R_DIR}/src/plugins/"
cd ${TEMP_R_DIR} cd "${TEMP_R_DIR}"
# Remove files not needed for CRAN # Remove files not needed for CRAN
echo "Removing files not needed for CRAN" echo "Removing files not needed for CRAN"
...@@ -138,7 +138,7 @@ cd ${TEMP_R_DIR} ...@@ -138,7 +138,7 @@ cd ${TEMP_R_DIR}
rm R/*.R.bak rm R/*.R.bak
rm NAMESPACE.bak rm NAMESPACE.bak
cd ${ORIG_WD} cd "${ORIG_WD}"
R CMD build \ R CMD build \
--keep-empty-dirs \ --keep-empty-dirs \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment