lua: normalize package name

This commit is contained in:
Matthieu Coudron 2021-07-28 02:28:25 +02:00
parent 8ecc61c91a
commit 594a143e0e

View File

@ -89,6 +89,10 @@ function convert_pkg() {
echo "Skipping comment ${*}" >&2 echo "Skipping comment ${*}" >&2
return return
fi fi
# Normalize package name
nix_pkg_name_normalized=$(sed 's/\./-/' <(echo "$nix_pkg_name"))
if [ -z "$lua_pkg_name" ]; then if [ -z "$lua_pkg_name" ]; then
echo "Using nix_name as lua_pkg_name for '$nix_pkg_name'" >&2 echo "Using nix_name as lua_pkg_name for '$nix_pkg_name'" >&2
lua_pkg_name="$nix_pkg_name" lua_pkg_name="$nix_pkg_name"
@ -111,7 +115,7 @@ function convert_pkg() {
luarocks_args+=("$pkg_version") luarocks_args+=("$pkg_version")
fi fi
echo "Running 'luarocks ${luarocks_args[*]}'" >&2 echo "Running 'luarocks ${luarocks_args[*]}'" >&2
if drv="$nix_pkg_name = $(luarocks "${luarocks_args[@]}")"; then if drv="$nix_pkg_name_normalized = $(luarocks "${luarocks_args[@]}")"; then
echo "$drv" echo "$drv"
else else
echo "Failed to convert $nix_pkg_name" >&2 echo "Failed to convert $nix_pkg_name" >&2