diff options
author | Matthieu Coudron <mattator@gmail.com> | 2019-06-19 14:23:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-19 14:23:31 +0200 |
commit | c33153bf1395e1149bf018ea391977b0ae399dde (patch) | |
tree | 030fb5d077f9942f9c9181b9b72d3079bb124128 /maintainers | |
parent | 56cc1e3aca3d877c3cab4f2d5b170245470deb46 (diff) | |
parent | 671e53af6736630cad70e8c404f263c8720ae3a1 (diff) | |
download | nixpkgs-c33153bf1395e1149bf018ea391977b0ae399dde.tar nixpkgs-c33153bf1395e1149bf018ea391977b0ae399dde.tar.gz nixpkgs-c33153bf1395e1149bf018ea391977b0ae399dde.tar.bz2 nixpkgs-c33153bf1395e1149bf018ea391977b0ae399dde.tar.lz nixpkgs-c33153bf1395e1149bf018ea391977b0ae399dde.tar.xz nixpkgs-c33153bf1395e1149bf018ea391977b0ae399dde.tar.zst nixpkgs-c33153bf1395e1149bf018ea391977b0ae399dde.zip |
Merge pull request #63108 from Shados/lua-packaging-improvements-pr
Lua/luarocks packaging improvements
Diffstat (limited to 'maintainers')
-rw-r--r-- | maintainers/scripts/luarocks-packages.csv | 40 | ||||
-rwxr-xr-x | maintainers/scripts/update-luarocks-packages | 105 | ||||
-rw-r--r-- | maintainers/scripts/update-luarocks-shell.nix | 9 |
3 files changed, 100 insertions, 54 deletions
diff --git a/maintainers/scripts/luarocks-packages.csv b/maintainers/scripts/luarocks-packages.csv index b958d2e7277..57d08b3649a 100644 --- a/maintainers/scripts/luarocks-packages.csv +++ b/maintainers/scripts/luarocks-packages.csv @@ -3,10 +3,17 @@ ansicolors,,,,, argparse,,,,, basexx,,,,, binaryheap,,,,,vcunat +bit32,,,,lua5_1,lblasc +busted,,,,, +cjson,lua-cjson,,,, +compat53,,,,,vcunat +coxpcall,,,1.17.0-1,, +cqueues,,,,,vcunat +cyrussasl,,,,,vcunat digestif,,http://luarocks.org/dev,,lua5_3, dkjson,,,,, fifo,,,,, -http,,,,, +http,,,,,vcunat inspect,,,,, ldoc,,,,, lgi,,,,, @@ -15,35 +22,44 @@ lpeg_patterns,,,,, lpeglabel,,,,, lpty,,,,, lrexlib-gnu,,,,, +lrexlib-pcre,,,,,vyp lrexlib-posix,,,,, ltermbox,,,,, -cjson,lua-cjson,,,, lua-cmsgpack,,,,, -lua_cliargs,,,,, lua-iconv,,,,, lua-lsp,,http://luarocks.org/dev,,, lua-messagepack,,,,, lua-term,,,,, lua-toml,,,,, lua-zlib,,,,,koral +lua_cliargs,,,,, luabitop,,,,, -luaevent,,,,, luacheck,,,,, +luadbi,,,,, +luadbi-mysql,,,,, +luadbi-postgresql,,,,, +luadbi-sqlite3,,,,, +luaevent,,,,, +luaexpat,,,,,flosse luaffi,,http://luarocks.org/dev,,, +luafilesystem,,,1.7.0-2,,flosse vcunat +luaossl,,,,lua5_1,vcunat luaposix,,,,,vyp lblasc +luasec,,,,,flosse +luasocket,,,,, +luasql-sqlite3,,,,,vyp +luassert,,,,, +luasystem,,,,, luazip,,,,, luuid,,,,, +luv,,,,, markdown,,,,, +mediator_lua,,,,, +mpack,,,,, +nvim-client,,,,, penlight,,,,, rapidjson,,,,, say,,,,, std__debug,std._debug,,,, std_normalize,std.normalize,,,, -luv,,,,, -luasystem,,,,, -mediator_lua,,http://luarocks.org/manifests/teto,,, -mpack,,,,, -nvim-client,,,,, -busted,,http://luarocks.org/manifests/teto,,, -luassert,,,,, -coxpcall,,https://luarocks.org/manifests/hisham,1.17.0-1,, +stdlib,,,,,vyp diff --git a/maintainers/scripts/update-luarocks-packages b/maintainers/scripts/update-luarocks-packages index e2f2cc6bbd2..a8d67d208e3 100755 --- a/maintainers/scripts/update-luarocks-packages +++ b/maintainers/scripts/update-luarocks-packages @@ -1,5 +1,5 @@ #!/usr/bin/env nix-shell -#!nix-shell -p nix-prefetch-scripts luarocks-nix -i bash +#!nix-shell update-luarocks-shell.nix -i bash # You'll likely want to use # `` @@ -8,17 +8,21 @@ # to update all libraries in that folder. # to debug, redirect stderr to stdout with 2>&1 - # stop the script upon C-C set -eu -o pipefail CSV_FILE="maintainers/scripts/luarocks-packages.csv" TMP_FILE="$(mktemp)" +# Set in the update-luarocks-shell.nix +NIXPKGS_PATH="$LUAROCKS_NIXPKGS_PATH" -exit_trap() -{ - local lc="$BASH_COMMAND" rc=$? - test $rc -eq 0 || echo -e "*** error $rc: $lc.\nGenerated temporary file in $TMP_FILE" >&2 +# 10 is a pretty arbitrary number of simultaneous jobs, but it is generally +# impolite to hit a webserver with *too* many simultaneous connections :) +PARALLEL_JOBS=10 + +exit_trap() { + local lc="$BASH_COMMAND" rc=$? + test $rc -eq 0 || echo -e "*** error $rc: $lc.\nGenerated temporary file in $TMP_FILE" >&2 } print_help() { @@ -37,19 +41,19 @@ fi trap exit_trap EXIT while getopts ":hc:" opt; do - case $opt in + case $opt in h) - print_help - ;; + print_help + ;; c) - echo "Loading package list from $OPTARG !" >&2 - CSV_FILE="$OPTARG" - ;; + echo "Loading package list from $OPTARG !" >&2 + CSV_FILE="$OPTARG" + ;; \?) - echo "Invalid option: -$OPTARG" >&2 - ;; - esac - shift $((OPTIND-1)) + echo "Invalid option: -$OPTARG" >&2 + ;; + esac + shift $((OPTIND - 1)) done GENERATED_NIXFILE="$1" @@ -72,43 +76,60 @@ FOOTER=" /* GENERATED */ " - -function convert_pkg () { +function convert_pkg() { nix_pkg_name="$1" lua_pkg_name="$2" - server="${3:+--only-server=$3}" - pkg_version="${4:-}" - lua_version="${5:+--lua-dir=$(nix path-info nixpkgs.$5)/bin}" - - echo "looking at $lua_pkg_name (version $pkg_version) from server [$server]" >&2 - cmd="luarocks nix $server $lua_version $lua_pkg_name $pkg_version" - echo "Running $cmd" >&2 - drv="$nix_pkg_name = $($cmd)" - if [ $? -ne 0 ]; then - echo "Failed to convert $pkg" >&2 + server="$3" + pkg_version="$4" + lua_version="$5" + maintainers="$6" + + if [ "${nix_pkg_name:0:1}" == "#" ]; then + echo "Skipping comment ${*}" >&2 + return + fi + if [ -z "$lua_pkg_name" ]; then + echo "Using nix_name as lua_pkg_name for '$nix_pkg_name'" >&2 + lua_pkg_name="$nix_pkg_name" + fi + + echo "Building expression for $lua_pkg_name (version $pkg_version) from server [$server]" >&2 + luarocks_args=(nix) + if [[ -n $server ]]; then + luarocks_args+=("--only-server=$server") + fi + if [[ -n $maintainers ]]; then + luarocks_args+=("--maintainers=$maintainers") + fi + if [[ -n $lua_version ]]; then + lua_drv_path=$(nix-build --no-out-link "$NIXPKGS_PATH" -A "$lua_version") + luarocks_args+=("--lua-dir=$lua_drv_path/bin") + fi + luarocks_args+=("$lua_pkg_name") + if [[ -n $pkg_version ]]; then + luarocks_args+=("$pkg_version") + fi + echo "Running 'luarocks ${luarocks_args[*]}'" >&2 + if drv="$nix_pkg_name = $(luarocks "${luarocks_args[@]}")"; then + echo "$drv" else - echo "$drv" | tee -a "$TMP_FILE" + echo "Failed to convert $nix_pkg_name" >&2 + return 1 fi } # params needed when called via callPackage echo "$HEADER" | tee "$TMP_FILE" -# list of packages with format -while IFS=, read -r nix_pkg_name lua_pkg_name server pkg_version luaversion -do - if [ "${nix_pkg_name:0:1}" == "#" ]; then - echo "Skipping comment ${nix_pkg_name}" >&2 - continue - fi - if [ -z "$lua_pkg_name" ]; then - echo "Using nix_name as lua_pkg_name" >&2 - lua_pkg_name="$nix_pkg_name" - fi - convert_pkg "$nix_pkg_name" "$lua_pkg_name" "$server" "$pkg_version" "$luaversion" -done < "$CSV_FILE" +# Ensure parallel can run our bash function +export -f convert_pkg +export SHELL=bash +# Read each line in the csv file and run convert_pkg for each, in parallel +parallel --group --keep-order --halt now,fail=1 --jobs "$PARALLEL_JOBS" --colsep ',' convert_pkg {} <"$CSV_FILE" | tee -a "$TMP_FILE" # close the set echo "$FOOTER" | tee -a "$TMP_FILE" cp "$TMP_FILE" "$GENERATED_NIXFILE" + +# vim: set ts=4 sw=4 ft=sh: diff --git a/maintainers/scripts/update-luarocks-shell.nix b/maintainers/scripts/update-luarocks-shell.nix new file mode 100644 index 00000000000..23a940b3691 --- /dev/null +++ b/maintainers/scripts/update-luarocks-shell.nix @@ -0,0 +1,9 @@ +{ nixpkgs ? import ../.. { } +}: +with nixpkgs; +mkShell { + buildInputs = [ + bash luarocks-nix nix-prefetch-scripts parallel + ]; + LUAROCKS_NIXPKGS_PATH = toString nixpkgs.path; +} |