mirror of
https://github.com/octoleo/lsyncd.git
synced 2024-12-04 19:03:17 +00:00
finish lua2.4 changes
This commit is contained in:
parent
a609f34971
commit
f65cdd282d
@ -17,16 +17,16 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1637709854,
|
||||
"narHash": "sha256-y98gkOBUEiPAmwRhZPzTQ0YayZKPS2loNgA0GcNewMM=",
|
||||
"lastModified": 1639488789,
|
||||
"narHash": "sha256-Ey12CBni1jlEGoW4eH4X0hugWs25MxHMcNH4N8VVX0U=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "9c43581935a23d56734bd02da0ba8e7fda21e747",
|
||||
"rev": "ce635e9dca8f7e2bfab19a3667d7e697c019c68b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "release-21.05",
|
||||
"ref": "release-21.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
|
66
flake.nix
66
flake.nix
@ -1,30 +1,65 @@
|
||||
{
|
||||
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";
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem
|
||||
(system:
|
||||
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; [
|
||||
gcc
|
||||
cmake
|
||||
gnumake
|
||||
glib
|
||||
rsync
|
||||
openssh
|
||||
curl
|
||||
];
|
||||
version = builtins.elemAt
|
||||
(builtins.match ''.*set\(.LSYNCD_VERSION ([0-9\.]*).*''
|
||||
(builtins.substring 0 500
|
||||
(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 = {
|
||||
lua5_1 = [pkgs.lua5_1 pkgs.lua51Packages.luaposix pkgs.lua51Packages.penlight];
|
||||
lua5_2 = [pkgs.lua5_2 pkgs.lua52Packages.luaposix pkgs.lua52Packages.penlight];
|
||||
lua5_3 = [pkgs.lua5_3 pkgs.lua53Packages.luaposix pkgs.lua53Packages.penlight];
|
||||
lua5_4 = [pkgs.lua5_4 pkgs.lua54Packages.luaposix pkgs.lua54Packages.penlight];
|
||||
lua5_1 = [pkgs.lua5_1 pkgs.lua51Packages.luaposix];
|
||||
lua5_2 = [pkgs.lua5_2 pkgs.lua52Packages.luaposix];
|
||||
lua5_3 = [pkgs.lua5_3 pkgs.lua53Packages.luaposix];
|
||||
lua5_4 = [pkgs.lua5_3 (luaposix35 mylua5_4)];
|
||||
};
|
||||
in
|
||||
let
|
||||
@ -33,10 +68,12 @@
|
||||
name = "lsyncd";
|
||||
|
||||
src = ./.;
|
||||
|
||||
# nativeBuildInputs = [ pkgs.qt5.wrapQtAppsHook ];
|
||||
|
||||
buildInputs = defaultDeps ++ luaPackages;
|
||||
});
|
||||
});
|
||||
mkDev = packages: pkgs.mkShell {
|
||||
propagatedBuildInputs = defaultDeps ++ packages;
|
||||
};
|
||||
in
|
||||
{
|
||||
packages = {
|
||||
@ -47,10 +84,15 @@
|
||||
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;
|
||||
# devShell = pkgs.mkShell {
|
||||
# buildInputs = defaultDeps ++ buildTypes.lua5_3;
|
||||
# };
|
||||
}
|
||||
);
|
||||
}
|
@ -1,8 +1,7 @@
|
||||
-- common testing environment
|
||||
posix = require( 'posix' )
|
||||
string = require( 'string' )
|
||||
path = require( 'pl.path' )
|
||||
stringx = require( 'pl.stringx' )
|
||||
|
||||
local sys_stat = require "posix.sys.stat"
|
||||
|
||||
-- escape codes to colorize output on terminal
|
||||
@ -94,10 +93,39 @@ function writefile
|
||||
return true
|
||||
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()
|
||||
-- local str = debug.getinfo(2, "S").source:sub(2)
|
||||
-- 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
|
||||
|
||||
function which(exec)
|
||||
@ -159,6 +187,11 @@ function startSshd()
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
function strip(s)
|
||||
return s:match "^%s*(.-)%s*$"
|
||||
end
|
||||
|
||||
--
|
||||
-- Stop test ssh server
|
||||
--
|
||||
@ -169,7 +202,7 @@ function stopSshd()
|
||||
then
|
||||
return false
|
||||
end
|
||||
pid = stringx.strip(f:read("*a"))
|
||||
pid = strip(f:read("*a"))
|
||||
posix.kill(tonumber(pid))
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user