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> 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 Summary: Implementation of New/POSIX AWK
License: GPL-2.0-only License: GPL-2.0-only
Group: Productivity/Text/Utilities 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 Source0: ftp://ftp.invisible-island.net/mawk/mawk-%{_upver}-%{_datever}.tgz
Source1: ftp://ftp.invisible-island.net/mawk/mawk-%{_upver}-%{_datever}.tgz.asc Source1: ftp://ftp.invisible-island.net/mawk/mawk-%{_upver}-%{_datever}.tgz.asc
Source2: %{name}.keyring Source2: %{name}.keyring
# PATCH-FIX-OPENSUSE -- bmwiedemann -- drop timestamp / for build-compare # PATCH-FIX-OPENSUSE -- bmwiedemann -- drop timestamp / for build-compare
Patch0: reproducible.patch Patch0: reproducible.patch
BuildRequires: update-alternatives
Requires(post): update-alternatives
Requires(preun): update-alternatives
%description %description
mawk is an interpreter for the AWK Programming Language. It implements the AWK 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 # noreturn attribute and produce warnings when $RPM_OPT_FLAGS contains -Wall
%configure \ %configure \
--enable-warnings --enable-warnings
make %{?_smp_mflags} %make_build
%install %install
%make_install %make_install
# create symlinks for update-alternatives %if !0%{?usrmerged}
install -d -m 755 %{buildroot}%{_sysconfdir}/alternatives
%if 0%{?usrmerged}
ln -s %{_sysconfdir}/alternatives/awk %{buildroot}%{_bindir}/awk
%else
# compatibility symlink # compatibility symlink
install -d -m 755 %{buildroot}/bin install -d -m 755 %{buildroot}/bin
ln -s %{_bindir}/mawk %{buildroot}/bin/mawk 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 %endif
ln -s %{_sysconfdir}/alternatives/awk.1%{?ext_man} %{buildroot}%{_mandir}/man1/awk.1%{?ext_man}
%check %check
make %{?_smp_mflags} check %make_build 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
%files %files
%license COPYING %license COPYING
@ -94,13 +69,7 @@ fi
%{_bindir}/mawk %{_bindir}/mawk
%{_mandir}/man1/mawk.1%{?ext_man} %{_mandir}/man1/mawk.1%{?ext_man}
%if !0%{?usrmerged} %if !0%{?usrmerged}
/bin/awk
/bin/mawk /bin/mawk
%endif %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 %changelog

View File

@ -1,13 +1,18 @@
Index: mawk-1.3.4-20171017/makescan.c --- 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
--- mawk-1.3.4-20171017.orig/makescan.c @@ -77,13 +77,12 @@ scan_init(void)
+++ mawk-1.3.4-20171017/makescan.c static void
@@ -83,7 +83,7 @@ scan_print(void) scan_print(void)
{
- time_t now = time((time_t *) 0);
register char *p = scan_code;
register int c; /* column */
register int r; /* row */ 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)); - '$', '$', 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("#include \"scancode.h\"\n");
printf("/* *INDENT-OFF* */\n"); printf("/* *INDENT-OFF* */\n");
printf("char scan_code[256] = {\n"); printf("char scan_code[256] = {\n");