ksh/ksh.spec

115 lines
3.0 KiB
RPMSpec

%define pkg_version %(echo %version | tr . - )
Name: ksh
Version: 2020.0.0
Release: 1mamba
Summary: The Original ATT Korn Shell
Group: Applications/Shells
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: http://www.kornshell.com/
Source: https://github.com/ksh2020/ksh.git/%{version}/ksh-%{version}.tar.bz2
#Source0: http://www2.research.att.com/~gsf/download/tgz/ast-ksh.%{pkg_version}.tgz
#Source1: http://www2.research.att.com/~gsf/download/tgz/INIT.%{pkg_version}.tgz
# from fedora
Source2: dotkshrc
Source3: kshrc.mamba
Source4: expectedresults.log
Patch0: ksh-20070328-builtins.patch
Patch1: ksh-20100826-fixregr.patch
License: Common Public License Version 1.0
BuildRequires: bison
BuildRequires: diffutils
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
## AUTOBUILDREQ-END
BuildRequires: procps
Requires: coreutils
Requires: grep
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
KSH-93 is the most recent version of the Korn Shell by David Korn of
AT&T Bell Laboratories.
Korn Shell is a shell programming language, which is upward compatible
with "sh" (the Bourne Shell).
%debug_package
%prep
%setup -q
#% setup -q -T -D -a 1
#%patch0 -p1
#%patch1 -p1
#sed -i 's|ls /dev/fd|ls /proc/self/fd|' src/cmd/ksh93/features/options
%build
%meson
%meson_build
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%meson_install
mkdir -p %{buildroot}%{_sysconfdir}/skel
install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/skel/.kshrc
install -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/kshrc
install -d -m0755 %{buildroot}/bin
mv %{buildroot}%{_bindir}/ksh %{buildroot}/bin/ksh
%check
export SHELL=$(ls $(pwd)/arch/*/bin/ksh)
cd src/cmd/ksh93/tests/
#ulimit -c unlimited
if [ ! -e /dev/fd ]
then
echo "ERROR: /dev/fd does not exist, regression tests skipped"
exit 0
fi
$SHELL ./shtests 2>&1 | tee testresults.log
sed -e '/begins at/d' -e '/ 0 error/d' -e 's/at [^\[]*\[/\[/' testresults.log -e '/tests skipped/d' >filteredresults.log
if ! cmp filteredresults.log %{SOURCE4} >/dev/null || ls core.*
then
echo "Regression tests failed (ignoring)"
diff -Naurp %{SOURCE4} filteredresults.log || true
# exit -1
fi
:
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%post
if [ ! -f %{_sysconfdir}/shells ]; then
echo "/bin/ksh" > %{_sysconfdir}/shells
else
if ! grep -q '^/bin/ksh$' %{_sysconfdir}/shells ; then
echo "/bin/ksh" >> %{_sysconfdir}/shells
fi
fi
%postun
if [ ! -f /bin/ksh ]; then
sed -i '/^\/bin\/ksh$/ d' %{_sysconfdir}/shells
fi
%files
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/skel/.kshrc
%config(noreplace) %{_sysconfdir}/kshrc
/bin/ksh
%{_bindir}/shcomp
%{_mandir}/man1/ksh.1*
%doc LICENSE
%changelog
* Sun Sep 06 2020 Silvan Calarco <silvan.calarco@mambasoft.it> 2020.0.0-1mamba
- update to 2020.0.0
* Sat Feb 12 2011 gil <puntogil@libero.it> 20110208-1mamba
- package created by autospec