nushell: update to 0.68.0

This commit is contained in:
Chongyun Lee 2022-09-07 13:03:50 +08:00 committed by Uchiha Kakashi
parent b547cd4704
commit 847797efe4
3 changed files with 80 additions and 5 deletions

View File

@ -2,9 +2,9 @@ TERMUX_PKG_HOMEPAGE=https://www.nushell.sh
TERMUX_PKG_DESCRIPTION="A new type of shell operating on structured data"
TERMUX_PKG_LICENSE="MIT"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="0.67.0"
TERMUX_PKG_VERSION="0.68.0"
TERMUX_PKG_SRCURL=https://github.com/nushell/nushell/archive/$TERMUX_PKG_VERSION.tar.gz
TERMUX_PKG_SHA256=a8c4c092087d035805781dff11000f2b7c4a44ae487b013f9d0a59c4dc610546
TERMUX_PKG_SHA256=c170ce2a0fa931194c8169585608747fea0cbf7c957f67c6e2fd54c0c5071c64
TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_DEPENDS="openssl, zlib"
TERMUX_PKG_AUTO_UPDATE=true
@ -31,6 +31,8 @@ termux_step_pre_configure() {
: "${CARGO_HOME:=$HOME/.cargo}"
export CARGO_HOME
rm -rf $CARGO_HOME/registry/src/github.com-*/libgit2-sys-*
rm -rf $CARGO_HOME/registry/src/github.com-*/pwd-*
cargo fetch --target "${CARGO_TARGET_NAME}"
for d in $CARGO_HOME/registry/src/github.com-*/libgit2-sys-*/libgit2; do
@ -39,6 +41,10 @@ termux_step_pre_configure() {
cp $TERMUX_SCRIPTDIR/packages/libgit2/getloadavg.c ${d}/src/ || :
done
for d in $CARGO_HOME/registry/src/github.com-*/pwd-*; do
patch --silent -p1 -d ${d} < $TERMUX_PKG_BUILDER_DIR/crates-pwd-for-android.diff || :
done
mv $TERMUX_PREFIX/lib/libz.so.1{,.tmp}
mv $TERMUX_PREFIX/lib/libz.so{,.tmp}

View File

@ -0,0 +1,55 @@
diff -uNr pwd-1.4.0/src/unix.rs pwd-1.4.0.mod/src/unix.rs
--- pwd-1.4.0/src/unix.rs
+++ pwd-1.4.0.mod/src/unix.rs
@@ -1,4 +1,6 @@
-use libc::{c_char, endpwent, getpwent, getpwnam, getpwuid, getuid, passwd, setpwent};
+use libc::{c_char, getpwnam, getpwuid, getuid, passwd};
+#[cfg(not(target_os = "android"))]
+use libc::{endpwent, getpwent, setpwent};
use std::ffi::{CStr, CString};
use crate::errors::{PwdError, Result};
@@ -40,6 +42,7 @@
impl Iterator for PasswdIter {
type Item = Passwd;
+ #[cfg(not(target_os = "android"))]
fn next(&mut self) -> Option<Self::Item> {
if !self.inited {
unsafe {
@@ -63,6 +66,11 @@
None
}
}
+
+ #[cfg(target_os = "android")]
+ fn next(&mut self) -> Option<Self::Item> {
+ None
+ }
}
fn cstr_to_string(cstr: *const c_char) -> Result<String> {
@@ -86,10 +94,19 @@
Some(cstr_to_string(pwd.pw_passwd)?)
};
- let gecos = if pwd.pw_gecos.is_null() {
- None
- } else {
- Some(cstr_to_string(pwd.pw_gecos)?)
+ let gecos = {
+ #[cfg(not(all(target_os = "android", target_pointer_width = "32")))]
+ {
+ if pwd.pw_gecos.is_null() {
+ None
+ } else {
+ Some(cstr_to_string(pwd.pw_gecos)?)
+ }
+ }
+ #[cfg(all(target_os = "android", target_pointer_width = "32"))]
+ {
+ None
+ }
};
Ok(Passwd {

View File

@ -1,12 +1,26 @@
--- a/crates/nu-path/src/tilde.rs
+++ b/crates/nu-path/src/tilde.rs
@@ -53,6 +53,12 @@
@@ -1,4 +1,4 @@
-#[cfg(all(unix, not(target_os = "macos")))]
+#[cfg(all(unix, not(target_os = "macos"), not(target_os = "android")))]
use pwd::Passwd;
use std::path::{Path, PathBuf};
@@ -45,7 +45,7 @@
}
}
-#[cfg(all(unix, not(target_os = "macos")))]
+#[cfg(all(unix, not(target_os = "macos"), not(target_os = "android")))]
fn user_home_dir(username: &str) -> PathBuf {
let passwd = Passwd::from_name(username);
match &passwd.ok() {
@@ -60,6 +60,11 @@
// Returns home dir of user.
}
+#[cfg(target_os = "android")]
+#[allow(unused)]
+fn user_home_dir(username: &str) -> PathBuf {
+fn user_home_dir(_username: &str) -> PathBuf {
+ PathBuf::from(String::from("@TERMUX_HOME@"))
+}
+