From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id QDIpCik+CGFxUAEAgWs5BA (envelope-from ) for ; Mon, 02 Aug 2021 20:49:13 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id CMrIBSk+CGE7fwAAB5/wlQ (envelope-from ) for ; Mon, 02 Aug 2021 18:49:13 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 69ED080CF for ; Mon, 2 Aug 2021 20:49:12 +0200 (CEST) Received: from localhost ([::1]:41976 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mAczv-0005oN-Ep for larch@yhetil.org; Mon, 02 Aug 2021 14:49:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55366) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mAczl-0005o9-U4 for guix-patches@gnu.org; Mon, 02 Aug 2021 14:49:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:55976) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mAczl-0006SE-Mn for guix-patches@gnu.org; Mon, 02 Aug 2021 14:49:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mAczl-00014e-Mc for guix-patches@gnu.org; Mon, 02 Aug 2021 14:49:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49828] [PATCH 02/20] gnu: minetest: Search for mods in MINETEST_MOD_PATH. Resent-From: Leo Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 02 Aug 2021 18:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49828 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxime Devos , 49828@debbugs.gnu.org Received: via spool by 49828-submit@debbugs.gnu.org id=B49828.16279300854061 (code B ref 49828); Mon, 02 Aug 2021 18:49:01 +0000 Received: (at 49828) by debbugs.gnu.org; 2 Aug 2021 18:48:05 +0000 Received: from localhost ([127.0.0.1]:39289 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mAcyr-00013Q-4L for submit@debbugs.gnu.org; Mon, 02 Aug 2021 14:48:05 -0400 Received: from mailrelay.tugraz.at ([129.27.2.202]:56831) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mAcyo-00012y-CB for 49828@debbugs.gnu.org; Mon, 02 Aug 2021 14:48:04 -0400 Received: from [10.0.0.4] (194-118-35-216.adsl.highway.telekom.at [194.118.35.216]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4Gdn7f4dsqz1LB21; Mon, 2 Aug 2021 20:47:58 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 mailrelay.tugraz.at 4Gdn7f4dsqz1LB21 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1627930078; bh=xlGVtFNV6ChTU+yG8/BPcFImcMFN2mOwYDMt37twQjA=; h=Subject:From:To:Date:In-Reply-To:References:From; b=nB5boUk1L+oI3lQ6c4VVfJOwae65GNz5SoCaHGe8BpzxW+s7pF/M5kJBO/HYC1K1N EW1L4lf/D4DOBcZGlzMLUS80oGixI4X3+2HzUBYP/WQvgxLY0fSiCyIrd/Epekazt7 NNcBfHRFtKt/zA1JZ2260Ix31cyg4/Uu6N4DZE1E= Message-ID: <19c7cec42e57899c62ba6b4ff7f297a3e5bc2be4.camel@student.tugraz.at> From: Leo Prikler Date: Mon, 02 Aug 2021 20:47:37 +0200 In-Reply-To: <97f899a616812a0086a68ee97c36d1531e04c2e3.camel@telenet.be> References: <20210802155019.6122-1-maximedevos@telenet.be> <20210802155019.6122-2-maximedevos@telenet.be> <87207455fefb91bb3e12fdb3209f28f11dab92e0.camel@student.tugraz.at> <97f899a616812a0086a68ee97c36d1531e04c2e3.camel@telenet.be> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-TUG-Backscatter-control: bt4lQm5Tva3SBgCuw0EnZw X-Spam-Scanner: SpamAssassin 3.003001 X-Spam-Score-relay: -1.9 X-Scanned-By: MIMEDefang 2.74 on 129.27.10.117 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1627930152; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=xlGVtFNV6ChTU+yG8/BPcFImcMFN2mOwYDMt37twQjA=; b=hZnZTA4UlzQ9jWGlrzFQGXRkvINh6BMBpw9roVk9fNHJiEzl3dLwIvlxLauTyqfRz680s/ PHTnP0+CtSjlGGX59DFnlXs8JU3lxST54oNoGic2GT8l63wwYVld6ayEdxIuoLWsMwrbRW C8ztrICcSv/+xXkrbhVr+meLyHKlHOTD8VRwDiuIEiKpFU+dsEQb9txPVFHOX2esaQQf4V Wx8Wvr8U+35S8Bvrbalu550WYEvQaa+S0EKVeBBAPAYFQHt4pHCJ5Tzbemc3qlI3w5tTwt gEoPvPQwbhwPg1qwp7z0w7MOEmQrN4IYpQDeXDoJkCMfwNq8tBY414iWQxowxg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1627930152; a=rsa-sha256; cv=none; b=qr57+qT/hzFJlKEoMspQj6yfvj5GGRroVxY0rdo/PACmQDVXE9smy/1bXSNtwyi/rJiSr4 qZE53yjMiDWNVzrYJBeBlNyXNg+0jZSzseyXNuS79IsnAxUCTdXTwSrcsQCXTBMZypK3Yz YrGcfAR3HIC3Td9ZAD1C0gsh+7ISaZ9Df79Ef9mImp5V7SOrMpF5sDnvwPBpqkXP4vt2iS yU2z3pZjFkje+wEAS7GaS4Yhg2+/zWhHGLbRkDjGV+G1tejkin+7vUEg4JtFvVZDs1sTYR fruh4lJ9J+OqhlUWitlN/98HgTJL18XxLHFzpm1Os0KU/z9BqTMeYMICtwO64w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tugraz.at header.s=mailrelay header.b=nB5boUk1; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -1.32 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tugraz.at header.s=mailrelay header.b=nB5boUk1; dmarc=fail reason="SPF not aligned (relaxed)" header.from=student.tugraz.at (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 69ED080CF X-Spam-Score: -1.32 X-Migadu-Scanner: scn0.migadu.com X-TUID: rwpwl7LBR45j Am Montag, den 02.08.2021, 19:53 +0200 schrieb Maxime Devos: > > > +This patch as-is is not yet ready for upstream, because: > > > + > > > + * the GUI will only display mods in MINETEST_MOD_PATH > > > + or mods in ~/.minetest/mods, it won't combine the two > > > + > > > + * the GUI for installing mods from ContentDB is disabled > > > + when MINETEST_MOD_PATH is set, because otherwise Minetest > > > + would try to install mods in the store. > > These two are fine for a "Guix-only" patch, although I do think we > > should still read ~/.minetest/mods for backwards compatibility. > > ~/.minetest/mods is still read when MINETEST_MOD_PATH is unset. > MINETEST_MOD_PATH is only set when some mod is actually installed. > So backwards compatibility should be ok. I mean in the sense of "have some mods in ~/.minetest/mods, that aren't yet packaged in Guix and have the rest sit in the profile where they belong". Not everyone will like the the import to manifest approach that is needed while you're waiting for review. > > > + * MINETEST_MOD_PATH can only have a single component > > This one seems kinda arbitrary, though, and does not fit well with > > MINETEST_SUBGAME_PATH. > > Yes, I know. I didn't know how to adjust pkgmgr.lua and > dlg_contentstore.lua > to support multiple components, though I have an idea now to try. > > > > + -- Unordered preserves the original order of the ContentDB API, > > > + -- before the package list is ordered based on installed state. > > > +diff --git a/src/content/subgames.cpp b/src/content/subgames.cpp > > > +index e9dc609b0..1809f189e 100644 > > > +--- a/src/content/subgames.cpp > > > ++++ b/src/content/subgames.cpp > > > +@@ -110,6 +110,9 @@ SubgameSpec findSubgame(const std::string > > > &id) > > > + std::set mods_paths; > > > + if (!user_game) > > > + mods_paths.insert(share + DIR_DELIM + "mods"); > > > ++ const char *env_mod_path = getenv("MINETEST_MOD_PATH"); > > > ++ if (env_mod_path) > > > ++ mods_paths.insert(std::string(env_mod_path)); > > Here, I would instead use an std::istringstream together with > > std::getline(<>, <>, ':') to get the components of > > MINETEST_MOD_PATH > > and insert each of them. Either that or copy whatever is used for > > MINETEST_SUBGAME_PATH. > > Minetest has a class 'Strfnd' supporting iteration. Using that, > it should be easy to allow MINETEST_MOD_PATH to contain ":" > seperators. > However, the GUI client code (pkgmgr.lua) > uses some other logic for determining which mods exists, and > currently, > that logic does not support ":" separators. Hmm, how important is the GUI side here? Can we sneek mods into it? > > > +diff --git a/src/script/lua_api/l_mainmenu.cpp > > > b/src/script/lua_api/l_mainmenu.cpp > > > +index ad00de1c4..737550c42 100644 > > > +--- a/src/script/lua_api/l_mainmenu.cpp > > > ++++ b/src/script/lua_api/l_mainmenu.cpp > > > +@@ -495,9 +495,19 @@ int > > > ModApiMainMenu::l_get_user_path(lua_State > > > *L) > > > + > > > /**************************************************************** > > > **** > > > **********/ > > > + int ModApiMainMenu::l_get_modpath(lua_State *L) > > > + { > > > ++ const char *c_modpath = getenv("MINETEST_MOD_PATH"); > > > + std::string modpath = fs::RemoveRelativePathComponents( > > > + porting::path_user + DIR_DELIM + "mods" + > > > DIR_DELIM); > > > +- lua_pushstring(L, modpath.c_str()); > > > ++ if (c_modpath == NULL) > > > ++ c_modpath = modpath.c_str(); > > > ++ lua_pushstring(L, c_modpath); > > > ++ return 1; > > > ++} > > > ++ > > > ++/************************************************************** > > > **** > > > ************/ > > > ++int ModApiMainMenu::l_mod_path_set(lua_State *L) > > > ++{ > > > ++ lua_pushboolean(L, NULL != > > > getenv("MINETEST_MOD_PATH")); > > > + return 1; > > > + } > > > + > > > +@@ -855,6 +865,7 @@ void ModApiMainMenu::Initialize(lua_State > > > *L, > > > int top) > > > + API_FCT(get_mapgen_names); > > > + API_FCT(get_user_path); > > > + API_FCT(get_modpath); > > > ++ API_FCT(mod_path_set); > > > + API_FCT(get_clientmodpath); > > > + API_FCT(get_gamepath); > > > + API_FCT(get_texturepath); > > > +@@ -888,6 +899,7 @@ void > > > ModApiMainMenu::InitializeAsync(lua_State > > > *L, int top) > > > + API_FCT(get_mapgen_names); > > > + API_FCT(get_user_path); > > > + API_FCT(get_modpath); > > > ++ API_FCT(mod_path_set); > > > + API_FCT(get_clientmodpath); > > > + API_FCT(get_gamepath); > > > + API_FCT(get_texturepath); > > > +diff --git a/src/script/lua_api/l_mainmenu.h > > > b/src/script/lua_api/l_mainmenu.h > > > +index ec2d20da2..719c26077 100644 > > > +--- a/src/script/lua_api/l_mainmenu.h > > > ++++ b/src/script/lua_api/l_mainmenu.h > > > +@@ -112,6 +112,8 @@ class ModApiMainMenu: public ModApiBase > > > + > > > + static int l_get_modpath(lua_State *L); > > > + > > > ++ static int l_mod_path_set(lua_State *L); > > > ++ > > > + static int l_get_clientmodpath(lua_State *L); > > > + > > > + static int l_get_gamepath(lua_State *L); > > > +-- > > > +2.32.0 > > What are these modpaths used for? For mod installation or for > > querying mod existence? If it's the former, you could leave them > > as-is, similar to how elpa stays enabled in Emacs. > > It is only used by the GUI. The GUI looks in the directory returned > by "get_modpath" for two things: > > (1) to determine which mods exist (and to find their descriptions, > their dependency list, screenshots ...). Only the mods that > exist there can be enabled. > > (2) to determine where mods must be installed when using Minetest's > built-in installer. I see. Is this the same GUI for all parts or different GUIs? I think if we can handle the world creation parts, everything should be fine, no? Regards,