build: Make buildroot correctly build packages from correct branch.

This is intended for the Gerrit buildbot's use only.

When environment variable $GERRIT_PROJECT=aredn_packages

Assumptions:
$BUILDROOTBASE/../aredn_packages exists.
The changeset/refspec/patchset_revision has already been checked out into this aredn_pacakges folder
$GERRIT_PATCHSET_REVISION is set.

When GIT_BRANCH is set and not on aredn_packages gerrit project ensure aredn_packages is checked out
as above or system may fallback to sane defaults.

Change-Id: I693bed9fb2a4f7ee1471a8dbf440bbd391d3e783
This commit is contained in:
Conrad Lara - KG6JEI 2016-10-24 13:28:36 -07:00
parent bbeabbfec8
commit 4845272554
1 changed files with 26 additions and 1 deletions

View File

@ -2,8 +2,33 @@
cd "$BUILDROOTBASE"
# Prep the feeds file
echo "src-git arednpackages git://git.aredn.org/aredn_packages;develop" > feeds.conf
AREDN_PACKAGES_DIR=$(readlink -f "$BUILDROOTBASE/../aredn_packages")
if [ -n "$GERRIT_PROJECT" ] && [ "$GERRIT_PROJECT" = "aredn_packages" ]
then
# This is a Gerrit build for aredn_packages, lets run the single commit
echo "src-git arednpackages file://$AREDN_PACKAGES_DIR^$GERRIT_PATCHSET_REVISION" > feeds.conf
else
# If $GIT_BRANCH is set lets try and check locally to be sure the branch exists. If we haven't checked out aredn_packages
# locally then lets assume this may not be in the build environment and fall back to some sane defaults.
if [ -n "$GIT_BRANCH" ] && [ -d "$AREDN_PACKAGES_DIR" ] && [ -n "$(git --git-dir="$AREDN_PACKAGES_DIR/.git" branch --list -r "$GIT_BRANCH")" ]
then
BASE_BRANCH="$GIT_BRANCH"
else
case $GIT_BRANCH in
origin/release-* ) BASE_BRANCH="origin/master";;
origin/hotfix-* ) BASE_BRANCH="origin/master";;
origin/master ) BASE_BRANCH="origin/master";;
* ) BASE_BRANCH="origin/develop";;
esac
fi
echo "src-git arednpackages git://git.aredn.org/aredn_packages;$BASE_BRANCH" > feeds.conf
fi
cat feeds.conf.default >> feeds.conf
./scripts/feeds update -a
./scripts/feeds install -p arednpackages olsrd