Skip to content

Commit

Permalink
SNOW-1055755: fix rpm build
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-mraba committed Jul 31, 2024
1 parent c783b10 commit 08aaad3
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 11 deletions.
1 change: 0 additions & 1 deletion scripts/packaging/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ RUN gem install fpm
RUN pip install -U pip uv hatch

WORKDIR /snowflake-cli
RUN git clone https://github.com/snowflakedb/snowflake-cli.git .
25 changes: 15 additions & 10 deletions scripts/packaging/build_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,34 @@ set -o pipefail

VERSION=$(hatch version)
THIS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
DEB_PGK="snowflke-cli-${VERSION}.deb"
RPM_PGK="snowflke-cli-${VERSION}.rpm"
ARCH="$(uname -m)"
DEB_PGK="snowflake_cli_${VERSION}.${ARCH}.deb"
RPM_PGK="snowflake_cli_${VERSION}.${ARCH}.rpm"

echo "Building deb for version ${VERSION} on ${ARCH}..."
fpm \
-s dir \
-t deb \
--name snow \
--version ${VERSION} \
-p ${DEB_PGK} \
-C ./dist/snow \
-a native \
--prefix /usr/lib/snowflake/snowflake-cli \
--after-install $THIS_DIR/ubuntu/after_install.sh \
--after-remove $THIS_DIR/ubuntu/after_remove.sh \
--force
--force \
-C ./dist/snow \
-p ${DEB_PGK}

echo "Building rpm for version ${VERSION} on ${ARCH}..."
fpm \
-s dir \
-t rpm \
--name snow \
--version ${VERSION} \
-p ${RPM_PG} \
-C ./dist/snow \
-a native \
--prefix /usr/lib/snowflake/snowflake-cli \
--after-install $THIS_DIR/ubuntu/after_install.sh \
--after-remove $THIS_DIR/ubuntu/after_remove.sh \
--force
--after-install $THIS_DIR/centos/after_install.sh \
--after-remove $THIS_DIR/centos/after_remove.sh \
--force \
-C ./dist/snow \
-p ${RPM_PKG}
9 changes: 9 additions & 0 deletions scripts/packaging/centos/after_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash -e
#
# Snowcd after install script
set -o pipefail

SNOWFLAKE_CLI_LINK=/usr/local/bin/snow
SNOWFLAKE_CLI_BIN=/usr/lib/snowflake/snowflake-cli/snow
rm -f ${SNOWFLAKE_CLI_LINK}
ln -s ${SNOWFLAKE_CLI_BIN} ${SNOWFLAKE_CLI_LINK}
11 changes: 11 additions & 0 deletions scripts/packaging/centos/after_remove.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash -e
#
# Snowcd after remove script
#
set -o pipefail

SNOWFLAKE_CLI_LINK=/usr/local/bin/snow
if [[ -L "${SNOWFLAKE_CLI_LINK}" ]]; then
# delete only if it is symlink
rm -f "${SNOWFLAKE_CLI_LINK}"
fi

0 comments on commit 08aaad3

Please sign in to comment.