Accepting request 921254 from home:manfred999:branches:Base:System

This is Part 2/2 to remove update-alternatives support from awk.
On linux systems, GNU software is usually considered the default implementation. There are a lot of scripts assuming gawk to be the
interpreter engine, as for very long time now, gawk is the default
interpreter for SUSE/openSUSE. 
Gawk is POSIX compliant if the env variable POSIXLY_CORRECT is set,
and therefore should be able to run run all awk scripts seeking for compatibility.
This patch unconditionally removes the ability to set mawk as the default awk implementation.

OBS-URL: https://build.opensuse.org/request/show/921254
OBS-URL: https://build.opensuse.org/package/show/Base:System/mawk?expand=0&rev=28
This commit is contained in:
Thomas Renninger 2021-09-28 08:55:41 +00:00 committed by Git OBS Bridge
parent 56dd04e32d
commit 16b2a0762b
3 changed files with 25 additions and 42 deletions

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Thu Sep 23 14:03:54 UTC 2021 - Manfred Schwarb <manfred99@gmx.ch>
- remove update-alternatives support, as on linux systems GNU software
(i.e. gawk in this case) is usually considered the default implementation.
- use %make macros
- modify patch reproducible.patch to use __DATE__ and __TIME__, as
these macros are reproducible now (SOURCE_DATE_EPOCH support since GCC 7)
-------------------------------------------------------------------
Thu Feb 4 10:41:36 UTC 2021 - Ludwig Nussel <lnussel@suse.de>

View File

@ -25,15 +25,12 @@ Release: 0
Summary: Implementation of New/POSIX AWK
License: GPL-2.0-only
Group: Productivity/Text/Utilities
URL: http://invisible-island.net/mawk/mawk.html
URL: https://invisible-island.net/mawk/mawk.html
Source0: ftp://ftp.invisible-island.net/mawk/mawk-%{_upver}-%{_datever}.tgz
Source1: ftp://ftp.invisible-island.net/mawk/mawk-%{_upver}-%{_datever}.tgz.asc
Source2: %{name}.keyring
# PATCH-FIX-OPENSUSE -- bmwiedemann -- drop timestamp / for build-compare
Patch0: reproducible.patch
BuildRequires: update-alternatives
Requires(post): update-alternatives
Requires(preun): update-alternatives
%description
mawk is an interpreter for the AWK Programming Language. It implements the AWK
@ -52,41 +49,19 @@ chmod 755 examples/*
# noreturn attribute and produce warnings when $RPM_OPT_FLAGS contains -Wall
%configure \
--enable-warnings
make %{?_smp_mflags}
%make_build
%install
%make_install
# create symlinks for update-alternatives
install -d -m 755 %{buildroot}%{_sysconfdir}/alternatives
%if 0%{?usrmerged}
ln -s %{_sysconfdir}/alternatives/awk %{buildroot}%{_bindir}/awk
%else
%if !0%{?usrmerged}
# compatibility symlink
install -d -m 755 %{buildroot}/bin
ln -s %{_bindir}/mawk %{buildroot}/bin/mawk
ln -s %{_sysconfdir}/alternatives/awk %{buildroot}/bin/awk
ln -s %{_sysconfdir}/alternatives/usr-bin-awk %{buildroot}%{_bindir}/awk
%endif
ln -s %{_sysconfdir}/alternatives/awk.1%{?ext_man} %{buildroot}%{_mandir}/man1/awk.1%{?ext_man}
%check
make %{?_smp_mflags} check
%post
%{_sbindir}/update-alternatives \
%if 0%{?usrmerged}
--install %{_bindir}/awk awk %{_bindir}/mawk 15 \
%else
--install /bin/awk awk %{_bindir}/mawk 15 \
--slave %{_bindir}/awk usr-bin-awk %{_bindir}/mawk \
%endif
--slave %{_mandir}/man1/awk.1.gz awk.1%{?ext_man} %{_mandir}/man1/mawk.1%{?ext_man}
%postun
if [ ! -f %{_bindir}/mawk ]; then
%{_sbindir}/update-alternatives --remove awk %{_bindir}/mawk
fi
%make_build check
%files
%license COPYING
@ -94,13 +69,7 @@ fi
%{_bindir}/mawk
%{_mandir}/man1/mawk.1%{?ext_man}
%if !0%{?usrmerged}
/bin/awk
/bin/mawk
%endif
%{_bindir}/awk
%{_mandir}/man1/awk.1%{?ext_man}
%ghost %{_sysconfdir}/alternatives/awk
%ghost %{_sysconfdir}/alternatives/usr-bin-awk
%ghost %{_sysconfdir}/alternatives/awk.1%{?ext_man}
%changelog

View File

@ -1,13 +1,18 @@
Index: mawk-1.3.4-20171017/makescan.c
===================================================================
--- mawk-1.3.4-20171017.orig/makescan.c
+++ mawk-1.3.4-20171017/makescan.c
@@ -83,7 +83,7 @@ scan_print(void)
--- mawk-1.3.4-20200120.orig/makescan.c 2016-10-01 01:58:49.000000000 +0200
+++ mawk-1.3.4-20200120/makescan.c 2021-09-23 17:14:01.205982671 +0200
@@ -77,13 +77,12 @@ scan_init(void)
static void
scan_print(void)
{
- time_t now = time((time_t *) 0);
register char *p = scan_code;
register int c; /* column */
register int r; /* row */
printf("/*\n * %cMawkId%c\n * generated by makescan.c\n * date: %s */\n",
- printf("/*\n * %cMawkId%c\n * generated by makescan.c\n * date: %s */\n",
- '$', '$', ctime(&now));
+ '$', '$', "Sun Jan 1 00:00:01 2017");
+ printf("/*\n * %cMawkId%c\n * generated by makescan.c\n * date: %s %s */\n",
+ '$', '$', __DATE__, __TIME__);
printf("#include \"scancode.h\"\n");
printf("/* *INDENT-OFF* */\n");
printf("char scan_code[256] = {\n");