Update handling of mvn.repo.tgz

The special case handling of mvn.repo.tgz accesses loop variables
before they are set, resulting in the code using a value set during
the previous iteration. As a result, the script overwrites the
previously downloaded tarball with mvn.repo.tgz in the output
directory, and mvn.repo.tgz is missing.

This update moves the setting of the output path variables ahead of
the special case handlers.

Story: 2003058
Task: 23095

Change-Id: I3fbca2e056a584984d173942b0cbd46ec88579cc
Signed-off-by: Don Penney <don.penney@windriver.com>
This commit is contained in:
Don Penney 2018-07-20 09:36:29 -05:00
parent 5ee339a7e0
commit 846974a843

View File

@ -75,6 +75,18 @@ for line in $(cat $tarball_file); do
directory_name=$(echo $line | cut -d"#" -f2-2) directory_name=$(echo $line | cut -d"#" -f2-2)
tarball_url=$(echo $line | cut -d"#" -f3-3) tarball_url=$(echo $line | cut -d"#" -f3-3)
# - For the General category and the Puppet category:
# - Packages have a common process: download, decompressed,
# change the directory path and compressed.
if [[ "$line" =~ ^pupp* ]]; then
download_path=$output_puppet/$tarball_name
download_directory=$output_puppet
else
download_path=$output_tarball/$tarball_name
download_directory=$output_tarball
fi
# We have 6 packages from the text file starting with the character "!": # We have 6 packages from the text file starting with the character "!":
# they require special handling besides the common process: remove directory, # they require special handling besides the common process: remove directory,
# remove text from some files, clone a git repository, etc. # remove text from some files, clone a git repository, etc.
@ -119,7 +131,7 @@ for line in $(cat $tarball_file); do
# Create tarball # Create tarball
tar -zcvf "$tarball_name" -C "$directory_name"/ . tar -zcvf "$tarball_name" -C "$directory_name"/ .
rm -rf "$directory_name" rm -rf "$directory_name"
mv "$tarball_name" "$download_path" mv "$tarball_name" "$download_directory"
elif [[ "$tarball_name" =~ ^'MLNX_OFED_LINUX' ]]; then elif [[ "$tarball_name" =~ ^'MLNX_OFED_LINUX' ]]; then
pkg_version=$(echo "$tarball_name" | cut -d "-" -f2-3) pkg_version=$(echo "$tarball_name" | cut -d "-" -f2-3)
srpm_path="MLNX_OFED_SRC-${pkg_version}/SRPMS/" srpm_path="MLNX_OFED_SRC-${pkg_version}/SRPMS/"
@ -166,18 +178,6 @@ for line in $(cat $tarball_file); do
continue continue
fi fi
# - For the General category and the Puppet category:
# - Packages have a common process: download, decompressed,
# change the directory path and compressed.
if [[ "$line" =~ ^pupp* ]]; then
download_path=$output_puppet/$tarball_name
download_directory=$output_puppet
else
download_path=$output_tarball/$tarball_name
download_directory=$output_tarball
fi
download_cmd="wget -t 5 --wait=15 $tarball_url -O $download_path" download_cmd="wget -t 5 --wait=15 $tarball_url -O $download_path"
if [ ! -e $download_path ]; then if [ ! -e $download_path ]; then