Skip to content

Commit

Permalink
build-package.sh accepts tag or branch to build against
Browse files Browse the repository at this point in the history
  • Loading branch information
core1024 committed Dec 11, 2018
1 parent 06fe891 commit 938d486
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 4 deletions.
13 changes: 11 additions & 2 deletions dist-utils/build-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,24 @@ then DEST_DIR=$(realpath -- "$2")
else DEST_DIR=$PWD
fi

if [ -n "$3" ]; then
BRANCH="$3"
else
BRANCH=master
fi

DISTROS_DIR="$(realpath -- "$(dirname -- "$0")/../distros")"

usage() {
printf "Usage: %s distro [output directory]\n" "$0"
printf "Usage: %s distro [output directory] [version]\n" "$0"
printf "\ndistro\n\t\tThe name of the distribution to build a package for.\n"
printf "\noutput directory\n\t\tThe directory where the package should be placed.\n"
printf "\t\tIf omitted, the CWD is asumed as output directory.\n"
printf "\nAvailable distros are:\n"
ls -Qq1 "$DISTROS_DIR" | sed 's/^/ * /g'
printf "\nThe version is git branch/tag\n"
printf "\t You can see the available branches with git branch -r\n"
printf "\t You can see the available tags with git tag -l\n"
exit 1
}

Expand All @@ -25,4 +34,4 @@ fi
cd "$DISTROS_DIR/$DISTRO" &> /dev/null || usage

source mkconfig.sh
docker run --privileged --rm -v "$DEST_DIR:/app" -t "$(docker build -q .)" sh -c "(su builduser -c './package.sh') && $COPY_CMD"
docker run --privileged --rm -v "$DEST_DIR:/app" -t "$(docker build -q .)" sh -c "(su builduser -c \"./package.sh $BRANCH\") && $COPY_CMD"
4 changes: 4 additions & 0 deletions distros/ArchLinux/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ pkgver() {

prepare() {
cd "$srcdir/${_pkgname}"
if [ -n "$BRANCH" ]; then
git checkout "$BRANCH"
fi

git submodule update --init
make -f release.makefile clean
}
Expand Down
5 changes: 4 additions & 1 deletion distros/ArchLinux/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@

# Script to build distro's package
# check the Dockerfile for any adittional dependencies
if [ -n "$1" ]; then
export BRANCH=$1
fi

makepkg --clean --syncdeps --noconfirm
makepkg --clean --syncdeps --noconfirm
5 changes: 4 additions & 1 deletion distros/Fedora/package.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash
if [ -n "$1" ]; then
export BRANCH="$1"
fi

rpmdev-setuptree
spectool --get-files -R stremio.spec
rpmbuild -ba stremio.spec
rpmbuild -ba stremio.spec
3 changes: 3 additions & 0 deletions distros/Fedora/stremio.spec.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ git init
git remote add origin https://github.com/Stremio/stremio-shell.git
git fetch --all
git reset --hard origin/master
if [ -n "$BRANCH" ]; then
git checkout "$BRANCH"
fi
git submodule update --init
make -f release.makefile clean

Expand Down
3 changes: 3 additions & 0 deletions distros/Ubuntu/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

git clone https://github.com/Stremio/stremio-shell.git
cd stremio-shell
if [ -n "$1" ]; then
git checkout "$1"
fi
git submodule update --init

cp dist-utils/common/description ./description-pak
Expand Down

0 comments on commit 938d486

Please sign in to comment.