yocto-autobuilder-helper/scripts/buildhistory-init
Richard Purdie d19e7f2802 Continue to fill out buildhistory code
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-01-15 13:45:29 +00:00

40 lines
934 B
Bash
Executable File

#!/bin/sh
#
# Called with $1 - The target name
# $2 - The buildhistory directory
# $3 - The remote repository url
# $4 - The remote branch name
#
TARGETNAME=$1
BUILDHISTDIR=$2
REMOTEREPO=$3
REMOTEBRANCH=$4
echo BH $@
exit 0
# Example code dumped from an existing nightly-arm buildhistory step for reference
if [ ! -d $BUILDHISTDIR ]; then
mkdir -p $BUILDHISTDIR
git init $BUILDHISTDIR
fi
rm -rf $BUILDHISTDIR
mkdir -p $BUILDHISTDIR
git init $BUILDHISTDIR
if git ls-remote --exit-code $REMOTEREPO refs/heads/$REMOTEBRANCH> /dev/null; then
git push -q $REMOTEREPO :$REMOTEBRANCH
fi
if ! git ls-remote --exit-code $REMOTEREPO refs/heads/$REMOTEBRANCH > /dev/null; then
cd $BUILDHISTDIR
echo 'Initializing Repo' >> README
git checkout -b $REMOTEBRANCH
git add README
git commit -s -m 'Initializing Repo'
git push -q $REMOTEREPO $REMOTEBRANCH:$REMOTEBRANCH
fi