Merge pull request #169802 from NinjaTrappeur/nin/prosody012

This commit is contained in:
Matthieu Coudron 2022-05-03 11:04:17 +02:00 committed by GitHub
commit 5114d91cd8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 81 additions and 26 deletions

View file

@ -64,6 +64,7 @@ luasocket,,,,,,
luasql-sqlite3,,,,,,vyp
luassert,,,,,,
luasystem,,,,,,
luaunbound,,,,,
luautf8,,,,,,pstn
luazip,,,,,,
lua-yajl,,,,,,pstn

Can't render this file because it has a wrong number of fields in line 67.

View file

@ -820,6 +820,7 @@ in
'') cfg.muc}
${ lib.optionalString (cfg.uploadHttp != null) ''
-- TODO: think about migrating this to mod-http_file_share instead.
Component ${toLua cfg.uploadHttp.domain} "http_upload"
http_upload_file_size_limit = ${cfg.uploadHttp.uploadFileSizeLimit}
http_upload_expire_after = ${cfg.uploadHttp.uploadExpireAfter}

View file

@ -51,11 +51,8 @@ class CthonTest(ClientXMPP):
log.info('Message sent')
# Test http upload (XEP_0363)
def timeout_callback(arg):
log.error("ERROR: Cannot upload file. XEP_0363 seems broken")
sys.exit(1)
try:
url = await self['xep_0363'].upload_file("${dummyFile}",timeout=10, timeout_callback=timeout_callback)
url = await self['xep_0363'].upload_file("${dummyFile}",timeout=10)
except:
log.error("ERROR: Cannot run upload command. XEP_0363 seems broken")
sys.exit(1)

View file

@ -1952,6 +1952,31 @@ buildLuarocksPackage {
};
}) {};
luaunbound = callPackage({ buildLuarocksPackage, luaOlder, luaAtLeast
, fetchurl, lua
}:
buildLuarocksPackage {
pname = "luaunbound";
version = "1.0.0-1";
knownRockspec = (fetchurl {
url = "https://luarocks.org/luaunbound-1.0.0-1.rockspec";
sha256 = "1zlkibdwrj5p97nhs33cz8xx0323z3kiq5x7v0h3i7v6j0h8ppvn";
}).outPath;
src = fetchurl {
url = "https://code.zash.se/dl/luaunbound/luaunbound-1.0.0.tar.gz";
sha256 = "1lsh0ylp5xskygxl5qdv6mhkm1x8xp0vfd5prk5hxkr19jk5mr3d";
};
disabled = with lua; (luaOlder "5.1") || (luaAtLeast "5.5");
propagatedBuildInputs = [ lua ];
meta = {
homepage = "https://www.zash.se/luaunbound.html";
description = "A binding to libunbound";
license.fullName = "MIT";
};
}) {};
luautf8 = callPackage({ buildLuarocksPackage, luaOlder, luaAtLeast
, fetchurl, lua
}:

View file

@ -254,6 +254,12 @@ with prev;
];
});
luaunbound = prev.lib.overrideLuarocks prev.luaunbound(drv: {
externalDeps = [
{ name = "libunbound"; dep = pkgs.unbound; }
];
});
luuid = (prev.lib.overrideLuarocks prev.luuid (drv: {
externalDeps = [
{ name = "LIBUUID"; dep = pkgs.libuuid; }

View file

@ -0,0 +1,36 @@
From 7b5ac168892dedc5bd6be4244b18dc32d37d00fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?F=C3=A9lix=20Baylac-Jacqu=C3=A9?= <felix@alternativebit.fr>
Date: Fri, 22 Apr 2022 15:26:05 +0200
Subject: [PATCH] xep_0030: allow extra args in get_info_from_domain
Aftermath of ea2d851a.
http_upload from xep_0363 is now forwarding all its extra input args
to get_info_from_domain. Sadly for us, get_info_from_domain won't
accept any extra args passed that way and will yield a "got an
unexpected keyword argument".
Modifying get_info_from_domain to accept these extra args.
I hit this bug by passing a timeout_callback argument to http_upload.
Adding this scenario to the relevant integration test.
---
itests/test_httpupload.py | 1 +
slixmpp/plugins/xep_0030/disco.py | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/slixmpp/plugins/xep_0030/disco.py b/slixmpp/plugins/xep_0030/disco.py
index 37d453aa..9f9a45f2 100644
--- a/slixmpp/plugins/xep_0030/disco.py
+++ b/slixmpp/plugins/xep_0030/disco.py
@@ -307,7 +307,7 @@ class XEP_0030(BasePlugin):
return self.api['has_identity'](jid, node, ifrom, data)
async def get_info_from_domain(self, domain=None, timeout=None,
- cached=True, callback=None):
+ cached=True, callback=None, **iqkwargs):
"""Fetch disco#info of specified domain and one disco#items level below
"""
--
2.35.1

View file

@ -39,6 +39,8 @@ buildPythonPackage rec {
src = ./hardcode-gnupg-path.patch;
inherit gnupg;
})
# Upstream MR: https://lab.louiz.org/poezio/slixmpp/-/merge_requests/198
./0001-xep_0030-allow-extra-args-in-get_info_from_domain.patch
];
disabledTestPaths = [

View file

@ -1,4 +1,5 @@
{ stdenv, fetchurl, lib, libidn, openssl, makeWrapper, fetchhg
, icu
, lua
, nixosTests
, withLibevent ? true
@ -13,7 +14,7 @@ with lib;
let
luaEnv = lua.withPackages(p: with p; [
luasocket luasec luaexpat luafilesystem luabitop luadbi-sqlite3
luasocket luasec luaexpat luafilesystem luabitop luadbi-sqlite3 luaunbound
]
++ lib.optional withLibevent p.luaevent
++ lib.optional withDBI p.luadbi
@ -21,21 +22,19 @@ let
);
in
stdenv.mkDerivation rec {
version = "0.11.13"; # also update communityModules
version = "0.12.0"; # also update communityModules
pname = "prosody";
# The following community modules are necessary for the nixos module
# prosody module to comply with XEP-0423 and provide a working
# default setup.
nixosModuleDeps = [
"bookmarks"
"cloud_notify"
"vcard_muc"
"smacks"
"http_upload"
];
src = fetchurl {
url = "https://prosody.im/downloads/source/${pname}-${version}.tar.gz";
sha256 = "sha256-OcYbNGoJtRJbYEy5aeFCBsu8uGyBFW/8a6LWJSfPBDI=";
sha256 = "sha256-dS/zIBXaxWX8NBfCGWryaJccNY7gZuUfXZEkE1gNiJo=";
};
# A note to all those merging automated updates: Please also update this
@ -43,13 +42,13 @@ stdenv.mkDerivation rec {
# version.
communityModules = fetchhg {
url = "https://hg.prosody.im/prosody-modules";
rev = "54fa2116bbf3";
sha256 = "sha256-OKZ7tD75q8/GMXruUQ+r9l0BxzdbPHNf41fZ3fHVQVw=";
rev = "65438e4ba563";
sha256 = "sha256-zHOrMzcgHOdBl7nObM+OauifbcmKEOfAuj81MDSoLMk=";
};
nativeBuildInputs = [ makeWrapper ];
buildInputs = [
luaEnv libidn openssl
luaEnv libidn openssl icu
]
++ withExtraLibs;
@ -63,26 +62,14 @@ stdenv.mkDerivation rec {
make -C tools/migration
'';
luaEnvPath = lua.pkgs.lib.genLuaPathAbsStr luaEnv;
luaEnvCPath = lua.pkgs.lib.genLuaCPathAbsStr luaEnv;
# the wrapping should go away once lua hook is fixed
postInstall = ''
${concatMapStringsSep "\n" (module: ''
cp -r $communityModules/mod_${module} $out/lib/prosody/modules/
'') (lib.lists.unique(nixosModuleDeps ++ withCommunityModules ++ withOnlyInstalledCommunityModules))}
wrapProgram $out/bin/prosody \
--prefix LUA_PATH ';' "$luaEnvPath" \
--prefix LUA_CPATH ';' "$luaEnvCPath"
wrapProgram $out/bin/prosodyctl \
--add-flags '--config "/etc/prosody/prosody.cfg.lua"' \
--prefix LUA_PATH ';' "$luaEnvPath" \
--prefix LUA_CPATH ';' "$luaEnvCPath"
--add-flags '--config "/etc/prosody/prosody.cfg.lua"'
make -C tools/migration install
wrapProgram $out/bin/prosody-migrator \
--prefix LUA_PATH ';' "$luaEnvPath" \
--prefix LUA_CPATH ';' "$luaEnvCPath"
'';
passthru = {
@ -95,6 +82,6 @@ stdenv.mkDerivation rec {
license = licenses.mit;
homepage = "https://prosody.im";
platforms = platforms.linux;
maintainers = with maintainers; [ fpletz globin ninjatrappeur ];
maintainers = with maintainers; [ fpletz globin ];
};
}