1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-24 05:00:07 +00:00

Squashed 'gitstatus/' changes from e02d9eed..6eb490ab

6eb490ab survive broken $TMPDIR
94bf4fc2 add ppc64 support to the build script

git-subtree-dir: gitstatus
git-subtree-split: 6eb490ab86118ad063224e4d50b6b05bea7dd12c
This commit is contained in:
Roman Perepelitsa 2022-01-26 14:45:50 +01:00
parent c8160f2954
commit 5014de0541
4 changed files with 34 additions and 17 deletions

12
build
View file

@ -145,8 +145,12 @@ cpus="$(command getconf _NPROCESSORS_ONLN 2>/dev/null)" ||
cpus=8
case "$gitstatus_cpu" in
powerpc64le) archflag="-mcpu";;
*) archflag="-march";;
powerpc64|powerpc64le)
archflag="-mcpu"
;;
*)
archflag="-march"
;;
esac
cflags="$archflag=$gitstatus_cpu -fno-plt -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fpie"
@ -520,7 +524,7 @@ if [ -z "$gitstatus_cpu" ]; then
armv6l|armhf) gitstatus_cpu=armv6;;
armv7l) gitstatus_cpu=armv7;;
arm64|aarch64) gitstatus_cpu=armv8-a;;
ppc64le) gitstatus_cpu=powerpc64le;;
ppc64|ppc64le) gitstatus_cpu=powerpc64le;;
riscv64) gitstatus_cpu=rv64imafdc;;
loongarch64) gitstatus_cpu=loongarch64;;
x86_64|amd64) gitstatus_cpu=x86-64;;
@ -559,7 +563,7 @@ case "$gitstatus_kernel" in
armv6l|armhf) docker_image=arm32v6/alpine:3.11.6;;
armv7l) docker_image=arm32v7/alpine:3.11.6;;
aarch64) docker_image=arm64v8/alpine:3.11.6;;
ppc64le) docker_image=ppc64le/alpine:3.11.6;;
ppc64|ppc64le) docker_image=ppc64le/alpine:3.11.6;;
s390x) docker_image=s390x/alpine:3.11.6;;
*)
>&2 echo '[error] unable to infer docker image'

View file

@ -121,7 +121,12 @@ function gitstatus_start() {
--repo-ttl-seconds="$ttl"
$extra_flags)
tmpdir="$(command mktemp -d "${TMPDIR:-/tmp}"/gitstatus.bash.$$.XXXXXXXXXX)" || return
if [[ -n "$TMPDIR" && ( ( -d "$TMPDIR" && -w "$TMPDIR" ) || ! ( -d /tmp && -w /tmp ) ) ]]; then
local tmpdir=$TMPDIR
else
local tmpdir=/tmp
fi
tmpdir="$(command mktemp -d "$tmpdir"/gitstatus.bash.$$.XXXXXXXXXX)" || return
if [[ -n "$log_level" ]]; then
GITSTATUS_DAEMON_LOG="$tmpdir"/daemon.log

View file

@ -574,7 +574,12 @@ function gitstatus_start"${1:-}"() {
else
typeset -gi _GITSTATUS_START_COUNTER
local log_level=$GITSTATUS_LOG_LEVEL
local file_prefix=${${TMPDIR:-/tmp}:A}/gitstatus.$name.$EUID
if [[ -n "$TMPDIR" && ( ( -d "$TMPDIR" && -w "$TMPDIR" ) || ! ( -d /tmp && -w /tmp ) ) ]]; then
local tmpdir=$TMPDIR
else
local tmpdir=/tmp
fi
local file_prefix=${tmpdir:A}/gitstatus.$name.$EUID
file_prefix+=.$sysparams[pid].$EPOCHSECONDS.$((++_GITSTATUS_START_COUNTER))
(( GITSTATUS_ENABLE_LOGGING )) && : ${log_level:=INFO}
if [[ -n $log_level ]]; then

25
install
View file

@ -245,27 +245,30 @@ END
return 1
fi
local tmpdir
if [ -n "$TMPDIR" -a '(' '(' -d "$TMPDIR" -a -w "$TMPDIR" ')' -o '!' '(' -d /tmp -a -w /tmp ')' ')' ]; then
local tmp="$TMPDIR"
else
local tmp=/tmp
fi
if ! command -v mktemp >/dev/null 2>&1 ||
! tmpdir="$(command mktemp -d "${TMPDIR:-/tmp}"/gitstatus-install.XXXXXXXXXX)"; then
tmpdir="${TMPDIR:-/tmp}/gitstatus-install.tmp.$$"
! tmpdir="$(command mktemp -d "$tmp"/gitstatus-install.XXXXXXXXXX)"; then
tmpdir="$tmp/gitstatus-install.tmp.$$"
if ! mkdir -p -- "$tmpdir"; then
local dir="${TMPDIR:-/tmp}"
if [ -z "${TMPDIR:-}" ]; then
if [ "$tmp" = /tmp ]; then
local label='directory'
else
local label='directory (\033[1mTMPDIR\033[m)'
fi
if [ ! -e "$dir" ]; then
>&"$e" printf 'Temporary '"$label"' does not exist: \033[4;31m%s\033[0m\n' "$dir"
if [ ! -e "$tmp" ]; then
>&"$e" printf 'Temporary '"$label"' does not exist: \033[4;31m%s\033[0m\n' "$tmp"
>&"$e" printf '\n'
>&"$e" printf 'Create it, then restart your shell.\n'
elif [ ! -d "$dir" ]; then
>&"$e" printf 'Not a '"$label"': \033[4;31m%s\033[0m\n' "$dir"
elif [ ! -d "$tmp" ]; then
>&"$e" printf 'Not a '"$label"': \033[4;31m%s\033[0m\n' "$tmp"
>&"$e" printf '\n'
>&"$e" printf 'Make it a directory, then restart your shell.\n'
elif [ ! -w "$dir" ]; then
>&"$e" printf 'Temporary '"$label"' is not writable: \033[4;31m%s\033[0m\n' "$dir"
elif [ ! -w "$tmp" ]; then
>&"$e" printf 'Temporary '"$label"' is not writable: \033[4;31m%s\033[0m\n' "$tmp"
>&"$e" printf '\n'
>&"$e" printf 'Make it writable, then restart your shell.\n'
fi