finish lua2.4 changes

This commit is contained in:
Daniel Poelzleithner 2022-01-12 20:46:14 +01:00
parent a609f34971
commit f65cdd282d
3 changed files with 95 additions and 20 deletions

View File

@ -17,16 +17,16 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1637709854, "lastModified": 1639488789,
"narHash": "sha256-y98gkOBUEiPAmwRhZPzTQ0YayZKPS2loNgA0GcNewMM=", "narHash": "sha256-Ey12CBni1jlEGoW4eH4X0hugWs25MxHMcNH4N8VVX0U=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "9c43581935a23d56734bd02da0ba8e7fda21e747", "rev": "ce635e9dca8f7e2bfab19a3667d7e697c019c68b",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nixos", "owner": "nixos",
"ref": "release-21.05", "ref": "release-21.11",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }

View File

@ -1,30 +1,65 @@
{ {
description = "Lsyncd (Live Syncing Daemon)"; description = "Lsyncd (Live Syncing Daemon)";
inputs.nixpkgs.url = "github:nixos/nixpkgs/release-21.05"; inputs.nixpkgs.url = "github:nixos/nixpkgs/release-21.11";
inputs.flake-utils.url = "github:numtide/flake-utils"; inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }: outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem flake-utils.lib.eachDefaultSystem
(system: (system:
let let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = (import nixpkgs {
inherit system;
# Makes the config pure as well. See <nixpkgs>/top-level/impure.nix:
config = {
allowBroken = true;
};}); #.legacyPackages.${system};
defaultDeps = with pkgs; [ defaultDeps = with pkgs; [
gcc gcc
cmake cmake
gnumake
glib glib
rsync rsync
openssh openssh
curl
]; ];
version = builtins.elemAt version = builtins.elemAt
(builtins.match ''.*set\(.LSYNCD_VERSION ([0-9\.]*).*'' (builtins.match ''.*set\(.LSYNCD_VERSION ([0-9\.]*).*''
(builtins.substring 0 500 (builtins.substring 0 500
(builtins.readFile ./CMakeLists.txt))) 0; (builtins.readFile ./CMakeLists.txt))) 0;
mylua5_4 = pkgs.lua5_4.override({
packageOverrides = luaself: luaprev: {
luarocks = luaprev.luarocks-3_7;
};
});
luaposix35 = mylua: mylua.pkgs.buildLuarocksPackage {
pname = "luaposix";
lua = mylua;
version = "35.1-1";
knownRockspec = (pkgs.fetchurl {
url = "https://luarocks.org/luaposix-35.1-1.rockspec";
sha256 = "1n6c7qyabj2y95jmbhf8fxbrp9i73kphmwalsam07f9w9h995xh1";
}).outPath;
src = pkgs.fetchurl {
url = "http://github.com/luaposix/luaposix/archive/v35.1.zip";
sha256 = "1c03chkzwr2p1wd0hs1bafl2890fqbrfc3qk0wxbd202gc6128zi";
};
#
propagatedBuildInputs = [ mylua ];
meta = {
homepage = "http://github.com/luaposix/luaposix/";
description = "Lua bindings for POSIX";
license.fullName = "MIT/X11";
};
};
buildTypes = { buildTypes = {
lua5_1 = [pkgs.lua5_1 pkgs.lua51Packages.luaposix pkgs.lua51Packages.penlight]; lua5_1 = [pkgs.lua5_1 pkgs.lua51Packages.luaposix];
lua5_2 = [pkgs.lua5_2 pkgs.lua52Packages.luaposix pkgs.lua52Packages.penlight]; lua5_2 = [pkgs.lua5_2 pkgs.lua52Packages.luaposix];
lua5_3 = [pkgs.lua5_3 pkgs.lua53Packages.luaposix pkgs.lua53Packages.penlight]; lua5_3 = [pkgs.lua5_3 pkgs.lua53Packages.luaposix];
lua5_4 = [pkgs.lua5_4 pkgs.lua54Packages.luaposix pkgs.lua54Packages.penlight]; lua5_4 = [pkgs.lua5_3 (luaposix35 mylua5_4)];
}; };
in in
let let
@ -34,9 +69,11 @@
src = ./.; src = ./.;
# nativeBuildInputs = [ pkgs.qt5.wrapQtAppsHook ];
buildInputs = defaultDeps ++ luaPackages; buildInputs = defaultDeps ++ luaPackages;
}); });
mkDev = packages: pkgs.mkShell {
propagatedBuildInputs = defaultDeps ++ packages;
};
in in
{ {
packages = { packages = {
@ -47,10 +84,15 @@
lsyncd_lua5_4 = mkLsync buildTypes.lua5_4; lsyncd_lua5_4 = mkLsync buildTypes.lua5_4;
}; };
devShells = {
lsyncd = mkDev buildTypes.lua5_3;
lsyncd_lua5_1 = mkDev buildTypes.lua5_1;
lsyncd_lua5_2 = mkDev buildTypes.lua5_2;
lsyncd_lua5_3 = mkDev buildTypes.lua5_3;
lsyncd_lua5_4 = mkDev buildTypes.lua5_4;
};
defaultPackage = self.packages.${system}.lsyncd; defaultPackage = self.packages.${system}.lsyncd;
# devShell = pkgs.mkShell {
# buildInputs = defaultDeps ++ buildTypes.lua5_3;
# };
} }
); );
} }

View File

@ -1,8 +1,7 @@
-- common testing environment -- common testing environment
posix = require( 'posix' ) posix = require( 'posix' )
string = require( 'string' ) string = require( 'string' )
path = require( 'pl.path' )
stringx = require( 'pl.stringx' )
local sys_stat = require "posix.sys.stat" local sys_stat = require "posix.sys.stat"
-- escape codes to colorize output on terminal -- escape codes to colorize output on terminal
@ -94,10 +93,39 @@ function writefile
return true return true
end end
function splitpath(P)
local i = #P
local ch = P:sub(i,i)
while i > 0 and ch ~= "/" do
i = i - 1
ch = P:sub(i,i)
end
if i == 0 then
return '',P
else
return P:sub(1,i-1), P:sub(i+1)
end
end
function isabs(p)
return string.sub(p, 1, 2) == "/"
end
function abspath(P,pwd)
P = P:gsub('[\\/]$','')
if not isabs(P) then
local rv = posix.unistd.getcwd() .. "/" .. P
return rv
end
return P
end
function script_path() function script_path()
-- local str = debug.getinfo(2, "S").source:sub(2) -- local str = debug.getinfo(2, "S").source:sub(2)
-- return str:match("(.*/)") -- return str:match("(.*/)")
return path.dirname(path.abspath(debug.getinfo(1).short_src)) local dir, file = splitpath(abspath(debug.getinfo(1).short_src))
return dir
end end
function which(exec) function which(exec)
@ -159,6 +187,11 @@ function startSshd()
return true return true
end end
function strip(s)
return s:match "^%s*(.-)%s*$"
end
-- --
-- Stop test ssh server -- Stop test ssh server
-- --
@ -169,7 +202,7 @@ function stopSshd()
then then
return false return false
end end
pid = stringx.strip(f:read("*a")) pid = strip(f:read("*a"))
posix.kill(tonumber(pid)) posix.kill(tonumber(pid))
end end