diff options
author | Rob Savoye <rob.savoye@linaro.org> | 2016-04-07 15:30:20 -0600 |
---|---|---|
committer | Rob Savoye <rob.savoye@linaro.org> | 2016-04-20 09:57:16 -0600 |
commit | f5115fdea3e90f2d329c6a948d4627091d5b10ae (patch) | |
tree | 81c3d1e13f0f1f7a832b283f12952a9b27a63128 | |
parent | 780abcb5c0ec7fdc94ced7b71ecf16b276075ad1 (diff) |
Merge branch using an array into master. Address comments from patchset 4.
Change-Id: I8ed46668962711c4aa051fadb25c78f1e2e646cc
-rwxr-xr-x | abe.sh | 76 | ||||
-rw-r--r-- | config/expat.conf | 16 | ||||
-rw-r--r-- | config/gcc.conf | 3 | ||||
-rw-r--r-- | config/gdb.conf | 2 | ||||
-rw-r--r-- | config/glibc.conf | 4 | ||||
-rw-r--r-- | config/gmp.conf | 2 | ||||
-rw-r--r-- | config/infrastructure.conf | 2 | ||||
-rw-r--r-- | config/linux.conf | 2 | ||||
-rw-r--r-- | config/mpc.conf | 2 | ||||
-rw-r--r-- | config/mpfr.conf | 2 | ||||
-rw-r--r-- | config/newlib.conf | 9 | ||||
-rw-r--r-- | config/python.conf | 16 | ||||
-rw-r--r-- | config/sources.conf | 40 | ||||
-rwxr-xr-x | configure | 4 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | lib/checkout.sh | 371 | ||||
-rw-r--r-- | lib/common.sh | 571 | ||||
-rw-r--r-- | lib/component.sh | 604 | ||||
-rwxr-xr-x | lib/configure.sh | 159 | ||||
-rwxr-xr-x | lib/depend.sh | 94 | ||||
-rwxr-xr-x | lib/fetch.sh | 236 | ||||
-rw-r--r-- | lib/gerrit.sh | 4 | ||||
-rw-r--r-- | lib/globals.sh | 106 | ||||
-rwxr-xr-x | lib/make.sh | 287 | ||||
-rw-r--r-- | lib/package.sh | 419 | ||||
-rwxr-xr-x | lib/release.sh | 10 | ||||
-rwxr-xr-x | scripts/Backport.job | 4 | ||||
-rwxr-xr-x | test.sh | 2 | ||||
-rw-r--r-- | testsuite/common.sh | 64 | ||||
-rw-r--r-- | testsuite/component-tests.sh | 205 | ||||
-rw-r--r-- | testsuite/stamp-tests.sh | 2 | ||||
-rwxr-xr-x | testsuite/test.sh | 1221 | ||||
-rw-r--r-- | testsuite/test_sources.conf | 10 |
33 files changed, 1724 insertions, 2829 deletions
@@ -29,7 +29,7 @@ usage() [--extraconfig <tool>=<path>] [--fetch <url>] [--force] [--help] [--host <host_triple>] [--infrastructure] [--interactive] - [--list] [--manifest <manifest_file>] + [--manifest <manifest_file>] [--space <space needed>] [--parallel] [--prefix] [--release <release_version_string>] [--set {arch|cpu|tune}=XXX] @@ -216,14 +216,12 @@ OPTIONS --interactive Interactively select packages from the snapshots file. - --list List the available snapshots or configured repositories. - --manifest <manifest_file> Source the <manifest_file> to override the default configuration. This is used to reproduce an identical toolchain build from manifest files generated by a previous - build. + build. --space <space_needed> @@ -430,6 +428,9 @@ abe="`basename $0`" # this is used to launch builds of dependant components command_line_arguments=$* +# Initialize an entry in the data array for components +collect_data abe + # # These functions actually do something # @@ -657,33 +658,6 @@ check_optional_directive() return 0 } -# This gets a list from a remote server of the available tarballs. We use HTTP -# instead of SSH so it's more accessible to those behind nasty firewalls. -# base - already checkout out source trees -# snapshots - tarballs of various source snapshots -# prebuilt - prebuilt executables -get_list() -{ - echo "Get version list for $1..." - - # http://abe.validation.linaro.org/snapshots - case $1 in - testcode|t*) - testcode="`grep testcode ${local_snapshots}/testcode/md5sums | cut -d ' ' -f 3 | cut -d '/' -f 2`" - echo "${testcode}" - ;; - snapshots|s*) - snapshots="`egrep -v "\.asc|\.diff|\.txt|xdelta|base|infrastructure|testcode" ${local_snapshots}/md5sums | cut -d ' ' -f 3`" - echo "${snapshots}" - ;; - infrastructure|i*) - infrastructure="`grep infrastructure ${local_snapshots}/md5sums | cut -d ' ' -f 3 | cut -d '/' -f 2`" - echo "${infrastructure}" - ;; - esac - return 0 -} - # Get some info on the build system # $1 - If specified, it's the hostname of the remote system get_build_machine_info() @@ -777,6 +751,10 @@ while test $# -gt 0; do # URL can be either for a source tarball, or a checkout via svn, bzr, # or git case "$1" in + --fileserver) + warning "The --fileserver option has been removed, so ignoring it." + continue + ;; --bu*|-bu*) # build check_directive $1 build bu $2 @@ -851,17 +829,11 @@ while test $# -gt 0; do ;; --manifest*|-m*) check_directive $1 manifest "m" $2 - # source a manifest file if there is one - if test -f $2 ; then - egrep "_revision=|_version=|_branch=|clibrary=" $2 > /tmp/rev$$.txt - source /tmp/rev$$.txt - rm /tmp/rev$$.txt - else - error "Manifest file '$2' not found" - build_failure + import_manifest $2 + if test $? -gt 0; then + build_failure fi shift - echo $gcc_version ;; # download and install the infrastructure libraries GCC depends on --inf*|infrastructure) @@ -913,10 +885,6 @@ while test $# -gt 0; do --interactive|-i) interactive=yes ;; - --list|-l) - get_list $2 - shift - ;; --nodepends|-n) # nodepends nodepends=yes ;; @@ -1211,12 +1179,6 @@ if test x"${force}" = xyes -a x"$supdate" = xno; then echo " Using \"--force\" overrides \"--disable update\". Sources will be redownloaded." fi -timeout_save=${wget_timeout} -wget_timeout=10 -# Get the md5sums file, which is used later to get the URL for remote files -fetch_md5sums -wget_timeout=${timeout_save} - if test ! -z "${do_makecheck}"; then # If we encounter 'all' in ${do_makecheck} anywhere we just overwrite # runtests with ${all_unit_tests} and ignore the rest. @@ -1276,19 +1238,15 @@ fi if test ! -z ${do_checkout}; then if test x"${do_checkout}" != x"all"; then - url="`get_source ${do_checkout}`" - if test $? -gt 0; then - error "Couldn't find the source for ${do_checkout}" - build_failure - fi - - checkout ${url} + checkout ${do_checkout} if test $? -gt 0; then error "--checkout ${url} failed." build_failure fi else - checkout_all + infrastructure="`grep ^depends ${topdir}/config/infrastructure.conf | tr -d '\"' | sed -e 's:^depends=::'`" + builds="${infrastructure} binutils gcc gdb libc" + checkout_all ${builds} if test $? -gt 0; then error "--checkout all failed." build_failure @@ -1299,7 +1257,7 @@ fi if test ! -z ${do_build}; then if test x"${do_build}" != x"all"; then buildingall=no - gitinfo="`get_source ${do_build}`" + gitinfo="${do_build}" if test x"${gitinfo}" = x; then error "Couldn't find the source for ${do_build}" build_failure diff --git a/config/expat.conf b/config/expat.conf new file mode 100644 index 00000000..7f357538 --- /dev/null +++ b/config/expat.conf @@ -0,0 +1,16 @@ +# This is a list of other components need to build this component +depends="" + +# This is the latest version of this toolchain component +latest="expat-2.1.0-1-mingw32-dev.tar.xz" + +# This is a file that gets installed that is used to determine if the toolchain +# component is already installed. +installs="libexpat." + +# This is a list of default flags always supplied to configure +default_configure_flags="" + +# If yes, only static linking will be used +static_link=yes + diff --git a/config/gcc.conf b/config/gcc.conf index d0ee7c75..e16b629c 100644 --- a/config/gcc.conf +++ b/config/gcc.conf @@ -12,9 +12,8 @@ latest="gcc.git~linaro/gcc-5-branch" static_link="no" # This is a list of default flags always supplied to configure -default_configure_flags="--with-bugurl=https://bugs.linaro.org --with-mpc=${local_builds}/destdir/${host} --with-mpfr=${local_builds}/destdir/${host} --with-gmp=${local_builds}/destdir/${host} --with-gnu-as --with-gnu-ld --disable-libstdcxx-pch --disable-libmudflap${override_arch:+ --with-arch=${override_arch}}${override_cpu:+ --with-cpu=${override_cpu}}${override_tune:+ --with-tune=${override_tune}}" +default_configure_flags="--with-mpc=${local_builds}/destdir/${host} --with-mpfr=${local_builds}/destdir/${host} --with-gmp=${local_builds}/destdir/${host} --with-gnu-as --with-gnu-ld --disable-libstdcxx-pch --disable-libmudflap${override_arch:+ --with-arch=${override_arch}}${override_cpu:+ --with-cpu=${override_cpu}}${override_tune:+ --with-tune=${override_tune}}" -# --with-pkgversion=${USER} # --with-as=${local_builds}/bin/${target}-as --with-ld=${local_builds}/bin/${target}-ld # Disable the Graphite loop optimizer as it's being depreciated diff --git a/config/gdb.conf b/config/gdb.conf index e332488e..cf285a85 100644 --- a/config/gdb.conf +++ b/config/gdb.conf @@ -15,7 +15,7 @@ if test x"${build}" != x"${target}"; then case ${host} in *-mingw32*) # For mingw, we have to specify where our mingw version of python is. - default_configure_flags="--with-python=${local_snapshots}/infrastructure/python-2.7.4-mingw32 `echo ${default_configure_flags} | sed -e 's:--enable-tui::'` CFLAGS=-I${local_builds}/destdir/${host}/usr/include LDFLAGS=-L${local_builds}/destdir/${host}/usr/lib" + default_configure_flags="--with-python=${local_snapshots}/python-2.7.4-mingw32 `echo ${default_configure_flags} | sed -e 's:--enable-tui::'` CFLAGS=-I${local_builds}/destdir/${host}/usr/include LDFLAGS=-L${local_builds}/destdir/${host}/usr/lib" ;; *linux*) default_configure_flags="${default_configure_flags} --disable-sim --with-python=yes" diff --git a/config/glibc.conf b/config/glibc.conf index b33a7815..3ffe76a8 100644 --- a/config/glibc.conf +++ b/config/glibc.conf @@ -6,11 +6,11 @@ latest="glibc.git~release/2.21/master" # If yes, only static linking will be used static_link=no -default_configure_flags="--disable-profile --without-gd --enable-obsolete-rpc --with-headers=${sysroots}/usr/include libc_cv_forced_unwind=yes libc_cv_c_cleanup=yes libc_cv_ctors_header=yes --without-selinux" +default_configure_flags="--disable-profile --without-gd --enable-obsolete-rpc --with-headers=${sysroots}/usr/include libc_cv_forced_unwind=yes libc_cv_c_cleanup=yes libc_cv_ctors_header=yes --without-selinux --disable-werror" # Add platform specific flags case ${target} in arm*7-*linux-*) default_configure_flags="${default_configure_flags} --enable-multi-arch";; esac -default_makeflags="PARALLELMFLAGS=\"-j ${cpus}\"" +default_makeflags="PARALLELMFLAGS=-j${cpus}" diff --git a/config/gmp.conf b/config/gmp.conf index f8b8b46e..7bb7734c 100644 --- a/config/gmp.conf +++ b/config/gmp.conf @@ -2,7 +2,7 @@ depends="" # This is the latest version of this toolchain component -latest="6.0.0a" +latest="6.0.0a.tar.xz" # This is a file that gets installed that is used to determine if the toolchain # component is already installed. diff --git a/config/infrastructure.conf b/config/infrastructure.conf index 2a6db8c0..5e74fb56 100644 --- a/config/infrastructure.conf +++ b/config/infrastructure.conf @@ -1,5 +1,5 @@ # These need to be built and installed in the order they are listed. -depends="gmp mpfr mpc linux dejagnu" # installjammer make +depends="gmp mpfr mpc linux dejagnu" # If yes, only static linking will be used static_link=yes diff --git a/config/linux.conf b/config/linux.conf index 4b446b22..4056d887 100644 --- a/config/linux.conf +++ b/config/linux.conf @@ -8,7 +8,7 @@ default_configure_flags="" # distributions, so we force it to be bash. # This is the latest version of this toolchain component, which is a tarball -latest="linux-linaro-4.0-rc4-2015.03" +latest="linaro-4.0-rc4-2015.03.tar.xz" # This is a file that gets installed that is used to determine if the toolchain # component is already installed. diff --git a/config/mpc.conf b/config/mpc.conf index dd1c5d3d..adffe4d0 100644 --- a/config/mpc.conf +++ b/config/mpc.conf @@ -2,7 +2,7 @@ depends="" # This is the latest version of this toolchain component -latest="1.0.3" +latest="1.0.3.tar.gz" # This is a file that gets installed that is used to determine if the toolchain # component is already installed. diff --git a/config/mpfr.conf b/config/mpfr.conf index dad04f02..8f51f962 100644 --- a/config/mpfr.conf +++ b/config/mpfr.conf @@ -2,7 +2,7 @@ depends="" # This is the latest version of this toolchain component -latest="3.1.3" +latest="3.1.3.tar.xz" # This is a file that gets installed that is used to determine if the toolchain # component is already installed. diff --git a/config/newlib.conf b/config/newlib.conf index 047e35b3..da2b1a2a 100644 --- a/config/newlib.conf +++ b/config/newlib.conf @@ -3,13 +3,12 @@ depends="" latest="newlib.git~linaro_newlib-branch" -# The --with-newlib flag may seem weird for newlib build. Newlib has -# top level configure/Makefile above newlib, and without this flag it +# The --with-newlib flag may seem weird for newlib build. Newlib has +# top level configure/Makefile above newlib, and without this flag it # won't configure and build newlib. # This is a list of default flags always supplied to configure -# Without -nostdlib, newlib won't configure. -default_configure_flags="--with-newlib LDFLAGS=-nostdlib --enable-newlib-multithread --enable-newlib-io-pos-args --enable-newlib-io-c99-formats --enable-newlib-io-long-long --enable-newlib-io-long-double --enable-newlib-mb" -#default_makeflags="install-rdimon" +default_configure_flags="--with-newlib --enable-newlib-multithread --enable-newlib-io-pos-args --enable-newlib-io-c99-formats --enable-newlib-io-long-long --enable-newlib-io-long-double --enable-newlib-mb" +#default_makeflags="all-target-newlib all-target-libgloss" # If yes, only static linking will be used static_link=yes diff --git a/config/python.conf b/config/python.conf new file mode 100644 index 00000000..3c66f88a --- /dev/null +++ b/config/python.conf @@ -0,0 +1,16 @@ +# This is a list of other components need to build this component +depends="" + +# This is the latest version of this toolchain component +latest="python-2.7.4-mingw32.tar.xz" + +# This is a file that gets installed that is used to determine if the toolchain +# component is already installed. +installs="libpython" + +# This is a list of default flags always supplied to configure +default_configure_flags="" + +# If yes, only static linking will be used +static_link=yes + diff --git a/config/sources.conf b/config/sources.conf index fedfe048..305dcc68 100644 --- a/config/sources.conf +++ b/config/sources.conf @@ -3,33 +3,35 @@ # NOTE: use spaces instead of TABs # -dejagnu.git http://git.linaro.org/git/toolchain/dejagnu.git -kernel http://git.linaro.org/git/kernel/linux-linaro-stable.git -linux-linaro http://git.linaro.org/git/kernel/linux-linaro-stable.git +# These are infrastructure files, only tarballs are used. + +expat http://snapshots.linaro.org/components/toolchain/infrastructure/ +gmp http://snapshots.linaro.org/components/toolchain/infrastructure/ +mpc http://snapshots.linaro.org/components/toolchain/infrastructure/ +mpfr http://snapshots.linaro.org/components/toolchain/infrastructure/ +python http://snapshots.linaro.org/components/toolchain/infrastructure/ +installjammer-1.2.15 http://snapshots.linaro.org/components/toolchain/infrastructure/ +linux http://snapshots.linaro.org/components/toolchain/infrastructure/ +gcc http://148.251.136.42/snapshots-ref +binutils http://148.251.136.42/snapshots-ref + +# These URLS are for repositories, ie... git +dejagnu.git http://git.linaro.org/git/toolchain/dejagnu.git +kernel http://git.linaro.org/git/kernel/linux-linaro-stable.git +linaro-kernel http://git.linaro.org/git/kernel/linux-linaro-stable.git # GCC -gcc-4.6 svn://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch -gcc-4.7 svn://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch -gcc-4.8 svn://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch -gcc-aarch64-4.7 svn://gcc.gnu.org/svn/gcc/branches/ARM/aarch64-4.7-branch -gcc-embedded-4.6 svn://gcc.gnu.org/svn/gcc/branches/ARM/embedded-4_6-branch -gcc-google-4.6 svn://gcc.gnu.org/svn/gcc/branches/google/gcc-4_6 -#gcc svn://gcc.gnu.org/svn/gcc/trunk gcc.git http://git.linaro.org/git/toolchain/gcc.git -abe.git http://git.linaro.org/git/toolchain/abe.git -#gcc.git http://git.linaro.org/git/toolchain/gcc.git +abe.git http://git.linaro.org/git/toolchain/abe.git +#gcc.git http://staging.git.linaro.org/git/toolchain/gcc.git -#gcc-linaro-4.7 lp:gcc-linaro/4.7 -gcc-linaro-4.6 lp:gcc-linaro/4.6 -gdb-linaro-7.6 lp:gdb-linaro/7.6 -gdb-linaro-7.5 lp:gdb-linaro/7.5 clang http://llvm.org/svn/llvm-project/cfe/trunk cfe http://llvm.org/svn/llvm-project/cfe/trunk # Binutils -binutils.git http://git.linaro.org/git/toolchain/binutils.git binutils-gdb.git http://git.linaro.org/git/toolchain/binutils-gdb.git -gdb.git http://git.linaro.org/git/toolchain/gdb.git +gdb.git http://git.linaro.org/git/toolchain/binutils-gdb.git +binutils.git http://git.linaro.org/git/toolchain/binutils-gdb.git # Libraries llvm http://llvm.org/svn/llvm-project/llvm/trunk @@ -54,5 +56,3 @@ valgrind svn://svn.valgrind.org/valgrind/trunk qemu.git git://git.qemu.org/qemu.git qemu-linaro.git http://git.linaro.org/qemu/qemu-linaro.git -#Benchmarks -eembc.git ssh://somehost/somepath/eembc.git @@ -606,7 +606,6 @@ LOCAL_SNAPSHOTS SYSROOTS ABE_PATH SOURCES_CONF -FILESERVER ABE_TOP BUILDDATE ALIEN @@ -3103,7 +3102,7 @@ DBPASSWD=${dbpasswd} DBHOST=${dbhost} -CPUS="`getconf _NPROCESSORS_ONLN`" +CPUS="`grep -c proces /proc/cpuinfo`" CORES="`grep cores /proc/cpuinfo | tail -1 | cut -d ' ' -f 3`" @@ -3882,7 +3881,6 @@ fi - # Check whether --with-sources-conf was given. if test "${with_sources_conf+set}" = set; then : withval=$with_sources_conf; SOURCES_CONF="${srcdir}/config/sources.conf" diff --git a/configure.ac b/configure.ac index 0bc33efc..e4f3fad7 100644 --- a/configure.ac +++ b/configure.ac @@ -49,7 +49,7 @@ AC_SUBST(DBPASSWD) DBHOST=${dbhost} AC_SUBST(DBHOST) -CPUS="`getconf _NPROCESSORS_ONLN`" +CPUS="`grep -c proces /proc/cpuinfo`" AC_SUBST(CPUS) CORES="`grep cores /proc/cpuinfo | tail -1 | cut -d ' ' -f 3`" AC_SUBST(CORES) @@ -277,7 +277,7 @@ AC_ARG_WITH(fileserver, AC_HELP_STRING([--with-fileserver], [the remote file server hostname]), FILESERVER=${withval}, FILESERVER='148.251.136.42/snapshots-ref') -AC_SUBST(FILESERVER) +dnl AC_SUBST(FILESERVER) AC_ARG_WITH(sources-conf, AC_HELP_STRING([--with-sources-conf], []), diff --git a/lib/checkout.sh b/lib/checkout.sh index 6b2da675..68fbb3da 100644 --- a/lib/checkout.sh +++ b/lib/checkout.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (C) 2013, 2014 Linaro, Inc +# Copyright (C) 2013, 2014, 2015 Linaro, Inc # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -24,89 +24,65 @@ # but we also want to work with the native source code control system. usegit=no -# This is used by abe.sh --checkout all but not by --build -checkout_infrastructure() +# This is similar to make_all except it _just_ gathers sources trees and does +# nothing else. +checkout_all() { trace "$*" - if test x"${supdate}" = xno; then - warning "checkout_infrastructure called with --disable update. Checkout of infrastructure files will be skipped." - return 0 - fi - - source_config infrastructure - - if test x"${depends}" = x; then - error "No dependencies listed for infrastructure libraries!" - return 1 - fi + local packages="$*" - # This shouldn't happen, but it's nice for regression verification. - if test ! -e ${local_snapshots}/md5sums; then - error "Missing ${local_snapshots}/md5sums file needed for infrastructure libraries." - return 1 - fi - - # We have to grep each dependency separately to preserve the order, as - # some libraries depend on other libraries being bult first. Egrep - # unfortunately sorts the files, which screws up the order. - local files= - if test x"${dejagnu_version}" = x; then - files="`grep ^latest= ${topdir}/config/dejagnu.conf | cut -d '\"' -f 2`" - else - files="${dejagnu_version}" - fi - - local version= - for i in ${depends}; do - case $i in - linux) version=${linux_version} ;; - mpfr) version=${mpfr_version} ;; - mpc) version=${mpc_version} ;; - gmp) version=${gmp_version} ;; - dejagnu) version=${dejagnu_version} ;; - *) - error "config/infrastructure.conf contains an unknown dependency: $i" - return 1 - ;; - esac - - # If the user didn't set it, check the <component>.conf files for - # 'latest'. - if test "${version:+set}" != "set"; then - version="`grep ^latest= ${topdir}/config/${i}.conf | cut -d '\"' -f 2`" - # Sometimes config/${i}.conf uses <component>-version and sometimes - # it just uses 'version'. Regardless, searching the md5sums file requires - # that we include the component name. - version=${i}-${version#${i}-} + for i in ${packages}; do + local package=$i + if test x"$i" = x"libc"; then + package="${clibrary}" + fi + if test x"${package}" = x"stage1" -o x"${package}" = x"stage2"; then + package="gcc" fi + collect_data ${package} - if test "${version:+found}" != "found"; then - error "Can't find a version for component \"$i\" in ${i}.conf" - return 1 + local filespec="`get_component_filespec ${package}`" + if test "`component_is_tar ${package}`" = no; then + local checkout_ret= + checkout ${package} + checkout_ret=$? + if test ${checkout_ret} -gt 0; then + error "Failed checkout out of ${name}." + return 1 + fi + else + fetch ${package} + if test $? -gt 0; then + error "Couldn't fetch tarball ${package}" + return 1 + fi + extract ${package} + if test $? -gt 0; then + error "Couldn't extract tarball ${package}" + return 1 + fi fi - # Hopefully we only download the exact match for each one. Depending - # how vague the user is it might download multiple tarballs. - files="${files} `grep /${version} ${local_snapshots}/md5sums | cut -d ' ' -f3 | uniq`" - unset version done if test `echo ${host} | grep -c mingw` -eq 1; then # GDB now needs expat for XML support. mkdir -p ${local_builds}/destdir/${host}/bin/ - fetch infrastructure/expat-2.1.0-1-mingw32-dev.tar.xz - extract infrastructure/expat-2.1.0-1-mingw32-dev.tar.xz - rsync -ar ${local_snapshots}/infrastructure/expat-2.1.0-1/include ${local_builds}/destdir/${host}/usr/ - rsync -ar ${local_snapshots}/infrastructure/expat-2.1.0-1/lib ${local_builds}/destdir/${host}/usr/ + collect_data expat + fetch expat + extract expat + rsync -ar ${local_snapshots}/expat-2.1.0-1/include ${local_builds}/destdir/${host}/usr/ + rsync -ar ${local_snapshots}/expat-2.1.0-1/lib ${local_builds}/destdir/${host}/usr/ # GDB now has python support, for mingw we have to download a # pre-built win2 binary that works with mingw32. - fetch infrastructure/python-2.7.4-mingw32.tar.xz - extract infrastructure/python-2.7.4-mingw32.tar.xz + collect_data python + fetch python + extract python # The mingw package of python contains a script used by GDB to # configure itself, this is used to specify that path so we don't # have to modify the GDB configure script. - export PYTHON_MINGW=${local_snapshots}/infrastructure/python-2.7.4-mingw32 + export PYTHON_MINGW=${local_snapshots}/python-2.7.4-mingw32 # The Python DLLS need to be in the bin dir where the executables are. rsync -ar ${PYTHON_MINGW}/pylib ${local_builds}/destdir/${host}/bin/ rsync -ar ${PYTHON_MINGW}/dll ${local_builds}/destdir/${host}/bin/ @@ -124,137 +100,11 @@ checkout_infrastructure() files="${files} installjammer-1.2.15.tar.gz" fi - for i in ${files}; do - local name="`echo $i | sed -e 's:\.tar\..*::' -e 's:infrastructure/::' -e 's:testcode/::'`" - local gitinfo= - gitinfo="`get_source ${name}`" - if test -z "${gitinfo}"; then - error "No matching source found for \"${name}\"." - return 1 - fi - - # Some infrastructure packages (like dejagnu) come from a git repo. - local service= - service="`get_git_service ${gitinfo}`" || return 1 - 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 ${name}." - return 1 - fi - else - 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 - - return 0 -} - -# This is similar to make_all except it _just_ gathers sources trees and does -# nothing else. -checkout_all() -{ - local packages= - packages="binutils libc gcc gdb" - - # See if specific component versions were specified at runtime - if test x"${gcc_version}" = x; then - gcc_version="`grep ^latest= ${topdir}/config/gcc.conf | cut -d '\"' -f 2`" - fi - if test x"${binutils_version}" = x; then - binutils_version="`grep ^latest= ${topdir}/config/binutils.conf | cut -d '\"' -f 2`" - fi - if test x"${eglibc_version}" = x; then - eglibc_version="`grep ^latest= ${topdir}/config/eglibc.conf | cut -d '\"' -f 2`" - fi - if test x"${newlib_version}" = x; then - newlib_version="`grep ^latest= ${topdir}/config/newlib.conf | cut -d '\"' -f 2`" - fi - if test x"${glibc_version}" = x; then - glibc_version="`grep ^latest= ${topdir}/config/glibc.conf | cut -d '\"' -f 2`" - fi - if test x"${gdb_version}" = x; then - gdb_version="`grep ^latest= ${topdir}/config/gdb.conf | cut -d '\"' -f 2`" - fi - - checkout_infrastructure - if test $? -gt 0; then - return 1 - fi - - for i in ${packages}; do - local package= - case $i in - gdb) - package=${gdb_version} - ;; - binutils) - package=${binutils_version} - ;; - gcc) - package=${gcc_version} - ;; - libc) - if test x"${clibrary}" = x"eglibc"; then - package=${eglibc_version} - elif test x"${clibrary}" = x"glibc"; then - package=${glibc_version} - elif test x"${clibrary}" = x"newlib"; then - package=${newlib_version} - else - error "\${clibrary}=${clibrary} not supported." - return 1 - fi - ;; - *) - ;; - esac - - local gitinfo="`get_source ${package}`" - 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 ${name}." - return 1 - fi - else - 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 - notice "Checkout all took ${SECONDS} seconds" + # Set this to no, since all the sources are now checked out + supdate=no + return 0 } @@ -278,42 +128,32 @@ checkout() { trace "$*" - if test x"$1" = x; then - error "No URL given!" - return 1 - fi + local component="$1" - local service= - 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 + # gdbserver is already checked out in the GDB source tree. + if test x"${component}" = x"gdbserver"; then + return 0 fi - local repo= - repo="`get_git_repo $1`" || return 1 - - #None of the following should be able to fail with the code as it is - #written today (and failures are therefore untestable) but propagate - #errors anyway, in case that situation changes. - local tool= - tool="`get_toolname $1`" || return 1 + # None of the following should be able to fail with the code as it is + # written today (and failures are therefore untestable) but propagate + # errors anyway, in case that situation changes. local url= - url="`get_git_url $1`" || return 1 + url="`get_component_url ${component}`" || return 1 local branch= - branch="`get_git_branch $1`" || return 1 + branch="`get_component_branch ${component}`" || return 1 local revision= - revision="`get_git_revision $1`" || return 1 + revision="`get_component_revision ${component}`" || return 1 local srcdir= - srcdir="`get_srcdir $1`" || return 1 + srcdir="`get_component_srcdir ${component}`" || return 1 + local repo= + repo="`get_component_filespec ${component}`" || return 1 + local protocol="`echo ${url} | cut -d ':' -f 1`" - case $1 in + case ${protocol} in git*|http*|ssh*) - #FIXME: We deliberately ignored error returns from get_git_url, - # because any path with an '@' in will result in errors. - # Jenkins is wont to create such paths. - local repodir="`get_git_url ssh://${srcdir} | sed 's#^ssh://##'`" - + local repodir="${url}/${repo}" +# local revision= `echo ${gcc_version} | grep -o "[~@][0-9a-z]*\$" | tr -d '~@'`" if test x"${revision}" != x"" -a x"${branch}" != x""; then warning "You've specified both a branch \"${branch}\" and a commit \"${revision}\"." warning "Git considers a commit as implicitly on a branch.\nOnly the commit will be used." @@ -321,16 +161,16 @@ checkout() # If the master branch doesn't exist, clone it. If it exists, # update the sources. - if test ! -d ${repodir}; then - local git_reference_opt - if [ x"$git_reference_dir" != x"" -a \ - -d "$git_reference_dir/$(basename $repodir)" ]; then - local git_reference_opt="--reference $git_reference_dir/$(basename $repodir)" + if test ! -d ${local_snapshots}/${repo}; then + local git_reference_opt= + if test -d "${git_reference_dir}/${repo}"; then + local git_reference_opt="--reference ${git_reference_dir}/${repo}" fi notice "Cloning $1 in ${srcdir}" - dryrun "git_robust clone $git_reference_opt ${url} ${repodir}" + dryrun "git_robust clone ${git_reference_opt} ${repodir} ${local_snapshots}/${repo}" if test $? -gt 0; then - error "Failed to clone master branch from ${url} to ${repodir}" + error "Failed to clone master branch from ${url} to ${srcdir}" + rm -f ${local_builds}/git$$.lock return 1 fi fi @@ -340,13 +180,14 @@ checkout() # branch AND a commit is redundant and potentially contradictory. For this # reason we only consider the commit if both are present. if test x"${revision}" != x""; then - notice "Checking out revision for ${tool} in ${srcdir}" + notice "Checking out revision for ${component} in ${srcdir}" if test x${dryrun} != xyes; then local cmd="${NEWWORKDIR} ${local_snapshots}/${repo} ${srcdir} ${revision}" flock ${local_builds}/git$$.lock --command "${cmd}" if test $? -gt 0; then error "Revision ${revision} likely doesn't exist in git repo ${repo}!" - return 1 + rm -f ${local_builds}/git$$.lock + return 1 fi fi # git checkout of a commit leaves the head in detached state so we need to @@ -354,12 +195,13 @@ checkout() # it doesn't exist already. dryrun "(cd ${srcdir} && git checkout -B local_${revision})" else - notice "Checking out branch ${branch} for ${tool} in ${srcdir}" + notice "Checking out branch ${branch} for ${component} in ${srcdir}" if test x${dryrun} != xyes; then local cmd="${NEWWORKDIR} ${local_snapshots}/${repo} ${srcdir} ${branch}" flock ${local_builds}/git$$.lock --command "${cmd}" if test $? -gt 0; then error "Branch ${branch} likely doesn't exist in git repo ${repo}!" + rm -f ${local_builds}/git$$.lock return 1 fi fi @@ -369,37 +211,47 @@ checkout() elif test x"${supdate}" = xyes; then # Some packages allow the build to modify the source directory and # that might screw up abe's state so we restore a pristine branch. - notice "Updating sources for ${tool} in ${srcdir}" - dryrun "(cd ${repodir} && git stash --all)" - dryrun "(cd ${repodir} && git reset --hard)" - - # This is required due to the following scenario: A git - # reference dir is populated with a git clone on day X. On day - # Y a developer removes a branch and then replaces the same - # branch with a new branch of the same name. On day Z ABE is - # executed against the reference dir copy and the git pull fails - # due to error: 'refs/remotes/origin/<branch>' exists; cannot - # create 'refs/remotes/origin/<branch>'. You have to remove the - # stale branches before pulling the new ones. - dryrun "(cd ${repodir} && git remote prune origin)" - - dryrun "(cd ${repodir} && git_robust pull)" - # Update branch directory (which maybe the same as repo - # directory) - dryrun "(cd ${srcdir} && git stash --all)" - dryrun "(cd ${srcdir} && git reset --hard)" + notice "Updating sources for ${component} in ${srcdir}" + local current_branch="`cd ${srcdir} && git branch`" + if test "`echo ${current_branch} | grep -c local_`" -eq 0; then + dryrun "(cd ${srcdir} && git stash --all)" + dryrun "(cd ${srcdir} && git reset --hard)" + dryrun "(cd ${srcdir} && git_robust pull)" + # This is required due to the following scenario: A git + # reference dir is populated with a git clone on day X. On day + # Y a developer removes a branch and then replaces the same + # branch with a new branch of the same name. On day Z ABE is + # executed against the reference dir copy and the git pull fails + # due to error: 'refs/remotes/origin/<branch>' exists; cannot + # create 'refs/remotes/origin/<branch>'. You have to remove the + # stale branches before pulling the new ones. + dryrun "(cd ${srcdir} && git remote prune origin)" + + dryrun "(cd ${srcdir} && git_robust pull)" + # Update branch directory (which maybe the same as repo + # directory) + dryrun "(cd ${srcdir} && git stash --all)" + dryrun "(cd ${srcdir} && git reset --hard)" + fi if test x"${revision}" != x""; then # No need to pull. A commit is a single moment in time # and doesn't change. dryrun "(cd ${srcdir} && git_robust checkout -B local_${revision})" else # Make sure we are on the correct branch. - # If ${branch} is empty we set it to HEAD and checkout HEAD. - : ${branch:=HEAD} - dryrun "(cd ${srcdir} && git_robust checkout -B local_${branch} origin/${branch})" + # This is a no-op if $branch is empty and it + # just gets master. + dryrun "(cd ${srcdir} && git_robust checkout -B ${branch} origin/${branch})" dryrun "(cd ${srcdir} && git_robust pull)" fi fi + + local newrev="`pushd ${srcdir} 2>&1 > /dev/null && git log --format=format:%H -n 1 ; popd 2>&1 > /dev/null`" + if test x"${revision}" != x"${newrev}" -a x"${revision}" != x; then + error "SHA1s don't match for ${component}!, now is ${newrev}, was ${revision}" + return 1 + fi + set_component_revision ${component} ${newrev} ;; *) ;; @@ -407,15 +259,17 @@ checkout() if test $? -gt 0; then error "Couldn't checkout $1 !" + rm -f ${local_builds}/git$$.lock return 1 fi if test -e ${srcdir}/contrib/gcc_update; then - # Touch GCC's auto-generated files to avoid non-deterministic - # build behavior. - dryrun "(cd ${srcdir} && ./contrib/gcc_update --touch)" + # Touch GCC's auto-generated files to avoid non-deterministic + # build behavior. + dryrun "(cd ${srcdir} && ./contrib/gcc_update --touch)" fi + rm -f ${local_builds}/git$$.lock return 0 } @@ -521,11 +375,10 @@ change_branch() { trace "$*" - local dir="`normalize_path $1`" local version="`basename $1`" local branch="`echo $1 | cut -d '/' -f 2`" - local srcdir="`get_srcdir $1`" + local srcdir="`get_component_srcdir $1`" if test "`echo $1 | grep -c '@'`" -gt 0; then local revision="`echo $1 | cut -d '@' -f 2`" else diff --git a/lib/common.sh b/lib/common.sh index 17b6bfde..ae8fa5a6 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -33,12 +33,12 @@ set -o pipefail . "${topdir}/lib/stamp.sh" || exit 1 . "${topdir}/lib/schroot.sh" || exit 1 . "${topdir}/lib/gerrit.sh" || exit 1 +. "${topdir}/lib/component.sh" || exit 1 # # All the set* functions set global variables used by the other functions. # This way there can be some error recovery and handing. # - set_config() { echo "Set config file to $1..." @@ -140,194 +140,6 @@ notice() fi } -# Get the URL to checkout out development sources. -# -# $1 - The toolchain component identifier. -# -# Returns a string that represents the full URL for a git service -# that matches the identifier in the sources.conf file. -# -# [Optional] Return a branch and revision number for git if tagged -# onto the identifier. e.g., get_URL repo.git~multi/slash/branch@12345 -# will return a matching url in sources.conf such as: -# -# http://staging.linaro.org/git/toolchain/repo.git~multi/slash/branch@12345 -# -# If get_URL is passed an identifier that already contains a URL it will fail. -# -get_URL() -{ -# trace "$*" - - if test "`echo $1 | grep -c "\.tar.*$"`" -gt 0; then - error "not supported for .tar.* files." - return 1 - fi - - # It makes no sense to call get_URL if you already have the URL. - local service= - service="`get_git_service $1`" || return 1 - if test x"${service}" != x; then - error "Input already contains a url." - return 1 - fi - - # Use the git parser functions to retrieve information about the - # 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`" || return 1 - - # Optional elements for git repositories. - local branch= - branch="`get_git_branch $1`" || return 1 - local revision= - revision="`get_git_revision $1`" || return 1 - - local srcs="${sources_conf}" - if test -e ${srcs}; then - if test "`grep -c "^${node}" ${srcs}`" -gt 1; then - error "Need unique component and version to get URL!" - return 1 - fi - # We don't want to match on partial matches - # (hence looking for a trailing space or \t). - if test "`grep -c "^${node} " ${srcs}`" -lt 1 -a "`grep -Pc "^${node}\t" ${srcs}`" -lt 1; then - error "Component \"${node}\" not found in ${srcs} file!" - return 1 - fi - local url="`grep "^${node}" ${srcs} | sed -e 's:^.*[ \t]::'`" - echo "${url}${branch:+~${branch}}${revision:+@${revision}}" - - return 0 - else - error "No config file for repository sources!" - fi - - return 1 -} - -# display a list of matching URLS we know about. This is how you can see the -# correct name to pass to get_URL(). -# -# $1 - The name of the toolchain component, partial strings ok -list_URL() -{ -# trace "$*" - - local srcs="${sources_conf}" - if test -e ${srcs}; then - notice "Supported source repositories for $1 are:" -# sed -e 's:\t.*::' -e 's: .*::' -e 's:^:\t:' ${srcs} | grep $1 - local url="`grep $1 ${srcs} | tr -s ' ' | cut -d ' ' -f 2`" - for i in ${url}; do - echo " $i" 1>&2 - done - return 0 - else - error "No config file for sources!" - return 1 - fi - - return 0 -} - -# This takes a URL and turns it into a name suitable for the build -# directory name. -# $1 - the path to fixup -normalize_path() -{ -# FIXME: ban non-service or tarball inputs. - - local process= - if test "`echo $1 | egrep -c "^git://|^http://|^ssh://"`" -lt 1 -a "`echo $1 | grep -c "\.git"`" -gt 0; then - # If the input is an identifier (not a service) then process \.git - # identifiers as git URLs - process="`get_URL $1`" - else - process=$1 - fi - - local branch="" - case ${process} in - git*|http*|ssh*) - if test "`echo ${process} | grep -c "\.tar"`" -gt 0 -o "`echo ${process} | grep -c "\.tgz"`" -gt 0; then - local node="`basename ${process} | sed -e 's:\.tar.*::' -e 's:\.tgz$::'`" - else - local node= - node="`get_git_repo ${process}`" || return 1 - - local branch= - 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}`" || return 1 - fi - ;; - *.tar.*) - local node="`echo ${process} | sed -e 's:\.tar.*::' -e 's:\+git:@:' -e 's:\.git/:.git-:'`" - ;; - *) - fixme "normalize_path should only be called with a URL or a tarball name, not a sources.conf identifier." - # FIXME: This shouldn't be handled here. - local node="`echo ${process} | sed -e 's:\.tar.*::' -e 's:\+git:@:' -e 's:\.git/:.git-:'`" - ;; - esac - - if test "`echo $1 | grep -c glibc`" -gt 0; then - local delim='_' - else - local delim='@' - fi - - echo ${node}${branch:+~${branch}}${revision:+${delim}${revision}} - - return 0 -} - -# Extract the build directory from the URL of the source tree as it -# varies depending on which source code control system is used. -# -# $1 - The full URL to the source tree as returned by get_URL() -get_builddir() -{ - # We should be more strict but this works with identifiers - # as well because we might be passed a tar file. - local dir="`normalize_path $1`" - - if test x"$2" = x"libgloss"; then - echo "${local_builds}/${host}/${target}/${dir}/${target}/libgloss" - else - echo "${local_builds}/${host}/${target}/${dir}${2:+-$2}" - fi - - return 0 -} - -get_config() -{ - conf="`get_toolname $1`.conf" - if test $? -gt 0; then - return 1 - fi - if test -e ${topdir}/config/${conf}; then - echo "${topdir}/config/${conf}" - return 0 - else - tool="`echo ${tool} | sed -e 's:-linaro::'`" - if test -e ${topdir}/config/${conf}; then - echo "${topdir}/config/${conf}" - return 0 - fi - fi - error "Couldn't find ${topdir}/config/${conf}" - - return 1 -} - # Extract the name of the toolchain component being built # Source a bourne shell config file so we can access its variables. @@ -345,8 +157,8 @@ source_config() stage1_flags="" stage2_flags="" - conf="`get_config $1`" - if test $? -eq 0; then + local conf="${topdir}/config/$1.conf" + if test -e ${conf}; then . "${conf}" return 0 else @@ -354,19 +166,6 @@ source_config() fi } -read_config() -{ - conf="`get_config $1`" - if test $? -gt 0; then - return 1 - else - local value="`export ${2}= && . ${conf} && set -o posix && set | grep \"^${2}=\" | sed \"s:^[^=]\+=\(.*\):\1:\" | sed \"s:^'\(.*\)'$:\1:\"`" - local retval=$? - echo "${value}" - return ${retval} - fi -} - # Extract the name of the toolchain component being built # $1 - The full URL to the source tree as returned by get_URL(), or the # tarball name. @@ -394,304 +193,6 @@ get_toolname() return 0 } -# This look at a remote repository for source tarball -# -# $1 - The file to look for, which should be unique or we get too many results -# -# returns ${snapshot} -find_snapshot() -{ - if test x"$1" = x; then - error "find_snapshot() called without an argument!" - return 1 - fi - - local dir="`dirname $1`/" - if test x"${dir}" = x"."; then - dir="" - fi - - #rm -f ${local_snapshots}/md5sums - #fetch_http md5sums - #fetch_rsync ${remote_snapshots}/md5sums - - # Search for the snapshot in the md5sum file, and filter out anything we don't want. - snapshot="`grep $1 ${local_snapshots}/md5sums | egrep -v "\.asc|\.diff|\.txt|xdelta" | cut -d ' ' -f 3`" - if test x"${snapshot}" != x; then - if test `echo "${snapshot}" | grep -c $1` -gt 1; then - warning "Too many results for $1!" - echo "${snapshot}" - return 1 - fi - echo "${snapshot}" - return 0 - fi - -# snapshot="`grep $1 ${local_snapshots}/${dir}md5sums | cut -d ' ' -f 3`" - if test x"${snapshot}" = x; then - warning "No results for $1!" - return 1 - fi - if test `echo "${snapshot}" | grep -c $1` -gt 1; then - warning "Too many results for $1!" - echo "${snapshot}" - return 1 - fi - - echo ${snapshot} - return 0 -} - -# Get the full path or URL to checkout or download sources of a toolchain -# component. -# This is the kitchen sink of function. -# -# $1 - -# binutils, gcc, glibc, newlib, etc... -# -# returns ${url} as a string with either a single string that is the tarball -# name, or a URL that can be used by git. The fields are as returned by -# get_URL(), which is 'git url' and optionally 'git branch' 'git revision'. -get_source() -{ -# trace "$*" - - if test x"$1" = x; then - error "get_source() called without an argument!" - return 1 - fi - - local url= - # If a full URL or git repo identifier isn't passed as an argument, - # assume we want a tarball snapshot - if test `echo $1 | egrep -c "^git|^http|^ssh|\.git"` -eq 0; then - local snapshot - snapshot=`find_snapshot $1` - if test $? -gt 0; then - if test x"${interactive}" = x"yes"; then - # TODO: Add a testcase for this leg, conditional on - # interactive. - echo "Pick a unique snapshot name from this list: " 1>&2 - for i in ${snapshot}; do - echo " $i" 1>&2 - done - read answer - local url - url="`find_snapshot ${answer}`" - local ssret=$? - echo "${url}" - return ${ssret} - else - if test x"${snapshot}" != x; then - # It's possible that the value passed in to get_sources - # didn't match any known snapshots OR there were too many - # matches. Check <package>.conf:latest to see if there's a - # matching snapshot. - if test x"${latest}" != x; then - local url - url=`find_snapshot ${latest}` - local ssret=$? - echo "${url}" - return ${ssret} - fi - # Technically 'notice' and 'get_URL' already suppress without - # verbose being set but no reason to do unnecessary work. - if test "${verbose}" -gt 0; then - notice "Pick a unique snapshot name from this list and try again: " - for i in ${snapshot}; do - echo " $i" 1>&2 - done - list_URL $1 - fi - return 1 - fi - fi - else - echo ${snapshot} - return 0 - fi - else - # This leg captures direct urls that don't start or end in .git. - # This includes git identifiers that start with http://. - if test `echo $1 | egrep -c "\.git"` -eq 0 -a `echo $1 | egrep -c "^git"` -eq 0; then - #if test `echo $1 | egrep -c "\.git"` -eq 0; then - local url=$1 - echo "${url}" - return 0 - fi - fi - - # If a full URL isn't passed as an argment, get one for the - # toolchain component from the sources.conf file. - # If passed a full URL, use that to checkout the sources - if test x"${url}" = x; then - - local service= - service="`get_git_service $1`" || return 1 - - # This might be a full URL or just an identifier. Use the - # service field to determine this. - local gitinfo= - if test x"${service}" = x; then - # Just an identifier, so get the full git info. - local gitinfo="`get_URL $1`" - if test x"${gitinfo}" = x; then - error "$1 not a valid sources.conf identifier." - return 1; - fi - else - # Full URL - local gitinfo="$1" - fi - - local url= - local url_ret= - url="`get_git_url ${gitinfo}`" || return 1 - url_ret=$? - local branch= - branch="`get_git_branch ${gitinfo}`" || return 1 - local revision= - revision="`get_git_revision ${gitinfo}`" || return 1 - -# -# local url="`echo ${gitinfo} | cut -d ' ' -f 1`" -# if test `echo ${gitinfo} | wc -w` -gt 1; then -# local branch="`echo ${gitinfo} | cut -d ' ' -f 2`" -# else -# branch= -# fi -# if test `echo ${gitinfo} | wc -w` -gt 2; then -# local revision="`echo ${gitinfo} | cut -d ' ' -f 3`" -# fi - - #if test $? -gt 0; then - if test ${url_ret} -gt 0; then - if test x"${interactive}" = x"yes"; then - notice "Pick a unique URL (by identifier) from this list: " - list_URL $3 - for i in ${url}; do - echo "\t$i" 1>&2 - done - read answer - local url="`get_URL ${answer}`" - fi - # else - # notice "Pick a unique URL from this list: " - # for i in ${url}; do - # echo " $i" 1>&2 - # done - fi - fi - - # We aren't guaranteed a match even after snapshots and sources.conf have - # been checked. - if test x"${url}" = x; then - return 1 - fi - - echo "${url}${branch:+~${branch}}${revision:+@${revision}}" - - return 0 -} - -# Get the proper source directory -# $1 - The component name, which is one of the following: -# -# A git, http, ssh URL -# A repository identifier mapping an entry in sources.conf -# A tarball -# -# Returns the fully qualified srcdir -get_srcdir() -{ -# trace "$*" - - if test `echo $1 | grep -c "\.tar"` -gt 0; then - # tarballs have no branch or revision - local dir="`echo $1 | sed -e 's:\.tar.*::'`" - else - local process=$1 - - # The git parser will return results for all valid services. - local service= - 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 - # valid sources.conf entry. - if test x"${service}" = x; then - local process= - process="`get_URL $1`" - if test $? -gt 0; then - error "get_srcdir called with invalid input." - return 1 - fi - fi - - local tool= - tool="`get_toolname ${process}`" - - local repo= - repo="`get_git_repo ${process}`" || return 1 - - local branch= - 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}`" || return 1 - - local dir=${repo}${branch:+~${branch}}${revision:+@${revision}} - fi - - local srcdir="${local_snapshots}/${dir}" - - # Some components have non-standard directory layouts. - case ${tool} in - gcc*) -# FIXME: How does this work with current g.l.o gcc sources? - - # The Linaro gcc git branches are git repositories converted from - # bzr so they have goofy directory layouts which include the branch - # as a directory inside the source directory. - local newdir="`echo ${srcdir} | sed -e 's:\.git-linaro::' | tr '.' '_'`" - local newdir="`basename ${newdir}`" - # If the top level file doesn't yet exist then the user is asking - # where to put the source. If it does exist then they're asking - # where the actual source is located. - if test ! -e ${srcdir}/config.sub; then - # Fixme! - if test -e ${srcdir}/${newdir}${revision}/config.sub; then - local srcdir="${srcdir}/${newdir}${revision}" - fi - fi - ;; - eglibc*) - # Eglibc has no top level configure script, it's in the libc - # subdirectory. - if test -d "${srcdir}/libc"; then - # If the directory already exists the caller wants to know - # where the sources are. - local srcdir="${srcdir}/libc" - fi - # Else if the directory does not yet exist the caller wants to know - # where to put the eglibc sources. - ;; - *) - ;; - esac - - if test x"$2" = x"libgloss"; then - local srcdir="${srcdir}/libgloss" - fi - - echo ${srcdir} - - return 0 -} - # Parse a version string and produce a release version string suitable # for the LINARO-VERSION file. create_release_version() @@ -708,7 +209,7 @@ create_release_version() local branch="~`echo ${version} | cut -d '/' -f 2 | cut -d '@' -f 1`" fi - local srcdir="`get_srcdir ${version}`" + local srcdir="`get_component_srcdir ${version}`" if test -d "${srcdir}/.git" -o -e "${srcdir}/.gitignore"; then local revision="@`cd ${srcdir} && git log --oneline | head -1 | cut -d ' ' -f 1`" fi @@ -735,7 +236,6 @@ create_release_version() return 0 } - # 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 @@ -744,38 +244,33 @@ create_release_version() # returns "version~branch@revision" create_release_tag() { -# trace "$*" + trace "$*" - local version=$1 - local branch= - local revision= - - 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\.]*::'`" + local component="`echo $1 | sed -e 's:-[0-9a-z\.\-]*::' -e 's:\.git.*::'`" + if test "`component_is_tar ${component}`" = no; then + local branch="~`get_component_branch ${component}`" + local revision="@`get_component_revision ${component} | grep -o '[0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z]' | head -1`" + fi - if test x"${release}" = x; then - # extract the branch from the version - local srcdir="`get_srcdir ${version}`" - if test -d "${srcdir}/.git" -o -e "${srcdir}/.gitignore"; then - local revision="@`cd ${srcdir} && git log --oneline | head -1 | cut -d ' ' -f 1`" + # GCC stores it's version number in BASE-VER, while GLIBC uses version.h + local srcdir="`get_component_srcdir ${component}`" + local version= + if test x"${component}" = x"gcc"; then + local version="`cat ${srcdir}/gcc/BASE-VER`" + else + if test x"${component}" = x"glibc"; then + local version="`grep VERSION ${srcdir}/version.h | cut -d ' ' -f 3 | tr -d '\"'`" fi - + fi + local rtag="${component}-linaro-${version}" + if test x"${release}" = x; then local date="`date +%Y%m%d`" - - # return the version string array - local rtag="${rtag}${revision}-${date}" - else - # 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`" - local version="`echo ${version} | sed -e 's:[a-z\./-]*::' -e 's:-branch::'`" + if test x"${component}" = x"glibc"; then + local branch="~`basename ${branch}`" fi - local rtag="${name}-${version}-${release}" - # For a release, we don't need the .git~ identifier. - local rtag="`echo ${rtag} | sed -e 's:\.git~:-:'`" + local rtag="${rtag}${branch}${revision}-${date}" + else + local rtag="${rtag}-${release}" fi @@ -783,20 +278,8 @@ create_release_tag() rtag="`echo ${rtag} | sed -e 's:~linaro/gcc-::' -e 's:~linaro-::'`" fi - echo `echo ${rtag} | tr '/' '-'` - - return 0 -} + echo "`echo ${rtag} | tr '/' '-' | sed -e 's:-none-:-:' -e 's:-unknown-:-:'`" -# Get the SHA-1 for the latest commit to the git repository -srcdir_revision() -{ -# trace "$*" - - local srcdir=$1 - local revision="`cd ${srcdir} && git log -n 1 | head -1 | cut -d ' ' -f 2`" - - echo ${revision} return 0 } diff --git a/lib/component.sh b/lib/component.sh new file mode 100644 index 00000000..a520134e --- /dev/null +++ b/lib/component.sh @@ -0,0 +1,604 @@ +#!/bin/bash +# +# Copyright (C) 2015 Linaro, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +declare -ag toolchain + +# This file attempts to turn an associative array into a semblance of a +# data structure. Note that this will only work with the bash shell. +# +# The default fields are calculated at runtime +# TOOL +# URL +# REVISION +# SRCDIR +# BUILDDIR +# FILESPEC +# These values are extracted from the config/[component].conf files +# BRANCH +# MAKEFLAGS +# STATICLINK +# CONFIGURE +# RUNTESTFLAGS + +# Initialize the associative array +# parameters: +# $ - Any parameter without a '=' sign becomes the name of the the array. +# Any embedded spaces in the value have been converted to a '%' +# character. +component_init () +{ + #trace "$*" + + local component="$1" + + local index= + for index in $*; do + if test "`echo ${index} | grep -c '='`" -gt 0; then + name="`echo ${index} | cut -d '=' -f 1`" + value="`echo ${index} | cut -d '=' -f2-20 | sed -e 's:^[a-zA-Z]*=::' | tr '%' ' '`" + eval "local ifset=\${${component}[${name}]:-notset}" + if test x"${ifset}" = x"notset"; then + eval "${component}[${name}]="${value}"" + if test $? -gt 0; then + return 1 + fi + fi + else + component="`echo ${index} | sed -e 's:-[0-9a-z\.\-]*::'`" + declare -Ag ${component} + eval ${component}[TOOL]="${component}" + if test $? -gt 0; then + return 1 + fi + fi + name= + value= + done + + toolchain=(${toolchain[@]} ${component}) + return 0 +} + +# Accessor functions for the data structure to set "private" data. This is a crude +# approximation of an object oriented API for this data structure. Each of the setters +# takes two arguments, which are: +# +# $1 - The name of the data structure, which is based on the toolname, ie... gcc, gdb, etc... +# $2 - The value to assign the data field. +# +# Returns 0 on success, 1 on error +# +set_component_url () +{ +# trace "$*" + + local component="`echo $1 | sed -e 's:-[0-9a-z\.\-]*::' -e 's:\.git.*::'`" + declare -p ${component} 2>&1 > /dev/null + if test $? -gt 0; then + warning "${component} does not exist!" + return 1 + else + eval ${component}[URL]="$2" + fi + + return 0 +} + +set_component_revision () +{ +# trace "$*" + + local component="`echo $1 | sed -e 's:-[0-9a-z\.\-]*::' -e 's:\.git.*::'`" + declare -p ${component} 2>&1 > /dev/null + if test $? -gt 0; then + warning "${component} does not exist!" + return 1 + else + eval ${component}[REVISION]="$2" + fi + + return 0 +} + +set_component_srcdir () +{ +# trace "$*" + + local component="`echo $1 | sed -e 's:-[0-9a-z\.\-]*::' -e 's:\.git.*::'`" + declare -p ${component} 2>&1 > /dev/null + if test $? -gt 0; then + warning "${component} does not exist!" + return 1 + else + eval ${component}[SRCDIR]="$2" + fi + + return 0 +} + +set_component_builddir () +{ +# trace "$*" + + local component="`echo $1 | sed -e 's:-[0-9a-z\.\-]*::' -e 's:\.git.*::'`" + declare -p ${component} 2>&1 > /dev/null + if test $? -gt 0; then + warning "${component} does not exist!" + return 1 + else + eval ${component}[BUILDDIR]="$2" + fi + + return 0 +} + +set_component_filespec () +{ +# trace "$*" + + local component="`echo $1 | sed -e 's:-[0-9a-z\.\-]*::' -e 's:\.git.*::'`" + declare -p ${component} 2>&1 > /dev/null + if test $? -gt 0; then + warning "${component} does not exist!" + return 1 + else + eval ${component}[FILESPEC]="$2" + fi + + return 0 +} + +set_component_branch () +{ +# trace "$*" + + local component="`echo $1 | sed -e 's:-[0-9a-z\.\-]*::' -e 's:\.git.*::'`" + declare -p ${component} 2>&1 > /dev/null + if test $? -gt 0; then + warning "${component} does not exist!" + return 1 + else + eval ${component}[BRANCH]="$2" + fi + + return 0 +} + +set_component_makeflags () +{ +# trace "$*" + + local component="`echo $1 | sed -e 's:-[0-9a-z\.\-]*::' -e 's:\.git.*::'`" + declare -p ${component} 2>&1 > /dev/null + if test $? -gt 0; then + warning "${component} does not exist!" + return 1 + else + eval ${component}[MAKEFLAGS]="$2" + fi + + return 0 +} + +set_component_configure () +{ +# trace "$*" + + local component="`echo $1 | sed -e 's:-[0-9a-z\.\-]*::' -e 's:\.git.*::'`" + declare -p ${component} 2>&1 > /dev/null + if test $? -gt 0; then + warning "${component} does not exist!" + return 1 + else + eval ${component}[CONFIGURE]="$2" + fi + + return 0 +} + +# BRANCH is parsed from the config file for each component, but can be redefined +# on the command line at runtime. +# +# These next few fields are also from the config file for each component, but as +# defaults, they aren't changed from the command line, so don't have set_component_* +# functions. +# +# MAKEFLAGS +# STATICLINK +# CONFIGURE +# RUNTESTFLAGS + +# Accessor functions for the data structure to get "private" data. This is a crude +# approximation of an object oriented API for this data structure. All of the getters +# take only one argument, which is the toolname, ie... gcc, gdb, etc... +# +# $1 - The name of the data structure, which is based on the toolname, ie... gcc, gdb, etc... +# +# Returns 0 on success, 1 on error, and the value is returned as a string. +# +get_component_url () +{ +# trace "$*" + + local component="`echo $1 | sed -e 's:-[0-9a-z\.\-]*::' -e 's:\.git.*::'`" + if test "${component:+set}" != "set"; then + warning "${component} does not exist!" + return 1 + else + eval "echo \${${component}[URL]}" + fi + + return 0 +} + +get_component_revision () +{ +# trace "$*" + + local component="`echo $1 | sed -e 's:-[0-9a-z\.\-]*::' -e 's:\.git.*::'`" + if test "${component:+set}" != "set"; then + warning "${component} does not exist!" + return 1 + else + eval "echo \${${component}[REVISION]}" + fi + + return 0 +} + +get_component_srcdir () +{ +# trace "$*" + + local component="`echo $1 | sed -e 's:-[0-9a-z\.\-]*::' -e 's:\.git.*::'`" + if test "${component:+set}" != "set"; then + warning "${component} does not exist!" + return 1 + else + eval "echo \${${component}[SRCDIR]}" + fi + + return 0 +} + +get_component_builddir () +{ +# trace "$*" + + local component="`echo $1 | sed -e 's:-[0-9a-z\.\-]*::' -e 's:\.git.*::'`" + if test "${component:+set}" != "set"; then + warning "${component} does not exist!" + return 1 + else + eval "echo \${${component}[BUILDDIR]}" + fi + + return 0 +} + +get_component_filespec () +{ +# trace "$*" + + local component="`echo $1 | sed -e 's:-[0-9a-z\.\-]*::' -e 's:\.git.*::'`" + if test "${component:+set}" != "set"; then + warning "${component} does not exist!" + return 1 + else + eval "echo \${${component}[FILESPEC]}" + fi + + return 0 +} + +get_component_branch () +{ +# trace "$*" + + local component="`echo $1 | sed -e 's:-[0-9a-z\.\-]*::' -e 's:\.git.*::'`" + if test "${component:+set}" != "set"; then + warning "${component} does not exist!" + return 1 + else + eval "echo \${${component}[BRANCH]}" + fi + + return 0 +} + +get_component_makeflags () +{ +# trace "$*" + + local component="`echo $1 | sed -e 's:-[0-9a-z\.\-]*::' -e 's:\.git.*::'`" + if test "${component:+set}" != "set"; then + warning "${component} does not exist!" + return 1 + else + eval "echo \${${component}[MAKEFLAGS]}" + fi + + return 0 +} + +get_component_configure () +{ +# trace "$*" + + local sopts="" + local component="`echo $1 | sed -e 's:-[0-9a-z\.\-]*::' -e 's:\.git.*::'`" + + # Only GCC has parameters for two stages. + if test x"${component}" = x"gcc"; then + if test x"$2" != x; then + local stage="`echo $2 | tr "[:lower:]" "[:upper:]"`" + local sopts="${gcc[${stage}]}" + fi + fi + + if test "${component:+set}" != "set"; then + warning "${component} does not exist!" + return 1 + else + eval "echo \${${component}[CONFIGURE]} ${sopts}" + fi + + return 0 +} + +get_component_staticlink () +{ +# trace "$*" + + local component="`echo $1 | sed -e 's:-[0-9a-z\.\-]*::' -e 's:\.git.*::'`" + if test "${component:+set}" != "set"; then + warning "${component} does not exist!" + return 1 + else + eval "echo \${${component}[STATICLINK]}" + fi + + return 0 +} + +get_component_runtestflags () +{ +# trace "$*" + + local component="`echo $1 | sed -e 's:-[0-9a-z\.\-]*::' -e 's:\.git.*::'`" + if test "${component:+set}" != "set"; then + warning "${component} does not exist!" + return 1 + else + eval "echo \${${component}[RUNTESTFLAGS]}" + fi + + return 0 +} + +# Note that this function is GCC specific. +get_component_stage () +{ +# trace "$*" + + local stage="`echo $1 | tr "[:lower:]" "[:upper:]"`" + local component="gcc" + + if test "${component:+set}" != "set"; then + warning "${component} does not exist!" + return 1 + else + eval "echo \${${component}[${stage}]}" + fi + + return 0 +} + +# Determine if the component is a tarfile, or git repository. +# $1 - The component name. +component_is_tar () +{ +# trace "$*" + + local component="`echo $1 | sed -e 's:-[0-9a-z\.\-]*::' -e 's:\.git.*::'`" + if test "${component:+set}" != "set"; then + warning "${component} does not exist!" + return 1 + else + if test "`get_component_filespec ${component} | grep -c \.tar\.`" -gt 0; then + echo "yes" + return 0 + else + echo "no" + return 1 + fi + fi +} + +get_component_subdir () +{ +# trace "$*" + + local component="`echo $1 | sed -e 's:-[0-9a-z\.\-]*::' -e 's:\.git.*::'`" + if test "${component:+set}" != "set"; then + warning "${component} does not exist!" + return 1 + else + if test "`get_component_filespec ${component} | grep -c \.tar\.`" -gt 0; then + echo "yes" + return 0 + fi + fi +} + +# declare -p does print the same data from the array, but this is an easier to +# read version of the same data. +component_dump() +{ +# trace "$*" + + local flag="`set -o | grep xtrace| tr -s ' ' | tr -d '\t' | cut -d ' ' -f 2`" + set +x + + local component="`echo $1 | sed -e 's:-[0-9a-z\.\-]*::' -e 's:\.git.*::'`" + if test "${component:+set}" != "set"; then + warning "${component} does not exist!" + return 1 + fi + + local data="`declare -p ${component} | sed -e 's:^.*(::' -e 's:).*$::'`" + + echo "Data dump of component \"${component}\"" + for i in ${data}; do + echo " $i" + done + + if test x"${flag}" = x"on"; then + set -x + fi + + return 0 +} + +collect_data () +{ +# trace "$*" + + local component="`echo $1 | sed -e 's:\.git.*::' -e 's:-[0-9a-z\.\-]*::'`" + + if test x"${manifest}" != x; then + notice "Reading data from Manifest file." + return 0 + fi + + # ABE's data is extracted differently than the rest. + if test x"${component}" = x"abe"; then + pushd ${abe_path} + local revision="`git log --format=format:%H -n 1`" + local abbrev="`git log --format=format:%h -n 1`" + local branch="`git branch | grep "^\*" | cut -d ' ' -f 2`" + if test "`echo ${branch} | egrep -c "detached|^\(no"`" -gt -0; then + local branch= + fi + local url="`git config --get remote.origin.url`" + local url="`dirname ${url}`" + local date="`git log -n 1 --format=%aD | tr ' ' '%'`" + local filespec="abe.git" + local srcdir="${abe_path}" + local configure="`grep ${srcdir}/configure ${abe_top}/config.log | tr -s ' ' | cut -d ' ' -f 4-10| tr ' ' '%'`" + popd + component_init ${component} TOOL=${component} ${branch:+BRANCH=${branch}} ${revision:+REVISION=${revision}} ${url:+URL=${url}} ${filespec:+FILESPEC=${filespec}} ${data:+DATE=${date}} ${srcdir:+SRCDIR=${srcdir}} ${configure:+CONFIGURE=${configure}} + return 0 + fi + + if test -d ${local_builds}/${host}/${target}; then + local conf="`find ${local_builds}/${host}/${target} -name ${component}.conf | head -1`" + else + local conf= + fi + if test x"${conf}" != x; then + test ${topdir}/config/${component}.conf -nt ${conf} + if test $? -gt 0; then + . "${topdir}/config/${component}.conf" + else + notice "Local ${component}.conf overriding defaults" + . "${conf}" + fi + else + . "${topdir}/config/${component}.conf" + fi + + local version="${component}_version" + local tool="${!version}" + if test x"${tool}" = x; then + eval ${component}_version="${latest}" + fi + eval "local latest=\${${component}_version}" + if test "`echo ${latest} | grep -c ${component}`" -eq 0; then + latest="${component}-${latest}" + fi + if test `echo ${latest} | grep -c "\.tar"` -gt 0; then + if test "`echo ${latest} | grep -c 'http*://.*\.tar\.'`" -eq 0; then + local url="`grep "^${component} " ${sources_conf} | tr -s ' ' | cut -d ' ' -f 2`" + local filespec="${latest}" + else + local url="`dirname ${latest}`" + local filespec="`basename ${latest}`" + fi + + local dir="`echo ${filespec} | sed -e 's:\.tar.*::'| tr '@' '_'`" + else + # If a manifest file has been imported, use those values + local filespec="`get_component_filespec ${component}`" + local gitinfo="${!version}" + local branch="`get_git_branch ${gitinfo}`" + local revision="`get_git_revision ${gitinfo}`" + local search= + case ${component} in + binutils*|gdb*) search="binutils-gdb.git" ;; + *) search="${component}.git" ;; + esac + local url="`grep ^${search} ${sources_conf} | tr -s ' ' | cut -d ' ' -f 2`" + if test x"{$url}" = x; then + warning "${component} Not found in ${sources_conf}" + return 1 + fi + local filespec="`basename ${url}`" + local url="`dirname ${url}`" + # Builds will fail if there is an @ in the build directory path. + # This is unfortunately, as @ is used to deliminate the revision + # string. + local fixbranch="`echo ${branch} | tr '/' '~' | tr '@' '_'`" + local dir=${search}${branch:+~${fixbranch}}${revision:+_rev_${revision}} + fi + + # configured and built as a separate way. + local builddir="${local_builds}/${host}/${target}/${dir}" + local srcdir=${local_snapshots}/${dir} + case "${component}" in + gdb|binutils) + local dir="`echo ${dir} | sed -e 's:^.*\.git:binutils-gdb.git:'`" + local srcdir=${local_snapshots}/${dir} + ;; + gdbserver) + local dir="`echo ${dir} | sed -e 's:^.*\.git:binutils-gdb.git:'`" + local srcdir=${srcdir}/gdb/gdbserver + local builddir="${builddir}-gdbserver" + ;; + *) + ;; + esac + + # Extract a few other data variables from the conf file and store them so + # the conf file only needs to be sourced once. + local confvars="${static_link:+STATICLINK=${static_link}}" + confvars="${confvars} ${default_makeflags:+MAKEFLAGS=\"`echo ${default_makeflags} | tr ' ' '%'`\"}" + confvars="${confvars} ${default_configure_flags:+CONFIGURE=\"`echo ${default_configure_flags} | tr ' ' '%'`\"}" + if test x"${component}" = "xgcc"; then + confvars="${confvars} ${stage1_flags:+STAGE1=\"`echo ${stage1_flags} | tr ' ' '%'`\"}" + confvars="${confvars} ${stage2_flags:+STAGE2=\"`echo ${stage2_flags} | tr ' ' '%'`\"}" + fi + confvars="${confvars} ${runtest_flags:+RUNTESTFLAGS=\"`echo ${runtest_flags} | tr ' ' '%'`\"}" + component_init ${component} TOOL=${component} ${branch:+BRANCH=${branch}} ${revision:+REVISION=${revision}} ${srcdir:+SRCDIR=${srcdir}} ${builddir:+BUILDDIR=${builddir}} ${filespec:+FILESPEC=${filespec}} ${url:+URL=${url}} ${confvars} + + default_makeflags= + default_configure_flags= + runtest_flags= + + return 0 +} diff --git a/lib/configure.sh b/lib/configure.sh index 73d6a5b4..9dcb20d0 100755 --- a/lib/configure.sh +++ b/lib/configure.sh @@ -1,6 +1,6 @@ -#!/bin/sh +#!/bin/bash # -# Copyright (C) 2013, 2014 Linaro, Inc +# Copyright (C) 2013, 2014, 2015 Linaro, Inc # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,33 +18,28 @@ # Configure a source directory # $1 - the directory to configure -# $2 - [OPTIONAL] which gcc stage to build +# $2 - [OPTIONAL] which sub component to build, gcc stage, gdbserver, binutils, etc... configure_build() { trace "$*" + local component="`echo $1 | sed -e 's:\.git.*::' -e 's:-[0-9a-z\.\-]*::'`" + flock --wait 100 ${local_builds}/git$$.lock --command echo if test $? -gt 0; then error "Timed out waiting for a git checkout to complete." return 1 fi - local gitinfo="`get_source $1`" - - local tool="`get_toolname ${gitinfo}`" # Linux isn't a build project, we only need the headers via the existing # Makefile, so there is nothing to configure. - if test x"${tool}" = x"linux"; then + if test x"${component}" = x"linux"; then return 0 fi - # The git parser functions shall return valid results for all - # services, especially once we have a URL. - - 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}`" + local srcdir="`get_component_srcdir ${component}`" + local builddir="`get_component_builddir ${component}`${2:+-$2}" + local version="`basename ${srcdir}`" + local stamp="`get_stamp_name configure ${version} ${2:+$2}`" # Don't look for the stamp in the builddir because it's in builddir's # parent directory. @@ -62,26 +57,10 @@ configure_build() if test ! -d "${builddir}"; then notice "The build directory '${builddir}' doesn't exist, so creating it" - # Zlib has to be built in it's source directory. -# if test x"${tool}" = x"zlib"; then -# dryrun "ln -s ${srcdir} ${builddir}" -# else - dryrun "mkdir -p \"${builddir}\"" -# fi + dryrun "mkdir -p \"${builddir}\"" fi - # Since Binutils and GDB have a shared git repository, this confuses the logic - # of loading the right config file. If Binutils is already configured, then - # assume GDB. - if test x"${2}" = x"gdb" -o x"${2}" = x"binutils"; then - local tool="${2}" - fi - - local configure="`grep ^configure= ${topdir}/config/${tool}.conf | cut -d '\"' -f 2`" - if test x"${configure}" = x; then - configure="yes" - fi - if test ! -f "${srcdir}/configure" -a x"${dryrun}" != x"yes" -a x"${configure}" != xno; then + if test ! -f "${srcdir}/configure" -a x"${dryrun}" != x"yes"; then warning "No configure script in ${srcdir}!" # not all packages commit their configure script, so if it has autogen, # then run that to create the configure script. @@ -94,43 +73,11 @@ configure_build() fi fi - # If a target architecture isn't specified, then it's a native build -# if test x"${target}" = x; then -# target=${build} -# host=${build} -# else - # FIXME: this won't work yet when doing a Canadian Cross. -# host=${build} -# fi - - # Load the default config file for this component if it exists. - local default_configure_flags="" - local stage1_flags="" - local stage2_flags="" local opts="" if test x"$2" = x"gdbserver"; then local toolname="gdbserver" else - local toolname="${tool}" - fi - if test -e "${topdir}/config/${toolname}.conf"; then - . "${topdir}/config/${toolname}.conf" - # if there is a local config file in the build directory, allow - # it to override the default settings - # unset these two variables to avoid problems later - if test -e "${builddir}/${toolname}.conf" -a ${builddir}/${toolname}.conf -nt ${topdir}/config/${toolname}.conf; then - . "${builddir}/${toolname}.conf" - notice "Local ${toolname}.conf overriding defaults" - else - # Since there is no local config file, make one using the - # default, and then add the target architecture so it doesn't - # have to be supplied for future reconfigures. - echo "target=${target}" > ${builddir}/${toolname}.conf - cat ${topdir}/config/${toolname}.conf >> ${builddir}/${toolname}.conf - fi - else - error "No ${topdir}/config/${tool}.conf file for ${tool}." - exit 1 + local toolname="${component}" fi local this_extraconfig="${extraconfig[${toolname}]}" @@ -143,6 +90,7 @@ configure_build() exit 1 fi fi + local opts="`get_component_configure ${component} $2`" # See if this component depends on other components. They then need to be # built first. @@ -156,10 +104,10 @@ configure_build() # Force static linking unless dynamic linking is specified - local static="`grep ^static_link= ${topdir}/config/${tool}.conf | cut -d '=' -f 2 | tr -d '\"'`" + local static="`get_component_staticlink ${component}`" if test x"${static}" = x"yes"; then - if test "`echo ${tool} | grep -c glibc`" -eq 0; then - local opts="--disable-shared --enable-static" + if test "`echo ${component} | grep -c glibc`" -eq 0 -a "`echo ${component} | grep -c gdbserver`" -eq 0; then + local opts="${opts} --disable-shared --enable-static" fi fi @@ -176,19 +124,19 @@ configure_build() local date="${release}" fi - if test x"${override_cflags}" != x -a x"${tool}" != x"eglibc"; then + if test x"${override_cflags}" != x -a x"${component}" != x"eglibc"; then local opts="${opts} CFLAGS=\"${override_cflags}\" CXXFLAGS=\"${override_cflags}\"" fi # GCC and the binutils are the only toolchain components that need the # --target option set, as they generate code for the target, not the host. - case ${tool} in + case ${component} in # zlib) # # zlib doesn't support most standard configure options # local opts="--prefix=${sysroots}/usr" # ;; newlib*|libgloss*) - local opts="${opts} --build=${build} --host=${target} --target=${target} --prefix=${sysroots}/usr CC=${target}-gcc" + local opts="${opts} --host=${host} --target=${target} --prefix=${sysroots}/usr" ;; *libc) # [e]glibc uses slibdir and rtlddir for some of the libraries and @@ -209,32 +157,17 @@ configure_build() dryrun "(mkdir -p ${sysroots}/usr/lib)" ;; gcc*) - # Force a complete reconfigure, as we changed the flags. We could do a - # make distclean, but this builds faster, as not all files have to be - # recompiled. -# find ${builddir} -name Makefile -o -name config.status -o -name config.cache -exec rm {} \; -# if test -e ${builddir}/Makefile; then -# make ${make_flags} -C ${builddir} distclean -i -k -# fi if test x"${build}" != x"${target}"; then if test x"$2" != x; then case $2 in stage1*) notice "Building stage 1 of GCC" - local opts="${opts} ${stage1_flags}" ;; stage2*) notice "Building stage 2 of GCC" - local opts="${opts} ${stage2_flags}" - # Only add the Linaro bug and version strings for - # Linaro branches. - if test "`echo ${gcc_version} | grep -ic linaro`" -gt 0; then - local opts="${opts} --with-bugurl=\"https://bugs.linaro.org\"" - fi ;; gdbserver) notice "Building gdbserver for the target" - local srcdir="${srcdir}/gdbserver" ;; bootstrap*) notice "Building bootstrapped GCC" @@ -271,14 +204,12 @@ configure_build() fi local opts="${opts} --build=${build} --host=${host} --target=${target} --prefix=${prefix}" ;; - gdb*) - local opts="${opts} --with-pkgversion=\"Linaro GDB ${date}\"" - if test x"$2" = x"gdbserver"; then - local opts="${opts} --build=${build} --host=${target} --prefix=${prefix}" - local srcdir="${srcdir}/gdb/gdbserver" - else - local opts="${opts} --build=${build} --host=${host} --target=${target} --prefix=${prefix}" - fi + gdb) + local opts="${opts} --build=${build} --host=${host} --target=${target} --prefix=${prefix}" + dryrun "mkdir -p ${builddir}" + ;; + gdbserver) + local opts="${opts} --build=${build} --host=${target} --prefix=${prefix}" dryrun "mkdir -p ${builddir}" ;; # These are only built for the host @@ -290,7 +221,7 @@ configure_build() ;; esac - if test -e ${builddir}/config.status -a x"${tool}" != x"gcc" -a x"${force}" = xno; then + if test -e ${builddir}/config.status -a x"${component}" != x"gcc" -a x"${force}" = xno; then warning "${buildir} already configured!" else export PATH="${local_builds}/${host}/bin:$PATH" @@ -298,34 +229,11 @@ configure_build() if test x"${CONFIG_SHELL}" = x; then export CONFIG_SHELL=${bash_shell} fi - # In release mode, use default pkgversion for GCC. -# if test x"${release}" != x;then -# case ${tool} in -# gcc*) -# default_configure_flags=`echo "${default_configure_flags}" | sed -e 's/--with-pkgversion=.* //'` -# ;; -# esac -# fi - - # zlib can only be configured in the source tree, and doesn't like any of the - # stadard GNU configure options -# if test x"${tool}" = x"zlib"; then -# dryrun "(cd ${builddir} && ${CONFIG_SHELL} ./configure --prefix=${prefix})" -# else - if test x"${configure}" = xyes; then - dryrun "(cd ${builddir} && ${CONFIG_SHELL} ${srcdir}/configure SHELL=${bash_shell} ${default_configure_flags} ${opts})" - if test $? -gt 0; then - error "Configure of $1 failed." - return $? - fi - else - dryrun "rsync -a --exclude=.git/ ${srcdir}/ ${builddir}" - if test $? -gt 0; then - error "Copy of $1 failed (rsync -a ${srcdir} ${builddir})" - return $? - fi - fi -# fi + dryrun "(cd ${builddir} && ${CONFIG_SHELL} ${srcdir}/configure SHELL=${bash_shell} ${default_configure_flags} ${opts})" + if test $? -gt 0; then + error "Configure of $1 failed." + return 1 + fi # unset this to avoid problems later unset default_configure_flags @@ -334,9 +242,8 @@ configure_build() unset stage2_flags fi - notice "Done configuring ${gitinfo}" + notice "Done configuring ${component}" - #touch ${stampdir}/${stamp} create_stamp "${stampdir}" "${stamp}" return 0 diff --git a/lib/depend.sh b/lib/depend.sh index 00a0c929..7b5215db 100755 --- a/lib/depend.sh +++ b/lib/depend.sh @@ -129,97 +129,3 @@ installed() return 1 } - -# These are the latest copies of the infrastructure files required to -# fully build GCC in all it's glory. While it is possible to pass -# --disable-* options at configure time to GCC, these are used for -# good reason, so we download, build and install them. -infrastructure() -{ - trace "$*" - - rm -f ${local_snapshots}/infrastructure/ChangeLog - fetch_http infrastructure/ChangeLog - - source_config infrastructure - - if test x"${depends}" = x; then - error "No dependencies listed for infrastructure libraries!" - return 1 - fi - - # This shouldn't happen, but it's nice for regression verification. - if test ! -e ${local_snapshots}/md5sums; then - error "Missing ${local_snapshots}/md5sums file needed for infrastructure libraries." - return 1 - fi - - # We have to grep each dependency separately to preserve the order, as - # some libraries depend on other libraries being bult first. Egrep - # unfortunately sorts the files, which screws up the order. - local files= - if test x"${dejagnu_version}" = x; then - files="`grep ^latest= ${topdir}/config/dejagnu.conf | cut -d '\"' -f 2`" - else - files="${dejagnu_version}" - fi - - local version= - for i in ${depends}; do - case $i in - linux) version=${linux_version} ;; - mpfr) version=${mpfr_version} ;; - mpc) version=${mpc_version} ;; - gmp) version=${gmp_version} ;; - dejagnu) version=${dejagnu_version} ;; - *) - error "config/infrastructure.conf contains an unknown dependency: $i" - return 1 - ;; - esac - - # If the user didn't set it, check the <component>.conf files for - # 'latest'. - if test "${version:+set}" != "set"; then - version="`grep ^latest= ${topdir}/config/${i}.conf | cut -d '\"' -f 2`" - # Sometimes config/${i}.conf uses <component>-version and sometimes - # it just uses 'version'. Regardless, searching the md5sums file requires - # that we include the component name. - version=${i}-${version#${i}-} - fi - - if test "${version:+found}" != "found"; then - error "Can't find a version for component \"$i\" in ${i}.conf" - return 1 - fi - - # Hopefully we only return the exact match for each one. Depending - # how vague the user is it might match on multiple tarballs. - files="${files} `grep /${version} ${local_snapshots}/md5sums | cut -d ' ' -f3 | uniq`" - unset version - done - - # Store the current value so we can reset it after we're done. - local nodep=${nodepends} - - # Turn off dependency checking, as everything is handled here. - nodepends=yes - local buildret= - for i in ${files}; do - # if make 4.0 is already installed, we don't need to build it everytime. - if test $i = "make" -a "${makeversion}" = "4.0"; then - continue - fi - local name="`echo $i | sed -e 's:\.tar\..*::' -e 's:infrastructure/::' -e 's:testcode/::'`" - build ${name} - buildret=$? - if test ${buildret} -gt 0; then - error "Building ${name} failed." - return 1 - fi - done - - # Reset to the stored value - nodepends=${nodep} -} - diff --git a/lib/fetch.sh b/lib/fetch.sh index 02d0139e..201b733d 100755 --- a/lib/fetch.sh +++ b/lib/fetch.sh @@ -16,62 +16,32 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -# The fetch_md5sums() function is special because the md5sums file is used by -# ABE for knowing where to fetch other files, i.e. it's used by fetch(). This -# function should only be called once at the start of every ABE run. This -# function does not respect supdate=no. It is harmless to download new versions -# of md5sums. -fetch_md5sums() -{ - # The fetch_http function will always attempt to fetch the remote file - # if the version on the server is newer than the local version. - # Note, we don't want to fetch md5sums from $git_reference_dir because - # it is not versioned in the filename like other gmp-* or linux-* files - # are. $git_reference_dir is a caching mechanism serving fast access to - # git/file content, but it doesn't provide any master copies of content. - fetch_http md5sums - - # If the fetch_*() fails we might have a previous version of md5sums in - # ${local_snapshots}. Use that, otherwise we have no choice but to fail. - if test ! -s ${local_snapshots}/md5sums; then - return 1 - fi - return 0 -} - # Fetch a file from a remote machine. All decision logic should be in this # function, not in the fetch_<protocol> functions to avoid redundancy. fetch() { -# trace "$*" + trace "$*" + if test x"$1" = x; then error "No file name specified to fetch!" return 1 fi - # Peel off 'infrastructure/' - local file="`basename $1`" + local component=$1 + local getfile="`get_component_filespec ${component}`" + local url="`get_component_url ${component}`" - # The md5sums file should have been downloaded before fetch() was - # ever called. - if test ! -e "${local_snapshots}/md5sums"; then - error "${local_snapshots}/md5sums is missing." - return 1 - fi - - # We can grab the full file name by searching for it in the md5sums file. - # Match on the first hit. This might be prepended with the - # 'infrastructure/' directory name if it's an infrastructure file. - local getfile="$(grep ${file} -m 1 ${local_snapshots}/md5sums | cut -d ' ' -f 3)" - if test x"${getfile}" = x; then - error "${file} not in md5sum!" - return 1 - fi + # This provides the infrastructure/ directory if ${getfile} contains it. +# if test "`echo ${url} | grep -c infrastructure`" -gt 0; then +# local dir="/infrastructure" +# else + local dir="" +# fi # Forcing trumps ${supdate} and always results in sources being updated. if test x"${force}" != xyes; then if test x"${supdate}" = xno; then - if test -e "${local_snapshots}/${getfile}"; then + if test -e "${local_snapshots}${dir}/${getfile}"; then notice "${getfile} already exists and updating has been disabled." return 0 fi @@ -84,7 +54,7 @@ fetch() # If the user has specified a git_reference_dir, then we'll use it if the # file exists in the reference dir. - if test -e "${git_reference_dir}/${getfile}" -a x"${force}" != xyes; then + if test -e "${git_reference_dir}${dir}/${getfile}" -a x"${force}" != xyes; then # This will always fetch if the version in the reference dir is newer. local protocol=reference else @@ -93,17 +63,19 @@ fetch() fi # download from the file server or copy the file from the reference dir - fetch_${protocol} ${getfile} + fetch_${protocol} ${component} if test $? -gt 0; then return 1 fi # Fetch only supports fetching files which have an entry in the md5sums file. # An unlisted file should never get this far anyway. - dryrun "check_md5sum ${getfile}" - if test $? -gt 0 -a x"${force}" != xyes; then - error "md5sums don't match!" - return 1 + dryrun "check_md5sum ${component}" + if test $? -gt 0; then + error "md5sums don't match!" + if test x"${force}" != xyes; then + return 1 + fi fi notice "md5sums matched" @@ -113,64 +85,64 @@ fetch() # decompress and untar a fetched tarball extract() { -# trace "$*" + trace "$*" local extractor= local taropt= + local component=$1 - if test `echo $1 | egrep -c "\.gz|\.bz2|\.xz"` -eq 0; then - local file="`grep $1 ${local_snapshots}/md5sums | egrep -v "\.asc|\.txt" | cut -d ' ' -f 3 | cut -d '/' -f 2`" - else - local file="`echo $1 | cut -d '/' -f 2`" - fi - - local srcdir= - srcdir="`get_srcdir $1`" + local url="`get_component_url ${component}`" +# if test "`echo ${url} | grep -c infrastructure`" -gt 0; then +# local dir="/infrastructure/" +# else + local dir="" +# fi + local file="`get_component_filespec ${component}`" + local srcdir="`get_component_srcdir ${component}`" + local version="`basename ${srcdir}`" local stamp= - stamp="`get_stamp_name extract $1`" + stamp="`get_stamp_name extract ${version}`" # Extract stamps go into srcdir - local stampdir="`dirname ${srcdir}`" + local stampdir="${local_snapshots}${dir}" # Name of the downloaded tarball. - local tarball="`dirname ${srcdir}`/${file}" + local tarball="${local_snapshots}${dir}/${file}" + + # Initialize component data structures + local builddir="`get_component_builddir ${component}`" local ret= # If the tarball hasn't changed, then we don't need to extract anything. check_stamp "${stampdir}" ${stamp} ${tarball} extract ${force} ret=$? if test $ret -eq 0; then - return 0 + return 0 elif test $ret -eq 255; then - # the ${tarball} isn't present. - return 1 + # the ${tarball} isn't present. + return 1 fi # Figure out how to decompress a tarball case "${file}" in - *.xz) - local extractor="xz -d " - local taropt="J" - ;; - *.bz*) - local extractor="bzip2 -d " - local taropt="j" - ;; - *.gz) - local extractor="gunzip " - local taropt="x" - ;; - *) ;; + *.xz) + local extractor="xz -d " + local taropt="J" + ;; + *.bz*) + local extractor="bzip2 -d " + local taropt="j" + ;; + *.gz) + local extractor="gunzip " + local taropt="x" + ;; + *) ;; esac - if test -d ${srcdir} -a x"${force}" = xno; then - notice "${srcdir} already exists. Removing to extract newer version!" - dryrun "rm -rf ${srcdir}" - fi - local taropts="${taropt}xf" - notice "Extracting ${srcdir} from ${tarball}." + notice "Extracting from ${tarball}." dryrun "tar ${taropts} ${tarball} -C `dirname ${srcdir}`" # FIXME: this is hopefully a temporary hack for tarballs where the @@ -181,16 +153,16 @@ extract() # dryrun has to skip this step otherwise execution will always drop into # this leg. if test x"${dryrun}" != xyes -a ! -d ${srcdir}; then - local dir2="`echo ${name} | sed -e 's:-linaro::' -e 's:-201[0-9\.\-]*::'`" - if test ! -d ${srcdir}; then - dir2="`dirname ${srcdir}`/${dir2}" - warning "${tarball} didn't extract to ${srcdir} as expected!" - notice "Making a symbolic link from ${dir2} to ${srcdir}!" - dryrun "ln -sf ${dir2} ${srcdir}" - else - error "${srcdir} already exists!" - return 1 - fi + local dir2="`echo ${name} | sed -e 's:-linaro::' -e 's:-201[0-9\.\-]*::'`" + if test ! -d ${srcdir}; then + dir2="${srcdir}/${dir2}" + warning "${tarball} didn't extract to ${srcdir} as expected!" + notice "Making a symbolic link from ${dir2} to ${srcdir}!" + dryrun "ln -sf ${dir2} ${srcdir}" + else + error "${srcdir} already exists!" + return 1 + fi fi create_stamp "${stampdir}" "${stamp}" @@ -207,18 +179,29 @@ extract() # on the server is newer than the destination file. fetch_http() { -# trace "$*" + trace "$*" - local getfile=$1 + local component=$1 + local getfile="`get_component_filespec ${component}`" + if test x"${getfile}" = x; then + error "No filespec specified for ${component} !" + return 1 + fi + local url="`get_component_url ${component}`/${getfile}" + + if test x"${url}" = x; then + error "No URL specified for ${component} !" + return 1 + fi # This provides the infrastructure/ directory if ${getfile} contains it. - local dir="`dirname $1`/" - if test x"${dir}" = x"./"; then +# if test "`echo ${url} | grep -c infrastructure`" -gt 0; then +# local dir="/infrastructure" +# else local dir="" - else - if test ! -d ${local_snapshots}/${dir}; then - mkdir -p ${local_snapshots}/${dir} - fi +# fi + if test ! -d ${local_snapshots}${dir}; then + mkdir -p ${local_snapshots}${dir} fi # You MUST have " " around ${wget_bin} or test ! -x will @@ -245,11 +228,19 @@ fetch_http() # NOTE: the timeout is short, and we only try twice to access the # remote host. This is to improve performance when offline, or # the remote host is offline. - dryrun "${wget_bin} ${wget_quiet:+-q} --timeout=${wget_timeout}${wget_progress_style:+ --progress=${wget_progress_style}} --tries=2 --directory-prefix=${local_snapshots}/${dir} http://${fileserver}/${remote_snapshots}/${getfile} ${overwrite_or_timestamp}" - if test x"${dryrun}" != xyes -a ! -s ${local_snapshots}/${getfile}; then + dryrun "${wget_bin} ${wget_quiet:+-q} --timeout=${wget_timeout}${wget_progress_style:+ --progress=${wget_progress_style}} --tries=2 --directory-prefix=${local_snapshots}/${dir} ${url} ${overwrite_or_timestamp}" + if test $? -gt 0; then + error "${url} doesn't exist on the remote machine !" + return 1 + fi + if test x"${dryrun}" != xyes -a ! -s ${local_snapshots}${dir}/${getfile}; then warning "downloaded file ${getfile} has zero data!" return 1 fi + dryrun "${wget_bin} ${wget_quiet:+-q} --timeout=${wget_timeout}${wget_progress_style:+ --progress=${wget_progress_style}} --tries=2 --directory-prefix=${local_snapshots}/${dir} ${url}.asc ${overwrite_or_timestamp}" + if test x"${dryrun}" != xyes -a ! -s ${local_snapshots}${dir}/${getfile}.asc; then + warning "downloaded file ${getfile}.asc has zero data!" + fi return 0 } @@ -261,8 +252,10 @@ fetch_http() # whether it is newer or not. fetch_reference() { -# trace "$*" + trace "$*" + local getfile=$1 + local url="`get_component_url ${getfile}`" # Prevent error with empty variable-expansion. if test x"${getfile}" = x""; then @@ -271,7 +264,11 @@ fetch_reference() fi # This provides the infrastructure/ directory if ${getfile} contains it. - local dir="`dirname $getfile`/" +# if test "`echo ${url} | grep -c infrastructure`" -gt 0; then +# local dir="/infrastructure/" +# else + local dir="" +# fi if test x"${dir}" = x"./"; then local dir="" else @@ -290,9 +287,9 @@ fetch_reference() # Only copy if the source file in the reference dir is newer than # that file in the local_snapshots directory (if it exists). - dryrun "cp${update_on_change:+ ${update_on_change}} ${git_reference_dir}/${getfile} ${local_snapshots}/${getfile}" + dryrun "cp${update_on_change:+ ${update_on_change}} ${git_reference_dir}${dir}/${getfile}*.tar.* ${local_snapshots}${dir}/" if test $? -gt 0; then - error "Copying ${getfile} from reference dir to ${local_snapshots} failed." + error "Copying ${getfile} from reference dir to ${local_snapshots}${dir} failed." return 1 fi return 0 @@ -303,25 +300,28 @@ fetch_reference() # the actual file's downloaded md5sum. check_md5sum() { -# trace "$*" + trace "$*" - # ${local_snapshots}/md5sums is a pre-requisite. - if test ! -e ${local_snapshots}/md5sums; then - error "${local_snapshots}/md5sums is missing." - return 1 - fi + local tool="`basename $1`" + + local file="`get_component_filespec ${tool}`.asc" + local url="`get_component_url ${tool}`" + +# if test "`echo ${url} | grep -c infrastructure`" -gt 0; then +# local dir="/infrastructure/" +# else + local dir="" +# fi - local entry= - entry=$(grep "${1}" ${local_snapshots}/md5sums) - if test x"${entry}" = x; then - error "No md5sum entry for $1!" + if test ! -e "${local_snapshots}${dir}/${file}"; then + error "No md5sum file for ${tool}!" return 1 fi # Ask md5sum to verify the md5sum of the downloaded file against the hash in # the index. md5sum must be executed from the snapshots directory. - pushd ${local_snapshots} &>/dev/null - dryrun "echo \"${entry}\" | md5sum --status --check -" + pushd ${local_snapshots}${dir} &>/dev/null + dryrun "md5sum --status --check ${file}" md5sum_ret=$? popd &>/dev/null diff --git a/lib/gerrit.sh b/lib/gerrit.sh index 46d0f784..04cefd16 100644 --- a/lib/gerrit.sh +++ b/lib/gerrit.sh @@ -225,7 +225,7 @@ gerrit_build_status() { trace "$*" - local srcdir="`get_srcdir $1`" + local srcdir="`get_component_srcdir $1`" local status="$2" local resultsfile="${3:-}" local revision="`get_git_revision ${srcdir}`" || return 1 @@ -319,7 +319,7 @@ gerrit_fetch_patch() warning "Gerrit support not specified, will try anyway" fi - local srcdir="`get_srcdir gcc.git~${gerrit['BRANCH']}`" + local srcdir="`get_component_srcdir gcc`" rm -f /tmp/gerrit$$.patch (cd ${srcdir} && git fetch ssh://gerrit['USERNAME']@${gerrit['REVIEW_HOST']}:${gerrit['PORT']}/${gerrit['PROJECT']} ${gerrit['REFSPEC']} && git format-patch -1 --stdout FETCH_HEAD > /tmp/gerrit$$.patch) diff --git a/lib/globals.sh b/lib/globals.sh index 53b19f90..b4cbd664 100644 --- a/lib/globals.sh +++ b/lib/globals.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2013, 2014 Linaro, Inc +# Copyright (C) 2013, 2014, 2015 Linaro, Inc # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -21,9 +21,10 @@ # Start by assuming it's a native build build="${build}" -host="${build}" +host="${host:-${build}}" target="${host}" +date="`date "+%Y.%m.%d"`" gcc="`which gcc`" host_gcc_version="`${gcc} -v 2>&1 | tail -1`" binutils="default" @@ -39,7 +40,7 @@ override_arch= override_cpu= override_tune= -manifest= +manifest_version=1.0 # The prefix for installing the toolchain prefix= @@ -55,6 +56,10 @@ wget_progress_style= # This doesn't do any real work, just prints the configure options and make commands dryrun=no +# +launchpad_id= +svn_id= + # config values for the build machine libc_version= kernel=${kernel:+${kernel}} @@ -121,7 +126,6 @@ gerrit_change_number="" gerrit_event_type="" jenkins_job_name="" jenkins_job_url="" -fileserver="${fileserver:-148.251.136.42}" sources_conf="${sources_conf:-${abe_path}/config/sources.conf}" # source a user specific config file for commonly used configure options. @@ -130,3 +134,97 @@ if test -e ~/.aberc; then . ~/.aberc fi +# +# +# +import_manifest() +{ + trace "$*" + + manifest=$1 + if test -f ${manifest} ; then + local components="`grep "Component data for " ${manifest} | cut -d ' ' -f 5`" + + clibrary="`grep "clibrary=" ${manifest} | cut -d '=' -f 2`" + local ltarget="`grep target= ${manifest} | cut -d '=' -f 2`" + if test x"${ltarget}" != x; then + target=${ltarget} + fi + if test "`echo ${sysroots} | grep -c ${target}`" -eq 0; then + sysroots=${sysroots}/${target} + fi + + local manifest_format="`grep "manifest_format" ${manifest} | cut -d '=' -f 2`" + if test ${manifest_version} != ${manifest_format}; then + error "Imported manifest isn't the current supported format!" + return 1 + fi + local variables= + local i=0 + for i in ${components}; do + local url="`grep "${i}_url" ${manifest} | cut -d '=' -f 2`" + local branch="`grep "${i}_branch" ${manifest} | cut -d '=' -f 2`" + local filespec="`grep "${i}_filespec" ${manifest} | cut -d '=' -f 2`" + local static="`grep "${i}_staticlink" ${manifest} | cut -d '=' -f 2`" + # Any embedded spaces in the value have to be converted to a '%' + # character. for component_init(). + local makeflags="`grep "${i}_makeflags" ${manifest} | cut -d '=' -f 2-20 | tr ' ' '%'`" + eval "makeflags=${makeflags}" + local configure="`grep "${i}_configure" ${manifest} | cut -d '=' -f 2-20 | tr ' ' '%'| tr -d '\"'`" + eval "configure=${configure}" + local revision="`grep "${i}_revision" ${manifest} | cut -d '=' -f 2`" + if test "`echo ${filespec} | grep -c \.tar\.`" -gt 0; then + local version="`echo ${filespec} | sed -e 's:\.tar\..*$::'`" + local dir=${version} + else + local fixbranch="`echo ${branch} | tr '/@' '_'`" + local dir=${i}.git~${fixbranch}${revision:+_rev_${revision}} + fi + local srcdir="${local_snapshots}/${dir}" + local builddir="${local_builds}/${host}/${target}/${dir}" + case "${i}" in + gdb|binutils) + local dir="`echo ${dir} | sed -e 's:^.*\.git:binutils-gdb.git:'`" + local srcdir=${local_snapshots}/${dir} + local builddir="${local_builds}/${host}/${target}/${dir}" + ;; + gdbserver) + local dir="`echo ${dir} | sed -e 's:^.*\.git:binutils-gdb.git:'`" + local srcdir=${local_snapshots}/${dir}/gdb/gdbserver + local builddir="${local_builds}/${host}/${target}/${dir}-gdbserver" + ;; + *glibc) + # Glibc builds will fail if there is an @ in the path. This is + # unfortunately, as @ is used to deliminate the revision string. + local srcdir="${local_snapshots}/${dir}" + local builddir="`echo ${local_builds}/${host}/${target}/${dir} | tr '@' '_'`" + ;; + gcc) + local configure= + local stage1_flags="`grep gcc_stage1_flags= ${manifest} | cut -d '=' -f 2-20 | tr ' ' '%' | tr -d '\"'`" + eval "stage1_flags=${stage1_flags}" + local stage2_flags="`grep gcc_stage2_flags= ${manifest} | cut -d '=' -f 2-20 | tr ' ' '%' | tr -d '\"'`" + eval "stage2_flags=${stage2_flags}" + ;; + *) + ;; + esac + + component_init $i ${branch:+BRANCH=${branch}} ${revision:+REVISION=${revision}} ${url:+URL=${url}} ${filespec:+FILESPEC=${filespec}} ${srcdir:+SRCDIR=${srcdir}} ${builddir:+BUILDDIR=${builddir}} ${stage1_flags:+STAGE1=\"${stage1_flags}\"} ${stage2_flags:+STAGE2=\"${stage2_flags}\"} ${configure:+CONFIGURE=\"${configure}\"} ${makeflags:+MAKEFLAGS=\"${makeflags}\"} ${static:+STATICLINK=${static}} + unset stage1_flags + unset stage2_flags + unset url + unset branch + unset filespec + unset static + unset makeflags + unset configure + done + else + error "Manifest file '${file}' not found" + build_failure + return 1 + fi + + return 0 +} diff --git a/lib/make.sh b/lib/make.sh index 923fe5c0..a029668a 100755 --- a/lib/make.sh +++ b/lib/make.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (C) 2013, 2014 Linaro, Inc +# Copyright (C) 2013, 2014, 2015 Linaro, Inc # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -24,58 +24,48 @@ build_all() # Turn off dependency checking, as everything is handled here nodepends=yes + local infrastructure="`grep ^depends ${topdir}/config/infrastructure.conf | tr -d '"' | sed -e 's:^depends=::'`" + # Specify the components, in order to get a full toolchain build if test x"${target}" != x"${build}"; then + # Build a cross compiler if test "`echo ${host} | grep -c mingw`" -gt 0; then # As Mingw32 requires a cross compiler to be already built, so we don't need # to rebuilt the sysroot. - local builds="infrastructure binutils libc stage2 gdb" + local builds="${infrastructure} binutils libc stage2 gdb" else - local builds="infrastructure binutils stage1 libc stage2 gdb" + local builds="${infrastructure} binutils stage1 libc stage2 gdb" fi if test "`echo ${target} | grep -c -- -linux-`" -eq 1; then local builds="${builds} gdbserver" fi notice "Buildall: Building \"${builds}\" for cross target ${target}." else - local builds="infrastructure binutils stage2 libc gdb" # native build + local builds="${infrastructure} binutils stage2 libc gdb" # native build notice "Buildall: Building \"${builds}\" for native target ${target}." fi - # See if specific component versions were specified at runtime - if test x"${gcc_version}" = x; then - gcc_version="`grep ^latest= ${topdir}/config/gcc.conf | cut -d '\"' -f 2`" - fi - if test x"${binutils_version}" = x; then - binutils_version="`grep ^latest= ${topdir}/config/binutils.conf | cut -d '\"' -f 2`" - fi - if test x"${eglibc_version}" = x; then - eglibc_version="`grep ^latest= ${topdir}/config/eglibc.conf | cut -d '\"' -f 2`" - fi - if test x"${newlib_version}" = x; then - newlib_version="`grep ^latest= ${topdir}/config/newlib.conf | cut -d '\"' -f 2`" - libgloss_version="`grep ^latest= ${topdir}/config/newlib.conf | cut -d '\"' -f 2`" - fi - if test x"${glibc_version}" = x; then - glibc_version="`grep ^latest= ${topdir}/config/glibc.conf | cut -d '\"' -f 2`" - fi - - if test x"${gdb_version}" = x; then - gdb_version="`grep ^latest= ${topdir}/config/gdb.conf | cut -d '\"' -f 2`" - fi - # cross builds need to build a minimal C compiler, which after compiling # the C library, can then be reconfigured to be fully functional. local build_all_ret= # Checkout all the sources - checkout_all + checkout_all ${builds} if test $? -ne 0; then error "checkout_all failed" return 1; fi + if test x"${manifest}" = x"create"; then + notice "Exiting after creating" + local exitflag=true + fi + manifest="`manifest`" + if test x"${exitflag}" = xtrue; then + exit 0 + fi + # build each component for i in ${builds}; do notice "Building all, current component $i" @@ -86,28 +76,14 @@ build_all() read answer fi case $i in - infrastructure) - infrastructure - build_all_ret=$? - ;; # Build stage 1 of GCC, which is a limited C compiler used to compile # the C library. libc) - if test x"${clibrary}" = x"eglibc"; then - build ${eglibc_version} - elif test x"${clibrary}" = x"glibc"; then - build ${glibc_version} - elif test x"${clibrary}" = x"newlib"; then - build ${newlib_version} - build ${newlib_version} libgloss - else - error "\${clibrary}=${clibrary} not supported." - return 1 - fi + build ${clibrary} build_all_ret=$? ;; stage1) - build ${gcc_version} stage1 + build gcc stage1 build_all_ret=$? # Don't create the sysroot if the clibrary build didn't succeed. if test ${build_all_ret} -lt 1; then @@ -116,7 +92,6 @@ build_all() if test x"${dryrun}" != xyes; then local sysroot="`${target}-gcc -print-sysroot`" if test ! -d ${sysroot}; then - dryrun "mkdir -p /opt/linaro" dryrun "ln -sfnT ${abe_top}/sysroots/${target} ${sysroot}" fi fi @@ -134,24 +109,15 @@ build_all() sed -i -e 's/typedef __caddr_t caddr_t/\/\/ FIXME: typedef __caddr_t caddr_t/' ${sysroots}/usr/include/sys/types.h fi - build ${gcc_version} stage2 + build gcc stage2 build_all_ret=$? # Reverse the ugly hack if test `echo ${host} | grep -c mingw` -eq 1; then sed -i -e 's/.*FIXME: //' ${sysroots}/usr/include/sys/types.h fi ;; - gdb) - build ${gdb_version} gdb - build_all_ret=$? - ;; - gdbserver) - build ${gdb_version} gdbserver - build_all_ret=$? - ;; - # Build anything not GCC or infrastructure *) - build ${binutils_version} binutils + build $i build_all_ret=$? ;; esac @@ -162,8 +128,6 @@ build_all() fi done - manifest="`manifest`" - # Notify that the build completed successfully build_success @@ -182,7 +146,7 @@ build_all() is_package_in_runtests "${runtests}" binutils if test $? -eq 0; then - make_check ${binutils_version} binutils + make_check binutils if test $? -ne 0; then check_ret=1 check_failed="${check_failed} binutils" @@ -191,7 +155,7 @@ build_all() is_package_in_runtests "${runtests}" gcc if test $? -eq 0; then - make_check ${gcc_version} stage2 + make_check gcc stage2 if test $? -ne 0; then check_ret=1 check_failed="${check_failed} gcc-stage2" @@ -200,7 +164,7 @@ build_all() is_package_in_runtests "${runtests}" gdb if test $? -eq 0; then - make_check ${gdb_version} gdb + make_check gdb if test $? -ne 0; then check_ret=1 check_failed="${check_failed} gdb" @@ -312,65 +276,56 @@ build() { trace "$*" - # gitinfo contains the service://url~branch@revision - local gitinfo="`get_source $1`" - if test -z "${gitinfo}"; then - error "No matching source found for \"$1\"." - return 1 + local component="`echo $1 | sed -e 's:\.git.*::' -e 's:-[0-9a-z\.\-]*::'`" + + if test "`echo $2 | grep -c gdb`" -gt 0; then + local component="$2" fi - - # The git parser functions shall return valid results for all - # services, especially once we have a URL. - - # tag is a sanitized string that's only used for naming and information - # 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}`" || return 1 - - local srcdir="`get_srcdir ${gitinfo} ${2:+$2}`" - - # We have to use get_toolname because binutils-gdb use the same - # repository and get_toolname needs to parse the branchname to - # determine the tool. - local tool="`get_toolname ${srcdir}`" + local url="`get_component_url ${component}`" + local srcdir="`get_component_srcdir ${component}`" + local builddir="`get_component_builddir ${component}`${2:+-$2}" + local version="`basename ${srcdir}`" local stamp= - stamp="`get_stamp_name build ${gitinfo} ${2:+$2}`" - - local builddir="`get_builddir ${gitinfo} ${2:+$2}`" + stamp="`get_stamp_name build ${version} ${2:+$2}`" # The stamp is in the buildir's parent directory. local stampdir="`dirname ${builddir}`" - notice "Building ${tag}${2:+ $2}" + notice "Building ${component} ${2:+$2}" # If this is a native build, we always checkout/fetch. If it is a # cross-build we only checkout/fetch if this is stage1 if test x"${target}" = x"${build}" \ -o x"${target}" != x"${build}" -a x"$2" != x"stage2"; then - if test `echo ${gitinfo} | egrep -c "^git|^ssh|^http|^git|\.git"` -gt 0; then - # Don't update the compiler sources between stage1 and stage2 builds if this - # is a cross build. - notice "Checking out ${tag}${2:+ $2}" - checkout ${gitinfo} ${2:+$2} - if test $? -gt 0; then - warning "Sources not updated, network error!" - fi - else - # Don't update the compiler sources between stage1 and stage2 builds if this - # is a cross build. - fetch ${gitinfo} - if test $? -gt 0; then - error "Couldn't fetch tarball ${gitinfo}" - return 1 - fi - extract ${gitinfo} + # Don't attempt to get sources if updating is disabled. If checkout_all() + # has been called, (build_all() does), then there is no need to keep + # updating. + if test x"${supdate}" = xyes; then + component_is_tar ${component} if test $? -gt 0; then - error "Couldn't extract tarball ${gitinfo}" - return 1 +- # Don't update the compiler sources between stage1 and stage2 builds if this + # is a cross build. + notice "Checking out ${component} ${2:+$2}" + checkout ${component} + if test $? -gt 0; then + warning "Sources not updated, network error!" + fi + else + # Don't update the compiler sources between stage1 and stage2 builds if this + # is a cross build. + fetch ${component} + if test $? -gt 0; then + error "Couldn't fetch tarball ${component}" + return 1 + fi + extract ${component} + if test $? -gt 0; then + error "Couldn't extract tarball ${component}" + return 1 + fi fi - fi + fi fi # We don't need to build if the srcdir has not changed! We check the @@ -382,13 +337,13 @@ build() return 0 elif test $ret -eq 255; then # Don't proceed if the srcdir isn't present. What's the point? - return 1 warning "no source dir for the stamp!" + return 1 fi if test x"${building}" != xno; then - notice "Configuring ${tag}${2:+ $2}" - configure_build ${gitinfo} $2 + notice "Configuring ${component} ${2:+$2}" + configure_build ${component} ${2:+$2} if test $? -gt 0; then error "Configure of $1 failed!" return $? @@ -396,21 +351,21 @@ build() # Clean the build directories when forced if test x"${force}" = xyes; then - make_clean ${gitinfo} $2 + make_clean ${component} ${2:+$2} if test $? -gt 0; then return 1 fi fi # Finally compile and install the libaries - make_all ${gitinfo} $2 + make_all ${component} ${2:+$2} if test $? -gt 0; then return 1 fi # Build the documentation, unless it has been disabled at the command line. if test x"${make_docs}" = xyes; then - make_docs ${gitinfo} $2 + make_docs ${component} ${2:+$2} if test $? -gt 0; then return 1 fi @@ -420,7 +375,7 @@ build() # Install, unless it has been disabled at the command line. if test x"${install}" = xyes; then - make_install ${gitinfo} $2 + make_install ${component} ${2:+$2} if test $? -gt 0; then return 1 fi @@ -441,6 +396,7 @@ build() create_stamp "${stampdir}" "${stamp}" + local tag="`create_release_tag ${component}`" notice "Done building ${tag}${2:+ $2}, took ${SECONDS} seconds" # For cross testing, we need to build a C library with our freshly built @@ -458,7 +414,7 @@ build() if test x"${buildingall}" = xno -a x"${tarbin}" != xyes; then # Skip make_check if it isn't designated to be executed in ${runtests} - is_package_in_runtests "${runtests}" ${tool} + is_package_in_runtests "${runtests}" ${component} if test $? -eq 0 -a x"$2" != x"stage1" -a x"$2" != x"gdbserver"; then # We don't run make check on gcc stage1 or on gdbserver because # it's unnecessary. @@ -479,24 +435,23 @@ make_all() { trace "$*" - local tool="`get_toolname $1`" + local component="`echo $1 | sed -e 's:\.git.*::' -e 's:-[0-9a-z\.\-]*::'`" # Linux isn't a build project, we only need the headers via the existing # Makefile, so there is nothing to compile. - if test x"${tool}" = x"linux"; then + if test x"${component}" = x"linux"; then return 0 fi - # FIXME: This should be a URL - local builddir="`get_builddir $1 ${2:+$2}`" + local builddir="`get_component_builddir ${component}`${2:+-$2}" notice "Making all in ${builddir}" - if test x"${parallel}" = x"yes" -a "`echo ${tool} | grep -c glibc`" -eq 0; then + if test x"${parallel}" = x"yes" -a "`echo ${component} | grep -c glibc`" -eq 0; then local make_flags="${make_flags} -j ${cpus}" fi # Enable an errata fix for aarch64 that effects the linker - if test "`echo ${tool} | grep -c glibc`" -gt 0 -a `echo ${target} | grep -c aarch64` -gt 0; then + if test "`echo ${component} | grep -c glibc`" -gt 0 -a `echo ${target} | grep -c aarch64` -gt 0; then local make_flags="${make_flags} LDFLAGS=\"-Wl,--fix-cortex-a53-843419\" " fi @@ -505,7 +460,7 @@ make_all() fi # Use pipes instead of /tmp for temporary files. - if test x"${override_cflags}" != x -a x"${tool}" != x"eglibc"; then + if test x"${override_cflags}" != x -a x"${component}" != x"eglibc"; then local make_flags="${make_flags} CFLAGS_FOR_BUILD=\"-pipe -g -O2\" CFLAGS=\"${override_cflags}\" CXXFLAGS=\"${override_cflags}\" CXXFLAGS_FOR_BUILD=\"-pipe -g -O2\"" else local make_flags="${make_flags} CFLAGS_FOR_BUILD=\"-pipe -g -O2\" CXXFLAGS_FOR_BUILD=\"-pipe -g -O2\"" @@ -520,16 +475,15 @@ make_all() fi # All tarballs are statically linked - if test x"${tarbin}" = x"yes"; then - local make_flags="${make_flags} LDFLAGS_FOR_BUILD=\"-static-libgcc\" -C ${builddir}" - fi + local make_flags="${make_flags} LDFLAGS_FOR_BUILD=\"-static-libgcc\" -C ${builddir}" - # Some components require extra flags to make: we put them at the end so that config files can override - local default_makeflags="`read_config $1 default_makeflags`" + # Some components require extra flags to make: we put them at the + # end so that config files can override + local default_makeflags="`get_component_makeflags ${component}`" - if test x"${tool}" = x"gdb" -a x"$2" == x"gdbserver"; then - default_makeflags="gdbserver CFLAGS=--sysroot=${sysroots}" - fi +# if test x"$2" = x"gdbserver"; then +# default_makeflags="CFLAGS=--sysroot=${sysroots}" +# fi if test x"${default_makeflags}" != x; then local make_flags="${make_flags} ${default_makeflags}" @@ -545,7 +499,7 @@ make_all() local makeret= # GDB and Binutils share the same top level files, so we have to explicitly build # one or the other, or we get duplicates. - local logfile="${builddir}/make-${tool}${2:+-$2}.log" + local logfile="${builddir}/make-${component}${2:+-$2}.log" dryrun "make SHELL=${bash_shell} -w -C ${builddir} ${make_flags} 2>&1 | tee ${logfile}" local makeret=$? @@ -598,13 +552,14 @@ make_install() { trace "$*" - if test x"${parallel}" = x"yes" -a "`echo ${tool} | grep -c glibc`" -eq 0; then + local component="`echo $1 | sed -e 's:\.git.*::' -e 's:-[0-9a-z\.\-]*::'`" + + if test x"${parallel}" = x"yes" -a "`echo ${component} | grep -c glibc`" -eq 0; then local make_flags="${make_flags} -j $((2*${cpus}))" fi - local tool="`get_toolname $1`" - if test x"${tool}" = x"linux"; then - local srcdir="`get_srcdir $1 ${2:+$2}`" + if test x"${component}" = x"linux"; then + local srcdir="`get_component_srcdir ${component}` ${2:+$2}" if test `echo ${target} | grep -c aarch64` -gt 0; then dryrun "make ${make_opts} -C ${srcdir} headers_install ARCH=arm64 INSTALL_HDR_PATH=${sysroots}/usr" elif test `echo ${target} | grep -c i.86` -gt 0; then @@ -627,7 +582,7 @@ make_install() # Use LSB to produce more portable binary releases. if test x"${LSBCC}" != x -a x"${LSBCXX}" != x -a x"${tarbin}" = x"yes"; then - case ${tool} in + case ${component} in binutils|gdb|gcc) export LSB_SHAREDLIBPATH=${builddir} local make_flags="${make_flags} CC=${LSBCC} CXX=${LSBCXX}" @@ -637,10 +592,10 @@ make_install() esac fi - local builddir="`get_builddir $1 ${2:+$2}`" + local builddir="`get_component_builddir ${component}`${2:+-$2}" notice "Making install in ${builddir}" - if test "`echo ${tool} | grep -c glibc`" -gt 0; then + if test "`echo ${component} | grep -c glibc`" -gt 0; then local make_flags=" install_root=${sysroots} ${make_flags} LDFLAGS=-static-libgcc PARALLELMFLAGS=\"-j ${cpus}\"" fi @@ -651,17 +606,12 @@ make_install() # NOTE: $make_flags is dropped, as newlib's 'make install' doesn't # like parallel jobs. We also change tooldir, so the headers and libraries # get install in the right place in our non-multilib'd sysroot. - if test x"${tool}" = x"newlib"; then + if test x"${component}" = x"newlib"; then # as newlib supports multilibs, we force the install directory to build # a single sysroot for now. FIXME: we should not disable multilibs! local make_flags=" tooldir=${sysroots}/usr/" if test x"$2" = x"libgloss"; then - local make_flags="${make_flags} install-rdimon" - if test `echo ${target} | grep -c aarch64` -gt 0; then - local builddir="${builddir}/aarch64" - else - local builddir="${builddir}/arm" - fi + local make_flags="${make_flags}" fi fi @@ -674,25 +624,26 @@ make_install() export CONFIG_SHELL=${bash_shell} fi - local default_makeflags="`read_config $1 default_makeflags | sed -e 's:\ball-:install-:g'`" - if test x"${tool}" = x"gdb" ; then + local default_makeflags= #"`get_component_makeflags ${component}`" + if test x"${component}" = x"gdb" ; then + local log="`dirname ${builddir}`/install.log" if test x"$2" != x"gdbserver" ; then - dryrun "make install-gdb ${make_flags} ${default_makeflags} -i -k -w -C ${builddir} 2>&1 | tee ${builddir}/install.log" + dryrun "make install-gdb ${make_flags} ${default_makeflags} -i -k -w -C ${builddir} 2>&1 | tee ${log}" else - dryrun "make install ${make_flags} -i -k -w -C ${builddir} 2>&1 | tee ${builddir}/install.log" + dryrun "make install ${make_flags} -i -k -w -C ${builddir} 2>&1 | tee ${log}" fi else - dryrun "make install ${make_flags} ${default_makeflags} -i -k -w -C ${builddir} 2>&1 | tee ${builddir}/install.log" + dryrun "make install ${make_flags} ${default_makeflags} -i -k -w -C ${builddir} 2>&1 | tee ${log}" fi if test $? != "0"; then warning "Make install failed!" return 1 fi - if test x"${tool}" = x"gcc"; then + if test x"${component}" = x"gcc"; then dryrun "copy_gcc_libs_to_sysroot \"${local_builds}/destdir/${host}/bin/${target}-gcc --sysroot=${sysroots}\"" if test `echo ${host} | grep -c mingw` -eq 1 -a -e /usr/${host}/lib/libwinpthread-1.dll; then - local builddir="`get_builddir ${gcc_version}`-stage2" + local builddir="`get_component_builddir ${gcc_version}`-stage2" cp /usr/${host}/lib/libwinpthread-1.dll ${builddir}/gcc fi fi @@ -706,14 +657,14 @@ make_check() { trace "$*" - local tool="`get_toolname $1`" - local builddir="`get_builddir $1 ${2:+$2}`" + local component="`echo $1 | sed -e 's:\.git.*::' -e 's:-[0-9a-z\.\-]*::'`" + local builddir="`get_component_builddir ${component}`${2:+-$2}" # Some tests cause problems, so don't run them all unless # --enable alltests is specified at runtime. - local ignore="dejagnu gmp mpc mpfr make eglibc linux" + local ignore="dejagnu gmp mpc mpfr make eglibc linux gdbserver" for i in ${ignore}; do - if test x"${tool}" = x$i -a x"${alltests}" != xyes; then + if test x"${component}" = x$i -a x"${alltests}" != xyes; then return 0 fi done @@ -730,6 +681,10 @@ make_check() local make_flags="${make_flags} LDFLAGS_FOR_BUILD=\"${override_ldflags}\"" fi + local runtestflags="`get_component_runtestflags ${component}`" + if test x"${runtestflags}" != x; then + local make_flags="${make_flags} RUNTESTFLAGS=\"${runtestflags}\"" + fi if test x"${override_runtestflags}" != x; then local make_flags="${make_flags} RUNTESTFLAGS=\"${override_runtestflags}\"" fi @@ -748,11 +703,11 @@ make_check() export DEJAGNU=${topdir}/config/linaro.exp # Run tests - local checklog="${builddir}/check-${tool}.log" + local checklog="${builddir}/check-${component}.log" if test x"${build}" = x"${target}" -a x"${tarbin}" != x"yes"; then # Overwrite ${checklog} in order to provide a clean log file # if make check has been run more than once on a build tree. - dryrun "make check RUNTESTFLAGS=\"${runtest_flags} --xml=${tool}.xml \" ${make_flags} -w -i -k -C ${builddir} 2>&1 | tee ${checklog}" + dryrun "make check RUNTESTFLAGS=\"${runtest_flags} --xml=${component}.xml \" ${make_flags} -w -i -k -C ${builddir} 2>&1 | tee ${checklog}" if test $? -gt 0; then error "make check -C ${builddir} failed." return 1 @@ -760,7 +715,7 @@ make_check() else local exec_tests exec_tests=false - case "$tool" in + case "$component" in gcc) exec_tests=true ;; # Support testing remote gdb for the merged binutils-gdb.git # repository where the branch doesn't indicate the tool. @@ -794,7 +749,7 @@ make_check() fi fi - case ${tool} in + case ${component} in binutils) local dirs="/binutils /ld /gas" local check_targets="check-DEJAGNU" @@ -808,7 +763,7 @@ make_check() local check_targets="check" ;; esac - if test x"${tool}" = x"gcc"; then + if test x"${component}" = x"gcc" -a x"${clibrary}" != "newlib"; then touch ${sysroots}/etc/ld.so.cache chmod 700 ${sysroots}/etc/ld.so.cache fi @@ -818,7 +773,7 @@ make_check() if test -e ${checklog}; then # This might or might not be called, depending on whether make_clean # is called before make_check. None-the-less it's better to be safe. - notice "Removing existing check-${tool}.log: ${checklog}" + notice "Removing existing check-${component}.log: ${checklog}" rm ${checklog} fi @@ -835,7 +790,7 @@ make_check() stop_schroot_sessions unset SCHROOT_TEST - if test x"${tool}" = x"gcc"; then + if test x"${component}" = x"gcc"; then rm -rf ${sysroots}/etc/ld.so.cache fi fi @@ -847,7 +802,7 @@ make_clean() { trace "$*" - builddir="`get_builddir $1 ${2:+$2}`" + builddir="`get_component_builddir $1 ${2:+$2}`" notice "Making clean in ${builddir}" if test x"$2" = "dist"; then @@ -867,7 +822,8 @@ make_docs() { trace "$*" - local builddir="`get_builddir $1 ${2:+$2}`" + local component="`echo $1 | sed -e 's:\.git.*::' -e 's:-[0-9a-z\.\-]*::'`" + local builddir="`get_component_builddir ${component}`${2:+-$2}" notice "Making docs in ${builddir}" @@ -882,7 +838,10 @@ make_docs() dryrun "make SHELL=${bash_shell} ${make_flags} -w -C ${builddir} install-html install-info 2>&1 | tee -a ${builddir}/makedoc.log" return $? ;; - *gdb*) + *gdbserver) + return 0 + ;; + *gdb) dryrun "make SHELL=${bash_shell} ${make_flags} -i -k -w -C ${builddir}/gdb diststuff install-html install-info 2>&1 | tee -a ${builddir}/makedoc.log" return $? ;; diff --git a/lib/package.sh b/lib/package.sh index f8a0b2eb..01415714 100644 --- a/lib/package.sh +++ b/lib/package.sh @@ -31,7 +31,9 @@ build_rpm() local infile="${abe_path}/packaging/redhat/tcwg.spec.in" local arch="`echo ${target} | tr '-' '_'`" - local version="`echo ${gcc_version} | cut -d '~' -f 2 | grep -o "[4-6][\._][0-9\.]*" | tr '_' '.'`" + + local srcdir="`get_component_srcdir gcc`" + local version="`cat ${srcdir}/gcc/BASE-VER`" rm -f /tmp/tcwg$$.spec sed -e "s:%global triplet.*:%global triplet ${arch}:" \ @@ -76,38 +78,8 @@ binary_runtime() { trace "$*" -# local version="`${target}-gcc --version | head -1 | cut -d ' ' -f 3`" - local version="`${target}-gcc --version | grep -o " [0-9]\.[0-9]" | tr -d ' ' | head -n 1`" - - # no expicit release tag supplied, so create one. - if test x"${release}" = x; then - if test x"${gcc_version}" = x; then - local gcc_version="~`grep ^latest= ${topdir}/config/gcc.conf | cut -d '\"' -f 2`" - fi - - if test `echo ${gcc_version} | grep -c "\.git/"`; then - local branch="`basename ${gcc_version}`" - else - if test `echo ${gcc_version} | grep -c "\.git"`; then - local branch= - fi - fi - - local builddir="`get_builddir ${gcc_version} stage2`" - local srcdir="`get_srcdir ${gcc_version}`" - - local date="`date +%Y%m%d`" - if test -d ${srcdir}/.gito -o -e ${srcdir}/.gitignore; then - local revision="@`cd ${srcdir} && git log --oneline | head -1 | cut -d ' ' -f 1`" - fi - if test `echo ${gcc_version} | grep -c "\.git/"`; then - local version="`echo ${gcc_version} | cut -d '/' -f 1 | sed -e 's:\.git:-linaro:'`-${version}" - fi - local tag="`echo runtime-${version}~${revision}-${target}-${date} | sed -e 's:-none-:-:' -e 's:-unknown-:-:'`" - else - # use an explicit tag for the release name - local tag="`echo runtime-linaro-gcc${version}-${release}-${target}`" - fi + local rtag="`create_release_tag gcc`" + local tag="runtime-${rtag}-${target}" local destdir="${local_builds}/tmp.$$/${tag}" @@ -140,15 +112,10 @@ binary_gdb() local version="`${target}-gdb --version | head -1 | grep -o " [0-9\.][0-9].*\." | tr -d ')'`" local tag="`create_release_tag ${gdb_version} | sed -e 's:binutils-::'`" - local builddir="`get_builddir ${gdb_version} gdb`" + local builddir="`get_component_builddir gdb`-gdb" local destdir="${local_builds}/tmp.$$/${tag}-tmp" local prefix="${local_builds}/destdir/${host}" - local gdb_static="`grep ^static_link= ${topdir}/config/gdb.conf | cut -d '\"' -f 2`" - -# if test x"${gdb_static}" = x"yes"; then -# fi - # Use LSB to produce more portable binary releases. if test x"${LSBCC}" != x -a x"${LSBCXX}" != x; then local make_flags="${make_flags} CC=${LSBCC} CXX=${LSBCXX}" @@ -183,40 +150,12 @@ binary_toolchain() { trace "$*" - local version="`${target}-gcc --version | grep -o " [0-9]\.[0-9]" | tr -d ' ' | head -n 1`" + local rtag="`create_release_tag gcc`" - # no expicit release tag supplied, so create one. - if test x"${release}" = x; then - if test x"${gcc_version}" = x; then - local gcc_version="`grep ^latest= ${topdir}/config/gcc.conf | cut -d '\"' -f 2`" - fi - if test `echo ${gcc_version} | grep -c "\.git/"`; then - local branch="`basename ${gcc_version}`" - else - if test `echo ${gcc_version} | grep -c "\.git"`; then - local branch= - fi - fi - - local date="`date +%Y%m%d`" - local srcdir="`get_srcdir ${gcc_version}`" - - if test -d ${srcdir}/.git -o -e ${srcdir}/.gitignore; then - local revision="git`cd ${srcdir} && git log --oneline | head -1 | cut -d ' ' -f 1`" - fi - if test x"${host}" != x"${build}"; then - local tag="`echo gcc-linaro-${version}~${revision}-i686-mingw32_${target}-${date} | sed -e 's:-none-:-:' -e 's:-unknown-:-:'`" - else - local tag="`echo gcc-linaro-${version}~${revision}-${build_arch}_${target}-${date} | sed -e 's:-none-:-:' -e 's:-unknown-:-:'`" - fi + if test x"${host}" != x"${build}"; then + local tag="${rtag}-i686-mingw32_${target}" else - # use an explicit tag for the release name - if test x"${host}" != x"${build}"; then - local tag="`echo gcc-linaro-${version}-${release}-i686-mingw32_${target} | sed -e 's:-none-:-:' -e 's:-unknown-:-:'`" - else - local tag="`echo gcc-linaro-${version}-${release}-${build_arch}_${target} | sed -e 's:-none-:-:' -e 's:-unknown-:-:'`" - fi - + local tag="${rtag}-${build_arch}_${target}" fi local destdir="${local_builds}/tmp.$$/${tag}" @@ -225,9 +164,6 @@ binary_toolchain() # The manifest file records the versions of all of the components used to # build toolchain. dryrun "cp ${manifest} ${local_builds}/destdir/${host}/" - -# local installdir="`find ${destdir} -name ${target}-nm`" -# local installdir="`dirname ${installdir} | sed -e 's:/bin::'`" dryrun "rsync -avr ${local_builds}/destdir/${host}/* ${destdir}/" if test x"${build}" != x"${target}"; then @@ -247,7 +183,7 @@ binary_toolchain() build_rpm ${destdir} fi if test x"${tarbin}" = x"yes"; then -# if test `echo ${host} | grep -c mingw` -eq 0; then + if test `echo ${host} | grep -c mingw` -eq 0; then # make the tarball from the tree we just created. notice "Making binary tarball for toolchain, please wait..." dryrun "tar Jcf ${local_snapshots}/${tag}.tar.xz --directory=${local_builds}/tmp.$$ ${exclude} ${tag}" @@ -256,8 +192,8 @@ binary_toolchain() dryrun "md5sum ${local_snapshots}/${tag}.tar.xz | sed -e 's:${local_snapshots}/::' > ${local_snapshots}/${tag}.tar.xz.asc" # else # notice "Making binary toolchain package for Windows, please wait..." -# ${local_snapshots}/infrastructure/installjammer-1.2.15/installjammer --output-dir ${local_snapshots}/ --build ${abe_path}/config/LinaroGCC.mpi -# fi +# ${local_snapshots}/infrastructure/installjammer/installjammer --output-dir ${local_snapshots}/ --build ${abe_path}/config/LinaroGCC.mpi + fi fi rm -fr ${local_builds}/tmp.$$ @@ -269,59 +205,9 @@ binary_sysroot() { trace "$*" - local version="`${target}-gcc --version | grep -o " [0-9]\.[0-9]" | tr -d ' ' | head -n 1`" + local rtag="`create_release_tag glibc`" + local tag="sysroot-${rtag}-${target}" - # no expicit release tag supplied, so create one. - if test x"${release}" = x; then - if test x"${clibrary}" = x"newlib"; then - if test x"${newlb_version}" = x; then - local libc_version="`grep ^latest= ${topdir}/config/newlib.conf | cut -d '=' -f 2 | cut -d '/' -f 1 | tr -d '\"'`" - else - local libc_version="`echo ${newlib_version} | cut -d '/' -f 1`" - fi - local srcdir="`get_srcdir ${libc_version}`" - elif test x"${clibrary}" = x"glibc"; then - if test x"${glibc_version}" = x; then - local libc_version="`grep ^latest= ${topdir}/config/glibc.conf | cut -d '/' -f 2 | tr -d '\"'`" - local srcdir="`get_srcdir ${libc_version}`" - local libc_version="glibc-linaro-`grep VERSION ${local_snapshots}/${libc_version}/libc/version.h | tr -d '\"' | cut -d ' ' -f 3`" - else - local libc_version="`echo ${glibc_version} | cut -d '/' -f 1`" - local srcdir="`get_srcdir ${libc_version}`" - local libc_version="glibc-linaro-`grep VERSION ${local_snapshots}/${libc_version}/libc/version.h | tr -d '\"' | cut -d ' ' -f 3`" - fi - else - if test x"${eglibc_version}" = x; then - local libc_version="`grep ^latest= ${topdir}/config/eglibc.conf | cut -d '/' -f 2 | tr -d '\"'`" - local srcdir="`get_srcdir ${libc_version}`" - local libc_version="eglibc-linaro-`grep VERSION ${local_snapshots}/${libc_version}/libc/version.h | tr -d '\"' | cut -d ' ' -f 3`" - else - local libc_version="`echo ${eglibc_version} | cut -d '/' -f 1`" - local srcdir="`get_srcdir ${libc_version}`" - local libc_version="eglibc-linaro-`grep VERSION ${local_snapshots}/${libc_version}/libc/version.h | tr -d '\"' | cut -d ' ' -f 3`" - fi - fi - - local builddir="`get_builddir ${libc_version}`" - - # if test "`echo $1 | grep -c '@'`" -gt 0; then - # local commit="@`echo $1 | cut -d '@' -f 2`" - # else - # local commit="" - # fi - local version="`${target}-gcc --version | grep -o " [0-9]\.[0-9]" | tr -d ' ' | head -n 1`" - date="`date +%Y%m%d`" - if test -d ${srcdir}/.git -o -e ${srcdir}/.gitignore; then - local revision="`cd ${srcdir} && git log --oneline | head -1 | cut -d ' ' -f 1`" - else - revision="${BUILD_NUMBER}" - fi - local tag="`echo sysroot-${libc_version}-${revision}-${target}-${date}-gcc_${version} | sed -e 's:\.git:-linaro:' -e 's:-none-:-:' -e 's:-unknown-:-:'`" - else - local tag="sysroot-linaro-${clibrary}-gcc${version}-${release}-${target}" - fi - -# dryrun "cp -fr ${abe_top}/sysroots/${target} ${destdir}" local destdir="${local_builds}/tmp.$$/${tag}" dryrun "mkdir -p ${local_builds}/tmp.$$" if test x"${build}" != x"${target}"; then @@ -330,9 +216,6 @@ binary_sysroot() dryrun "ln -sfnT ${abe_top}/sysroots ${destdir}" fi - # Generate the install script -# sysroot_install_script ${destdir} - notice "Making binary tarball for sysroot, please wait..." dryrun "tar Jcfh ${local_snapshots}/${tag}.tar.xz --directory=${local_builds}/tmp.$$ ${tag}" @@ -348,194 +231,161 @@ manifest() { trace "$*" - # This function relies too heavily on the built toolchain to do anything # in dryrun mode. if test x"${dryrun}" = xyes; then return 0; fi - if test x"${gmp_version}" = x; then - local gmp_version="`grep ^latest= ${topdir}/config/gmp.conf | cut -d '\"' -f 2`" - fi - - if test x"${mpc_version}" = x; then - local mpc_version="`grep ^latest= ${topdir}/config/mpc.conf | cut -d '\"' -f 2`" - fi - - if test x"${mpfr_version}" = x; then - local mpfr_version="`grep ^latest= ${topdir}/config/mpfr.conf | cut -d '\"' -f 2`" - fi - - if test x"${gdb_version}" = x; then - local gdb_version="`grep ^latest= ${topdir}/config/gdb.conf | cut -d '\"' -f 2`" - fi - local gcc_branch="`echo ${gcc_version} | cut -d '~' -f 2`" - - local srcdir="`get_srcdir ${gcc_version}`" - local gcc_revision="`srcdir_revision ${srcdir}`" - - local srcdir="`get_srcdir ${gdb_version}`" - local gdb_revision="`srcdir_revision ${srcdir}`" - - if test x"${dejagnu_version}" = x; then - local dejagnu_version="`grep ^latest= ${topdir}/config/dejagnu.conf | cut -d '\"' -f 2`" - fi - local srcdir="`get_srcdir ${dejagnu_version}`" - local dejagnu_revision="`srcdir_revision ${srcdir}`" - - if test x"${linux_version}" = x; then - local linux_version="`grep ^latest= ${topdir}/config/linux.conf | cut -d '\"' -f 2`" - fi - - if test x"${binutils_version}" = x; then - local binutils_version="`grep ^latest= ${topdir}/config/binutils.conf | cut -d '\"' -f 2`" - fi - local srcdir="`get_srcdir ${binutils_version}`" - local binutils_revision="`srcdir_revision ${srcdir}`" - - local abe_revision="`srcdir_revision ${abe_path}`" - - if test x"${clibrary}" = x"eglibc"; then - local srcdir="`get_srcdir ${eglibc_version}`" - elif test x"${clibrary}" = x"glibc"; then - local srcdir="`get_srcdir ${glibc_version}`" - elif test x"${clibrary}" = x"newlib"; then - local srcdir="`get_srcdir ${newlib_version}`" - fi - local libc_version="`srcdir_revision ${abe_path}`" - - local mtag= if test x"$1" = x; then - mtag="`create_release_tag ${gcc_version}`" + mtag="`create_release_tag gcc`" + mkdir -p ${local_builds}/${host}/${target} local outfile=${local_builds}/${host}/${target}/${mtag}-manifest.txt else local outfile=$1 fi - rm -f ${outfile} - cat >> ${outfile} <<EOF -# Build machine data -build=${build} -host=${host} -target=${target} -kernel=${kernel} -hostname=${hostname} -distribution=${distribution} -host_gcc=${host_gcc_version} - -Component versions -gmp_versionnum=${gmp_version} -mpc_versionnum=${mpc_version} -mpfr_versionnum=${mpfr_version} - -# Binutils -binutils_branch=${binutils_version} -EOF + if test -e ${outfile}; then + mv -f ${outfile} ${outfile}.bak + fi + echo "manifest_format=${manifest_version:-1.0}" > ${outfile} + echo "" >> ${outfile} + echo "# Note that for ABE, these parameters are not used" >> ${outfile} + + local seen=0 + local tmpfile="/tmp/mani$$.txt" + for i in ${toolchain[*]}; do + local component="$i" + # ABE build data goes in the documentation sxection + if test x"${component}" = x"abe"; then + echo "${component}_url=`get_component_url ${component}`" > ${tmpfile} + echo "${component}_branch=branch=`get_component_branch ${component}`" >> ${tmpfile} + echo "${component}_revision=`get_component_revision ${component}`" >> ${tmpfile} + echo "${component}_filespec=`get_component_filespec ${component}`" >> ${tmpfile} + local configure="`get_component_configure ${component} | sed -e "s:${local_builds}:\$\{local_builds\}:g" -e "s:${sysroots}:\$\{sysroots\}:g"`" + echo "${component}_configure=\"${configure}\"" >> ${tmpfile} + echo "" >> ${tmpfile} + continue + fi + if test ${seen} -eq 1 -a x"${component}" = x"gcc"; then + notice "Not writing GCC a second time, already done." + continue + else + if test x"${component}" = x"gcc"; then + local seen=1 + fi + fi - if test "`echo ${binutils_branch} | grep -c \.tar\.`" -eq 0; then - cat >> ${outfile} <<EOF -binutils_revision=${binutils_revision} -binutils_version=binutils-gdb.git@${binutils_revision} -EOF - fi + echo "# Component data for ${component}" >> ${outfile} - cat >> ${outfile} <<EOF + local url="`get_component_url ${component}`" + echo "${component}_url=${url}" >> ${outfile} -# DejaGnu -dejagnu_version=${dejagnu_version} + local branch="`get_component_branch ${component}`" + if test x"${branch}" != x; then + echo "${component}_branch=${branch}" >> ${outfile} + fi -# GDB -gdb_branch=${gdb_version} + local revision="`get_component_revision ${component}`" + if test x"${revision}" != x; then + echo "${component}_revision=${revision}" >> ${outfile} + fi -EOF + local filespec="`get_component_filespec ${component}`" + if test x"${filespec}" != x; then + echo "${component}_filespec=${filespec}" >> ${outfile} + fi - if test "`echo ${gdb_branch} | grep -c \.tar\.`" -eq 0; then - cat >> ${outfile} <<EOF -gdb_revision=${gdb_revision} -gdb_version=binutils-gdb.git@${gdb_revision} -EOF - fi + local makeflags="`get_component_makeflags ${component} | sed -e "s:${local_builds}:\$\{local_builds\}:g" -e "s:${sysroots}:\$\{sysroots\}:g"`" + if test x"${makeflags}" != x; then + echo "${component}_makeflags=\"${makeflags}\"" >> ${outfile} + fi - cat >> ${outfile} <<EOF + # Drop any local build paths and replaced with variables to be more portable. + if test x"${component}" = x"gcc"; then + echo "${component}_configure=" >> ${outfile} + else + local configure="`get_component_configure ${component} | sed -e "s:${local_builds}:\$\{local_builds\}:g" -e "s:${sysroots}:\$\{sysroots\}:g"`" + if test x"${configure}" != x; then + echo "${component}_configure=\"${configure}\"" >> ${outfile} + fi + fi -# GCC -gcc_branch=${gcc_branch} -EOF + local static="`get_component_staticlink ${component}`" + if test "`echo ${component} | grep -c glibc`" -eq 0; then + echo "${component}_staticlink=\"${static}\"" >> ${outfile} + fi + + if test x"${component}" = x"gcc"; then + local stage1="`get_component_configure gcc stage1 | sed -e "s:${local_builds}:\$\{local_builds\}:g" -e "s:${sysroots}:\$\{sysroots\}:g"`" + echo "gcc_stage1_flags=\"${stage1}\"" >> ${outfile} + local stage2="`get_component_configure gcc stage2 | sed -e "s:${local_builds}:\$\{local_builds\}:g" -e "s:${sysroots}:\$\{sysroots\}:g"`" + echo "gcc_stage2_flags=\"${stage2}\"" >> ${outfile} + fi - if test "`echo ${gcc_branch} | grep -c \.tar\.`" -eq 0; then + echo "" >> ${outfile} + done + + # Gerrit info, if triggered + if test x"${gerrit_trigger}" = xyes; then cat >> ${outfile} <<EOF -gcc_revision=${gcc_revision} -gcc_version=gcc.git@${gcc_revision} +gerrit_branch=${gerrit_branch} +gerrit_revision=${gerrit_revision} EOF fi cat >> ${outfile} <<EOF -# C Library clibrary=${clibrary} -libc_version=${libc_version} +target=${target} -# Kernel -linux_version=${linux_version} + ############################################################################## + # Everything below this line is only for informational purposes for developers + ############################################################################## -# Abe revision used -abe_revision=${abe_revision} -abe_version="abe.git@${abe_revision}" +# Build machine data +build: ${build} +host: ${host} +kernel: ${kernel} +hostname: ${hostname} +distribution: ${distribution} +host_gcc: ${host_gcc_version} + +# These aren't used in the repeat build. just a sanity check for developers +build directory: ${local_builds} +sysroot directory: ${sysroots} +snapshots directory: ${local_snapshots} +git reference directory: ${git_reference_dir} EOF - # Gerrit info, if triggered - if test x"${gerrit_trigger}" = xyes; then - cat >> ${outfile} <<EOF -gerrit_branch=${gerrit_branch} -gerrit_revision=${gerrit_revision} - -EOF + # Add the section for ABE. + if test -e ${tmpfile}; then + cat "${tmpfile}" >> ${outfile} + rm "${tmpfile}" fi - case ${clibrary} in - glibc) - local srcdir="`get_srcdir ${glibc_version}`" - if test x"${glibc_version}" = x; then - glibc_version="`grep ^latest= ${topdir}/config/glibc.conf | cut -d '\"' -f 2`" - fi - local glibc_revision="`cd ${srcdir} && git log | head -1 | cut -d ' ' -f 2`" - - echo "glibc_version=${glibc_version}" >> ${outfile} - echo "glibc_revision=${glibc_revision}" >> ${outfile} - ;; - newlib) - local srcdir="`get_srcdir ${newlib_version}`" - if test x"${newlib_version}" = x; then - newlib_version="`grep ^latest= ${topdir}/config/newlib.conf | cut -d '\"' -f 2`" - fi - local newlib_revision="`cd ${srcdir} && git log | head -1 | cut -d ' ' -f 2`" - - echo "newlib_version=${newlib_version}" >> ${outfile} - echo "newlib_revision=${newlib_revision}" >> ${outfile} - ;; - eglibc|*) - local srcdir="`get_srcdir ${eglibc_version}`" - if test x"${eglibc_version}" = x; then - eglibc_version="`grep ^latest= ${topdir}/config/eglibc.conf | cut -d '\"' -f 2`" - fi - local eglibc_revision="`cd ${srcdir} && git log | head -1 | cut -d ' ' -f 2`" - - echo "eglibc_version=${eglibc_version}" >> ${outfile} - echo "eglibc_revision=${eglibc_revision}" >> ${outfile} - ;; - esac - - echo "---------------------------------------------" >> ${outfile} - if test "`echo ${gcc_branch} | grep -c \.tar\.`" -eq 0; then - local srcdir="`get_srcdir ${gcc_version}`" - # Invoke in a subshell in order to prevent state-change of the current - # working directory after manifest is called. - $(cd ${srcdir} && git log -n 1 >> ${outfile}) + for i in gcc binutils ${clibrary} abe; do + if test "`component_is_tar ${i}`" = no; then + echo "--------------------- $i ----------------------" >> ${outfile} + local srcdir="`get_component_srcdir $i`" + # Invoke in a subshell in order to prevent state-change of the current + # working directory after manifest is called. + $(cd ${srcdir} && git log -n 1 >> ${outfile}) + echo "" >> ${outfile} + fi + done + + if test x"${manifest}" != x; then + if ! diff --brief ${manifest} ${outfile} > /dev/null; then + warning "Manifest files are different!" + else + notice "Manifest files match" + fi fi echo ${outfile} + return 0 } @@ -552,9 +402,8 @@ binutils_src_tarball() local binutils_version="binutils-`grep ^latest= ${topdir}/config/binutils.conf | cut -d '\"' -f 2`" fi - local dir="`normalize_path ${binutils_version}`" - local srcdir="`get_srcdir ${binutils_version}`" - local builddir="`get_builddir ${binutils_version} binutils`" + local srcdir="`get_component_srcdir ${binutils_version}`" + local builddir="`get_component_builddir ${binutils_version} binutils`" local branch="`echo ${binutils_version} | cut -d '/' -f 2`" # clean up files that don't go into a release, often left over from development diff --git a/lib/release.sh b/lib/release.sh index 956d5260..a63a2c7c 100755 --- a/lib/release.sh +++ b/lib/release.sh @@ -70,8 +70,8 @@ release_binutils_src() local binutils_version="`grep ^latest= ${topdir}/config/binutils.conf | cut -d '\"' -f 2` | tr -d '\"'" fi - local srcdir="`get_srcdir ${binutils_version}`" - local builddir="`get_builddir ${binutils_version} binutils`" + local srcdir="`get_component_srcdir ${binutils_version}`" + local builddir="`get_component_builddir ${binutils_version}`-binutils" # The new combined repository for binutils has GDB too, so we strip that off. local tag="`create_release_tag ${binutils_version} | sed -e 's:-gdb::' -e 's:-binutils::'`" @@ -126,8 +126,8 @@ release_gcc_src() if test x"${gcc_version}" = x; then local gcc_version="`grep ^latest= ${topdir}/config/gcc.conf | cut -d '\"' -f 2` | tr -d '\"'" fi - local srcdir="`get_srcdir ${gcc_version}`" - local builddir="`get_builddir ${gcc_version} stage2`" + local srcdir="`get_component_srcdir ${gcc_version}`" + local builddir="`get_component_builddir ${gcc_version}`-stage2" local tag="`create_release_tag ${gcc_version} | sed -e 's:[-~]linaro-::' | tr '~' '-'`" local destdir="${local_builds}/linaro.$$/${tag}" @@ -272,7 +272,7 @@ release_gdb_src() if test x"${gdb_version}" = x; then local gdb_version="`grep ^latest= ${topdir}/config/gdb.conf | cut -d '\"' -f 2` | tr -d '\"'" fi - local srcdir="`get_srcdir ${gdb_version}`" + local srcdir="`get_component_srcdir ${gdb_version}`" # The new combined repository for GDB has Binutils too, so we strip that off. local tag="`create_release_tag ${gdb_version} | sed -e 's:binutils-::'`" local destdir="/tmp/linaro.$$/${tag}" diff --git a/scripts/Backport.job b/scripts/Backport.job index 89cff7ef..18fb28e4 100755 --- a/scripts/Backport.job +++ b/scripts/Backport.job @@ -24,7 +24,7 @@ usage() { # Format this section with 75 columns. cat << EOF - Backport.job [--help] [f|--fileserver 'remote file server'] --target triplet branch + Backport.job [--help] --target triplet branch EOF return 0 } @@ -55,7 +55,7 @@ esac if test x"${GERRIT_TOPIC}" != x; then gcc_branch="gcc.git~${GERRIT_TOPIC}" fi -$CONFIG_SHELL -x ${abe_dir}/test-backport.sh --target ${target} ${gcc_branch}${excludecheck:+ --excludecheck ${excludecheck}} --fileserver 148.251.136.42 +$CONFIG_SHELL -x ${abe_dir}/test-backport.sh --target ${target} ${gcc_branch}${excludecheck:+ --excludecheck ${excludecheck}} # force a failure of abe has build problems. if test $? -gt 0; then @@ -506,7 +506,7 @@ match='' test_pass "${cb_commands}" "${match}" cb_commands="--dryrun --build asdflkajsdflkajsfdlasfdlaksfdlkaj.git" -match="Couldn't find the source for" +match="Malformed input. No url found" test_failure "${cb_commands}" "${match}" # This tests that --build can go before --target and --target is still processed correctly. diff --git a/testsuite/common.sh b/testsuite/common.sh new file mode 100644 index 00000000..e0ce7ca8 --- /dev/null +++ b/testsuite/common.sh @@ -0,0 +1,64 @@ +fixme() +{ + if test x"${debug}" = x"yes"; then + echo "($BASH_LINENO): $*" 1>&2 + fi +} + +trace() +{ + echo "TRACE(#${BASH_LINENO}): ${FUNCNAME[1]} ($*)" 1>&2 +} + +passes=0 +pass() +{ + echo "PASS: $1" + passes="`expr ${passes} + 1`" +} + +xpasses=0 +xpass() +{ + echo "XPASS: $1" + xpasses="`expr ${xpasses} + 1`" +} + +untested=0 +untested() +{ + echo "UNTESTED: $1" + untested="`expr ${untested} + 1`" +} + +failures=0 +fail() +{ + echo "FAIL: $1" + failures="`expr ${failures} + 1`" +} + +xfailures=0 +xfail() +{ + echo "XFAIL: $1" + xfailures="`expr ${xfailures} + 1`" +} + +totals() +{ + echo "" + echo "Total test results:" + echo " Passes: ${passes}" + echo " Failures: ${failures}" + if test ${xpasses} -gt 0; then + echo " Unexpected Passes: ${xpasses}" + fi + if test ${xfailures} -gt 0; then + echo " Expected Failures: ${xfailures}" + fi + if test ${untested} -gt 0; then + echo " Untested: ${untested}" + fi +} + diff --git a/testsuite/component-tests.sh b/testsuite/component-tests.sh new file mode 100644 index 00000000..5b0c7737 --- /dev/null +++ b/testsuite/component-tests.sh @@ -0,0 +1,205 @@ +# tests for the component data structure + +abe_path=/linaro/src/linaro/abe/parser +. ${abe_path}/testsuite/common.sh +. ${abe_path}/lib/component.sh + +echo "============= component_init() tests ================" + +# FIXME: Note these following test cases only PASS if you have the source +# directories created already. + +component_init ld BRANCH="aa" URL="http://cc" REVISION="12345abcdef" gas FILESPEC="bb" +if test $? -eq 0; then + pass "component_init() two data structures" + init="yes" +else + fail "component_init() two data structures" + init="no" +fi + +echo "============= set_component_*() tests ================" + +disp="URL is set" +if test x"${init}" = x"yes"; then + if test x"${ld[URL]}" = x"http://cc"; then + pass "${disp}" + else + fail "${disp}" + fixme "${disp}" + fi +else + untested "${disp}" +fi + +disp="FILESPEC is set" +if test x"${init}" = x"yes"; then + if test x"${gas[FILESPEC]}" = x"bb"; then + pass "${disp}" + else + fail "${disp}" + fixme "${disp}" + fi +else + untested "${disp}" +fi + +# Test the setter functions +set_component_url ld "aaa" +disp="set_component_url() ld" +if test x"${init}" = x"yes"; then + if test x"${ld[URL]}" = x"aaa"; then + pass "${disp}" + else + fail "${disp}" + fixme "${disp}" + fi +else + untested "${disp}" +fi + +set_component_srcdir ld "bbb" +disp="set_component_srcdir() ld" +if test x"${init}" = x"yes"; then + if test x"${ld[SRCDIR]}" = x"bbb"; then + pass "${disp}" + else + fail "${disp}" + fixme "${disp}" + fi +else + untested "${disp}" +fi + +set_component_builddir ld "dddd" +disp="set_component_builddir() ld" +if test x"${init}" = x"yes"; then + if test x"${ld[BUILDDIR]}" = x"dddd"; then + pass "${disp}" + else + fail "${disp}" + fixme "${disp}" + fi +else + untested "${disp}" +fi + +set_component_revision ld "eeeee" +disp="set_component_revision() ld" +if test x"${init}" = x"yes"; then + if test x"${ld[REVISION]}" = x"eeeee"; then + pass "${disp}" + else + fail "${disp}" + fixme "${disp}" + fi +else + untested "${disp}" +fi + +set_component_branch ld "ffff" +disp="set_component_branch() ld" +if test x"${init}" = x"yes"; then + if test x"${ld[BRANCH]}" = x"ffff"; then + pass "${disp}" + else + fail "${disp}" + fixme "${disp}" + fi +else + untested "${disp}" +fi + +set_component_filespec ld "ggg" +disp="set_component_filespec() ld" +if test x"${init}" = x"yes"; then + if test x"${ld[FILESPEC]}" = x"ggg"; then + pass "${disp}" + else + fail "${disp}" + fixme "${disp}" + fi +else + untested "${disp}" +fi + +# Getter function tests +echo "============= get_component_*() tests ================" + +disp="get_component_url() ld" +out="`get_component_url ld`" +if test x"${init}" = x"yes"; then + if test x"${out}" = x"aaa"; then + pass "${disp}" + else + fail "${disp}" + fixme "${disp}" + fi +else + untested "${disp}" +fi + +disp="get_component_srcdir() ld" +out="`get_component_srcdir ld`" +if test x"${init}" = x"yes"; then + if test x"${out}" = x"bbb"; then + pass "${disp}" + else + fail "${disp}" + fixme "${disp}" + fi +else + untested "${disp}" +fi + +disp="get_component_builddir() ld" +out="`get_component_builddir ld`" +if test x"${init}" = x"yes"; then + if test x"${out}" = x"dddd"; then + pass "${disp}" + else + fail "${disp}" + fixme "${disp}" + fi +else + untested "${disp}" +fi + +disp="get_component_revision() ld" +out="`get_component_revision ld`" +if test x"${init}" = x"yes"; then + if test x"${out}" = x"eeeee"; then + pass "${disp}" + else + fail "${disp}" + fixme "${disp}" + fi +else + untested "${disp}" +fi + +disp="get_component_filespec() ld" +out="`get_component_filespec ld`" +if test x"${init}" = x"yes"; then + if test x"${out}" = x"ggg"; then + pass "${disp}" + else + fail "${disp}" + fixme "${disp}" + fi +else + untested "${disp}" +fi + +disp="get_component_branch() ld" +out="`get_component_branch ld`" +if test x"${init}" = x"yes"; then + if test x"${out}" = x"ffff"; then + pass "${disp}" + else + fail "${disp}" + fixme "${disp}" + fi +else + untested "${disp}" +fi diff --git a/testsuite/stamp-tests.sh b/testsuite/stamp-tests.sh index aa2a380d..67444fb1 100644 --- a/testsuite/stamp-tests.sh +++ b/testsuite/stamp-tests.sh @@ -102,7 +102,7 @@ match="linux-linaro-3.11-rc6-2013.08-build.stamp" test_get_stamp_name "${in}" "${match}" "${errmatch}" errmatch=0 -in="configure http://git.linaro.org/git/toolchain/gcc.git" +in="configure http://.git.linaro.org/git/toolchain/gcc.git" match="gcc.git-configure.stamp" test_get_stamp_name "${in}" "${match}" "${errmatch}" diff --git a/testsuite/test.sh b/testsuite/test.sh index f8a0ba87..f6d0ee47 100755 --- a/testsuite/test.sh +++ b/testsuite/test.sh @@ -133,7 +133,6 @@ totals() . "${topdir}/testsuite/git-parser-tests.sh" . "${topdir}/testsuite/stamp-tests.sh" . "${topdir}/testsuite/normalize-tests.sh" -. "${topdir}/testsuite/builddir-tests.sh" . "${topdir}/testsuite/dryrun-tests.sh" #. "${topdir}/testsuite/gerrit-tests.sh" #. "${topdir}/testsuite/report-tests.sh" @@ -221,300 +220,32 @@ else fixme "is_package_in_runtests ${in_runtests} ${in_package} resulted in '${ret}'" fi - - -echo "============= get_toolname() tests ================" - -testing="get_toolname: uncompressed tarball" -in="http://abe.validation.linaro.org/snapshots/gdb-7.6~20121001+git3e2e76a.tar" -out="`get_toolname ${in}`" -if test ${out} = "gdb"; then - pass "${testing}" -else - fail "${testing}" - fixme "${in} returned ${out}" -fi - -# ---------------------------------------------------------------------------------- -testing="get_toolname: compressed tarball" -in="http://abe.validation.linaro.org/snapshots/gcc-linaro-4.8-2013.06-1.tar.xz" -out="`get_toolname ${in}`" -if test ${out} = "gcc"; then - pass "${testing}" -else - fail "${testing}" - fixme "${in} returned ${out}" -fi - -# ---------------------------------------------------------------------------------- -testing="get_toolname: git://<repo>[no .git suffix]" -in="git://git.linaro.org/toolchain/binutils" -out="`get_toolname ${in}`" -if test ${out} = "binutils"; then - pass "${testing}" -else - fail "${testing}" - fixme "${in} returned ${out}" -fi - -testing="get_toolname: git://<repo>[no .git suffix]/<branch> isn't supported." -in="git://git.linaro.org/toolchain/binutils/branch" -out="`get_toolname ${in}`" -if test ${out} != "binutils"; then - pass "${testing}" -else - fail "${testing}" - fixme "${in} returned ${out}" -fi - -testing="get_toolname: git://<repo>[no .git suffix]/<branch>@<revision> isn't supported." -in="git://git.linaro.org/toolchain/binutils/branch@12345" -out="`get_toolname ${in}`" -if test ${out} != "binutils"; then - pass "${testing}" -else - fail "${testing}" - fixme "${in} returned ${out}" -fi - -testing="get_toolname: git://<repo>[no .git suffix]@<revision>." -# This works, but please don't do this. -in="git://git.linaro.org/toolchain/binutils@12345" -out="`get_toolname ${in}`" -match="binutils" -if test x"${out}" = x"${match}"; then - pass "${testing}" -else - fail "${testing}" - fixme "${in} returned ${out} but expected ${match}" -fi - -# ---------------------------------------------------------------------------------- -# Test git:// git combinations -testing="get_toolname: git://<repo>.git" -in="git://git.linaro.org/toolchain/binutils.git" -out="`get_toolname ${in}`" -if test x"${out}" = x"binutils"; then - pass "${testing}" -else - fail "${testing}" - fixme "${in} returned ${out}" -fi - -testing="get_toolname: git://<repo>.git/<branch>" -in="git://git.linaro.org/toolchain/binutils.git/2.4-branch" -out="`get_toolname ${in}`" -if test x"${out}" = x"binutils"; then - pass "${testing}" -else - fail "${testing}" - fixme "${in} returned ${out}" -fi - -testing="get_toolname: git://<repo>.git/<branch>@<revision>" -in="git://git.linaro.org/toolchain/binutils.git/2.4-branch@12345" -out="`get_toolname ${in}`" -if test x"${out}" = x"binutils"; then - pass "${testing}" -else - fail "${testing}" - fixme "${in} returned ${out}" -fi - -testing="get_toolname: git://<repo>.git@<revision>" -in="git://git.linaro.org/toolchain/binutils.git@12345" -out="`get_toolname ${in}`" -if test x"${out}" = x"binutils"; then - pass "${testing}" -else - fail "${testing}" - fixme "${in} returned ${out}" -fi -# ---------------------------------------------------------------------------------- -# Test http:// git combinations -testing="get_toolname: http://<repo>.git" -in="http://git.linaro.org/git/toolchain/binutils.git" -out="`get_toolname ${in}`" -if test x"${out}" = x"binutils"; then - pass "${testing}" -else - fail "${testing}" - fixme "${in} returned ${out}" -fi - -testing="get_toolname: http://<repo>.git/<branch>" -in="http://git.linaro.org/git/toolchain/binutils.git/2.4-branch" -out="`get_toolname ${in}`" -if test x"${out}" = x"binutils"; then - pass "${testing}" -else - fail "${testing}" - fixme "${in} returned ${out}" -fi - -testing="get_toolname: http://<repo>.git/<branch>@<revision>" -in="http://git.linaro.org/git/toolchain/binutils.git/2.4-branch@12345" -out="`get_toolname ${in}`" -if test x"${out}" = x"binutils"; then - pass "${testing}" -else - fail "${testing}" - fixme "${in} returned ${out}" -fi - -testing="get_toolname: http://<repo>.git@<revision>" -in="http://git.linaro.org/git/toolchain/binutils.git@12345" -out="`get_toolname ${in}`" -if test x"${out}" = x"binutils"; then - pass "${testing}" -else - fail "${testing}" - fixme "${in} returned ${out}" -fi - -# ---------------------------------------------------------------------------------- -# Test http://<user>@ git combinations -testing="get_toolname: http://<user>@<repo>.git" -in="http://git@git.linaro.org/git/toolchain/binutils.git" -out="`get_toolname ${in}`" -if test x"${out}" = x"binutils"; then - pass "${testing}" -else - fail "${testing}" - fixme "${in} returned ${out}" -fi - -testing="get_toolname: http://<user>@<repo>.git/<branch>" -in="http://git@git.linaro.org/git/toolchain/binutils.git/2.4-branch" -out="`get_toolname ${in}`" -if test x"${out}" = x"binutils"; then - pass "${testing}" -else - fail "${testing}" - fixme "${in} returned ${out}" -fi - -testing="get_toolname: http://<user>@<repo>.git/<branch>@<revision>" -in="http://git@git.linaro.org/git/toolchain/binutils.git/2.4-branch@12345" -out="`get_toolname ${in}`" -if test x"${out}" = x"binutils"; then - pass "${testing}" -else - fail "${testing}" - fixme "${in} returned ${out}" -fi - -testing="get_toolname: http://<user>@<repo>.git@<revision>" -in="http://git@git.linaro.org/git/toolchain/binutils.git@12345" -out="`get_toolname ${in}`" -if test x"${out}" = x"binutils"; then - pass "${testing}" -else - fail "${testing}" - fixme "${in} returned ${out}" -fi - -# ---------------------------------------------------------------------------------- -testing="get_toolname: sources.conf identifier <repo>.git" -in="eglibc.git" -out="`get_toolname ${in}`" -if test x"${out}" = x"eglibc"; then - pass "${testing}" -else - fail "${testing}" - fixme "${in} returned ${out}" -fi - -testing="get_toolname: sources.conf identifier <repo>.git/<branch>" -in="eglibc.git/linaro_eglibc-2_18" -out="`get_toolname ${in}`" -if test x"${out}" = x"eglibc"; then - pass "${testing}" -else - fail "${testing}" - fixme "${in} returned ${out}" -fi - -testing="get_toolname: sources.conf identifier <repo>.git/<branch>@<revision>" -in="eglibc.git/linaro_eglibc-2_18@12345" -out="`get_toolname ${in}`" -if test x"${out}" = x"eglibc"; then - pass "${testing}" -else - fail "${testing}" - fixme "${in} returned ${out}" -fi - -testing="get_toolname: sources.conf identifier <repo>.git@<revision>" -in="eglibc.git@12345" -out="`get_toolname ${in}`" -if test x"${out}" = x"eglibc"; then - pass "${testing}" -else - fail "${testing}" - fixme "${in} returned ${out}" -fi - -testing="get_toolname: combined binutils-gdb repository with gdb branch" -in="binutils-gdb.git/gdb_7_6-branch" -out="`get_toolname ${in}`" -match="gdb" -if test x"${out}" = x"${match}"; then - pass "${testing}" -else - fail "${testing}" - fixme "${in} returned ${out} expected ${match}" -fi - -testing="get_toolname: combined binutils-gdb repository with binutils branch" -in="binutils-gdb.git/binutils-2_24" -out="`get_toolname ${in}`" -match="binutils" -if test x"${out}" = x"${match}"; then - pass "${testing}" -else - fail "${testing}" - fixme "${in} returned ${out} but expected ${match}" -fi - -# The special casing for binutils-gdb.git was failing in this one. -testing="get_toolname: combined binutils-gdb repository with linaro binutils branch" -in="binutils-gdb.git/linaro_binutils-2_24_branch" -out="`get_toolname ${in}`" -match="binutils" -if test x"${out}" = x"${match}"; then - pass "${testing}" -else - fail "${testing}" - fixme "${in} returned ${out} but expected ${match}" -fi - # ---------------------------------------------------------------------------------- echo "============= fetch_http() tests ================" # Download the first time without force. -out="`fetch_http infrastructure/gmp-5.1.3.tar.xz 2>/dev/null`" -if test $? -eq 0 -a -e ${local_snapshots}/infrastructure/gmp-5.1.3.tar.xz; then - pass "fetch_http infrastructure/gmp-5.1.3.tar.xz" +out="`fetch_http infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null`" +if test $? -eq 0 -a -e ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz; then + pass "fetch_http infrastructure/gmp-6.0.0a.tar.xz" else - fail "fetch_http infrastructure/gmp-5.1.3.tar.xz" + fail "fetch_http infrastructure/gmp-6.0.0a.tar.xz" fi # Get the timestamp of the file. -gmp_stamp1=`stat -c %X ${local_snapshots}/infrastructure/gmp-5.1.3.tar.xz` +gmp_stamp1=`stat -c %X ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz` # Download it again -out="`fetch_http infrastructure/gmp-5.1.3.tar.xz 2>/dev/null`" +out="`fetch_http infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null`" ret=$? # Get the timestamp of the file after another fetch. -gmp_stamp2=`stat -c %X ${local_snapshots}/infrastructure/gmp-5.1.3.tar.xz` +gmp_stamp2=`stat -c %X ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz` # They should be the same timestamp. if test $ret -eq 0 -a ${gmp_stamp1} -eq ${gmp_stamp2}; then - pass "fetch_http infrastructure/gmp-5.1.3.tar.xz didn't update as expected (force=no)" + pass "fetch_http infrastructure/gmp-6.0.0a.tar.xz didn't update as expected (force=no)" else - fail "fetch_http infrastructure/gmp-5.1.3.tar.xz updated unexpectedly (force=no)" + fail "fetch_http infrastructure/gmp-6.0.0a.tar.xz updated unexpectedly (force=no)" fi # If the two operations happen within the same second then their timestamps will @@ -522,48 +253,41 @@ fi sleep 2s # Now try it with force on -out="`force=yes fetch_http infrastructure/gmp-5.1.3.tar.xz 2>/dev/null`" +out="`force=yes fetch_http infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null`" if test $? -gt 0; then - fail "fetch_http infrastructure/gmp-5.1.3.tar.xz with \${force}=yes when source exists" + fail "fetch_http infrastructure/gmp-6.0.0a.tar.xz with \${force}=yes when source exists" else - pass "fetch_http infrastructure/gmp-5.1.3.tar.xz with \${force}=yes when source exists" + pass "fetch_http infrastructure/gmp-6.0.0a.tar.xz with \${force}=yes when source exists" fi # Get the timestamp of the file after another fetch. -gmp_stamp3=`stat -c %X ${local_snapshots}/infrastructure/gmp-5.1.3.tar.xz` +gmp_stamp3=`stat -c %X ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz` if test ${gmp_stamp1} -eq ${gmp_stamp3}; then - fail "fetch_http infrastructure/gmp-5.1.3.tar.xz with \${force}=yes has unexpected matching timestamps" + fail "fetch_http infrastructure/gmp-6.0.0a.tar.xz with \${force}=yes has unexpected matching timestamps" else - pass "fetch_http infrastructure/gmp-5.1.3.tar.xz with \${force}=yes has unmatching timestamps as expected." + pass "fetch_http infrastructure/gmp-6.0.0a.tar.xz with \${force}=yes has unmatching timestamps as expected." fi # Make sure force doesn't get in the way of a clean download. -rm ${local_snapshots}/infrastructure/gmp-5.1.3.tar.xz +rm ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz # force should override supdate and this should download for the first time. -out="`force=yes fetch_http infrastructure/gmp-5.1.3.tar.xz 2>/dev/null`" +out="`force=yes fetch_http infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null`" if test $? -gt 0; then - fail "fetch_http infrastructure/gmp-5.1.3.tar.xz with \${force}=yes and sources don't exist" -else - pass "fetch_http infrastructure/gmp-5.1.3.tar.xz with \${force}=yes and sources don't exist" -fi - -out="`fetch_http md5sums 2>/dev/null`" -if test $? -eq 0; then - pass "fetch_http md5sums" + fail "fetch_http infrastructure/gmp-6.0.0a.tar.xz with \${force}=yes and sources don't exist" else - fail "fetch_http md5sums" + pass "fetch_http infrastructure/gmp-6.0.0a.tar.xz with \${force}=yes and sources don't exist" fi # Test the case where wget_bin isn't set. -rm ${local_snapshots}/infrastructure/gmp-5.1.3.tar.xz +rm ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz -out="`unset wget_bin; fetch_http infrastructure/gmp-5.1.3.tar.xz 2>/dev/null`" +out="`unset wget_bin; fetch_http infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null`" if test $? -gt 0; then - pass "unset wget_bin; fetch_http infrastructure/gmp-5.1.3.tar.xz should fail." + pass "unset wget_bin; fetch_http infrastructure/gmp-6.0.0a.tar.xz should fail." else - fail "unset wget_bin; fetch_http infrastructure/gmp-5.1.3.tar.xz should fail." + fail "unset wget_bin; fetch_http infrastructure/gmp-6.0.0a.tar.xz should fail." fi # Verify that '1' is returned when a non-existent file is requested. @@ -576,27 +300,6 @@ fi echo "============= fetch() tests ================" -# remove md5sums so we can test that fetch() fails. -if test -e "${local_snapshots}/md5sums"; then - rm ${local_snapshots}/md5sums -fi - -fetch_http md5sums 2>/dev/null -if test ! -e "${local_snapshots}/md5sums"; then - fail "Did not find ${local_snapshots}/md5sums" - echo "md5sums needed for snapshots, get_URL, and get_sources tests. Check your network connectivity." 1>&2 - exit 1; -else - pass "Found ${local_snapshots}/md5sums" -fi - -out="`fetch md5sums 2>/dev/null`" -if test $? -gt 0; then - pass "fetch md5sums should fail because md5sums isn't in ${snapshots}/md5sums." -else - fail "fetch md5sums should fail because md5sums isn't in ${snapshots}/md5sums." -fi - # Fetch with no file name should error. out="`fetch 2>/dev/null`" if test $? -gt 0; then @@ -608,7 +311,7 @@ fi # Test fetch from server with a partial name. rm ${local_snapshots}/infrastructure/gmp-5.1* &>/dev/null out="`fetch "infrastructure/gmp-5.1" 2>/dev/null`" -if test $? -gt 0 -o ! -e "${local_snapshots}/infrastructure/gmp-5.1.3.tar.xz"; then +if test $? -gt 0 -o ! -e "${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz"; then fail "fetch infrastructure/gmp-5.1 (with partial name) from server failed unexpectedly." else pass "fetch infrastructure/gmp-5.1 (with partial name) from server passed as expected." @@ -618,12 +321,12 @@ fi local_refdir="${local_snapshots}/../refdir" mkdir -p ${local_refdir}/infrastructure # We need a way to differentiate the refdir version. -cp ${local_snapshots}/infrastructure/gmp-5.1* ${local_refdir}/infrastructure/gmp-5.1.3.tar.xz +cp ${local_snapshots}/infrastructure/gmp-5.1* ${local_refdir}/infrastructure/gmp-6.0.0a.tar.xz rm ${local_snapshots}/infrastructure/gmp-5.1* &>/dev/null # Use fetch that goes to a reference dir using a shortname out="`git_reference_dir=${local_refdir} fetch infrastructure/gmp-5.1 2>/dev/null`" -if test $? -gt 0 -o ! -e "${local_snapshots}/infrastructure/gmp-5.1.3.tar.xz"; then +if test $? -gt 0 -o ! -e "${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz"; then fail "fetch infrastructure/gmp-5.1 (with partial name) from reference dir failed unexpectedly." else pass "fetch infrastructure/gmp-5.1 (with partial name) from reference dir passed as expected." @@ -631,8 +334,8 @@ fi rm ${local_snapshots}/infrastructure/gmp-5.1* &>/dev/null # Use fetch that goes to a reference dir using a longname -out="`git_reference_dir=${local_refdir} fetch infrastructure/gmp-5.1.3.tar.xz 2>/dev/null`" -if test $? -gt 0 -o ! -e "${local_snapshots}/infrastructure/gmp-5.1.3.tar.xz"; then +out="`git_reference_dir=${local_refdir} fetch infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null`" +if test $? -gt 0 -o ! -e "${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz"; then fail "fetch infrastructure/gmp-5.1 (with full name) from reference dir failed unexpectedly." else pass "fetch infrastructure/gmp-5.1 (with full name) from reference dir passed as expected." @@ -642,87 +345,87 @@ rm ${local_snapshots}/infrastructure/gmp-5.1* # Replace with a marked version so we can tell if it's copied the reference # versions erroneously. -rm ${local_refdir}/infrastructure/gmp-5.1.3.tar.xz -echo "DEADBEEF" > ${local_refdir}/infrastructure/gmp-5.1.3.tar.xz +rm ${local_refdir}/infrastructure/gmp-6.0.0a.tar.xz +echo "DEADBEEF" > ${local_refdir}/infrastructure/gmp-6.0.0a.tar.xz # Use fetch that finds a git reference dir but is forced to use the server. -out="`force=yes git_reference_dir=${local_refdir} fetch infrastructure/gmp-5.1.3.tar.xz 2>/dev/null`" +out="`force=yes git_reference_dir=${local_refdir} fetch infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null`" if test $? -gt 0; then fail "fetch infrastructure/gmp-5.1 (with full name) from reference dir failed unexpectedly." -elif test x"$(grep DEADBEEF ${local_snapshots}/infrastructure/gmp-5.1.3.tar.xz)" != x""; then +elif test x"$(grep DEADBEEF ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz)" != x""; then fail "fetch infrastructure/gmp-5.1 pulled from reference dir instead of server." else pass "fetch infrastructure/gmp-5.1 (with full name) from reference dir passed as expected." fi # The next test makes sure that the failure is due to a file md5sum mismatch. -rm ${local_refdir}/infrastructure/gmp-5.1.3.tar.xz -echo "DEADBEEF" > ${local_refdir}/infrastructure/gmp-5.1.3.tar.xz -out="`git_reference_dir=${local_refdir} fetch infrastructure/gmp-5.1.3.tar.xz 2>/dev/null`" -if test $? -gt 0 -a x"$(grep DEADBEEF ${local_snapshots}/infrastructure/gmp-5.1.3.tar.xz)" != x""; then +rm ${local_refdir}/infrastructure/gmp-6.0.0a.tar.xz +echo "DEADBEEF" > ${local_refdir}/infrastructure/gmp-6.0.0a.tar.xz +out="`git_reference_dir=${local_refdir} fetch infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null`" +if test $? -gt 0 -a x"$(grep DEADBEEF ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz)" != x""; then pass "fetch infrastructure/gmp-5.1 --force=yes git_reference_dir=foo failed because md5sum doesn't match." else fail "fetch infrastructure/gmp-5.1 --force=yes git_reference_dir=foo unexpectedly passed." fi # Make sure supdate=no where source doesn't exist fails -rm ${local_snapshots}/infrastructure/gmp-5.1.3.tar.xz -rm ${local_refdir}/infrastructure/gmp-5.1.3.tar.xz -out="`supdate=no fetch infrastructure/gmp-5.1.3.tar.xz 2>/dev/null`" +rm ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz +rm ${local_refdir}/infrastructure/gmp-6.0.0a.tar.xz +out="`supdate=no fetch infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null`" if test $? -gt 0; then - pass "fetch infrastructure/gmp-5.1.3.tar.xz --supdate=no failed as expected when there's no source downloaded." + pass "fetch infrastructure/gmp-6.0.0a.tar.xz --supdate=no failed as expected when there's no source downloaded." else - fail "fetch infrastructure/gmp-5.1.3.tar.xz --supdate=no passed unexpectedly when there's no source downloaded." + fail "fetch infrastructure/gmp-6.0.0a.tar.xz --supdate=no passed unexpectedly when there's no source downloaded." fi # Make sure supdate=no --force=yes where source doesn't exist passes by forcing # a download -rm ${local_snapshots}/infrastructure/gmp-5.1.3.tar.xz &>/dev/null -rm ${local_refdir}/infrastructure/gmp-5.1.3.tar.xz &>/dev/null -out="`force=yes supdate=no fetch infrastructure/gmp-5.1.3.tar.xz 2>/dev/null`" -if test $? -eq 0 -a -e "${local_snapshots}/infrastructure/gmp-5.1.3.tar.xz"; then - pass "fetch infrastructure/gmp-5.1.3.tar.xz --supdate=no --force=yes passed as expected when there's no source downloaded." +rm ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz &>/dev/null +rm ${local_refdir}/infrastructure/gmp-6.0.0a.tar.xz &>/dev/null +out="`force=yes supdate=no fetch infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null`" +if test $? -eq 0 -a -e "${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz"; then + pass "fetch infrastructure/gmp-6.0.0a.tar.xz --supdate=no --force=yes passed as expected when there's no source downloaded." else - fail "fetch infrastructure/gmp-5.1.3.tar.xz --supdate=no --force=yes failed unexpectedly when there's no source downloaded." + fail "fetch infrastructure/gmp-6.0.0a.tar.xz --supdate=no --force=yes failed unexpectedly when there's no source downloaded." fi # Make sure supdate=no where source does exist passes -out="`supdate=no fetch infrastructure/gmp-5.1.3.tar.xz 2>/dev/null`" -if test $? -eq 0 -a -e "${local_snapshots}/infrastructure/gmp-5.1.3.tar.xz"; then - pass "fetch infrastructure/gmp-5.1.3.tar.xz --supdate=no --force=yes passed as expected because the source already exists." +out="`supdate=no fetch infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null`" +if test $? -eq 0 -a -e "${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz"; then + pass "fetch infrastructure/gmp-6.0.0a.tar.xz --supdate=no --force=yes passed as expected because the source already exists." else - fail "fetch infrastructure/gmp-5.1.3.tar.xz --supdate=no --force=yes failed unexpectedly when the source exists." + fail "fetch infrastructure/gmp-6.0.0a.tar.xz --supdate=no --force=yes failed unexpectedly when the source exists." fi -cp ${local_snapshots}/infrastructure/gmp-5.1.3.tar.xz ${local_refdir}/infrastructure/ &>/dev/null +cp ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz ${local_refdir}/infrastructure/ &>/dev/null # Test to make sure the fetch_reference creates the infrastructure directory. rm -rf ${local_snapshots}/infrastructure &>/dev/null -out="`git_reference_dir=${local_refdir} fetch_reference infrastructure/gmp-5.1.3.tar.xz 2>/dev/null`" -if test $? -eq 0 -a -e "${local_snapshots}/infrastructure/gmp-5.1.3.tar.xz"; then - pass "fetch_reference infrastructure/gmp-5.1.3.tar.xz passed as expected because the infrastructure/ directory was created." +out="`git_reference_dir=${local_refdir} fetch_reference infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null`" +if test $? -eq 0 -a -e "${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz"; then + pass "fetch_reference infrastructure/gmp-6.0.0a.tar.xz passed as expected because the infrastructure/ directory was created." else - fail "fetch_reference infrastructure/gmp-5.1.3.tar.xz fail unexpectedly because the infrastructure/ directory was not created." + fail "fetch_reference infrastructure/gmp-6.0.0a.tar.xz fail unexpectedly because the infrastructure/ directory was not created." fi # Test the same, but through the fetch() function. rm -rf ${local_snapshots}/infrastructure &>/dev/null -out="`git_reference_dir=${local_refdir} fetch infrastructure/gmp-5.1.3.tar.xz 2>/dev/null`" -if test $? -eq 0 -a -e "${local_snapshots}/infrastructure/gmp-5.1.3.tar.xz"; then - pass "git_reference_dir=${local_refdir} fetch infrastructure/gmp-5.1.3.tar.xz passed as expected because the infrastructure/ directory was created." +out="`git_reference_dir=${local_refdir} fetch infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null`" +if test $? -eq 0 -a -e "${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz"; then + pass "git_reference_dir=${local_refdir} fetch infrastructure/gmp-6.0.0a.tar.xz passed as expected because the infrastructure/ directory was created." else - fail "git_reference_dir=${local_refdir} fetch infrastructure/gmp-5.1.3.tar.xz fail unexpectedly because the infrastructure/ directory was not created." + fail "git_reference_dir=${local_refdir} fetch infrastructure/gmp-6.0.0a.tar.xz fail unexpectedly because the infrastructure/ directory was not created." fi # Download a clean/new copy for the check_md5sum tests -rm ${local_snapshots}/infrastructure/gmp-5.1.3.tar.xz* &>/dev/null -fetch_http infrastructure/gmp-5.1.3.tar.xz 2>/dev/null +rm ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz* &>/dev/null +fetch_http infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null -out="`check_md5sum 'infrastructure/gmp-5.1.3.tar.xz' 2>/dev/null`" +out="`check_md5sum 'infrastructure/gmp-6.0.0a.tar.xz' 2>/dev/null`" if test $? -gt 0; then - fail "check_md5sum failed for 'infrastructure/gmp-5.1.3.tar.xz" + fail "check_md5sum failed for 'infrastructure/gmp-6.0.0a.tar.xz" else - pass "check_md5sum passed for 'infrastructure/gmp-5.1.3.tar.xz" + pass "check_md5sum passed for 'infrastructure/gmp-6.0.0a.tar.xz" fi # Test with a non-infrastructure file @@ -733,335 +436,18 @@ else fail "check_md5sum passed as expected for 'infrastructure/foo.tar.xz" fi -mv ${local_snapshots}/infrastructure/gmp-5.1.3.tar.xz ${local_snapshots}/infrastructure/gmp-5.1.3.tar.xz.back -echo "empty file" > ${local_snapshots}/infrastructure/gmp-5.1.3.tar.xz +mv ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz.back +echo "empty file" > ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz # Test an expected failure case. -out="`check_md5sum 'infrastructure/gmp-5.1.3.tar.xz' 2>/dev/null`" +out="`check_md5sum 'infrastructure/gmp-6.0.0a.tar.xz' 2>/dev/null`" if test $? -gt 0; then - pass "check_md5sum failed as expected for nonmatching 'infrastructure/gmp-5.1.3.tar.xz file" -else - fail "check_md5sum passed unexpectedly for nonmatching 'infrastructure/gmp-5.1.3.tar.xz file" -fi - -mv ${local_snapshots}/infrastructure/gmp-5.1.3.tar.xz.back ${local_snapshots}/infrastructure/gmp-5.1.3.tar.xz - -cp ${local_snapshots}/md5sums ${local_refdir}/ -rm ${local_snapshots}/md5sums -out="`git_reference_dir=${local_refdir} fetch_md5sums 2>/dev/null`" -if test $? -gt 0 -o ! -e ${local_snapshots}/md5sums; then - fail "fetch_md5sum failed to copy file from git_reference_dir: ${local_refdir}" -else - pass "fetch_md5sum successfully copied file from git_reference_dir: ${local_refdir}" -fi - -# Empty refdir (no md5sums file) should pull a copy from the server. -rm ${local_snapshots}/md5sums -rm ${local_refdir}/md5sums -out="`git_reference_dir=${local_refdir} fetch_md5sums 2>/dev/null`" -if test $? -gt 0 -o ! -e ${local_snapshots}/md5sums; then - fail "fetch_md5sum failed to copy file from the server" -else - pass "fetch_md5sum successfully copied file from the server" -fi -# ---------------------------------------------------------------------------------- -echo "============= find_snapshot() tests ================" - -testing="find_snapshot: not unique tarball name" -out="`find_snapshot gcc 2>/dev/null`" -if test $? -eq 1; then - pass "${testing}" -else - fail "${testing}" - fixme "find_snapshot returned ${out}" -fi - -testing="find_snapshot: unknown tarball name" -out="`find_snapshot gcc-linaro-4.8-2013.06XXX 2>/dev/null`" -if test $? -eq 1; then - pass "${testing}" -else - fail "${testing}" - fixme "find_snapshot returned ${out}" -fi - -# ---------------------------------------------------------------------------------- -echo "============= get_URL() tests ================" - -# This will dump an error to stderr, so squelch it. -testing="get_URL: non unique identifier shouldn't match in sources.conf." -out="`get_URL gcc 2>/dev/null`" -if test $? -eq 1; then - pass "${testing}" -else - fail "${testing}" - fixme "get_URL returned ${out}" -fi - -testing="get_URL: unmatching snapshot not found in sources.conf file" -out="`get_URL gcc-linaro-4.8-2013.06-1 2>/dev/null`" -if test $? -eq 1; then - pass "${testing}" -else - fail "${testing}" - fixme "get_URL returned ${out}" -fi - -# The regular sources.conf won't have this entry. -testing="get_URL: git URL where sources.conf has a tab" -out="`sources_conf=${test_sources_conf} get_URL gcc_tab.git`" -if test x"`echo ${out}`" = x"http://git.linaro.org/git/toolchain/gcc.git"; then - pass "${testing}" -else - fail "${testing}" - fixme "get_URL returned ${out}" -fi - -# The regular sources.conf won't have this entry. -testing="get_URL: nomatch.git@<revision> shouldn't have a corresponding sources.conf url." -out="`sources_conf=${test_sources_conf} get_URL nomatch.git@12345 2>/dev/null`" -if test x"${out}" = x""; then - pass "${testing}" -else - fail "${testing}" - fixme "get_URL returned ${out}" -fi - -echo "============= get_URL() tests with erroneous service:// inputs ================" - -testing="get_URL: Input contains an lp: service." -out="`get_URL lp:cortex-strings 2>/dev/null`" -if test $? -eq 1; then - pass "${testing}" -else - fail "${testing}" - fixme "get_URL returned ${out}" -fi - -testing="get_URL: Input contains a git:// service." -out="`get_URL git://git.linaro.org/toolchain/eglibc.git 2>/dev/null`" -if test $? -eq 1; then - pass "${testing}" + pass "check_md5sum failed as expected for nonmatching 'infrastructure/gmp-6.0.0a.tar.xz file" else - fail "${testing}" - fixme "get_URL returned ${out}" + fail "check_md5sum passed unexpectedly for nonmatching 'infrastructure/gmp-6.0.0a.tar.xz file" fi -testing="get_URL: Input contains an http:// service." -out="`get_URL http://git.linaro.org/git/toolchain/eglibc.git 2>/dev/null`" -if test $? -eq 1; then - pass "${testing}" -else - fail "${testing}" - fixme "get_URL returned ${out}" -fi - -# ---------------------------------------------------------------------------------- -echo "============= get_URL() [git|http]:// tests ================" -testing="get_URL: sources.conf <repo>.git identifier should match git://<url>/<repo>.git" -out="`get_URL glibc.git`" -if test x"`echo ${out} | cut -d ' ' -f 1`" = x"http://git.linaro.org/git/toolchain/glibc.git"; then - pass "${testing}" -else - fail "${testing}" - fixme "get_URL returned ${out}" -fi - -testing="get_URL: sources.conf <repo>.git/<branch> identifier should match" -out="`get_URL glibc.git/branch`" -if test x"`echo ${out}`" = x"http://git.linaro.org/git/toolchain/glibc.git~branch"; then - pass "${testing} http://<url>/<repo>.git" -else - fail "${testing} http://<url>/<repo>.git" - fixme "get_URL returned ${out}" -fi - -testing="get_URL: sources.conf <repo>.git/<multi/part/branch> identifier should match" -out="`get_URL glibc.git/multi/part/branch`" -if test x"`echo ${out}`" = x"http://git.linaro.org/git/toolchain/glibc.git~multi/part/branch"; then - pass "${testing} http://<url>/<repo>.git/multi/part/branch" -else - fail "${testing} http://<url>/<repo>.git/multi/part/branch" - fixme "get_URL returned ${out}" -fi - -testing="get_URL: sources.conf <repo>.git~<branch> identifier should match" -out="`get_URL glibc.git~branch`" -if test x"`echo ${out}`" = x"http://git.linaro.org/git/toolchain/glibc.git~branch"; then - pass "${testing} http://<url>/<repo>.git~branch" -else - fail "${testing} http://<url>/<repo>.git~branch" - fixme "get_URL returned ${out}" -fi - -testing="get_URL: sources.conf <repo>.git~<multi/part/branch> identifier should match" -out="`get_URL glibc.git~multi/part/branch`" -if test x"`echo ${out}`" = x"http://git.linaro.org/git/toolchain/glibc.git~multi/part/branch"; then - pass "${testing} http://<url>/<repo>.git~multi/part/branch" -else - fail "${testing} http://<url>/<repo>.git~multi/part/branch" - fixme "get_URL returned ${out}" -fi - -testing="get_URL: sources.conf <repo>.git/<branch>@<revision> identifier should match" -out="`get_URL glibc.git/branch@12345`" -if test x"`echo ${out}`" = x"http://git.linaro.org/git/toolchain/glibc.git~branch@12345"; then - pass "${testing} http://<url>/<repo>.git/<branch>@<revision>" -else - fail "${testing} http://<url>/<repo>.git/<branch>@<revision>" - fixme "get_URL returned ${out}" -fi - -testing="get_URL: sources.conf <repo>.git/<mulit/part/branch>@<revision> identifier should match" -out="`get_URL glibc.git/multi/part/branch@12345`" -if test x"`echo ${out}`" = x"http://git.linaro.org/git/toolchain/glibc.git~multi/part/branch@12345"; then - pass "${testing} http://<url>/<repo>.git/<multi/part/branch>@<revision>" -else - fail "${testing} http://<url>/<repo>.git/<multi/part/branch>@<revision>" - fixme "get_URL returned ${out}" -fi - -testing="get_URL: sources.conf <repo>.git~<branch>@<revision> identifier should match" -out="`get_URL glibc.git~branch@12345`" -if test x"`echo ${out}`" = x"http://git.linaro.org/git/toolchain/glibc.git~branch@12345"; then - pass "${testing} http://<url>/<repo>.git~<branch>@<revision>" -else - fail "${testing} http://<url>/<repo>.git~<branch>@<revision>" - fixme "get_URL returned ${out}" -fi - -testing="get_URL: sources.conf <repo>.git~<mulit/part/branch>@<revision> identifier should match" -out="`get_URL glibc.git~multi/part/branch@12345`" -if test x"`echo ${out}`" = x"http://git.linaro.org/git/toolchain/glibc.git~multi/part/branch@12345"; then - pass "${testing} http://<url>/<repo>.git~<multi/part/branch>@<revision>" -else - fail "${testing} http://<url>/<repo>.git~<multi/part/branch>@<revision>" - fixme "get_URL returned ${out}" -fi - -testing="get_URL: sources.conf <repo>.git@<revision> identifier should match" -out="`get_URL glibc.git@12345`" -if test x"`echo ${out}`" = x"http://git.linaro.org/git/toolchain/glibc.git@12345"; then - pass "${testing} http://<url>/<repo>.git@<revision>" -else - fail "${testing} http://<url>/<repo>.git@<revision>" - fixme "get_URL returned ${out}" -fi - -testing="get_URL: sources.conf <repo>.git identifier should match http://<url>/<repo>.git" -out="`get_URL gcc.git`" -if test x"`echo ${out}`" = x"http://git.linaro.org/git/toolchain/gcc.git"; then - pass "${testing}" -else - fail "${testing}" - fixme "get_URL returned ${out}" -fi - -testing="get_URL: Don't match partial match of <repo>[spaces] to sources.conf identifier." -out="`get_URL "eglibc" 2>/dev/null`" -if test x"`echo ${out}`" = x; then - pass "${testing}" -else - fail "${testing}" - fixme "get_URL returned ${out}" -fi - -testing="get_URL: Don't match partial match of <repo>[\t] to sources.conf identifier." -out="`get_URL "gcc_tab" 2>/dev/null`" -if test x"`echo ${out}`" = x; then - pass "${testing}" -else - fail "${testing}" - fixme "get_URL returned ${out}" -fi - -# ---------------------------------------------------------------------------------- -echo "============= get_URL() http://git@ tests ================" - -# The regular sources.conf won't have this entry. -testing="get_URL: sources.conf <repo>.git identifier should match http://git@<url>/<repo>.git" -out="`sources_conf=${test_sources_conf} get_URL git_gcc.git`" -if test x"`echo ${out}`" = x"http://git@git.linaro.org/git/toolchain/gcc.git"; then - pass "${testing}" -else - fail "${testing}" - fixme "get_URL returned ${out}" -fi - -# The regular sources.conf won't have this entry. -testing="get_URL: sources.conf <repo>.git/<branch> identifier should match" -out="`sources_conf=${test_sources_conf} get_URL git_gcc.git/branch`" -if test x"`echo ${out}`" = x"http://git@git.linaro.org/git/toolchain/gcc.git~branch"; then - pass "${testing} http://git@<url>/<repo>.git~<branch>" -else - fail "${testing} http://git@<url>/<repo>.git~<branch>" - fixme "get_URL returned ${out}" -fi - -# The regular sources.conf won't have this entry. -testing="get_URL: sources.conf <repo>.git/<branch>@<revision> identifier should match" -out="`sources_conf=${test_sources_conf} get_URL git_gcc.git/branch@12345`" -if test x"`echo ${out} | cut -d ' ' -f 1`" = x"http://git@git.linaro.org/git/toolchain/gcc.git~branch@12345"; then - pass "${testing} http://git@<url>/<repo>.git~<branch>@<revision>" -else - fail "${testing} http://git@<url>/<repo>.git~<branch>@<revision>" - fixme "get_URL returned ${out}" -fi - -# The regular sources.conf won't have this entry. -testing="get_URL: sources.conf <repo>.git@<revision> identifier should match" -out="`sources_conf=${test_sources_conf} get_URL git_gcc.git@12345`" -if test x"`echo ${out}`" = x"http://git@git.linaro.org/git/toolchain/gcc.git@12345"; then - pass "${testing} http://git@<url>/<repo>.git@<revision>" -else - fail "${testing} http://git@<url>/<repo>.git@<revision>" - fixme "get_URL returned ${out}" -fi - -# ---------------------------------------------------------------------------------- -echo "============= get_URL() http://user.name@ tests ================" -# We do these these tests to make sure that 'http://git@' -# isn't hardcoded in the scripts. - -# The regular sources.conf won't have this entry. -testing="get_URL: sources.conf <repo>.git identifier should match http://user.name@<url>/<repo>.git" -out="`sources_conf=${test_sources_conf} get_URL user_gcc.git`" -if test x"`echo ${out}`" = x"http://user.name@git.linaro.org/git/toolchain/gcc.git"; then - pass "${testing} http://<user.name>@<url>/<repo>.git" -else - fail "${testing} http://<user.name>@<url>/<repo>.git" - fixme "get_URL returned ${out}" -fi - -# The regular sources.conf won't have this entry. -testing="get_URL: sources.conf <repo>.git/<branch> identifier should match" -out="`sources_conf=${test_sources_conf} get_URL user_gcc.git/branch`" -if test x"`echo ${out}`" = x"http://user.name@git.linaro.org/git/toolchain/gcc.git~branch"; then - pass "${testing} http://user.name@<url>/<repo>.git~<branch>" -else - fail "${testing} http://user.name@<url>/<repo>.git~<branch>" - fixme "get_URL returned ${out}" -fi - -# The regular sources.conf won't have this entry. -testing="get_URL: sources.conf <repo>.git/<branch>@<revision> identifier should match" -out="`sources_conf=${test_sources_conf} get_URL user_gcc.git/branch@12345`" -if test x"`echo ${out} | cut -d ' ' -f 1`" = x"http://user.name@git.linaro.org/git/toolchain/gcc.git~branch@12345"; then - pass "${testing} http://user.name@<url>/<repo>.git~<branch>@<revision>" -else - fail "${testing} http://user.name@<url>/<repo>.git~<branch>@<revision>" - fixme "get_URL returned ${out}" -fi - -# The regular sources.conf won't have this entry. -testing="get_URL: sources.conf <repo>.git@<revision> identifier should match" -out="`sources_conf=${test_sources_conf} get_URL user_gcc.git@12345`" -if test x"`echo ${out}`" = x"http://user.name@git.linaro.org/git/toolchain/gcc.git@12345"; then - pass "${testing} http://user.name@<url>/<repo>.git@<revision>" -else - fail "${testing} http://user.name@<url>/<repo>.git@<revision>" - fixme "get_URL returned ${out}" -fi +mv ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz.back ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz # ---------------------------------------------------------------------------------- # @@ -1073,378 +459,56 @@ fi # out="`binary_toolchain 2>&1 | tee xx |grep "DRYRUN:.*Jcvf"`" -# date="`date +%Y%m%d`" -# tarname="`echo $out | cut -d ' ' -f 9`" -# destdir="`echo $out | cut -d ' ' -f 10`" -# match="${local_snapshots}/gcc.git-${target}-${host}-${date}" - -# if test "`echo ${tarname} | grep -c ${match}`" -eq 1; then -# pass "binary_toolchain: git repository" -# else -# fail "binary_toolchain: git repository" -# fixme "get_URL returned ${out}" -# fi - -# #binutils_version=linaro-4.8-2013.09 -# binutils_version=git://git.linaro.org/toolchain/binutils.git -# out="`binary_sysroot 2>&1 | tee xx |grep "DRYRUN:.*Jcvf"`" -# tarname="`echo $out | cut -d ' ' -f 9`" -# destdir="`echo $out | cut -d ' ' -f 10`" -# match="${local_snapshots}/sysroot-eglibc-linaro-2.18-2013.09-${target}-${date}" -# echo "${tarname}" -# echo "${match}" -# if test "`echo ${tarname} | grep -c ${match}`" -eq 1; then -# pass "binary_toolchain: git repository" -# else -# fail "binary_toolchain: git repository" -# fixme "get_URL returned ${out}" -# fi -# dryrun=no - -echo "============= get_source() tests ================" -# TODO Test ${sources_conf} for ${in} for relevant tests. - -# get_sources might, at times peak at latest for a hint if it can't find -# things. Keep it unset unless you want to test a specific code leg. -saved_latest=${latest} -latest='' - -# Test get_source with a variety of inputs -testing="get_source: unknown repository" -in="somethingbogus" -out="`get_source ${in} 2>&1`" -if test $? -eq 1; then - pass "${testing}" -else - fail "${testing}" - fixme "get_source returned \"${out}\"" -fi - -testing="get_source: empty url" -in='' -out="`get_source ${in} 2>/dev/null`" -if test $? -eq 1; then - pass "${testing}" -else - fail "${testing}" - fixme "get_source returned \"${out}\"" -fi - -testing="get_source: git repository" -in="eglibc.git" -out="`get_source ${in}`" -if test x"${out}" = x"http://git.linaro.org/git/toolchain/eglibc.git"; then - pass "${testing}" -else - fail "${testing}" - fixme "get_source returned ${out}" -fi - -testing="get_source: git repository with / branch" -in="eglibc.git/linaro_eglibc-2_17" -out="`get_source ${in}`" -if test x"${out}" = x"http://git.linaro.org/git/toolchain/eglibc.git~linaro_eglibc-2_17"; then - pass "${testing}" -else - fail "${testing}" - fixme "get_source returned ${out}" -fi - -testing="get_source: git repository with / branch and commit" -in="newlib.git/binutils-2_23-branch@e9a210b" -out="`get_source ${in}`" -if test x"${out}" = x"http://git.linaro.org/git/toolchain/newlib.git~binutils-2_23-branch@e9a210b"; then - pass "${testing}" -else - fail "${testing}" - fixme "get_source returned ${out}" -fi - -testing="get_source: git repository with ~ branch and commit" -in="newlib.git~binutils-2_23-branch@e9a210b" -out="`get_source ${in}`" -if test x"${out}" = x"http://git.linaro.org/git/toolchain/newlib.git~binutils-2_23-branch@e9a210b"; then - pass "${testing}" -else - fail "${testing}" - fixme "get_source returned ${out}" -fi - -testing="get_source: <repo>.git@commit" -in="newlib.git@e9a210b" -out="`get_source ${in}`" -if test x"${out}" = x"http://git.linaro.org/git/toolchain/newlib.git@e9a210b"; then - pass "${testing}" -else - fail "${testing}" - fixme "get_source returned ${out}" -fi - -testing="get_source: Too many snapshot matches." -in="gcc-linaro" -out="`get_source ${in} 2>/dev/null`" -if test $? -eq 1; then - pass "${testing}" -else - fail "${testing}" - fixme "get_source returned ${out}" -fi - -for transport in ssh git http; do - testing="get_source: git direct url not ending in .git (${transport})" - in="${transport}://git.linar9o.org/toolchain/eglibc" - out="`get_source ${in}`" - if test x"${out}" = x"${transport}://git.linaro.org/toolchain/eglibc"; then - xpass "${testing}" - else - xfail "${testing}" - fixme "get_source returned ${out}" - fi - - testing="get_source: git direct url not ending in .git with revision returns bogus url. (${transport})" - in="${transport}://git.linaro.org/git/toolchain/eglibc/branch@1234567" - if test x"${debug}" = x"yes"; then - out="`get_source ${in}`" - else - out="`get_source ${in} 2>/dev/null`" - fi - if test x"${out}" = x"${transport}://git.linaro.org/git/toolchain/eglibc/branch@1234567"; then - xpass "${testing}" - else - xfail "${testing}" - fixme "get_source returned ${out}" - fi -done - -# The regular sources.conf won't have this entry -testing="get_source: full url with <repo>.git with matching source.conf entry should succeed." -in="http://git.linaro.org/git/toolchain/foo.git" -if test x"${debug}" = x"yes"; then - out="`sources_conf=${test_sources_conf} get_source ${in}`" -else - out="`sources_conf=${test_sources_conf} get_source ${in} 2>/dev/null`" -fi -if test x"${out}" = x"http://git.linaro.org/git/toolchain/foo.git"; then - pass "${testing}" -else - fail "${testing}" - fixme "get_source returned ${out}" -fi - -# No sources.conf should have this entry, but use the one under test control -testing="get_source: <repo>.git identifier with no matching source.conf entry should fail." -in="nomatch.git" -if test x"${debug}" = x"yes"; then - out="`sources_conf=${test_sources_conf} get_source ${in}`" -else - out="`sources_conf=${test_sources_conf} get_source ${in} 2>/dev/null`" -fi -if test x"${out}" = x""; then - pass "${testing}" -else - fail "${testing}" - fixme "get_source returned ${out}" -fi - -# No sources.conf should have this entry, but use the one under test control -testing="get_source: <repo>.git@<revision> identifier with no matching source.conf entry should fail." -in="nomatch.git@12345" -if test x"${debug}" = x"yes"; then - out="`sources_conf=${test_sources_conf} get_source ${in}`" -else - out="`sources_conf=${test_sources_conf} get_source ${in} 2>/dev/null`" -fi -if test x"${out}" = x""; then - pass "${testing}" -else - fail "${testing}" - fixme "get_source returned ${out}" -fi - -# The regular sources.conf won't have this entry. -testing="get_source: <repo>.git matches non .git suffixed url." -in="foo.git" -out="`sources_conf=${test_sources_conf} get_source ${in} 2>/dev/null`" -if test x"${out}" = x"git://testingrepository/foo"; then - pass "${testing}" -else - fail "${testing}" - fixme "get_source returned ${out}" -fi - -# The regular sources.conf won't have this entry. -testing="get_source: <repo>.git/<branch> matches non .git suffixed url." -in="foo.git/bar" -out="`sources_conf=${test_sources_conf} get_source ${in} 2>/dev/null`" -if test x"${out}" = x"git://testingrepository/foo~bar"; then - pass "${testing}" -else - fail "${testing}" - fixme "get_source returned ${out}" -fi - -# The regular sources.conf won't have this entry. -testing="get_source: <repo>.git/<branch>@<revision> matches non .git suffixed url." -in="foo.git/bar@12345" -out="`sources_conf=${test_sources_conf} get_source ${in} 2>/dev/null`" -if test x"${out}" = x"git://testingrepository/foo~bar@12345"; then - pass "${testing}" -else - fail "${testing}" - fixme "get_source returned ${out}" -fi - -in="foo.git@12345" -testing="get_source: ${sources_conf}:${in} matching no .git in <repo>@<revision>." -out="`sources_conf=${test_sources_conf} get_source ${in} 2>/dev/null`" -if test x"${out}" = x"git://testingrepository/foo@12345"; then - pass "${testing}" -else - fail "${testing}" - fixme "get_source returned ${out}" -fi - -testing="get_source: partial match in snapshots, latest not set." -latest='' -in="gcc-linaro-4.8" -out="`get_source ${in} 2>/dev/null`" -if test x"${out}" = x""; then - pass "${testing}" -else - fail "${testing}" - fixme "get_source returned ${out}" -fi - -testing="get_source: too many matches in snapshots, latest set." -latest="gcc-linaro-4.8-2013.09.tar.xz" -in="gcc-linaro-4.8" -out="`get_source ${in} 2>/dev/null`" -if test x"${out}" = x"gcc-linaro-4.8-2013.09.tar.xz"; then - xpass "${testing}" -else - xfail "${testing}" - fixme "get_source returned ${out}" -fi - -latest=${saved_latest} - -for transport in ssh git http; do - testing="get_source: git direct url with a ~ branch designation. (${transport})" - in="${transport}://git.linaro.org/toolchain/eglibc.git~branch@1234567" - if test x"${debug}" = x"yes"; then - out="`get_source ${in}`" - else - out="`get_source ${in} 2>/dev/null`" - fi - if test x"${out}" = x"${transport}://git.linaro.org/toolchain/eglibc.git~branch@1234567"; then - pass "${testing}" - else - fail "${testing}" - fixme "get_source returned ${out}" - fi - - testing="get_source: git direct url with a ~ branch designation. (${transport})" - in="$transport://git.savannah.gnu.org/dejagnu.git~linaro" - if test x"${debug}" = x"yes"; then - out="`get_source ${in}`" - else - out="`get_source ${in} 2>/dev/null`" - fi - if test x"${out}" = x"${transport}://git.savannah.gnu.org/dejagnu.git~linaro"; then - pass "${testing}" - else - fail "${testing}" - fixme "get_source returned ${out}" - fi -done - - - - # ---------------------------------------------------------------------------------- echo "========= create_release_tag() tests ============" -testing="create_release_tag: repository with branch and revision" -date="`date +%Y%m%d`" -in="gcc.git/gcc-4.8-branch@12345abcde" -out="`create_release_tag ${in} | grep -v TRACE`" -toolname="`echo ${out} | cut -d ' ' -f 1`" -branch="`echo ${out} | cut -d ' ' -f 2`" -revision="`echo ${out} | cut -d ' ' -f 3`" -if test x"${out}" = x"gcc.git~gcc-4.8-branch@12345abcde-${date}"; then - pass "${testing}" -else - fail "${testing}" - fixme "create_release_tag returned ${out}" -fi +mkdir -p ${local_abe_tmp}/builds/gcc +echo "5.1.1" > ${local_abe_tmp}/builds/gcc/BASE-VER +component_init gcc BRANCH="aa" REVISION="a1b2c3d4e5f6" SRCDIR="${local_abe_tmp}/builds" -testing="create_release_tag: snapshot tarball" -in="gcc-linaro-snapshot-5.1-2015.06-1.tar.xz" -out="`create_release_tag ${in} | grep -v TRACE`" -toolname="`echo ${out} | cut -d ' ' -f 1`" -branch="`echo ${out} | cut -d ' ' -f 2`" -revision="`echo ${out} | cut -d ' ' -f 3`" -if test x"${out}" = x"gcc-linaro-snapshot-${date}"; then +testing="create_release_tag: GCC repository without release string set" +date="`date +%Y%m%d`" +out="`create_release_tag gcc | grep -v TRACE`" +toolname="`echo ${out} | cut -d '~' -f 1`" +branch="`echo ${out} | cut -d '~' -f 2 | cut -d '@' -f 1`" +revision="`echo ${out} | cut -d '@' -f 2`" +if test x"${out}" = x"gcc-linaro-5.1.1~aa@a1b2c3d4-${date}"; then pass "${testing}" else fail "${testing}" fixme "create_release_tag returned ${out}" fi -export release="2015.06-1" -testing="create_release_tag: snapshot tarball with release" -in="gcc-linaro-snapshot-5.1-2015.06-1.tar.xz" -out="`create_release_tag ${in} | grep -v TRACE`" -toolname="`echo ${out} | cut -d ' ' -f 1`" -branch="`echo ${out} | cut -d ' ' -f 2`" -revision="`echo ${out} | cut -d ' ' -f 3`" -if test x"${out}" = x"gcc-linaro-snapshot-5.1-2015.06-1"; then - pass "${testing}" -else - fail "${testing}" - fixme "create_release_tag returned ${out}" -fi +mkdir -p ${local_abe_tmp}/builds +echo "#define RELEASE \"development\"" > ${local_abe_tmp}/builds/version.h +echo "#define VERSION \"2.22.90\"" >> ${local_abe_tmp}/builds/version.h +component_init glibc BRANCH="aa/bb/cc" REVISION="1a2b3c4d5e6f" SRCDIR="${local_abe_tmp}/builds" -branch= -revision= -testing="create_release_tag: repository branch empty with release" -in="gcc.git" -out="`create_release_tag ${in} | grep -v TRACE`" -if test "`echo ${out} | grep -c "gcc-linaro-5-2015.06-1"`" -gt 0; then +testing="create_release_tag: GLIBC repository without release string set" +date="`date +%Y%m%d`" +out="`create_release_tag glibc | grep -v TRACE`" +toolname="`echo ${out} | cut -d '~' -f 1`" +branch="`echo ${out} | cut -d '~' -f 2 | cut -d '@' -f 1`" +revision="`echo ${out} | cut -d '@' -f 2`" +if test x"${out}" = x"glibc-linaro-2.22.90~aa-bb-cc@1a2b3c4d-${date}"; then pass "${testing}" else fail "${testing}" fixme "create_release_tag returned ${out}" fi -release= -branch= -revision= -testing="create_release_tag: repository branch empty" -in="gcc.git" -out="`create_release_tag ${in} | grep -v TRACE`" -if test "`echo ${out} | grep -c "gcc.git-${date}"`" -gt 0; then +release=foobar +testing="create_release_tag: GCC repository with release string set" +out="`create_release_tag gcc | grep -v TRACE`" +if test x"${out}" = x"gcc-linaro-5.1.1-${release}"; then pass "${testing}" else fail "${testing}" fixme "create_release_tag returned ${out}" fi -release= -testing="create_release_tag: tarball" -in="gcc-linaro-4.8-2013.09.tar.xz" -out="`create_release_tag ${in} | grep -v TRACE`" -if test x"${out}" = x"gcc-linaro-4.8-${date}"; then - xpass "${testing}" -else - # This fails because the tarball name fails to extract the version. This - # behavious isn't used by Abe, it was an early feature to have some - # compatability with abev1, which used tarballs. Abe produces the - # tarballs, it doesn't need to import them anymore. - xfail "${testing}" - fixme "create_release_tag returned ${out}" -fi +# rm ${local_abe_tmp}/builds/BASE-VER export release="2015.08-rc1" testing="create_release_tag: release candidate tarball with release" @@ -1512,7 +576,7 @@ for service in "foomatic://" "http:" "http:/fake.git" "http/" "http//" ""; do if test $? -eq 0; then fail "${testing}" else - if echo "${out}" | tail -n1 | grep -q "^ERROR.*: checkout (Unable to parse service from '${in}'\\. You have either a bad URL, or an identifier that should be passed to get_URL\\.)$"; then + if echo "${out}" | tail -n1 | grep -q "^ERROR.*: checkout (Unable to parse service from '${in}'\\. You have either a bad URL, or an identifier that should be passed to get_component_url\\.)$"; then pass "${testing}" else fail "${testing}" @@ -1539,33 +603,6 @@ else fi fi -rm -rf "${local_snapshots}"/* -in="`get_URL abe.git`" -testing="checkout: abe.git should produce ${local_snapshots}/abe.git" -if (cd "${local_snapshots}" && \ - if test x"${debug}" = xyes; then checkout "${in}" > /dev/null; else checkout "${in}" > /dev/null 2>&1; fi && \ - test `ls | wc -l` -eq 1 && \ - ls abe.git > /dev/null); then - pass "${testing}" -else - fail "${testing}" -fi - -rm -rf "${local_snapshots}"/* -in="`get_URL abe.git`" -in="`get_git_url ${in}`" -testing="checkout: abe.git~staging should produce ${local_snapshots}/abe.git and ${local_snapshots}/abe.git~staging" -if (cd "${local_snapshots}" && \ - if test x"${debug}" = xyes; then checkout "${in}~staging" > /dev/null; else - checkout "${in}~staging" >/dev/null 2>&1; fi && \ - test `ls | wc -l` -eq 2 && \ - ls abe.git > /dev/null && \ - ls abe.git~staging > /dev/null); then - pass "${testing}" -else - fail "${testing}" -fi - test_checkout () { local should="$1" @@ -1579,7 +616,7 @@ test_checkout () in="${package}${branch:+~${branch}}${revision:+@${revision}}" local gitinfo= - gitinfo="`sources_conf=${test_sources_conf} get_URL ${in}`" + gitinfo="`sources_conf=${test_sources_conf} get_component_url ${in}`" local tag= tag="`sources_conf=${test_sources_conf} get_git_url ${gitinfo}`" @@ -1607,20 +644,6 @@ test_checkout () fi fi - local srcdir= - srcdir="`sources_conf=${test_sources_conf} get_srcdir "${tag}"`" - - local branch_test= - if test ! -d ${srcdir}; then - branch_test=0 - elif test x"${branch}" = x -a x"${revision}" = x; then - branch_test=`(cd ${srcdir} && git branch | egrep -c "^\* (local_HEAD|master)$")` - elif test x"${revision}" = x; then - branch_test=`(cd ${srcdir} && git branch | grep -c "^\* ${branch}$")` - else - branch_test=`(cd ${srcdir} && git branch | grep -c "^\* local_${revision}$")` - fi - #Make sure we leave no hanging state if ls "${local_snapshots}/${package}"* > /dev/null 2>&1; then rm -rf "${local_snapshots}/${package}"* @@ -1752,48 +775,6 @@ depends= default_configure_flags= static_link= -testing="read_config one arg" -if test x"`read_config isl static_link`" = xyes; then - pass "${testing}" -else - fail "${testing}" -fi - -testing="read_config multiarg" -if test x"`read_config glib default_configure_flags`" = x"--disable-modular-tests --disable-dependency-tracking --cache-file=/tmp/glib.cache"; then - pass "${testing}" -else - fail "${testing}" -fi - -testing="read_config set then unset" -out="`default_makeflags=\`read_config binutils default_makeflags\` && default_makeflags=\`read_config newlib default_makeflags\` && echo ${default_makeflags}`" -if test $? -gt 0; then - fail "${testing}" -elif test x"${out}" != x; then - fail "${testing}" -else - pass "${testing}" -fi - -dryrun="yes" -tool="binutils" #this is a nice tool to use as it checks the substitution in make install, too -cmp_makeflags="`read_config ${tool} default_makeflags`" -testing="postfix make args (make_all)" -if test x"${cmp_makeflags}" = x; then - untested "${testing}" #implies that the config for this tool no longer contains default_makeflags -else - out="`. ${topdir}/config/${tool}.conf && make_all ${tool}.git 2>&1`" - if test x"${debug}" = x"yes"; then - echo "${out}" - fi - echo "${out}" | grep -- "${cmp_makeflags}" > /dev/null 2>&1 - if test $? -eq 0; then - pass "${testing}" - else - fail "${testing}" - fi -fi testing="postfix make args (make_install)" cmp_makeflags="`echo ${cmp_makeflags} | sed -e 's:\ball-:install-:g'`" if test x"${cmp_makeflags}" = x; then @@ -1812,6 +793,8 @@ else fi cmp_makeflags= +set +x + testing="configure" tool="dejagnu" configure="`grep ^configure= ${topdir}/config/${tool}.conf | cut -d '\"' -f 2`" @@ -1856,8 +839,6 @@ fi #should="pass" #test_checkout "${should}" "${testing}" "${package}" "${branch}" "${revision}" -. "${topdir}/testsuite/srcdir-tests.sh" - # ---------------------------------------------------------------------------------- # print the total of test results totals diff --git a/testsuite/test_sources.conf b/testsuite/test_sources.conf index 0aec256f..35c3798e 100644 --- a/testsuite/test_sources.conf +++ b/testsuite/test_sources.conf @@ -5,14 +5,14 @@ # For Testing Only gcc.git http://git.linaro.org/git/toolchain/gcc.git -git_gcc.git http://git@git.linaro.org/git/toolchain/gcc.git -user_gcc.git http://user.name@git.linaro.org/git/toolchain/gcc.git +git_gcc.git http://git@.git.linaro.org/git/toolchain/gcc.git +user_gcc.git http://user.name@.git.linaro.org/git/toolchain/gcc.git # gcc_tab.git has a tab between .git and git:// for testing. -gcc_tab.git http://git.linaro.org/git/toolchain/gcc.git -binutils.git git://git.linaro.org/toolchain/binutils.git +gcc_tab.git http://.git.linaro.org/git/toolchain/gcc.git +binutils-gdb.git git://git.linaro.org/toolchain/binutils.git libgloss.git git://git.linaro.org/toolchain/newlib.git newlib.git http://git.linaro.org/git/toolchain/newlib.git -abe.git http://git@git.linaro.org/git/toolchain/abe.git +abe.git http://git@.git.linaro.org/git/toolchain/abe.git eglibc.git http://git.linaro.org/git/toolchain/eglibc.git glibc.git http://git.linaro.org/git/toolchain/glibc.git bitbake.git git://git.openembedded.org/bitbake |