update-luarocks-packages: simplify server var, whitespace fixup

This commit is contained in:
Will Dietz 2019-03-25 03:04:33 -05:00
parent 7bd31a322f
commit c37b3ab888

View File

@ -76,11 +76,7 @@ FOOTER="
function convert_pkg () { function convert_pkg () {
nix_pkg_name="$1" nix_pkg_name="$1"
lua_pkg_name="$2" lua_pkg_name="$2"
server="" server="${3:+--server=$3}"
if [ ! -z "$3" ]; then
server=" --server=$3"
fi
version="${4:-}" version="${4:-}"
echo "looking at $lua_pkg_name (version $version) from server [$server]" >&2 echo "looking at $lua_pkg_name (version $version) from server [$server]" >&2
@ -101,15 +97,15 @@ echo "$HEADER" | tee "$TMP_FILE"
# name,server,version # name,server,version
while IFS=, read -r nix_pkg_name lua_pkg_name server version while IFS=, read -r nix_pkg_name lua_pkg_name server version
do do
if [ "${nix_pkg_name:0:1}" == "#" ]; then if [ "${nix_pkg_name:0:1}" == "#" ]; then
echo "Skipping comment ${nix_pkg_name}" >&2 echo "Skipping comment ${nix_pkg_name}" >&2
continue continue
fi fi
if [ -z "$lua_pkg_name" ]; then if [ -z "$lua_pkg_name" ]; then
echo "Using nix_name as lua_pkg_name" >&2 echo "Using nix_name as lua_pkg_name" >&2
lua_pkg_name="$nix_pkg_name" lua_pkg_name="$nix_pkg_name"
fi fi
convert_pkg "$nix_pkg_name" "$lua_pkg_name" "$server" "$version" convert_pkg "$nix_pkg_name" "$lua_pkg_name" "$server" "$version"
done < "$CSV_FILE" done < "$CSV_FILE"
# close the set # close the set