Adjust get_sources.sh to allow empty sources file

There are situations in which one will want to use a `sources` file to
indicate that they wish to use the flat dist-git layout.
However, until now we did not allow empty `sources` file in flat dist-git
layout.
With this change we allow empty `sources` file and we will just echo
something in the logs saying that this file is empty and bail.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
This commit is contained in:
Pierre-Yves Chibon 2022-03-03 09:53:43 +01:00
parent 014e3890be
commit 04de770669

6
get_sources.sh Executable file → Normal file
View file

@ -146,7 +146,10 @@ else
done <<< "$(git branch -r --contains HEAD | sed 's#origin/##g')"
fi
if [[ -s sources ]]; then
if [[ -f sources ]]; then
if [[ ! -s sources ]]; then
echo "Empty sources file -- nothing to check"
else
# This section is for the "flat" dist-git layout, where the spec file and
# patches are all present at the top level directory and the sha of the tarball
# present in a 'sources' file.
@ -192,6 +195,7 @@ if [[ -s sources ]]; then
fi
done < sources
"${hashtype}sum" -c sources
fi
else
# This section is for the "non-flat" dist-git layout, where the spec file
# is stored in a SPECS folder, the patches in a SOURCES folder and the sha