File man-pages.spec of Package man-pages

# spec file for package man-pages
# Copyright (c) 2020 SUSE LLC
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

Name:           man-pages
Version:        5.09
Release:        0
Summary:        Linux  Manual Pages
License:        BSD-3-Clause AND GPL-2.0-or-later AND MIT
Group:          Documentation/Man
#Git-Clone:	git://
Patch0:         %{name}.eal3.diff
Patch3:         %{name}_gai.conf-reference.patch
Patch5:         %{name}-tty_ioctl.patch
# [bsc#1154701]
Patch6:         man-pages-tcp_fack.patch
# [bsc#1173382]
Patch7:         man-pages-openat2.h-location.patch
BuildRequires:  fdupes
Supplements:    packageand(man:patterns-base-documentation)
BuildArch:      noarch

A large collection of man pages (documentation) from the Linux
Documentation Project (LDP).  The man pages are organized into the
following sections: Section 1, user commands (intro only); Section 2,
system calls; Section 3, libc calls; Section 4, devices (e.g., hd, sd);
Section 5, file formats and protocols (e.g., wtmp, %{_sysconfdir}/passwd, nfs);
Section 6, games (intro only); Section 7, conventions, macro packages,
etc. (e.g., nroff, ascii); and Section 8, system administration (intro

%setup -q
%patch0 -p2
%patch5 -p1
%patch6 -p1
%patch7 -p1
find -name "*.orig" | xargs rm -fv

# glibc
rm man3/{getifaddrs.3,freeifaddrs.3,crypt.3,crypt_r.3}
# remove .so link to bzero.3, conflicts with libbsd
rm man3/explicit_bzero.3
# already in bpftool package
rm man7/bpf-helpers.7
# conflicts with mandoc
mkdir man7mp
mv man7/man.7 man7mp/man.7mp

for i in man[0-9]*; do
  mkdir -p "%{buildroot}/%{_mandir}/$i"
  cp -p "$i"/* "%{buildroot}/%{_mandir}/$i/"
cd "%{buildroot}/%{_mandir}/"
for i in */* ; do
    grep "^.so man" "$i" && FOUND=1
    if [ "$FOUND" == 1 ] ; then
      if [ ! -f `grep "^.so man" "$i" | awk '{print $2}'` ]; then
echo ""
echo "The following manual pages are now missing (for .so reference):"
echo ""
if [ "$RETVAL" -ne 0 ] ; then
  exit "$RETVAL"

# Remove duplicates
%fdupes -s %{buildroot}/%{_prefix}

%dir %{_mandir}/man7mp
%doc README Changes Changes.old
%doc man-pages-*.Announce
%doc man-pages-*.lsm
%doc Changes