From 7763d559e48e5f56f346885c73446440995e73ef Mon Sep 17 00:00:00 2001 From: "Ryan S. Arnold" Date: Tue, 28 Jul 2015 15:29:21 -0500 Subject: lib/checkout.sh: Fix greedy checkout_infrastructure(). The checkout_infrastructure() function was checking out every file from md5sums that matched the 'depends' component name. This fix makes sure to use the configs/.conf file (or the user's = command line) for the full component version or name. Change-Id: I302fa96052bef23d56d65054c6368e8a19416306 --- lib/checkout.sh | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/checkout.sh b/lib/checkout.sh index 54ff68d2..76962a31 100644 --- a/lib/checkout.sh +++ b/lib/checkout.sh @@ -30,6 +30,7 @@ checkout_infrastructure() trace "$*" if test x"${supdate}" = xno; then + warning "checkout_infrastructure called with --disable update. Checkout of infrastructure files will be skipped." return 0 fi @@ -50,10 +51,41 @@ checkout_infrastructure() # some libraries depend on other libraries being bult first. Egrep # unfortunately sorts the files, which screws up the order. local files="`grep ^latest= ${topdir}/config/dejagnu.conf | cut -d '\"' -f 2`" + + local version= for i in ${depends}; do - files="${files} `grep /$i ${local_snapshots}/md5sums | cut -d ' ' -f3 | uniq`" - done + 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 .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 -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 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 for i in ${files}; do local name="`echo $i | sed -e 's:\.tar\..*::' -e 's:infrastructure/::' -e 's:testcode/::'`" -- cgit v1.2.3