Merge pull request #8944 from influxdata/mr-package-dir

Fix tarball packaging paths
pull/8955/head
Mark Rushakoff 2017-10-10 08:00:27 -07:00 committed by GitHub
commit 767583c31a
3 changed files with 31 additions and 24 deletions

View File

@ -39,6 +39,8 @@ tar x -C /go -zf /influxdb-src.tar.gz
ln -s /go/src/github.com/influxdata/influxdb /isrc # Shorthand for influxdb source. ln -s /go/src/github.com/influxdata/influxdb /isrc # Shorthand for influxdb source.
SHA=$(jq -r .sha < "/isrc/.metadata.json") SHA=$(jq -r .sha < "/isrc/.metadata.json")
VERSION=$(jq -r .version < "/isrc/.metadata.json") VERSION=$(jq -r .version < "/isrc/.metadata.json")
ARCHIVE_ROOT_NAME="influxdb-${VERSION}-1"
PKG_ROOT="/pkg/$ARCHIVE_ROOT_NAME"
# Extract the respective binaries to dedicated folders. # Extract the respective binaries to dedicated folders.
mkdir -p /ibin mkdir -p /ibin
@ -49,34 +51,35 @@ if [ "$OS" == "linux" ] || [ "$OS" == "darwin" ]; then
####### Data packages ####### ####### Data packages #######
############################# #############################
# Create layout for packaging in /pkg. # Create layout for packaging under $PKG_ROOT.
mkdir -p /pkg/usr/bin \ rm -rf "$PKG_ROOT"
/pkg/var/log/influxdb \ mkdir -p "$PKG_ROOT/usr/bin" \
/pkg/var/lib/influxdb \ "$PKG_ROOT/var/log/influxdb" \
/pkg/usr/lib/influxdb/scripts \ "$PKG_ROOT/var/lib/influxdb" \
/pkg/usr/share/man/man1 \ "$PKG_ROOT/usr/lib/influxdb/scripts" \
/pkg/etc/influxdb \ "$PKG_ROOT/usr/share/man/man1" \
/pkg/etc/logrotate.d "$PKG_ROOT/etc/influxdb" \
"$PKG_ROOT/etc/logrotate.d"
chmod -R 0755 /pkg chmod -R 0755 /pkg
# Copy service scripts. # Copy service scripts.
cp /isrc/scripts/init.sh /pkg/usr/lib/influxdb/scripts/init.sh cp /isrc/scripts/init.sh "$PKG_ROOT/usr/lib/influxdb/scripts/init.sh"
chmod 0644 /pkg/usr/lib/influxdb/scripts/init.sh chmod 0644 "$PKG_ROOT/usr/lib/influxdb/scripts/init.sh"
cp /isrc/scripts/influxdb.service /pkg/usr/lib/influxdb/scripts/influxdb.service cp /isrc/scripts/influxdb.service "$PKG_ROOT/usr/lib/influxdb/scripts/influxdb.service"
chmod 0644 /pkg/usr/lib/influxdb/scripts/influxdb.service chmod 0644 "$PKG_ROOT/usr/lib/influxdb/scripts/influxdb.service"
# Copy logrotate script. # Copy logrotate script.
cp /isrc/scripts/logrotate /pkg/etc/logrotate.d/influxdb cp /isrc/scripts/logrotate "$PKG_ROOT/etc/logrotate.d/influxdb"
chmod 0644 /pkg/etc/logrotate.d/influxdb chmod 0644 "$PKG_ROOT/etc/logrotate.d/influxdb"
# Copy sample config. # Copy sample config.
cp /isrc/etc/config.sample.toml /pkg/etc/influxdb/influxdb.conf cp /isrc/etc/config.sample.toml "$PKG_ROOT/etc/influxdb/influxdb.conf"
# Copy data binaries. # Copy data binaries.
cp /ibin/* /pkg/usr/bin/ cp /ibin/* "$PKG_ROOT/usr/bin/"
# Copy man pages. # Copy man pages.
cp /isrc/man/*.1.gz /pkg/usr/share/man/man1 cp /isrc/man/*.1.gz "$PKG_ROOT/usr/share/man/man1"
# Make tarball of files in packaging. # Make tarball of files in packaging.
BIN_GZ_NAME="/out/influxdb-${VERSION}_${OS}_${ARCH}.tar.gz" BIN_GZ_NAME="/out/influxdb-${VERSION}_${OS}_${ARCH}.tar.gz"
@ -84,6 +87,7 @@ if [ "$OS" == "linux" ] || [ "$OS" == "darwin" ]; then
BIN_GZ_NAME="/out/influxdb-${VERSION}-static_${OS}_${ARCH}.tar.gz" BIN_GZ_NAME="/out/influxdb-${VERSION}-static_${OS}_${ARCH}.tar.gz"
fi fi
# Creating tarball from /pkg, NOT from $PKG_ROOT, so that influxdb-$VERSION-1 directory is present in archive.
(cd /pkg && tar czf $BIN_GZ_NAME ./*) (cd /pkg && tar czf $BIN_GZ_NAME ./*)
# don't need static install packages. # don't need static install packages.
@ -111,7 +115,7 @@ if [ "$OS" == "linux" ] || [ "$OS" == "darwin" ]; then
--architecture "$ARCH" \ --architecture "$ARCH" \
--version "$VERSION" \ --version "$VERSION" \
--iteration 1 \ --iteration 1 \
-C /pkg \ -C "$PKG_ROOT" \
-p /out \ -p /out \
| ruby -e 'puts (eval ARGF.read)[:path]' ) | ruby -e 'puts (eval ARGF.read)[:path]' )
@ -130,9 +134,13 @@ if [ "$OS" == "linux" ] || [ "$OS" == "darwin" ]; then
sha256sum "$f" > "$f.sha256" sha256sum "$f" > "$f.sha256"
done) done)
elif [ "$OS" == "windows" ]; then elif [ "$OS" == "windows" ]; then
# Windows gets the binaries and nothing else. # Windows gets the binaries and the sample config file.
# TODO: should Windows get the sample config files? rm -rf "$PKG_ROOT"
(cd /ibin && zip -9 -r "/out/influxdb-${VERSION}_${OS}_${ARCH}.zip" ./*) mkdir -p "$PKG_ROOT"
cp /ibin/*.exe "$PKG_ROOT"
cp /isrc/etc/config.sample.toml "$PKG_ROOT/influxdb.conf"
(cd /pkg && zip -9 -r "/out/influxdb-${VERSION}_${OS}_${ARCH}.zip" ./*)
(cd /out && for f in *.zip; do (cd /out && for f in *.zip; do
md5sum "$f" > "$f.md5" md5sum "$f" > "$f.md5"
sha256sum "$f" > "$f.sha256" sha256sum "$f" > "$f.sha256"

View File

@ -4,6 +4,7 @@ function printHelp() {
>&2 echo "USAGE: $0 -i PATH_TO_SOURCE_TARBALL -o OUTDIR >&2 echo "USAGE: $0 -i PATH_TO_SOURCE_TARBALL -o OUTDIR
Emits an archive of influxdb binaries based on the current environment's GOOS and GOARCH. Emits an archive of influxdb binaries based on the current environment's GOOS and GOARCH.
Respects CGO_ENABLED.
If the environment variable GO_NEXT is not empty, builds the binaries with the 'next' version of Go. If the environment variable GO_NEXT is not empty, builds the binaries with the 'next' version of Go.
" "

View File

@ -9,8 +9,6 @@ Emits a tarball of influxdb source code and dependencies to OUTDIR.
If using -p flag, directory containing influxdb source code will be used as source of truth. If using -p flag, directory containing influxdb source code will be used as source of truth.
This is helpful if you have local commits that have not been pushed. This is helpful if you have local commits that have not been pushed.
If not using -p, you must provide -S to clone over SSH.
" "
} }
@ -31,7 +29,7 @@ OUTDIR=""
INFLUXDB_GIT_MOUNT="" INFLUXDB_GIT_MOUNT=""
while getopts hs:b:v:o:p:S: arg; do while getopts hs:b:v:o:p: arg; do
case "$arg" in case "$arg" in
h) printHelp; exit 1;; h) printHelp; exit 1;;
s) SHA="$OPTARG";; s) SHA="$OPTARG";;