File lesspipe.spec of Package lesspipe

#
# spec file for package lesspipe
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2024 Asterios Dramis <asterios.dramis@gmail.com>.
#
# 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.


Name:           lesspipe
Version:        2.12
Release:        0
Summary:        Input Filter for the Pager "less" to Better Display Files
License:        GPL-2.0-or-later
Group:          System/Console
URL:            https://github.com/wofr06/lesspipe
Source0:        https://github.com/wofr06/lesspipe/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Requires:       %{_bindir}/iconv
Requires:       file
Requires:       grep
# Needed: tput
Requires:       ncurses-utils
Requires:       sed
# Needed: 7z, 7za, 7zr, 7zz
Recommends:     7zip
# Needed: identify
Recommends:     ImageMagick
# Program name may alternatively be batcat. Check at each update.
Recommends:     bat
# Needed: ar, nm, strings
Recommends:     binutils
Recommends:     brotli
Recommends:     bsdtar
Recommends:     bzip2
Recommends:     cabextract
Recommends:     ccze
Recommends:     cpio
# Needed: djvutxt
Recommends:     djvulibre
Recommends:     dtc
# Available from unofficial devel project
Recommends:     dvi2tty
Recommends:     elinks
Recommends:     exiftool
# Needed: ps2ascii
Recommends:     ghostscript
# Needed: gpg
Recommends:     gpg2
Recommends:     groff
Recommends:     gzip
# Needed: h5dump
Recommends:     hdf5
Recommends:     id3v2
Recommends:     jq
Recommends:     lz4
Recommends:     lzip
# Needed: matdump
Recommends:     matio-tools
Recommends:     mediainfo
# Needed: isoinfo
Recommends:     mkisofs
# Needed: compress
Recommends:     ncompress
Recommends:     odt2txt
Recommends:     openssl
Recommends:     pandoc
# Needed: perl, perldoc, pod2text
Recommends:     perl
# Needed: xlscat
Recommends:     perl-Spreadsheet-Read-scripts
# Needed: pdfinfo, pdftohtml, pdftotext
Recommends:     poppler-tools
# Available from unofficial devel project
Recommends:     pptx2md
# Needed: csvlook, in2csv
Recommends:     python3-csvkit
# Needed: zlib-flate
Recommends:     qpdf
# Needed: rpm2cpio
Recommends:     rpm
Recommends:     unrar
# Available from official devel project
Recommends:     unrtf
Recommends:     unzip
# Needed: column
Recommends:     util-linux
# Needed: wvText
Recommends:     wv
# Needed: lzma, xz
Recommends:     xz
Recommends:     zstd
# Needed: catdoc, catppt - Available from unofficial devel project
Suggests:       catdoc
# Needed: xls2csv - Available from unofficial devel project
Suggests:       catdoc-xls2csv
# Available from unofficial devel project
Suggests:       docx2txt
Suggests:       html2text
Suggests:       libreoffice
Suggests:       libreoffice-calc
Suggests:       libreoffice-draw
Suggests:       libreoffice-writer
Suggests:       lynx
Suggests:       man
# Needed: mandoc
Suggests:       mandoc-bin
# Needed: ncdump
Suggests:       netcdf
# Available from Packman
Suggests:       rar
Suggests:       w3m
# Build package, then add the following requirement
#Recommends:     csvtable
# Build package, then add the following requirement
#Recommends:     mdcat
# Build package, then add the following requirement
#Recommends:     procyon
# Package not considered important for now
#Recommends:     plistutil
# Build package, then add the following requirement
#Suggests:       excel2csv
# Package not considered important for now
#Suggests:       plutil
BuildArch:      noarch

%description
lesspipe.sh is an input filter for the pager less. It is able to process a wide
variety of file formats. It enables users to deeply inspect archives and to
display the contents of files in archives without having to unpack them before.
That means file contents can be properly interpreted even if the files are
compressed and contained in a hierarchy of archives (often found in RPM or DEB
archives containing source tarballs). The filter is easily extensible for new
formats. The input filter is a bash script, but works as well as a zsh script.
For zsh and bash tab completion mechanisms for archive contents are provided.

%prep
%autosetup

# Fix rpmlint error "env-script-interpreter"
sed -i "s/\#\!\/usr\/bin\/env\ bash/\#\!\/usr\/bin\/bash/" lesscomplete
sed -i "s/\#\!\/usr\/bin\/env\ perl/\#\!\/usr\/bin\/perl/" archive_color code2color sxw2txt vimcolor

%build
./configure --all-completions --prefix=%{_prefix}

%install
%make_install PREFIX=%{_prefix}

# Fix rpmlint error "env-script-interpreter"
sed -i "s/\#\!\/usr\/bin\/env\ bash/\#\!\/usr\/bin\/bash/" %{buildroot}%{_bindir}/lesspipe.sh

# Fix rpmlint error "filelist-forbidden-bashcomp-userdirs"
install -dp -m 0755 %{buildroot}%{_datadir}/bash-completion/completions/
mv %{buildroot}%{_datadir}/bash-completion/less_completion %{buildroot}%{_datadir}/bash-completion/completions/

%files
%license COPYING
%doc ChangeLog README.md german.txt
%{_bindir}/archive_color
%{_bindir}/code2color
%{_bindir}/lesscomplete
%{_bindir}/lesspipe.sh
%{_bindir}/sxw2txt
%{_bindir}/vimcolor
%{_datadir}/bash-completion/completions/less_completion
%dir %{_datadir}/zsh/
%dir %{_datadir}/zsh/site-functions/
%{_datadir}/zsh/site-functions/_less
%{_mandir}/man1/lesspipe.1%{?ext_man}

%changelog
openSUSE Build Service is sponsored by