Accepting request 908007 from home:gmbr3:Active

- Get patch lvl by running command to find it instead of hardcoding
- Remove old SUSE RPM constructs
- Clean spec file

OBS-URL: https://build.opensuse.org/request/show/908007
OBS-URL: https://build.opensuse.org/package/show/Base:System/bash?expand=0&rev=332
This commit is contained in:
Dr. Werner Fink 2021-07-26 08:01:45 +00:00 committed by Git OBS Bridge
parent b7172de4e9
commit c7de433241
2 changed files with 62 additions and 78 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Jul 23 12:18:48 UTC 2021 - Callum Farmer <gmbr3@opensuse.org>
- Get patch lvl by running command to find it instead of hardcoding
- Remove old SUSE RPM constructs
- Clean spec file
------------------------------------------------------------------- -------------------------------------------------------------------
Fri May 28 13:53:55 UTC 2021 - Dr. Werner Fink <werner@suse.de> Fri May 28 13:53:55 UTC 2021 - Dr. Werner Fink <werner@suse.de>

133
bash.spec
View File

@ -16,13 +16,15 @@
# #
%define bextend %{nil}
%define bversion 5.1
%define bpatchlvl %(tar -jtf %{_sourcedir}/bash-%{bversion}-patches.tar.bz2 | tail -n 1 | cut -d '/' -f 2 | cut -d '-' -f 2 | tr -d 0)
%global _incdir %{_includedir}
%global _ldldir %{_libdir}/bash
%global _minsh 0
%bcond_with import_function %bcond_with import_function
%bcond_with sjis %bcond_with sjis
Name: bash Name: bash
%define bextend %nil
%define bversion 5.1
%define bpatchlvl 4
Version: %{bversion}.%{bpatchlvl} Version: %{bversion}.%{bpatchlvl}
Release: 0 Release: 0
Summary: The GNU Bourne-Again Shell Summary: The GNU Bourne-Again Shell
@ -31,9 +33,7 @@ Summary: The GNU Bourne-Again Shell
#Recommends: bash-completion #Recommends: bash-completion
License: GPL-3.0-or-later License: GPL-3.0-or-later
Group: System/Shells Group: System/Shells
Suggests: command-not-found URL: https://www.gnu.org/software/bash/bash.html
Suggests: bash-doc = %version
URL: http://www.gnu.org/software/bash/bash.html
# Git: http://git.savannah.gnu.org/cgit/bash.git # Git: http://git.savannah.gnu.org/cgit/bash.git
Source0: ftp://ftp.gnu.org/gnu/bash/bash-%{bversion}%{bextend}.tar.gz Source0: ftp://ftp.gnu.org/gnu/bash/bash-%{bversion}%{bextend}.tar.gz
Source1: bash-%{bversion}-patches.tar.bz2 Source1: bash-%{bversion}-patches.tar.bz2
@ -72,27 +72,25 @@ Patch47: bash-4.3-perl522.patch
Patch48: bash-4.3-extra-import-func.patch Patch48: bash-4.3-extra-import-func.patch
# PATCH-EXTEND-SUSE Allow root to clean file system if filled up # PATCH-EXTEND-SUSE Allow root to clean file system if filled up
Patch49: bash-4.3-pathtemp.patch Patch49: bash-4.3-pathtemp.patch
BuildRequires: audit-devel
BuildRequires: autoconf BuildRequires: autoconf
BuildRequires: bison BuildRequires: bison
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: makeinfo BuildRequires: makeinfo
BuildRequires: ncurses-devel
BuildRequires: patchutils BuildRequires: patchutils
BuildRequires: pkg-config BuildRequires: pkgconfig
# This has to be always the same version as included in the bash its self
BuildRequires: readline-devel == 8.1
BuildRequires: screen BuildRequires: screen
BuildRequires: sed BuildRequires: sed
BuildRequires: update-alternatives BuildRequires: update-alternatives
BuildRequires: pkgconfig(audit)
BuildRequires: pkgconfig(ncurses)
# This has to be always the same version as included in the bash its self
BuildRequires: pkgconfig(readline) = 8.1
Requires(post): update-alternatives Requires(post): update-alternatives
Requires(preun):update-alternatives Requires(preun):update-alternatives
Suggests: bash-doc = %{version}
Suggests: command-not-found
Provides: /bin/bash Provides: /bin/bash
Provides: /bin/sh Provides: /bin/sh
%global _sysconfdir /etc
%global _incdir %{_includedir}
%global _ldldir %{_libdir}/bash
%global _minsh 0
%description %description
Bash is an sh-compatible command interpreter that executes commands Bash is an sh-compatible command interpreter that executes commands
@ -104,27 +102,15 @@ specification (IEEE Working Group 1003.2).
%package doc %package doc
Summary: Documentation how to Use the GNU Bourne-Again Shell Summary: Documentation how to Use the GNU Bourne-Again Shell
Group: Documentation/HTML Group: Documentation/HTML
Supplements: (bash and patterns-base-documentation)
Provides: bash:%{_infodir}/bash.info.gz Provides: bash:%{_infodir}/bash.info.gz
Supplements: packageand(bash:patterns-base-documentation)
BuildArch: noarch BuildArch: noarch
%description doc %description doc
This package contains the documentation for using the bourne shell This package contains the documentation for using the bourne shell
interpreter Bash. interpreter Bash.
%if %{defined lang_package} %lang_package
%lang_package(bash)
%else
%package lang
Summary: Languages for package bash
Group: System/Localization
Requires: bash = %{version}
Supplements: bash
%description lang
Provides translations to the package bash
%endif
%package devel %package devel
Summary: Include Files mandatory for Development of bash loadable builtins Summary: Include Files mandatory for Development of bash loadable builtins
@ -227,34 +213,34 @@ for patch in ../bash-%{bversion}-patches/*; do
patch -s -p$level < $patch patch -s -p$level < $patch
done done
set -x set -x
%patch1 -p0 -b .manual %patch1 -b .manual
%patch3 -p0 -b .2.4.4 %patch3 -b .2.4.4
%patch4 -p0 -b .evalexp %patch4 -b .evalexp
%patch5 -p0 -b .warnlc %patch5 -b .warnlc
%patch7 -p0 -b .decl %patch7 -b .decl
%patch9 -p0 -b .unistd %patch9 -b .unistd
%patch10 -p0 -b .printf %patch10 -b .printf
%patch11 -p0 -b .plugins %patch11 -b .plugins
%patch12 -p0 -b .completion %patch12 -b .completion
%patch13 -p0 -b .nscdunmap %patch13 -b .nscdunmap
%patch14 -p0 -b .sigrestart %patch14 -b .sigrestart
%patch16 -p0 -b .setlocale %patch16 -b .setlocale
#%patch18 -p0 -b .winch #%patch18 -p0 -b .winch
%patch40 -p0 -b .bashrc %patch40 -b .bashrc
%if %{with sjis} %if %{with sjis}
%patch42 -p0 -b .sjis %patch42 -b .sjis
%endif %endif
%patch46 -p0 -b .notimestamp %patch46 -b .notimestamp
%patch47 -p0 -b .perl522 %patch47 -b .perl522
%if %{with import_function} %if %{with import_function}
%patch48 -b .eif %patch48 -b .eif
%endif %endif
%patch49 -p0 -b .pthtmp %patch49 -b .pthtmp
%patch0 -p0 -b .0 %patch0 -b .0
# This has to be always the same version as included in the bash its self # This has to be always the same version as included in the bash its self
rl1=($(sed -rn '/RL_READLINE_VERSION/p' lib/readline/readline.h)) rl1=($(sed -rn '/RL_READLINE_VERSION/p' lib/readline/readline.h))
rl2=($(sed -rn '/RL_READLINE_VERSION/p' /usr/include/readline/readline.h)) rl2=($(sed -rn '/RL_READLINE_VERSION/p' %{_includedir}/readline/readline.h))
test ${rl1[2]} = ${rl2[2]} || exit 1 test ${rl1[2]} = ${rl2[2]} || exit 1
%build %build
@ -278,10 +264,11 @@ test ${rl1[2]} = ${rl2[2]} || exit 1
silence on silence on
utf8 on utf8 on
EOF EOF
CPU=$(uname -m 2> /dev/null) HOSTTYPE=%{_target_cpu}
HOSTTYPE=${CPU} VENDOR=%{_target_vendor}
MACHTYPE=${CPU}-suse-linux OSTYPE=%{_target_os}
export LANG LC_ALL HOSTTYPE MACHTYPE MACHTYPE=${HOSTTYPE}-${VENDOR}-${OSTYPE}
export LANG LC_ALL HOSTTYPE VENDOR OSTYPE MACHTYPE
cflags () cflags ()
{ {
local flag=$1; shift local flag=$1; shift
@ -309,7 +296,7 @@ test ${rl1[2]} = ${rl2[2]} || exit 1
set +o noclobber set +o noclobber
} }
LARGEFILE="$(getconf LFS_CFLAGS)" LARGEFILE="$(getconf LFS_CFLAGS)"
CFLAGS="$RPM_OPT_FLAGS $LARGEFILE -D_GNU_SOURCE -DRECYCLES_PIDS -Wall -g" CFLAGS="%{optflags} $LARGEFILE -D_GNU_SOURCE -DRECYCLES_PIDS -Wall -g"
LDFLAGS="" LDFLAGS=""
# #
# Never ever put -DMUST_UNBLOCK_CHLD herein as this breaks bash # Never ever put -DMUST_UNBLOCK_CHLD herein as this breaks bash
@ -331,7 +318,7 @@ test ${rl1[2]} = ${rl2[2]} || exit 1
# /proc is required for correct configuration # /proc is required for correct configuration
test -d /dev/fd || { echo "/proc is not mounted!" >&2; exit 1; } test -d /dev/fd || { echo "/proc is not mounted!" >&2; exit 1; }
CC=gcc CC=gcc
%if %_minsh %if %{_minsh}
cflags -Os CFLAGS cflags -Os CFLAGS
# cflags -U_FORTIFY_SOURCE CFLAGS # cflags -U_FORTIFY_SOURCE CFLAGS
# cflags -funswitch-loops CFLAGS # cflags -funswitch-loops CFLAGS
@ -361,7 +348,7 @@ test ${rl1[2]} = ${rl2[2]} || exit 1
--with-installed-readline --with-installed-readline
" "
bash support/mkconffiles -v bash support/mkconffiles -v
%if %_minsh %if %{_minsh}
./configure --build=%{_target_cpu}-suse-linux \ ./configure --build=%{_target_cpu}-suse-linux \
--prefix=%{_prefix} \ --prefix=%{_prefix} \
--mandir=%{_mandir} \ --mandir=%{_mandir} \
@ -428,9 +415,9 @@ test ${rl1[2]} = ${rl2[2]} || exit 1
sed -rn '/Configuration feature settings controllable by autoconf/,/End of configuration settings controllable by autoconf/p' < config.h sed -rn '/Configuration feature settings controllable by autoconf/,/End of configuration settings controllable by autoconf/p' < config.h
profilecflags=CFLAGS="$CFLAGS" profilecflags=CFLAGS="$CFLAGS"
%if 0%{?do_profiling} %if 0%{?do_profiling}
profilecflags=CFLAGS="$CFLAGS %cflags_profile_generate" profilecflags=CFLAGS="$CFLAGS %{cflags_profile_generate}"
%endif %endif
makeopts="Machine=%{_target_cpu} OS=linux VENDOR=suse MACHTYPE=%{_target_cpu}-suse-linux" makeopts="Machine=${HOSTTYPE} OS=${OSTYPE} VENDOR=${VENDOR} MACHTYPE=${MACHTYPE}"
make $makeopts "$profilecflags" \ make $makeopts "$profilecflags" \
all printenv recho zecho xcase all printenv recho zecho xcase
TMPDIR=$(mktemp -d /tmp/bash.XXXXXXXXXX) || exit 1 TMPDIR=$(mktemp -d /tmp/bash.XXXXXXXXXX) || exit 1
@ -442,7 +429,7 @@ test ${rl1[2]} = ${rl2[2]} || exit 1
kill -TERM $pid kill -TERM $pid
%if 0%{?do_profiling} %if 0%{?do_profiling}
rm -f jobs.gcda rm -f jobs.gcda
profilecflags=CFLAGS="$CFLAGS %cflags_profile_feedback -fprofile-correction" profilecflags=CFLAGS="$CFLAGS %{cflags_profile_feedback} -fprofile-correction"
clean=clean clean=clean
%endif %endif
make $makeopts "$profilecflags" $clean all make $makeopts "$profilecflags" $clean all
@ -497,30 +484,24 @@ but disables multi byte handling.
EOF EOF
# remove unpackaged files # remove unpackaged files
mkdir -p %{buildroot}%{_sysconfdir}/skel mkdir -p %{buildroot}%{_sysconfdir}/skel
install -m 644 %{S:5} %{buildroot}%{_sysconfdir}/skel/.bashrc install -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/skel/.bashrc
install -m 644 %{S:6} %{buildroot}%{_sysconfdir}/skel/.profile install -m 644 %{SOURCE6} %{buildroot}%{_sysconfdir}/skel/.profile
touch -t 199605181720.50 %{buildroot}%{_sysconfdir}/skel/.bash_history touch -t 199605181720.50 %{buildroot}%{_sysconfdir}/skel/.bash_history
chmod 600 %{buildroot}%{_sysconfdir}/skel/.bash_history chmod 600 %{buildroot}%{_sysconfdir}/skel/.bash_history
%find_lang bash %find_lang bash
%fdupes -s %{buildroot}%{_datadir}/bash/helpfiles %fdupes -s %{buildroot}%{_datadir}/bash/helpfiles
sed -ri '1{ s@/bin/sh@/bin/bash@ }' %{buildroot}%{_bindir}/bashbug sed -ri '1{ s@/bin/sh@/bin/bash@ }' %{buildroot}%{_bindir}/bashbug
%post -p /usr/bin/bash %post -p %{_bindir}/bash
%{_sbindir}/update-alternatives --quiet --force \ %{_sbindir}/update-alternatives --quiet --force \
--install %{_bindir}/sh sh %{_bindir}/bash 10100 --install %{_bindir}/sh sh %{_bindir}/bash 10100
%preun -p /usr/bin/bash %preun -p %{_bindir}/bash
if test "$1" = 0; then if test "$1" = 0; then
%{_sbindir}/update-alternatives --quiet --remove sh %{_bindir}/bash %{_sbindir}/update-alternatives --quiet --remove sh %{_bindir}/bash
fi fi
%clean
LD_LIBRARY_PATH=%{buildroot}/%{_libdir} \
ldd -u -r %{buildroot}%{_bindir}/bash || true
%{?buildroot: %__rm -rf %{buildroot}}
%files %files
%defattr(-,root,root)
%license COPYING %license COPYING
%config %attr(600,root,root) %{_sysconfdir}/skel/.bash_history %config %attr(600,root,root) %{_sysconfdir}/skel/.bash_history
%config %attr(644,root,root) %{_sysconfdir}/skel/.bashrc %config %attr(644,root,root) %{_sysconfdir}/skel/.bashrc
@ -538,21 +519,18 @@ ldd -u -r %{buildroot}%{_bindir}/bash || true
%dir %{_datadir}/bash %dir %{_datadir}/bash
%dir %{_datadir}/bash/helpfiles %dir %{_datadir}/bash/helpfiles
%{_datadir}/bash/helpfiles/* %{_datadir}/bash/helpfiles/*
%{_mandir}/man1/bash.1* %{_mandir}/man1/bash.1%{?ext_man}
%{_mandir}/man1/bashbuiltins.1* %{_mandir}/man1/bashbuiltins.1%{?ext_man}
%{_mandir}/man1/bashbug.1* %{_mandir}/man1/bashbug.1%{?ext_man}
%{_mandir}/man1/rbash.1* %{_mandir}/man1/rbash.1%{?ext_man}
%files lang -f bash.lang %files lang -f bash.lang
%defattr(-,root,root)
%files doc %files doc
%defattr(-,root,root) %{_infodir}/bash.info%{?ext_info}
%doc %{_infodir}/bash.info*
%doc %{_docdir}/%{name} %doc %{_docdir}/%{name}
%files devel %files devel
%defattr(-,root,root)
%dir %{_includedir}/bash/ %dir %{_includedir}/bash/
%dir %{_includedir}/bash/builtins/ %dir %{_includedir}/bash/builtins/
%dir %{_includedir}/bash/include/ %dir %{_includedir}/bash/include/
@ -563,7 +541,6 @@ ldd -u -r %{buildroot}%{_bindir}/bash || true
%{_datadir}/bash/*.inc %{_datadir}/bash/*.inc
%files loadables %files loadables
%defattr(-,root,root)
%{_ldldir} %{_ldldir}
%if 0%{?usrmerged} %if 0%{?usrmerged}