diff --git a/dotzshrc b/dotzshrc new file mode 100644 index 0000000..80fc62c --- /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 0000000..9f43955 --- /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 0000000..570516f --- /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 0000000..f694eea --- /dev/null +++ b/zprofile.rhs @@ -0,0 +1,11 @@ +# +# /etc/zprofile and ~/.zprofile are run for login shells +# + +PATH="$PATH:$HOME/bin" +export PATH + +# source profile +if [ -f /etc/profile ]; then + source /etc/profile +fi diff --git a/zsh-4.3.12-ksh-emulation-syntax-checking.patch b/zsh-4.3.12-ksh-emulation-syntax-checking.patch new file mode 100644 index 0000000..1eb08b2 --- /dev/null +++ b/zsh-4.3.12-ksh-emulation-syntax-checking.patch @@ -0,0 +1,15 @@ +diff -ruN zsh-4.3.12-orig/Src/subst.c zsh-4.3.12/Src/subst.c +--- zsh-4.3.12-orig/Src/subst.c 2011-05-23 18:48:19.000000000 +0200 ++++ zsh-4.3.12/Src/subst.c 2011-06-29 13:44:13.000000000 +0200 +@@ -245,7 +245,10 @@ + if (endchar == Outpar && str2[1] == '(' && str[-2] == ')') { + /* Math substitution of the form $((...)) */ + str[-2] = '\0'; +- str = arithsubst(str2 + 2, &str3, str); ++ if (isset(EXECOPT)) ++ str = arithsubst(str2 + 2, &str3, str); ++ else ++ strncpy(str3, str2, 1); + setdata(node, (void *) str3); + continue; + } diff --git a/zsh.changes b/zsh.changes index 03a4e3c..926c60d 100644 --- a/zsh.changes +++ b/zsh.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Wed Jun 29 12:35:50 UTC 2011 - chris@computersalat.de + +- enable build for RHEL and friends (CentOS, Fedora) + o merge with 4.2.6 from RHEL + o add/rework RHEL patch (BZ-488943-ksh-emulation-syntax-checking) + o add several *.rhs files + o disable E01options test +- add subpkg htmldoc +- fix deps + o fdupes >= suse_version 1110 + ------------------------------------------------------------------- Fri Jun 17 13:35:56 UTC 2011 - idonmez@novell.com diff --git a/zsh.spec b/zsh.spec index 4ba9613..a263970 100644 --- a/zsh.spec +++ b/zsh.spec @@ -23,23 +23,51 @@ Release: 2 License: BSD Summary: Shell with comprehensive completion Url: http://www.zsh.org +%if 0%{?suse_version} Group: System/Shells +%else +Group: System Environment/Shells +%endif +#Source0: ftp://ftp.fu-berlin.de/pub/unix/shells/zsh/zsh-4.3.12.tar.bz2 Source0: %{name}-%{version}.tar.bz2 Source1: zshrc Source2: zshenv Source3: zprofile +%if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora_version} +Source11: zlogin.rhs +Source12: zlogout.rhs +Source13: zprofile.rhs +Source14: zshrc.rhs +Source15: zshenv.rhs +Source16: dotzshrc +Source17: zshprompt.pl +%endif Patch1: %{name}-%{version}-disable-c02cond-test.patch # PATCH-FIX-UPSTREAM zsh-findproc.patch idoenmez@suse.de -- Upstream commit 21c39600ef2d74c3e7474c4e5b89805656c6fe4e Patch2: %{name}-findproc.patch # PATCH-FIX-UPSTREAM zsh-kill-suspended-job.patch idoenmez@suse.de -- Upstream commit 98b29d02ca17068779f4b8fa2d43c9753386478f Patch3: %{name}-kill-suspended-job.patch - +# PATCH-FIX ksh-emulation-syntax-checking.patch -- Import and rework from RHEL (zsh-4.2.6) +Patch4: %{name}-4.3.12-ksh-emulation-syntax-checking.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-build +%if 0%{?suse_version} +PreReq: %{install_info_prereq} +%if 0%{?suse_version} >= 1110 BuildRequires: fdupes +BuildRequires: yodl +%endif +%else +Prereq: fileutils grep /sbin/install-info +%endif + BuildRequires: libcap-devel BuildRequires: ncurses-devel -BuildRequires: yodl -PreReq: %{install_info_prereq} -BuildRoot: %{_tmppath}/%{name}-%{version}-build +%if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora_version} +BuildRequires: libtermcap-devel +BuildRequires: texi2html +BuildRequires: texinfo +BuildRequires: tetex +%endif %description Zsh is a UNIX command interpreter (shell) that resembles the Korn shell @@ -49,11 +77,39 @@ behavior, file name globbing, features to make C-shell (csh) users feel at home, and extra features drawn from tcsh (another `custom' shell). Zsh is well known for its command line completion. +%package htmldoc +Summary: Zsh shell manual in html format +%if 0%{?suse_version} +Group: System/Shells +%else +Group: System Environment/Shells +Obsoletes: %{name}-html < %{version} +%endif + +%description htmldoc +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. + +This package contains the Zsh manual in html format. + %prep %setup -q %patch1 %patch2 -p1 %patch3 -p1 +%patch4 -p1 + +##rpmlint +# spurious-executable-perm +chmod 0644 Etc/changelog2html.pl + +%if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora_version} + cp -p %{SOURCE17} . +%endif # Fix bindir path in some files perl -p -i -e 's|/usr/local/bin|%{_bindir}|' \ @@ -71,13 +127,10 @@ perl -p -i -e 's|/usr/local/bin|%{_bindir}|' \ --enable-cap \ --enable-multibyte -make - -# make html documentation -make -C Doc all zsh.info zsh_toc.html +make all info html # make help text files -mkdir -p Help +install -d Help pushd Help/ troff -Tlatin1 -t -mandoc ../Doc/zshbuiltins.1 | \ grotty -cbou | \ @@ -89,18 +142,38 @@ popd groff -Tps -ms Doc/intro.ms > intro.ps # better name for html documentation -mkdir Doc/htmldoc/ +install -d -m 0755 Doc/htmldoc/ mv Doc/*.html Doc/htmldoc # remove some unwanted files in Etc/ rm -f Etc/Makefile* Etc/*.yo -%install -%makeinstall install.info -# install SUSE configuration +%install +%if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora_version} + rm -rf %{buildroot} +%endif + +%if 0%{?suse_version} +%makeinstall install.info +%else + make DESTDIR=%{buildroot} install install.info +%endif + install -m 0755 -Dd %{buildroot}/{etc,bin} -install -m 0644 %{SOURCE1} %{SOURCE2} %{SOURCE3} %{buildroot}/etc + +%if 0%{?suse_version} +# install SUSE configuration +install -m 0644 %{SOURCE1} %{SOURCE2} %{SOURCE3} %{buildroot}%{_sysconfdir} +%endif + +%if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora_version} +# install RHEL || CentOS || Fedora configuration +for i in zlogin zlogout zprofile zshrc zshenv; do + install -m 0644 $RPM_SOURCE_DIR/${i}.rhs %{buildroot}%{_sysconfdir}/$i + install -D -m 0644 %{SOURCE16} %{buildroot}%{_sysconfdir}/skel/.zshrc +done +%endif # install help files install -m 0755 -Dd %{buildroot}%{_datadir}/%{name}/%{version}/help @@ -113,31 +186,92 @@ ln -s -f ../../bin/zsh %{buildroot}%{_bindir}/zsh # Remove versioned zsh binary rm -f %{buildroot}%{_bindir}/zsh-* +%if 0%{?suse_version} >= 1110 %fdupes %{buildroot} +%endif %check +%if 0%{?suse_version} make check +%else +# FixMe: sometimes failing Test +#+ fn:echo:2: write error: broken pipe +#+ fn:2: write error: inappropriate ioctl for device +mv Test/E01options.ztst Test/E01options.ztst.mvd +%ifarch s390 s390x ppc ppc64 + ( cd Test + mkdir skipped + mv Y*.ztst skipped ) +%endif + ZTST_verbose=0 make test +%endif + +%preun +%if 0%{?suse_version} + : +%else + if [ "$1" = 0 ] ; then + /sbin/install-info --delete %{_infodir}/zsh.info.gz %{_infodir}/dir \ + --entry="* zsh: (zsh). An enhanced bourne shell." + fi +%endif + +%post +%if 0%{?suse_version} + %install_info --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz +%else +if [ ! -f %{_sysconfdir}/shells ]; then + echo "%{_bindir}/zsh" > %{_sysconfdir}/shells +else + grep -q "^%{_bindir}/zsh$" %{_sysconfdir}/shells || echo "%{_bindir}/zsh" >> %{_sysconfdir}/shells +fi + +/sbin/install-info %{_infodir}/zsh.info.gz %{_infodir}/dir \ + --entry="* zsh: (zsh). An enhanced bourne shell." +%endif + +%postun +%if 0%{?suse_version} + %install_info_delete --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz +%else + if [ "$1" = 0 ] ; then + if [ -f %{_sysconfdir}/shells ] ; then + TmpFile=`%{_bindir}/mktemp /tmp/.zshrpmXXXXXX` + grep -v '^%{_bindir}/zsh$' %{_sysconfdir}/shells > $TmpFile + cp -f $TmpFile %{_sysconfdir}/shells + rm -f $TmpFile + chmod 644 %{_sysconfdir}/shells + fi + fi +%endif %clean rm -rf %{buildroot} -%post -%install_info --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz - -%postun -%install_info_delete --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz - %files %defattr(-,root,root) -%doc Etc/* intro.ps Misc/compctl-examples Doc/htmldoc +%doc ChangeLog FEATURES LICENCE MACHINES META-FAQ NEWS README +%doc Etc/* intro.ps Misc/compctl-examples + %config(noreplace) %{_sysconfdir}/zshrc %config(noreplace) %{_sysconfdir}/zshenv %config(noreplace) %{_sysconfdir}/zprofile +%if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora_version} +%config(noreplace) %{_sysconfdir}/zlogin +%config(noreplace) %{_sysconfdir}/zlogout +%config(noreplace) %{_sysconfdir}/skel/.zshrc +%endif + %{_bindir}/zsh /bin/zsh %{_libdir}/zsh/ %{_datadir}/zsh/ +#exclude %{_datadir}/zsh/htmldoc %{_infodir}/zsh.info*.gz %{_mandir}/man1/zsh*.1.gz +%files htmldoc +%defattr(-,root,root) +%doc Doc/htmldoc/* + %changelog diff --git a/zshenv.rhs b/zshenv.rhs new file mode 100644 index 0000000..d94b93a --- /dev/null +++ b/zshenv.rhs @@ -0,0 +1,9 @@ +# +# /etc/zshenv is sourced on all invocations of the +# shell, unless the -f option is set. It should +# contain commands to set the command search path, +# plus other important environment variables. +# .zshenv should not contain commands that produce +# output or assume the shell is attached to a tty. +# + diff --git a/zshprompt.pl b/zshprompt.pl new file mode 100644 index 0000000..d9052dc --- /dev/null +++ b/zshprompt.pl @@ -0,0 +1,235 @@ +#!/usr/bin/perl -w + +#requires Gtk-Perl + +use Gtk; +use strict; + +set_locale Gtk; +init Gtk; + +my $window = new Gtk::Window("toplevel"); +$window->signal_connect( "delete_event", \&CloseAppWindow ); +my $table = new Gtk::Table( 20, 6, 0 ); +$window->border_width( 5 ); +#$window->add( $button ); + + +my $prompt = new Gtk::Entry( 128); +my $log = new Gtk::Text(); +$log->set_usize(40,60); +$log->show(); +$prompt->show(); +#$prompt->set_editable (1); +$prompt->set_text(""); +$table->attach( $prompt,0,4,0,4,[ 'expand', 'shrink', 'fill' ], + 'shrink', + 0, 0 ); + +$table->set_row_spacings( 5 ); +$table->set_col_spacings( 5 ); + +my $currDir = new Gtk::Button( "Current Directory" ); +$currDir->show(); +$table->attach_defaults( $currDir,0,1,4,6 ); + +my $errorCode = new Gtk::Button( "Last Return Code" ); +$errorCode->show(); +$table->attach_defaults( $errorCode,1,2,4,6 ); + +my $currTime = new Gtk::Button( "Time" ); +$currTime->show(); +$table->attach_defaults( $currTime,2,3,4,6 ); + +my $hist = new Gtk::Button( "History Number" ); +$hist->show(); +$table->attach_defaults( $hist,3,4,4,6 ); + +my $host = new Gtk::Button( "Hostname" ); +$host->show(); +$table->attach_defaults( $host,0,1,6,8 ); + + + +my $backgroundBlue = new Gtk::Button( "Blue Background" ); +$backgroundBlue->show(); +$table->attach_defaults( $backgroundBlue,0,1,8,10 ); + +my $backgroundRed = new Gtk::Button( "Red Background" ); +$backgroundRed->show(); +$table->attach_defaults( $backgroundRed,1,2,8,10 ); + +my $backgroundGreen = new Gtk::Button( "Green Background" ); +$backgroundGreen->show(); +$table->attach_defaults( $backgroundGreen,2,3,8,10 ); + +my $backgroundYellow = new Gtk::Button( "Yellow Background" ); +$backgroundYellow->show(); +$table->attach_defaults( $backgroundYellow,3,4,8,10 ); + +my $backgroundBlack = new Gtk::Button( "Black Background" ); +$backgroundBlack->show(); +$table->attach_defaults( $backgroundBlack,5,6,8,10 ); + +my $backgroundWhite = new Gtk::Button( "White Background" ); +$backgroundWhite->show(); +$table->attach_defaults( $backgroundWhite,6,7,8,10 ); + +my $backgroundPink = new Gtk::Button( "Pink Background" ); +$backgroundPink->show(); +$table->attach_defaults( $backgroundPink,7,8,8,10 ); + + + + + +my $textBlue = new Gtk::Button( "Blue Text" ); +$textBlue->show(); +$table->attach_defaults( $textBlue,0,1,10,12 ); + +my $textRed = new Gtk::Button( "Red Text" ); +$textRed->show(); +$table->attach_defaults( $textRed,1,2,10,12 ); + +my $textGreen = new Gtk::Button( "Green Text" ); +$textGreen->show(); +$table->attach_defaults( $textGreen,2,3,10,12 ); + +my $textYellow = new Gtk::Button( "Yellow Text" ); +$textYellow->show(); +$table->attach_defaults( $textYellow,3,4,10,12 ); + +my $textBlack = new Gtk::Button( "Black Text" ); +$textBlack->show(); +$table->attach_defaults( $textBlack,5,6,10,12 ); + +my $textWhite = new Gtk::Button( "White Text" ); +$textWhite->show(); +$table->attach_defaults( $textWhite,6,7,10,12 ); + +my $textPink = new Gtk::Button( "Pink Text" ); +$textPink->show(); +$table->attach_defaults( $textPink,7,8,10,12 ); + + +my $textDefault = new Gtk::Button( "Default Text" ); +$textDefault->show(); +$table->attach_defaults( $textDefault,0,1,12,14 ); + +my $backgroundDefault = new Gtk::Button( "Default Background" ); +$backgroundDefault->show(); +$table->attach_defaults( $backgroundDefault,1,2,12,14 ); + + + +my $set = new Gtk::Button( "Save Settings" ); +$set->show(); +$table->attach_defaults( $set,0,1,16,18 ); + +my $xterm = new Gtk::Button( "Test saved settings" ); +$xterm->show(); +$table->attach_defaults( $xterm,1,2,16,18 ); + +$table->attach_defaults( $log,0,6,18,20 ); + + +$currDir->signal_connect( "clicked", \&insertButtonText, "%1/" ); +$errorCode->signal_connect( "clicked", \&insertButtonText, "%?" ); +$currTime->signal_connect( "clicked", \&insertButtonText, "%T" ); +$hist->signal_connect( "clicked", \&insertButtonText, "%!" ); +$host->signal_connect( "clicked", \&insertButtonText, "%m" ); + +$backgroundBlue->signal_connect( "clicked", \&insertButtonText, "%{\$bg[blue]%}" ); +$backgroundRed->signal_connect( "clicked", \&insertButtonText, "%{\$bg[red]%}" ); +$backgroundGreen->signal_connect( "clicked", \&insertButtonText, "%{\$bg[green]%}" ); +$backgroundYellow->signal_connect( "clicked", \&insertButtonText, "%{\$bg[yellow]%}" ); +$backgroundBlack->signal_connect( "clicked", \&insertButtonText, "%{\$bg[black]%}" ); +$backgroundWhite->signal_connect( "clicked", \&insertButtonText, "%{\$bg[white]%}" ); +$backgroundPink->signal_connect( "clicked", \&insertButtonText, "%{\$bg[magenta]%}" ); +$backgroundDefault->signal_connect( "clicked", \&insertButtonText, "%{\$bg[default]%}" ); + + + + +$textBlue->signal_connect( "clicked", \&insertButtonText, "%{\$fg[blue]%}" ); +$textRed->signal_connect( "clicked", \&insertButtonText, "%{\$fg[red]%}" ); +$textGreen->signal_connect( "clicked", \&insertButtonText, "%{\$fg[green]%}" ); +$textYellow->signal_connect( "clicked", \&insertButtonText, "%{\$fg[yellow]%}" ); +$textBlack->signal_connect( "clicked", \&insertButtonText, "%{\$fg[black]%}" ); +$textWhite->signal_connect( "clicked", \&insertButtonText, "%{\$fg[white]%}" ); +$textPink->signal_connect( "clicked", \&insertButtonText, "%{\$fg[magenta]%}" ); +$textDefault->signal_connect( "clicked", \&insertButtonText, "%{\$fg[default]%}" ); + + + + + +$set->signal_connect( "clicked", \&pushEnv ); +$xterm->signal_connect( "clicked", \&xterm ); + +sub xterm +{ +my $string="xterm -e zsh -li&"; +#$string.=$prompt->get_text(); + +#$string.="' zsh -li\"& "; + +system($string); +# $prompt->append_text( $string ); +$log->insert( "", "white", "black", "executing:\n $string\n"); +} + + +sub pushEnv +{ +chdir("~"); +use Env qw(PS1); +my $pNotSet=0; +open(PROMPT, "+<", ".prompt") or $pNotSet=1; + + +if($pNotSet) +{ + #$prompt->insert( "", "white", "black", "prompt is not set"); + open(ZSHRC, '>>','.zshrc') or die "cannot open zshrc"; + print ZSHRC ". ~/.prompt\n"; + close (ZSHRC); +} +close (PROMPT); +open(PROMPT, ">", ".prompt"); +print PROMPT "export PS1=\"",$prompt->get_text(),"\"\n"; + +#$prompt->insert( "", "white", "black", $PS1); + +close(PROMPT); +close(ZSHRC); +$prompt->grab_focus(); + +} +$prompt->can_default(1); +$prompt->grab_default(); +$table->show(); +$window->add( $table ); + + + + +$window->show(); +$prompt->grab_focus(); +main Gtk; + +exit( 0 ); + +sub CloseAppWindow +{ + Gtk->exit( 0 ); + return 0; +} + + +sub insertButtonText +{ + my ($widget, $txt) = @_; + $prompt->append_text( $txt ); +$prompt->grab_focus(); +} diff --git a/zshrc.rhs b/zshrc.rhs new file mode 100644 index 0000000..07a762c --- /dev/null +++ b/zshrc.rhs @@ -0,0 +1,26 @@ +# +# /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='[%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 + +# from bashrc +if [ "x$SHLVL" != "x1" ]; 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