diff options
-rw-r--r-- | lib/checkout.sh | 4 | ||||
-rw-r--r-- | lib/common.sh | 36 | ||||
-rwxr-xr-x | lib/configure.sh | 4 | ||||
-rw-r--r-- | lib/gerrit.sh | 2 | ||||
-rw-r--r-- | lib/git-parser.sh | 29 | ||||
-rwxr-xr-x | lib/make.sh | 2 | ||||
-rw-r--r-- | lib/stamp.sh | 2 | ||||
-rwxr-xr-x | testsuite/test.sh | 4 |
8 files changed, 54 insertions, 29 deletions
diff --git a/lib/checkout.sh b/lib/checkout.sh index 50115859..1c3d0f3e 100644 --- a/lib/checkout.sh +++ b/lib/checkout.sh @@ -102,7 +102,7 @@ checkout_infrastructure() # Some infrastructure packages (like dejagnu) come from a git repo. local service= - service="`get_git_service ${gitinfo}`" + service="`get_git_service ${gitinfo}`" || return 1 if test x"${service}" != x; then local checkout_ret= checkout ${gitinfo} @@ -251,7 +251,7 @@ checkout() fi local service= - service="`get_git_service $1`" + service="`get_git_service $1`" || return 1 if test x"${service}" = x ; then error "Unable to parse service from '$1'. You have either a bad URL, or an identifier that should be passed to get_URL." return 1 diff --git a/lib/common.sh b/lib/common.sh index 1e3cc058..f014998e 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -151,7 +151,7 @@ get_URL() # It makes no sense to call get_URL if you already have the URL. local service= - service="`get_git_service $1`" + service="`get_git_service $1`" || return 1 if test x"${service}" != x; then error "Input already contains a url." return 1 @@ -161,13 +161,13 @@ get_URL() # input parameters. The git parser will always return the 'repo' # for an identifier as long as it follows some semblance of sanity. local node= - node="`get_git_repo $1`" + node="`get_git_repo $1`" || return 1 # Optional elements for git repositories. local branch= - branch="`get_git_branch $1`" + branch="`get_git_branch $1`" || return 1 local revision= - revision="`get_git_revision $1`" + revision="`get_git_revision $1`" || return 1 local srcs="${sources_conf}" if test -e ${srcs}; then @@ -247,16 +247,16 @@ normalize_path() local node="`basename ${process} | sed -e 's:\.tar.*::' -e 's:\.tgz$::'`" else local node= - node="`get_git_repo ${process}`" + node="`get_git_repo ${process}`" || return 1 local branch= - branch="`get_git_branch ${process}`" + branch="`get_git_branch ${process}`" || return 1 # Multi-path branches should have forward slashes replaced with dashes. branch="`echo ${branch} | sed 's:/:-:g'`" local revision= - revision="`get_git_revision ${process}`" + revision="`get_git_revision ${process}`" || return 1 fi ;; svn*) @@ -376,13 +376,13 @@ get_toolname() fi local tool= - tool="`get_git_tool $1`" + tool="`get_git_tool $1`" || return 1 # binutils and gdb are special. They share a repository and the tool is # designated by the branch. if test x"${tool}" = x"binutils-gdb"; then local branch= - branch="`get_git_branch $1`" + branch="`get_git_branch $1`" || return 1 tool="`echo ${branch} | sed -e 's:.*binutils.*:binutils:' -e 's:.*gdb.*:gdb:'`" fi @@ -523,7 +523,7 @@ get_source() if test x"${url}" = x; then local service= - service="`get_git_service $1`" + service="`get_git_service $1`" || return 1 # This might be a full URL or just an identifier. Use the # service field to determine this. @@ -542,12 +542,12 @@ get_source() local url= local url_ret= - url="`get_git_url ${gitinfo}`" + url="`get_git_url ${gitinfo}`" || return 1 url_ret=$? local branch= - branch="`get_git_branch ${gitinfo}`" + branch="`get_git_branch ${gitinfo}`" || return 1 local revision= - revision="`get_git_revision ${gitinfo}`" + revision="`get_git_revision ${gitinfo}`" || return 1 # # local url="`echo ${gitinfo} | cut -d ' ' -f 1`" @@ -610,7 +610,7 @@ get_srcdir() # The git parser will return results for all valid services. local service= - service="`get_git_service ${process}`" + service="`get_git_service ${process}`" || return 1 # The git parser functions are most reliable when called with # a full URL and this verifies that a repo identifier has a @@ -628,16 +628,16 @@ get_srcdir() tool="`get_toolname ${process}`" local repo= - repo="`get_git_repo ${process}`" + repo="`get_git_repo ${process}`" || return 1 local branch= - branch="`get_git_branch ${process}`" + branch="`get_git_branch ${process}`" || return 1 # Multi-path branches should have / replaces with dashes. branch="`echo ${branch} | sed 's:/:-:g'`" local revision= - revision="`get_git_revision ${process}`" + revision="`get_git_revision ${process}`" || return 1 local dir=${repo}${branch:+~${branch}}${revision:+@${revision}} fi @@ -746,7 +746,7 @@ create_release_tag() local branch= local revision= - local rtag="`get_git_tag $1`" + local rtag="`get_git_tag $1`" || return 1 local name="`echo ${version} | cut -d '/' -f 1 | cut -d '~' -f 1 | sed -e 's:\.git:-linaro:' -e 's:\.tar.*::' -e 's:-[-0-9\.]\.[0-9\.\-][-rc0-9\.]*::'`" diff --git a/lib/configure.sh b/lib/configure.sh index 62a9d3f7..f79bd35b 100755 --- a/lib/configure.sh +++ b/lib/configure.sh @@ -40,8 +40,8 @@ configure_build() # The git parser functions shall return valid results for all # services, especially once we have a URL. - local url="`get_git_url ${gitinfo}`" - local tag="`get_git_tag ${gitinfo}`" + local url="`get_git_url ${gitinfo}`" || return 1 + local tag="`get_git_tag ${gitinfo}`" || return 1 local srcdir="`get_srcdir ${gitinfo} ${2:+$2}`" local stamp="`get_stamp_name configure ${gitinfo} ${2:+$2}`" local builddir="`get_builddir ${gitinfo} ${2:+$2}`" diff --git a/lib/gerrit.sh b/lib/gerrit.sh index a2f8e17f..46d0f784 100644 --- a/lib/gerrit.sh +++ b/lib/gerrit.sh @@ -228,7 +228,7 @@ gerrit_build_status() local srcdir="`get_srcdir $1`" local status="$2" local resultsfile="${3:-}" - local revision="`get_git_revision ${srcdir}`" + local revision="`get_git_revision ${srcdir}`" || return 1 local msgfile="/tmp/test-results-$$.txt" local code="0" diff --git a/lib/git-parser.sh b/lib/git-parser.sh index 2aeea03a..330a01fb 100644 --- a/lib/git-parser.sh +++ b/lib/git-parser.sh @@ -401,6 +401,9 @@ get_git_service() out="`git_parser service ${in}`" ret=$? echo "${out}" + if test ${ret} -ne 0; then + error "Malformed input \"${in}\"" + fi return ${ret} } @@ -412,6 +415,9 @@ get_git_user() out="`git_parser user ${in}`" ret=$? echo "${out}" + if test ${ret} -ne 0; then + error "Malformed input \"${in}\"" + fi return ${ret} } @@ -423,6 +429,9 @@ get_git_url() out="`git_parser url ${in}`" ret=$? echo "${out}" + if test ${ret} -ne 0; then + error "Malformed input \"${in}\"" + fi return ${ret} } @@ -434,6 +443,9 @@ get_git_tool() out="`git_parser tool ${in}`" ret=$? echo "${out}" + if test ${ret} -ne 0; then + error "Malformed input \"${in}\"" + fi return ${ret} } @@ -445,6 +457,9 @@ get_git_repo() out="`git_parser repo ${in}`" ret=$? echo "${out}" + if test ${ret} -ne 0; then + error "Malformed input \"${in}\"" + fi return ${ret} } @@ -456,6 +471,9 @@ get_git_branch() out="`git_parser branch ${in}`" ret=$? echo "${out}" + if test ${ret} -ne 0; then + error "Malformed input \"${in}\"" + fi return ${ret} } @@ -467,6 +485,9 @@ get_git_revision() out="`git_parser revision ${in}`" ret=$? echo "${out}" + if test ${ret} -ne 0; then + error "Malformed input \"${in}\"" + fi return ${ret} } @@ -480,17 +501,21 @@ get_git_tag() local revision= repo="`git_parser repo ${in}`" ret=$? + if test ${ret} -ne 0; then + error "Malformed input \"${in}\"" + return ${ret} + fi if test x"${repo}" = x; then error "repository name required for meaningful response." return ${ret} fi - branch="`get_git_branch ${in}`" + branch="`get_git_branch ${in}`" || ( error "Malformed input \"${in}\""; return 1 ) # Multi-path branches should have forward slashes replaced with dashes. branch="`echo ${branch} | sed 's:/:-:g'`" - revision="`git_parser revision ${in}`" + revision="`git_parser revision ${in}`" || ( error "Malformed input \"${in}\""; return 1 ) echo "${repo}${branch:+~${branch}}${revision:+@${revision}}" return 0 } diff --git a/lib/make.sh b/lib/make.sh index f810f3b2..cce831d5 100755 --- a/lib/make.sh +++ b/lib/make.sh @@ -326,7 +326,7 @@ build() # because it can't be reparsed by the parser (since '/' characters are # converted to '-' characters in branch names. local tag= - tag="`get_git_tag ${gitinfo}`" + tag="`get_git_tag ${gitinfo}`" || return 1 local srcdir="`get_srcdir ${gitinfo} ${2:+$2}`" diff --git a/lib/stamp.sh b/lib/stamp.sh index af71648e..b3a589e1 100644 --- a/lib/stamp.sh +++ b/lib/stamp.sh @@ -42,7 +42,7 @@ get_stamp_name() # e.g., infrastructure/gmp-2.1.2.tar.xz -> gmp-2.1.2 name_fragment="`basename ${name_fragment}`" else - name_fragment="`get_git_tag ${git_or_tar}`" + name_fragment="`get_git_tag ${git_or_tar}`" || return 1 if test x"${name_fragment}" = x; then error "Couldn't determine stamp name." return 1 diff --git a/testsuite/test.sh b/testsuite/test.sh index e142f39f..0a37865d 100755 --- a/testsuite/test.sh +++ b/testsuite/test.sh @@ -1630,7 +1630,7 @@ done #confirm that checkout fails with bad repo - abe is so forgiving that I can only find one suitable input rm -rf "${local_snapshots}"/*.git* in="http://" -testing="checkout: ${in} should fail with 'cannot parse repo' message." +testing="checkout: ${in} should fail with 'Malformed input' message." if test x"${debug}" = xyes; then out="`cd ${local_snapshots} && checkout ${in} 2> >(tee /dev/stderr)`" else @@ -1639,7 +1639,7 @@ fi if test $? -eq 0; then fail "${testing}" else - if echo "${out}" | tail -n1 | grep -q "^ERROR.*: git_parser (Malformed input\\. No repo found\\.)$"; then + if echo "${out}" | tail -n1 | grep -q "^ERROR.*: get_git_repo (Malformed input \"http://\")$"; then pass "${testing}" else fail "${testing}" |