From fc7ab1b9d897348c5a6672ce2019839288cdccd1 Mon Sep 17 00:00:00 2001
From: nibon7 <nibon7@163.com>
Date: Mon, 15 Mar 2021 12:24:13 +0800
Subject: [PATCH] testing/nushell: new aport

Closes #12522

Signed-off-by: nibon7 <nibon7@163.com>
---
 ...o-test-failed-with-release-3183-3184.patch | 35 +++++++++++++++++++
 testing/nushell/APKBUILD                      | 29 +++++++++++++++
 2 files changed, 64 insertions(+)
 create mode 100644 testing/nushell/0001-fix-cargo-test-failed-with-release-3183-3184.patch
 create mode 100644 testing/nushell/APKBUILD

diff --git a/testing/nushell/0001-fix-cargo-test-failed-with-release-3183-3184.patch b/testing/nushell/0001-fix-cargo-test-failed-with-release-3183-3184.patch
new file mode 100644
index 000000000000..79ff567cfcee
--- /dev/null
+++ b/testing/nushell/0001-fix-cargo-test-failed-with-release-3183-3184.patch
@@ -0,0 +1,35 @@
+From 82b6300dcb0874cf1b9c85675107a56b5b732390 Mon Sep 17 00:00:00 2001
+From: nibon7 <nibon7@163.com>
+Date: Mon, 15 Mar 2021 11:59:04 +0800
+Subject: [PATCH] fix: cargo test failed with --release (#3183) (#3184)
+
+Signed-off-by: nibon7 <nibon7@163.com>
+---
+ crates/nu-test-support/src/fs.rs | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/crates/nu-test-support/src/fs.rs b/crates/nu-test-support/src/fs.rs
+index c9ef2fa2..74ba94b9 100644
+--- a/crates/nu-test-support/src/fs.rs
++++ b/crates/nu-test-support/src/fs.rs
+@@ -246,10 +246,15 @@ pub fn root() -> PathBuf {
+ }
+ 
+ pub fn binaries() -> PathBuf {
++    let mut build_type = "debug";
++    if !cfg!(debug_assertions) {
++        build_type = "release"
++    }
++
+     std::env::var("CARGO_TARGET_DIR")
+         .ok()
+-        .map(|target_dir| PathBuf::from(target_dir).join("debug"))
+-        .unwrap_or_else(|| root().join("target/debug"))
++        .map(|target_dir| PathBuf::from(target_dir).join(&build_type))
++        .unwrap_or_else(|| root().join(format!("target/{}", &build_type)))
+ }
+ 
+ pub fn fixtures() -> PathBuf {
+-- 
+2.26.2
+
diff --git a/testing/nushell/APKBUILD b/testing/nushell/APKBUILD
new file mode 100644
index 000000000000..c5071f8637a3
--- /dev/null
+++ b/testing/nushell/APKBUILD
@@ -0,0 +1,29 @@
+# Contributor: nibon7 <nibon7@163.com>
+# Maintainer: nibon7 <nibon7@163.com>
+pkgname=nushell
+pkgver=0.28.0
+pkgrel=0
+pkgdesc="A new type of shell"
+url="https://www.nushell.sh"
+arch="all !s390x !mips !mips64 !ppc64le" # limited by cargo, crate ring failed to build on ppc64le
+license="MIT"
+makedepends="cargo pkgconf openssl-dev"
+source="$pkgname-$pkgver.tar.gz::https://github.com/nushell/nushell/archive/$pkgver.tar.gz
+	0001-fix-cargo-test-failed-with-release-3183-3184.patch
+	"
+
+build() {
+	cargo build --release --locked
+}
+
+check() {
+	cargo test --release --locked
+}
+
+package() {
+	cargo install --locked --path . --root="$pkgdir/usr"
+	rm "$pkgdir"/usr/.crates*
+}
+
+sha512sums="41c4a0d61c840ab55707479b80f2f16797f83af333ba2dfc91c3fa1fa345abfa98c8be4e7153da6f2d71e8a1fcbff512361fe24adcbd5e0ff7f5c08e8de0e0dd  nushell-0.28.0.tar.gz
+ba9422ddfa93a0c41c8056a43d035ca6caf6f59dfbf4b75e0541b74efcb6e51fb811f9650e9b1f7bb5a8e56d7531e21c645661b493cfee9bfcdd36a6fc31ccdd  0001-fix-cargo-test-failed-with-release-3183-3184.patch"
-- 
GitLab