diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/checkout.sh | 30 | ||||
-rw-r--r-- | lib/common.sh | 43 | ||||
-rwxr-xr-x | lib/configure.sh | 4 | ||||
-rw-r--r-- | lib/gerrit.sh | 2 | ||||
-rw-r--r-- | lib/git-parser.sh | 31 | ||||
-rwxr-xr-x | lib/make.sh | 2 | ||||
-rw-r--r-- | lib/package.sh | 4 | ||||
-rw-r--r-- | lib/stamp.sh | 2 |
8 files changed, 80 insertions, 38 deletions
diff --git a/lib/checkout.sh b/lib/checkout.sh index 9eb33668..08a170a7 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} @@ -189,18 +189,34 @@ checkout_all() esac local gitinfo="`get_source ${package}`" - if test x"${gitinfo}" != x; then + if test -z "${gitinfo}"; then + error "No matching source found for \"${name}\"." + return 1 + fi + + # If it doesn't have a service it's probably a tarball that we need to + # fetch, especially likely if passed in on the command line. + local service= + service="`get_git_service ${gitinfo}`" + if test x"${service}" != x; then local checkout_ret= checkout ${gitinfo} checkout_ret=$? - if test ${checkout_ret} -gt 0; then - error "Failed checkout out of $i." + error "Failed checkout out of ${name}." return 1 fi else - error "Unable to find source url for package $package." - return 1 + fetch ${gitinfo} + if test $? -gt 0; then + error "Couldn't fetch tarball ${gitinfo}" + return 1 + fi + extract ${gitinfo} + if test $? -gt 0; then + error "Couldn't extract tarball ${gitinfo}" + return 1 + fi fi done @@ -235,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 00b8a110..e1b33566 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 @@ -240,16 +240,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 ;; *.tar.*) @@ -365,13 +365,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 @@ -512,7 +512,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. @@ -531,12 +531,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`" @@ -599,7 +599,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 @@ -617,16 +617,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 @@ -721,7 +721,7 @@ create_release_version() } -# Parse a version string and produced the proper output fields. This is +# Parse a version string and produce the proper output fields. This is # used when naming releases for both directories, tarballs, and # internal version numbers. The version string looks like # 'gcc.git/gcc-4.8-branch' or 'gcc-linaro-4.8-2013.09' @@ -735,9 +735,9 @@ 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\.\-]*::'`" + 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\.]*::'`" if test x"${release}" = x; then # extract the branch from the version @@ -751,7 +751,8 @@ create_release_tag() # return the version string array local rtag="${rtag}${revision}-${date}" else - local version="`echo $1 | grep -o '\-[0-9\.]*\-' | tr -d '-'`" + # grep -o returns multiple lines. Match only on the first using 'head -1'. + local version="`echo $1 | grep -o '\-[0-9\.]*\-' | head -1 | tr -d '-'`" local tool="`get_toolname $1`" if test x"${version}" = x; then local version="`grep ^latest= ${topdir}/config/${tool}.conf | cut -d '\"' -f 2`" 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 59d15285..7e24b398 100644 --- a/lib/git-parser.sh +++ b/lib/git-parser.sh @@ -96,7 +96,7 @@ # # A full git url with branch and revision information, e.g., # -# http://firstname.lastname@staging.git.linaro.org/git/toolchain/gcc.git/linaro_4.9_branch@12345 +# http://firstname.lastname@git.linaro.org/git/toolchain/gcc.git/linaro_4.9_branch@12345 # # A git repo identifier with branch and revision information: # @@ -377,6 +377,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} } @@ -388,6 +391,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} } @@ -399,6 +405,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} } @@ -410,6 +419,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} } @@ -421,6 +433,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} } @@ -432,6 +447,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} } @@ -443,6 +461,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} } @@ -456,17 +477,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 a95f387f..923fe5c0 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/package.sh b/lib/package.sh index 6c3ea712..b65509e0 100644 --- a/lib/package.sh +++ b/lib/package.sh @@ -464,8 +464,8 @@ EOF if test "`echo ${gcc_branch} | grep -c \.tar\.`" -eq 0; then cat >> ${outfile} <<EOF - echo gcc_revision=${gcc_revision} - echo gcc_version=gcc.git@${gcc_revision} +gcc_revision=${gcc_revision} +gcc_version=gcc.git@${gcc_revision} EOF fi 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 |