app-misc/zellij: update patch

Signed-off-by: Alessandro Barbieri <lssndrbarbieri@gmail.com>
This commit is contained in:
Alessandro Barbieri
2022-03-17 10:42:13 +01:00
parent c522d472e9
commit 52e0eee766
2 changed files with 57 additions and 34 deletions

View File

@@ -1,7 +1,7 @@
From 22cff5439ca33c0beafd6a77c160959dff7fddf7 Mon Sep 17 00:00:00 2001
From: a-kenji <aks.kenji@protonmail.com>
Date: Wed, 16 Mar 2022 21:49:41 +0100
Subject: [PATCH 1/3] fix(feat): `disable_automatic_asset_installation`
Subject: [PATCH 1/4] fix(feat): `disable_automatic_asset_installation`
This fixes a regression in the feature system:
The asset installation didn't get turned off by the feature.
@@ -20,16 +20,6 @@ Alternative:
normal asset installation.
fixes #1130
---
Cargo.toml | 2 +-
src/commands.rs | 1 -
src/install.rs | 14 +++++++++++---
zellij-server/src/wasm_vm.rs | 4 +++-
zellij-utils/Cargo.toml | 2 ++
5 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
index 78457fdcb..e522a11f1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -64,4 +64,4 @@ bin-dir = "{ bin }{ binary-ext }"
@@ -38,8 +28,6 @@ index 78457fdcb..e522a11f1 100644
[features]
-disable_automatic_asset_installation = []
+disable_automatic_asset_installation = [ "zellij-utils/disable_automatic_asset_installation" ]
diff --git a/src/commands.rs b/src/commands.rs
index 542741343..cfbcb8f08 100644
--- a/src/commands.rs
+++ b/src/commands.rs
@@ -89,7 +89,6 @@ fn create_new_client() -> ClientInfo {
@@ -50,8 +38,6 @@ index 542741343..cfbcb8f08 100644
populate_data_dir(&data_dir);
}
diff --git a/src/install.rs b/src/install.rs
index e7778dde2..3ba682e75 100644
--- a/src/install.rs
+++ b/src/install.rs
@@ -1,7 +1,10 @@
@@ -91,8 +77,6 @@ index e7778dde2..3ba682e75 100644
+
+#[cfg(feature = "disable_automatic_asset_installation")]
+pub(crate) fn populate_data_dir(_data_dir: &Path) {}
diff --git a/zellij-server/src/wasm_vm.rs b/zellij-server/src/wasm_vm.rs
index ebea0b8c9..68867fd7d 100644
--- a/zellij-server/src/wasm_vm.rs
+++ b/zellij-server/src/wasm_vm.rs
@@ -92,7 +92,9 @@ pub(crate) fn wasm_thread_main(
@@ -106,8 +90,6 @@ index ebea0b8c9..68867fd7d 100644
loop {
let (event, mut err_ctx) = bus.recv().expect("failed to receive event on channel");
diff --git a/zellij-utils/Cargo.toml b/zellij-utils/Cargo.toml
index 4e837f5a1..1e3223dd9 100644
--- a/zellij-utils/Cargo.toml
+++ b/zellij-utils/Cargo.toml
@@ -46,3 +46,5 @@ features = ["unstable"]
@@ -120,14 +102,8 @@ index 4e837f5a1..1e3223dd9 100644
From e4cc8bc1e6b029ba7c61b12b60fc2916bd181157 Mon Sep 17 00:00:00 2001
From: a-kenji <aks.kenji@protonmail.com>
Date: Thu, 17 Mar 2022 08:13:08 +0100
Subject: [PATCH 2/3] fixup: make assets installation more robust
Subject: [PATCH 2/4] fixup: make assets installation more robust
---
src/install.rs | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/install.rs b/src/install.rs
index 3ba682e75..047c23707 100644
--- a/src/install.rs
+++ b/src/install.rs
@@ -32,12 +32,17 @@ pub(crate) fn populate_data_dir(data_dir: &Path) {
@@ -158,15 +134,9 @@ index 3ba682e75..047c23707 100644
From 3506ca50de0ab5443479011e44f750845f6bf5e1 Mon Sep 17 00:00:00 2001
From: a-kenji <aks.kenji@protonmail.com>
Date: Thu, 17 Mar 2022 08:22:09 +0100
Subject: [PATCH 3/3] fix(feat): disable `mkdir` in `wasm_vm`
Subject: [PATCH 3/4] fix(feat): disable `mkdir` in `wasm_vm`
disable `mkdir` in `wasm_vm` on `feature-disable-asset-installation`
---
zellij-server/src/wasm_vm.rs | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/zellij-server/src/wasm_vm.rs b/zellij-server/src/wasm_vm.rs
index 68867fd7d..d4796a3a7 100644
--- a/zellij-server/src/wasm_vm.rs
+++ b/zellij-server/src/wasm_vm.rs
@@ -272,7 +272,14 @@ fn start_plugin(
@@ -185,3 +155,56 @@ index 68867fd7d..d4796a3a7 100644
let mut wasi_env = WasiState::new("Zellij")
.env("CLICOLOR_FORCE", "1")
From be35cf5731aa786cbac85491f260321be3953a88 Mon Sep 17 00:00:00 2001
From: a-kenji <aks.kenji@protonmail.com>
Date: Thu, 17 Mar 2022 10:25:15 +0100
Subject: [PATCH 4/4] fixup! Use `cache_directory` for plugin hashes
Use `cache_directory` rather than the `plugin_directory`
for plugin hashes.
--- /dev/null
+++ b/update-toolchain.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+set -euxo pipefail
+
+get_latest_release() {
+ curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
+ grep '"tag_name":'
+ #| # Get tag line
+ #sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
+}
+
+get_latest_release "$1"
--- a/zellij-server/src/wasm_vm.rs
+++ b/zellij-server/src/wasm_vm.rs
@@ -29,7 +29,7 @@ use crate::{
};
use zellij_utils::{
- consts::{VERSION, ZELLIJ_PROJ_DIR, ZELLIJ_TMP_DIR},
+ consts::{VERSION, ZELLIJ_PROJ_DIR, ZELLIJ_TMP_DIR, ZELLIJ_CACHE_DIR},
errors::{ContextType, PluginContext},
};
use zellij_utils::{
@@ -271,8 +271,7 @@ fn start_plugin(
let output = Pipe::new();
let input = Pipe::new();
let stderr = LoggingPipe::new(&plugin.location.to_string(), plugin_id);
- let plugin_own_data_dir = plugin_global_data_dir.join(Url::from(&plugin.location).to_string());
- #[cfg(not(feature = "disable_automatic_asset_installation"))]
+ let plugin_own_data_dir = ZELLIJ_CACHE_DIR.join(Url::from(&plugin.location).to_string());
fs::create_dir_all(&plugin_own_data_dir).unwrap_or_else(|e| {
log::error!(
"Could not create plugin_own_data_dir in {:?} \n Error: {:?}",
--- a/zellij-utils/src/consts.rs
+++ b/zellij-utils/src/consts.rs
@@ -53,6 +53,7 @@ lazy_static! {
pub static ref ZELLIJ_TMP_DIR: PathBuf = PathBuf::from(format!("/tmp/zellij-{}", *UID));
pub static ref ZELLIJ_TMP_LOG_DIR: PathBuf = ZELLIJ_TMP_DIR.join("zellij-log");
pub static ref ZELLIJ_TMP_LOG_FILE: PathBuf = ZELLIJ_TMP_LOG_DIR.join("zellij.log");
+ pub static ref ZELLIJ_CACHE_DIR: PathBuf = ZELLIJ_PROJ_DIR.cache_dir().to_path_buf();
}
pub const FEATURES: &[&str] = &[

View File

@@ -324,7 +324,7 @@ BDEPEND="
QA_FLAGS_IGNORED="usr/bin/zellij"
PATCHES=( "${FILESDIR}/1226.patch" )
PATCHES=( "${FILESDIR}/${PN}-PR-1226.patch" )
src_configure() {
local myfeatures=(