Merge pull request #3106 from MilhouseVH/le90_buildsystem_fixup

scripts/get_git: fix a couple of errors
This commit is contained in:
CvH 2018-11-15 17:58:03 +01:00 committed by GitHub
commit cf9a0c97bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,7 +55,7 @@ GIT_SUBMODULE_PARAMS=""
if [ -n "${PKG_GIT_CLONE_DEPTH}" ]; then if [ -n "${PKG_GIT_CLONE_DEPTH}" ]; then
if [[ "${PKG_GIT_CLONE_DEPTH}" =~ ^[0-9]+$ ]]; then if [[ "${PKG_GIT_CLONE_DEPTH}" =~ ^[0-9]+$ ]]; then
GIT_CLONE_PARAMS="$GIT_CLONE_PARAMS --depth ${PKG_GIT_CLONE_DEPTH}" GIT_CLONE_PARAMS="${GIT_CLONE_PARAMS} --depth ${PKG_GIT_CLONE_DEPTH}"
else else
die "ERROR: PKG_GIT_CLONE_DEPTH is not a number! (${PKG_GIT_CLONE_DEPTH})" die "ERROR: PKG_GIT_CLONE_DEPTH is not a number! (${PKG_GIT_CLONE_DEPTH})"
fi fi
@ -70,13 +70,13 @@ if [ -n "${PKG_GIT_SUBMODULE_DEPTH}" ]; then
fi fi
GIT_FOUND="no" GIT_FOUND="no"
opwd=$(pwd) opwd="$(pwd)"
for d in "${SOURCES}/${1}/${1}-"* ; do for d in "${SOURCES}/${1}/${1}-"* ; do
if [ -d "${d}/.git" ]; then if [ -d "${d}/.git" ]; then
if [ "${GIT_FOUND}" = "no" ]; then if [ "${GIT_FOUND}" = "no" ]; then
cd "${d}" cd "${d}"
if [ "${PKG_URL}" = "$(git remote get-url origin)" ]; then if [ "${PKG_URL}" = "$(git remote get-url origin)" ]; then
if [[ -z "${PKG_GIT_CLONE_BRANCH}"]] || [[ $(git branch | grep "^\* ${PKG_GIT_CLONE_BRANCH}$" | wc -l) -eq 1 ]]; then if [[ -z "${PKG_GIT_CLONE_BRANCH}" ]] || [[ $(git branch | grep "^\* ${PKG_GIT_CLONE_BRANCH}$" | wc -l) -eq 1 ]]; then
GIT_FOUND="yes" GIT_FOUND="yes"
GIT_DIR="${d}" GIT_DIR="${d}"
_get_repo_clean _get_repo_clean
@ -95,7 +95,7 @@ for d in "${SOURCES}/${1}/${1}-"* ; do
cd "${opwd}" cd "${opwd}"
rm -rf "${d}" rm -rf "${d}"
fi fi
if [ "$GIT_FOUND" = "yes" ]; then if [ "${GIT_FOUND}" = "yes" ]; then
printf "%${BUILD_INDENT}c $(print_color CLR_GET "GIT PULL") ${1}\n" ' '>&$SILENT_OUT printf "%${BUILD_INDENT}c $(print_color CLR_GET "GIT PULL") ${1}\n" ' '>&$SILENT_OUT
git pull git pull
cd "${opwd}" cd "${opwd}"
@ -115,7 +115,7 @@ cd "${opwd}"
if [ "${GIT_FOUND}" = "no" ]; then if [ "${GIT_FOUND}" = "no" ]; then
printf "%${BUILD_INDENT}c $(print_color CLR_GET "GIT CLONE") ${1}\n" ' '>&$SILENT_OUT printf "%${BUILD_INDENT}c $(print_color CLR_GET "GIT CLONE") ${1}\n" ' '>&$SILENT_OUT
git clone "${GIT_CLONE_PARAMS}" "${PKG_URL}" "${PACKAGE}" git clone ${GIT_CLONE_PARAMS} "${PKG_URL}" "${PACKAGE}"
else else
if [ ! "${GIT_DIR}" = "${PACKAGE}" ]; then if [ ! "${GIT_DIR}" = "${PACKAGE}" ]; then
mv "${GIT_DIR}" "${PACKAGE}" mv "${GIT_DIR}" "${PACKAGE}"
@ -126,10 +126,10 @@ fi
[ $(git log --oneline --pretty=tformat:"%H" | grep "^${PKG_VERSION}" | wc -l) -eq 1 ] || die "There is no commit '${PKG_VERSION}' on branch '$(git branch | grep ^\* | cut -d ' ' -f2)' of package '${1}'! Aborting!" [ $(git log --oneline --pretty=tformat:"%H" | grep "^${PKG_VERSION}" | wc -l) -eq 1 ] || die "There is no commit '${PKG_VERSION}' on branch '$(git branch | grep ^\* | cut -d ' ' -f2)' of package '${1}'! Aborting!"
git reset --hard "${PKG_VERSION}" git reset --hard "${PKG_VERSION}"
printf "%${BUILD_INDENT}c $(print_color CLR_GET "GIT SUBMODULE") ${1}\n" ' '>&$SILENT_OUT printf "%${BUILD_INDENT}c $(print_color CLR_GET "GIT SUBMODULE") ${1}\n" ' '>&$SILENT_OUT
git submodule update --init --recursive "${GIT_SUBMODULE_PARAMS}" git submodule update --init --recursive ${GIT_SUBMODULE_PARAMS}
) )
GIT_SHA=$(git ls-remote "${PACKAGE}" | grep -m1 HEAD | awk '{print $1;}') GIT_SHA="$(git ls-remote "${PACKAGE}" | grep -m1 HEAD | awk '{print $1;}')"
if [ -n "${PKG_GIT_SHA}" ]; then if [ -n "${PKG_GIT_SHA}" ]; then
[ "${PKG_GIT_SHA}" = "${GIT_SHA}" ] || printf "%${BUILD_INDENT}c $(print_color CLR_WARNING "WARNING") Incorrect git hash in respository: got ${GIT_SHA}, wanted ${PKG_GIT_SHA}\n\n" ' '>&$SILENT_OUT [ "${PKG_GIT_SHA}" = "${GIT_SHA}" ] || printf "%${BUILD_INDENT}c $(print_color CLR_WARNING "WARNING") Incorrect git hash in respository: got ${GIT_SHA}, wanted ${PKG_GIT_SHA}\n\n" ' '>&$SILENT_OUT