diff --git a/scripts/check-kernel-fix b/scripts/check-kernel-fix index 64f2eb0..302ec60 100755 --- a/scripts/check-kernel-fix +++ b/scripts/check-kernel-fix @@ -1,6 +1,9 @@ #!/bin/bash # vim: sw=4:sts=4:et +# TODO: Error handling is really not great. Especially failures from nested shells +# sucks. + . $(dirname "$0")/common-functions usage() @@ -249,6 +252,7 @@ find_and_print_toplevel_actions() local mb_state= [ -z "$branch" ] && fail "find_and_print_toplevel_actions: No branch provided" + [ ! -f $branch_state_file ] && fail "Bailing out" grep "^$branch:" "$branch_state_file" | \ while read line ; do @@ -386,7 +390,3 @@ for_each_build_branch "$branches_conf" check_branch_state $sha $references for_each_build_branch "$branches_conf" find_and_print_toplevel_actions $flat_mode $cvss -if [ ! -e "$actions_file" ] ; then - echo "EVERYTHING IS OK!" -fi - diff --git a/scripts/common-functions b/scripts/common-functions index dadc0c3..161007f 100644 --- a/scripts/common-functions +++ b/scripts/common-functions @@ -142,7 +142,7 @@ fail() branch_base_ver() { local branch="origin/$1" - git show-ref --verify --quiet "refs/remotes/${branch}" || fail "$branch invalid branch" + git show-ref --verify --quiet "refs/remotes/${branch}" || fail "$branch invalid branch. Please git fetch origin." local base_ver="v$(git grep SRCVERSION $branch -- rpm/config.sh | sed 's@.*=@@')" @@ -281,7 +281,7 @@ sha_to_patch_in_branch() [ -z "$sha" ] && fail "sha_to_patch_in_branch: No sha provided" [ -z "$branch" ] && fail "sha_to_patch_in_branch: No branch provided" - branch_file=$(git --no-pager grep -l -i "^git-commit[[:space:]]*:[[:space:]]*$sha" "origin/$branch") + branch_file=$(git --no-pager grep -l -i "^git-commit[[:space:]]*:[[:space:]]*$sha" "origin/$branch" 2>/dev/null ) echo "${branch_file#origin/$branch:}" }