Fix download scripts to handle empty lines
Fixing download and saving scripts to be able to ignore empty or 00D
ending lines in lists
Issue-ID: OOM-1818
Change-Id: I55ef1dfbea628f8c1d4b19745536e629a2dbe0c9
Signed-off-by: Tomáš Levora <t.levora@partner.samsung.com>
diff --git a/build/creating_data/download-pip.sh b/build/creating_data/download-pip.sh
index dea60b5..fd4a436 100755
--- a/build/creating_data/download-pip.sh
+++ b/build/creating_data/download-pip.sh
@@ -16,6 +16,10 @@
#
# COPYRIGHT NOTICE ENDS HERE
+
+# Load common-functions library
+. $(dirname ${0})/../common-functions.sh
+
LIST_FILE="$1"
if [[ -z "$LIST_FILE" ]]; then
echo "Missing list file"
@@ -30,16 +34,15 @@
exit 1
fi
-lines=$(cat "$LIST_FILE" | wc -l)
+lines=$(clean_list "$LIST_FILE" | wc -l)
cnt=1
# create output dir if not exists
mkdir -p "$outdir"
cd "$outdir"
-while read -r line; do
+for line in $(clean_list "$LIST_FILE)"; do
echo "Downloading $cnt / $lines: $line"
pip download $line
cnt=$((cnt+1))
-
-done < "$LIST_FILE"
+done