diff --git a/0001-zsh-5.9-do-not-use-egrep-in-tests.patch b/0001-zsh-5.9-do-not-use-egrep-in-tests.patch new file mode 100644 index 0000000000000000000000000000000000000000..4d5a1cf911a29d261a07e78e67ee3549546e3f16 --- /dev/null +++ b/0001-zsh-5.9-do-not-use-egrep-in-tests.patch @@ -0,0 +1,178 @@ +From 6935aa4b515fe9b782507820c77ab681136470bc Mon Sep 17 00:00:00 2001 +From: Jun-ichi Takimoto +Date: Thu, 15 Sep 2022 18:56:20 +0900 +Subject: [PATCH] 50629: do not use egrep in tests + +Upstream-commit: 4fc5dc0292acd77f17281f451774ba2ca4203026 +Signed-off-by: Kamil Dudka +--- + Test/D07multibyte.ztst | 16 ++-------------- + Test/E01options.ztst | 2 +- + Test/V07pcre.ztst | 16 ++-------------- + Test/X02zlevi.ztst | 11 +---------- + Test/X03zlebindkey.ztst | 11 +---------- + Test/Y01completion.ztst | 11 +---------- + Test/ztst.zsh | 15 +++++++++++++++ + 7 files changed, 23 insertions(+), 59 deletions(-) + +diff --git a/Test/D07multibyte.ztst b/Test/D07multibyte.ztst +index e2e9a25..6909346 100644 +--- a/Test/D07multibyte.ztst ++++ b/Test/D07multibyte.ztst +@@ -1,19 +1,7 @@ + %prep + +-# Find a UTF-8 locale. +- setopt multibyte +-# Don't let LC_* override our choice of locale. +- unset -m LC_\* +- mb_ok= +- langs=(en_{US,GB}.{UTF-,utf}8 en.UTF-8 +- $(locale -a 2>/dev/null | egrep 'utf8|UTF-8')) +- for LANG in $langs; do +- if [[ é = ? ]]; then +- mb_ok=1 +- break; +- fi +- done +- if [[ -z $mb_ok ]]; then ++ LANG=$(ZTST_find_UTF8) ++ if [[ -z $LANG ]]; then + ZTST_unimplemented="no UTF-8 locale or multibyte mode is not implemented" + else + print -u $ZTST_fd Testing multibyte with locale $LANG +diff --git a/Test/E01options.ztst b/Test/E01options.ztst +index 2acbfd3..d38fbed 100644 +--- a/Test/E01options.ztst ++++ b/Test/E01options.ztst +@@ -651,7 +651,7 @@ + >noktarg1 + >0 1 + +- showopt() { setopt | egrep 'localoptions|ksharrays'; } ++ showopt() { echo ${(FM)${(@f)"$(setopt)"}:#(localoptions|ksharrays)*} } + f1() { setopt localoptions ksharrays; showopt } + f2() { setopt ksharrays; showopt } + setopt kshoptionprint +diff --git a/Test/V07pcre.ztst b/Test/V07pcre.ztst +index c9c844d..ca13419 100644 +--- a/Test/V07pcre.ztst ++++ b/Test/V07pcre.ztst +@@ -6,20 +6,8 @@ + return 0 + fi + setopt rematch_pcre +-# Find a UTF-8 locale. +- setopt multibyte +-# Don't let LC_* override our choice of locale. +- unset -m LC_\* +- mb_ok= +- langs=(en_{US,GB}.{UTF-,utf}8 en.UTF-8 +- $(locale -a 2>/dev/null | egrep 'utf8|UTF-8')) +- for LANG in $langs; do +- if [[ é = ? ]]; then +- mb_ok=1 +- break; +- fi +- done +- if [[ -z $mb_ok ]]; then ++ LANG=$(ZTST_find_UTF8) ++ if [[ -z $LANG ]]; then + ZTST_unimplemented="no UTF-8 locale or multibyte mode is not implemented" + else + print -u $ZTST_fd Testing PCRE multibyte with locale $LANG +diff --git a/Test/X02zlevi.ztst b/Test/X02zlevi.ztst +index 8146d67..203c13c 100644 +--- a/Test/X02zlevi.ztst ++++ b/Test/X02zlevi.ztst +@@ -1,16 +1,7 @@ + # Tests of the vi mode of ZLE + + %prep +- unset -m LC_\* +- ZSH_TEST_LANG= +- langs=(en_{US,GB}.{UTF-,utf}8 en.UTF-8 +- $(locale -a 2>/dev/null | egrep 'utf8|UTF-8')) +- for LANG in $langs; do +- if [[ é = ? ]]; then +- ZSH_TEST_LANG=$LANG +- break; +- fi +- done ++ ZSH_TEST_LANG=$(ZTST_find_UTF8) + if ( zmodload zsh/zpty 2>/dev/null ); then + . $ZTST_srcdir/comptest + comptestinit -v -z $ZTST_testdir/../Src/zsh +diff --git a/Test/X03zlebindkey.ztst b/Test/X03zlebindkey.ztst +index 43692a8..5277332 100644 +--- a/Test/X03zlebindkey.ztst ++++ b/Test/X03zlebindkey.ztst +@@ -3,16 +3,7 @@ + # into bindings. The latter is particularly tricky with multibyte sequences. + + %prep +- unset -m LC_\* +- ZSH_TEST_LANG= +- langs=(en_{US,GB}.{UTF-,utf}8 en.UTF-8 +- $(locale -a 2>/dev/null | egrep 'utf8|UTF-8')) +- for LANG in $langs; do +- if [[ é = ? ]]; then +- ZSH_TEST_LANG=$LANG +- break; +- fi +- done ++ ZSH_TEST_LANG=$(ZTST_find_UTF8) + if ( zmodload zsh/zpty 2>/dev/null ); then + . $ZTST_srcdir/comptest + comptestinit -z $ZTST_testdir/../Src/zsh +diff --git a/Test/Y01completion.ztst b/Test/Y01completion.ztst +index 6af0efc..f976f9f 100644 +--- a/Test/Y01completion.ztst ++++ b/Test/Y01completion.ztst +@@ -1,16 +1,7 @@ + # Tests for completion system. + + %prep +- unset -m LC_\* +- ZSH_TEST_LANG= +- langs=(en_{US,GB}.{UTF-,utf}8 en.UTF-8 +- $(locale -a 2>/dev/null | egrep 'utf8|UTF-8')) +- for LANG in $langs; do +- if [[ é = ? ]]; then +- ZSH_TEST_LANG=$LANG +- break; +- fi +- done ++ ZSH_TEST_LANG=$(ZTST_find_UTF8) + if ( zmodload zsh/zpty 2>/dev/null ); then + . $ZTST_srcdir/comptest + mkdir comp.tmp +diff --git a/Test/ztst.zsh b/Test/ztst.zsh +index aca275c..d95b726 100755 +--- a/Test/ztst.zsh ++++ b/Test/ztst.zsh +@@ -37,6 +37,21 @@ emulate -R zsh + # LANG must be passed to child zsh. + export LANG + ++# find UTF-8 locale ++ZTST_find_UTF8 () { ++ setopt multibyte ++ # Don't let LC_* override our choice of locale. ++ unset -m LC_\* ++ local langs=(en_{US,GB}.{UTF-,utf}8 en.UTF-8 ++ ${(M)$(locale -a 2>/dev/null):#*.(utf8|UTF-8)}) ++ for LANG in $langs; do ++ if [[ é = ? ]]; then ++ echo $LANG ++ return ++ fi ++ done ++} ++ + # Don't propagate variables that are set by default in the shell. + typeset +x WORDCHARS + +-- +2.39.0 + diff --git a/dotzprofile b/dotzprofile new file mode 100644 index 0000000000000000000000000000000000000000..9203f7e2c721b86152f5f7c339297a8818915d22 --- /dev/null +++ b/dotzprofile @@ -0,0 +1,12 @@ +# this file is installed as ~/.zprofile for newly created users + +# prepend ~/.local/bin and ~/bin to $PATH unless it is already there +if ! [[ "$PATH" =~ "$HOME/bin" ]] +then + PATH="$HOME/bin:$PATH" +fi +if ! [[ "$PATH" =~ "$HOME/.local/bin:" ]] +then + PATH="$HOME/.local/bin:$PATH" +fi +export PATH diff --git a/dotzshrc b/dotzshrc new file mode 100644 index 0000000000000000000000000000000000000000..9935bec4cd7738be670277e61327e8acad2ef4fe --- /dev/null +++ b/dotzshrc @@ -0,0 +1,34 @@ +# +# .zshrc is sourced in interactive shells. +# It should contain commands to set up aliases, +# functions, options, key bindings, etc. +# + +autoload -U compinit +compinit + +#allow tab completion in the middle of a word +setopt COMPLETE_IN_WORD + +## keep background processes at full speed +#setopt NOBGNICE +## restart running processes on exit +#setopt HUP + +## history +#setopt APPEND_HISTORY +## for sharing history between zsh processes +#setopt INC_APPEND_HISTORY +#setopt SHARE_HISTORY + +## never ever beep ever +#setopt NO_BEEP + +## automatically decide when to page a list of completions +#LISTMAX=0 + +## disable mail checking +#MAILCHECK=0 + +# autoload -U colors +#colors diff --git a/zlogin.rhs b/zlogin.rhs new file mode 100644 index 0000000000000000000000000000000000000000..5b7de4a4877bb87b065c673776f0b2ce64497657 --- /dev/null +++ b/zlogin.rhs @@ -0,0 +1,8 @@ +# +# /etc/zlogin and .zlogin are sourced in login shells. It should +# contain commands that should be executed only in +# login shells. It should be used to set the terminal +# type and run a series of external commands (fortune, +# msgs, from, etc). +# + diff --git a/zlogout.rhs b/zlogout.rhs new file mode 100644 index 0000000000000000000000000000000000000000..3e78094472a05a36ae55e89a7f2a964ab2bb5b73 --- /dev/null +++ b/zlogout.rhs @@ -0,0 +1,7 @@ +# +# +# /etc/zlogout and ~/.zlogout are run when an interactive session ends +# +# + +clear diff --git a/zprofile.rhs b/zprofile.rhs new file mode 100644 index 0000000000000000000000000000000000000000..5e214759d95d5d9a0b2b86f4d04f77ec6375c95d --- /dev/null +++ b/zprofile.rhs @@ -0,0 +1,19 @@ +# +# /etc/zprofile and ~/.zprofile are run for login shells +# + +_src_etc_profile() +{ + # Make /etc/profile happier, and have possible ~/.zshenv options like + # NOMATCH ignored. + # + emulate -L ksh + + # source profile + if [ -f /etc/profile ]; then + source /etc/profile + fi +} +_src_etc_profile + +unset -f _src_etc_profile diff --git a/zsh-5.9.tar.xz b/zsh-5.9.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..7fac164eff1e6a5ffca2601130d757291ea29a56 Binary files /dev/null and b/zsh-5.9.tar.xz differ diff --git a/zsh.spec b/zsh.spec new file mode 100644 index 0000000000000000000000000000000000000000..c06408e1b2618d92d1a1cd15a6a08dc7a540acc9 --- /dev/null +++ b/zsh.spec @@ -0,0 +1,153 @@ +%define anolis_release 1 + +Summary: Powerful interactive shell +Name: zsh +Version: 5.9 +Release: %{anolis_release}%{?dist} +License: MIT +URL: http://zsh.sourceforge.net/ +Source0: https://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.xz +Source1: zlogin.rhs +Source2: zlogout.rhs +Source3: zprofile.rhs +Source4: zshrc.rhs +Source5: zshenv.rhs +Source6: dotzshrc +Source7: dotzprofile + +# do not use egrep in tests to make them pass again +Patch1: 0001-zsh-5.9-do-not-use-egrep-in-tests.patch + +BuildRequires: autoconf +BuildRequires: coreutils +BuildRequires: gawk +BuildRequires: gcc +BuildRequires: gdbm-devel +BuildRequires: glibc-langpack-ja +BuildRequires: libcap-devel +BuildRequires: make +BuildRequires: ncurses-devel +BuildRequires: pcre-devel +BuildRequires: sed +BuildRequires: texi2html +BuildRequires: texinfo +Requires(post): grep +Requires(postun): coreutils grep +BuildRequires: hostname + +Provides: /bin/zsh + +%description +The zsh shell is a command interpreter usable as an interactive login +shell and as a shell script command processor. Zsh resembles the ksh +shell (the Korn shell), but includes many enhancements. Zsh supports +command line editing, built-in spelling correction, programmable +command completion, shell functions (with autoloading), a history +mechanism, and more. + +%package doc +Summary: Documentation files for %{name} +Requires: %{name} = %{version}-%{release} +Provides: %{name}-html = %{version}-%{release} +Obsoletes: %{name}-html < %{version}-%{release} +BuildArch: noarch + +%description doc +The %{name}-doc package contains documentation files and manual +in html format for %{name}. + +%prep +%autosetup -p1 +autoreconf -fiv + +# enable parallel build +sed -e 's|^\.NOTPARALLEL|#.NOTPARALLEL|' -i 'Config/defs.mk.in' + +%build +%undefine _strict_symbol_defs_build +export LIBLDFLAGS='-z lazy' +export zsh_cv_sys_nis='no' + +%configure \ + --enable-etcdir=%{_sysconfdir} \ + --with-tcsetpgrp \ + --enable-maildir-support \ + --enable-pcre + +# prevent the build from failing while running in parallel +make -C Src headers +make -C Src -f Makemod zsh{path,xmod}s.h version.h + +%make_build all html + +%check +make check + +%install +%make_install install.info \ + fndir=%{_datadir}/%{name}/%{version}/functions \ + sitefndir=%{_datadir}/%{name}/site-functions \ + scriptdir=%{_datadir}/%{name}/%{version}/scripts \ + sitescriptdir=%{_datadir}/%{name}/scripts \ + runhelpdir=%{_datadir}/%{name}/%{version}/help + +rm -f $RPM_BUILD_ROOT%{_bindir}/zsh-%{version} +rm -f $RPM_BUILD_ROOT%{_infodir}/dir + +mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir} +for i in %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} %{SOURCE5}; do + install -m 644 $i $RPM_BUILD_ROOT%{_sysconfdir}/"$(basename $i .rhs)" +done + +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/skel +install -m 644 %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/skel/.zshrc +install -m 644 %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/skel/.zprofile + +# This is just here to shut up rpmlint, and is very annoying. +# Note that we can't chmod everything as then rpmlint will complain about +# those without a she-bang line. +for i in checkmail harden run-help test-repo-git-rebase-{apply,merge} zcalc zkbd; do + sed -i -e 's!/usr/local/bin/zsh!%{_bindir}/zsh!' \ + $RPM_BUILD_ROOT%{_datadir}/zsh/%{version}/functions/$i + chmod +x $RPM_BUILD_ROOT%{_datadir}/zsh/%{version}/functions/$i +done + +%generate_compatibility_deps + +%post +if [ "$1" = 1 ]; then + if [ ! -f %{_sysconfdir}/shells ] ; then + echo "%{_bindir}/%{name}" > %{_sysconfdir}/shells + echo "/bin/%{name}" >> %{_sysconfdir}/shells + else + grep -q "^%{_bindir}/%{name}$" %{_sysconfdir}/shells || echo "%{_bindir}/%{name}" >> %{_sysconfdir}/shells + grep -q "^/bin/%{name}$" %{_sysconfdir}/shells || echo "/bin/%{name}" >> %{_sysconfdir}/shells + fi +fi + +%postun +if [ "$1" = 0 ] && [ -f %{_sysconfdir}/shells ] ; then + sed -i '\!^%{_bindir}/%{name}$!d' %{_sysconfdir}/shells + sed -i '\!^/bin/%{name}$!d' %{_sysconfdir}/shells +fi + +%files +%dir %{abidir} +%doc LICENCE +%attr(755,root,root) %{_bindir}/zsh +%{_mandir}/*/* +%{_infodir}/* +%{_datadir}/zsh +%{_libdir}/zsh +%{abidir}/* +%config(noreplace) %{_sysconfdir}/skel/.z* +%config(noreplace) %{_sysconfdir}/z* + +%files doc +%doc Doc/*.html +%doc README Etc/BUGS Etc/CONTRIBUTORS Etc/FAQ FEATURES MACHINES +%doc NEWS Etc/zsh-development-guide Etc/completion-style-guide + +%changelog +* Thu Mar 16 2023 Yuanhong Peng - 5.9-1 +- Init from upstream diff --git a/zshenv.rhs b/zshenv.rhs new file mode 100644 index 0000000000000000000000000000000000000000..a6614d3bdc7641d8bdabf855c94c8f29244949f7 --- /dev/null +++ b/zshenv.rhs @@ -0,0 +1,14 @@ +# /etc/zsh/zshenv: system-wide .zshenv file for zsh(1). +# +# This file is sourced on all invocations of the shell. +# If the -f flag is present or if the NO_RCS option is +# set within this file, all other initialization files +# are skipped. +# +# This file should contain commands to set the command +# search path, plus other important environment variables. +# This file should not contain commands that produce +# output or assume the shell is attached to a tty. +# +# Global Order: zshenv, zprofile, zshrc, zlogin + diff --git a/zshrc.rhs b/zshrc.rhs new file mode 100644 index 0000000000000000000000000000000000000000..82dc2133de9490a73a9ed529157e1389fc7c0d9d --- /dev/null +++ b/zshrc.rhs @@ -0,0 +1,50 @@ +# +# /etc/zshrc is sourced in interactive shells. It +# should contain commands to set up aliases, functions, +# options, key bindings, etc. +# + +## shell functions +#setenv() { export $1=$2 } # csh compatibility + +# Set prompts +[[ "$PROMPT" = "%m%# " ]] && PROMPT='[%n@%m]%~%# ' # default prompt +#RPROMPT=' %~' # prompt for right side of screen + +# bindkey -v # vi key bindings +# bindkey -e # emacs key bindings +bindkey ' ' magic-space # also do history expansion on space + +# Provide pathmunge for /etc/profile.d scripts +pathmunge() +{ + if ! echo $PATH | /bin/grep -qE "(^|:)$1($|:)" ; then + if [ "$2" = "after" ] ; then + PATH=$PATH:$1 + else + PATH=$1:$PATH + fi + fi +} + +_src_etc_profile_d() +{ + # Make the *.sh things happier, and have possible ~/.zshenv options like + # NOMATCH ignored. + emulate -L ksh + + + # from bashrc, with zsh fixes + if [[ ! -o login ]]; then # We're not a login shell + for i in /etc/profile.d/*.sh; do + if [ -r "$i" ]; then + . $i + fi + done + unset i + fi +} +_src_etc_profile_d + +unset -f pathmunge _src_etc_profile_d +