From 65710745ed1e1a36aa31f870ab408c23a9537bdf Mon Sep 17 00:00:00 2001 From: Martin Väth Date: Fri, 5 Jul 2024 22:47:17 +0200 Subject: sys-apps/less: Version bump. media-video/luvcview: Copy from gentoo repository MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Väth --- media-video/luvcview/Manifest | 2 + media-video/luvcview/luvcview-0.2.6-r1.ebuild | 45 +++ media-video/luvcview/metadata.xml | 8 + metadata/pkg_desc_index | 3 +- sys-apps/less/Manifest | 4 +- sys-apps/less/files/less-643-LESSOPEN-escape.patch | 61 ---- sys-apps/less/files/lesspipe-r3.sh | 339 -------------------- sys-apps/less/files/lesspipe-r4.sh | 342 +++++++++++++++++++++ sys-apps/less/less-643-r3.ebuild | 119 ------- sys-apps/less/less-661-r1.ebuild | 118 +++++++ 10 files changed, 519 insertions(+), 522 deletions(-) create mode 100644 media-video/luvcview/Manifest create mode 100644 media-video/luvcview/luvcview-0.2.6-r1.ebuild create mode 100644 media-video/luvcview/metadata.xml delete mode 100644 sys-apps/less/files/less-643-LESSOPEN-escape.patch delete mode 100644 sys-apps/less/files/lesspipe-r3.sh create mode 100644 sys-apps/less/files/lesspipe-r4.sh delete mode 100644 sys-apps/less/less-643-r3.ebuild create mode 100644 sys-apps/less/less-661-r1.ebuild diff --git a/media-video/luvcview/Manifest b/media-video/luvcview/Manifest new file mode 100644 index 00000000..1f399648 --- /dev/null +++ b/media-video/luvcview/Manifest @@ -0,0 +1,2 @@ +DIST luvcview_0.2.6-4.diff.gz 8227 BLAKE2B 10c01541920b24dafd55f969f4e86daa2d4bb7d73fc33b7ed3b592e080ef31a6d4e429585402e291f20898af5d48021d618ca6496a668def767fad4dced47a3f SHA512 ae0f760e08979065a072f28367fd6c399ff8bc821b79d021d0fec8bb62e36b10804f30f708de3e23ccada0596b7c57dec6d0f8b92a777046e1bfa087686e7f87 +DIST luvcview_0.2.6.orig.tar.gz 100318 BLAKE2B 94273fc4635d515c78b9604e3a1bcdfeea5f835f64f6bb1f19c192ebee5f96b7e1d3b1e7921969560e5bd111cb7e84d20806c42b64f4ab6de40e1597ffae3c99 SHA512 6d0b480c51716e36401680ae333c37f179122d04feca3e91056f77abee6dc60dac4e431e8cca999780c343d10170678ace1eb29076c9211c0cfef6d65a4599ab diff --git a/media-video/luvcview/luvcview-0.2.6-r1.ebuild b/media-video/luvcview/luvcview-0.2.6-r1.ebuild new file mode 100644 index 00000000..76fab30b --- /dev/null +++ b/media-video/luvcview/luvcview-0.2.6-r1.ebuild @@ -0,0 +1,45 @@ +# Copyright 1999-2024 Gentoo Authors and Martin V\"ath +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 +inherit desktop toolchain-funcs + +PATCH_LEVEL="4" + +DESCRIPTION="USB Video Class grabber" +HOMEPAGE="https://packages.qa.debian.org/l/luvcview.html" +SRC_URI="mirror://debian/pool/main/l/${PN}/${PN}_${PV}.orig.tar.gz + mirror://debian/pool/main/l/${PN}/${PN}_${PV}-${PATCH_LEVEL}.diff.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="" + +RDEPEND=" + media-libs/libsdl + media-libs/libv4l + x11-libs/libX11 +" +DEPEND="${RDEPEND} + virtual/pkgconfig +" + +src_prepare() { + default + eapply "${WORKDIR}"/${PN}_${PV}-${PATCH_LEVEL}.diff + eapply debian/patches/*.patch + sed -i -e 's:videodev.h:videodev2.h:' *.{c,h} || die + sed -i -e 's:-O2::' Makefile || die +} + +src_compile() { + emake CC="$(tc-getCC) ${LDFLAGS}" +} + +src_install() { + dobin luvcview + doman debian/luvcview.1 + dodoc Changelog README ToDo + make_desktop_entry ${PN} +} diff --git a/media-video/luvcview/metadata.xml b/media-video/luvcview/metadata.xml new file mode 100644 index 00000000..a2dfee95 --- /dev/null +++ b/media-video/luvcview/metadata.xml @@ -0,0 +1,8 @@ + + + + + media-video@gentoo.org + Gentoo Video project + + diff --git a/metadata/pkg_desc_index b/metadata/pkg_desc_index index 23ffc47a..9e262673 100644 --- a/metadata/pkg_desc_index +++ b/metadata/pkg_desc_index @@ -83,6 +83,7 @@ media-tv/sundtek-tv 221030.153539: Sundtek MediaTV Pro III Drivers media-tv/w_scan 20170107-r1: Scan DVB-C/DVB-T/DVB-S channels media-video/avidemux 2.7.8: Video editor designed for simple cutting, filtering and encoding tasks media-video/avinfo 1.0_alpha15_p1-r1: Utility for displaying AVI information +media-video/luvcview 0.2.6-r1: USB Video Class grabber media-video/video-mv 17.3: Frontends for using mplayer/mencoder, ffmpeg/libav, or tzap as video recorder net-dialup/accounting 1.60.45.3.1-r1: Give statistics about dialup connections. Originally part of SuSE's smpppd net-dialup/martian-modem 20100123-r3: ltmodem alternative driver providing support for Agere Systems winmodems @@ -97,7 +98,7 @@ net-print/foo2zjs 20200221: Support for printing to ZjStream-based printers sci-geosciences/googleearth 7.1.8.3036-r4 7.3.0.3832-r4 7.3.4-r2 7.3.6: A 3D interface to the planet sci-mathematics/reduce 20141130-r3 20190413: A general-purpose computer algebra system sys-apps/cpi 3.2: A wrapper for cp -i -a, making use of diff -sys-apps/less 643-r3: Excellent text file viewer, optionally with additional selection feature +sys-apps/less 661-r1: Excellent text file viewer, optionally with additional selection feature sys-apps/man 1.6g-r4: Standard commands to read man pages sys-apps/openrc-wrapper 2.4: Use openrc init scripts with systemd or other init systems sys-apps/paxopen 1.2: A wrapper script to set PAX kernel variables to an insecure/safe state diff --git a/sys-apps/less/Manifest b/sys-apps/less/Manifest index 40ed82a5..6866df87 100644 --- a/sys-apps/less/Manifest +++ b/sys-apps/less/Manifest @@ -1,2 +1,2 @@ -DIST less-643.tar.gz 592291 BLAKE2B 6dc60dc2e8db05afdae466877a1d26a3008ff5378bbbf2fbdf9efc4f87c0fcfde5703d44a24d4355c98d3a5f438bdb51173150f2a69f801d9c8e4a7401d71b53 SHA512 6a324ac54e22429ac652dc303bc1fe48933555d1cbf8ad7ecf345940910c014fef9551a3219743cfb7115e356b5841ae97d6ce62e7a1ba1e3300d243efca34d9 -DIST less-select-2.15.tar.gz 32374 BLAKE2B f135d80cdae38f84309754863ae3736f574e5476414b7b835a8d2f9c3ff6c8baf92ece154763e61e9f0a2133928bc8f7462b209e9508ac2dad2ca454eb32aecf SHA512 1284d11b9098cbdc5243886ffdc29cf998853fd998ef6a6e1ef8af9cdcf89175bc7573b836afaab8dc06a51e9018cdd07bc9011c994bc7fd63965d3bff46defd +DIST less-661.tar.gz 648198 BLAKE2B c1fa9a7a646fcc1203945e00c35fe41bddef0c564e30f120a37e417ecd5c60d234e0253a2e18123508dd5c0313bce346dc7752e96cdc1b067bd07a2a39818b42 SHA512 49d81ff9e79d43ce0271490e3bffd590b4aed5fcb387bc8eb3128de99e5b5a5ede2e2818b546f6e3a140fa6261f1de3dfba1231f7ff7ef18502bb7030eaea1b5 +DIST less-select-2.16.tar.gz 32973 BLAKE2B ee2eea1e7caa772d16f41385fbd2088d30e622a090a82398b86082aba392227b6f6d552a10e95eaf300bc6dc4828d1154adec519e5914dc0a2c392a00ee050fa SHA512 acf52b77e54b1c38339f7d2dff6b7d2303ef27316ba75edcdbfb8a3e76d25f42e1363b62eabe79c62c5fbe954a58c398d4d3dc4ad037e06f125458cb3fb10149 diff --git a/sys-apps/less/files/less-643-LESSOPEN-escape.patch b/sys-apps/less/files/less-643-LESSOPEN-escape.patch deleted file mode 100644 index f3fe50fc..00000000 --- a/sys-apps/less/files/less-643-LESSOPEN-escape.patch +++ /dev/null @@ -1,61 +0,0 @@ -https://openwall.com/lists/oss-security/2024/04/12/5 -https://bugs.gentoo.org/929210 -https://github.com/gwsw/less/commit/007521ac3c95bc76e3d59c6dbfe75d06c8075c33 - -Upstream provided this version via email as a backport to 643. ---- a/filename.c -+++ b/filename.c -@@ -134,6 +134,15 @@ - } - - /* -+ * Must use quotes rather than escape char for this metachar? -+ */ -+static int must_quote(char c) -+{ -+ /* {{ Maybe the set of must_quote chars should be configurable? }} */ -+ return (c == '\n'); -+} -+ -+/* - * Insert a backslash before each metacharacter in a string. - */ - public char * shell_quote(char *s) -@@ -164,6 +173,9 @@ - * doesn't support escape chars. Use quotes. - */ - use_quotes = 1; -+ } else if (must_quote(*p)) -+ { -+ len += 3; /* open quote + char + close quote */ - } else - { - /* -@@ -193,15 +205,22 @@ - { - while (*s != '\0') - { -- if (metachar(*s)) -+ if (!metachar(*s)) - { -- /* -- * Add the escape char. -- */ -+ *p++ = *s++; -+ } else if (must_quote(*s)) -+ { -+ /* Surround the char with quotes. */ -+ *p++ = openquote; -+ *p++ = *s++; -+ *p++ = closequote; -+ } else -+ { -+ /* Insert an escape char before the char. */ - strcpy(p, esc); - p += esclen; -+ *p++ = *s++; - } -- *p++ = *s++; - } - *p = '\0'; - } diff --git a/sys-apps/less/files/lesspipe-r3.sh b/sys-apps/less/files/lesspipe-r3.sh deleted file mode 100644 index baec90dc..00000000 --- a/sys-apps/less/files/lesspipe-r3.sh +++ /dev/null @@ -1,339 +0,0 @@ -#!/bin/bash -# Copyright 1999-2023 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -# Preprocessor for 'less'. Used when this environment variable is set: -# LESSOPEN="|lesspipe %s" - -# TODO: handle compressed files better - -[[ -n ${LESSDEBUG+set} ]] && set -x - -trap 'exit 0' PIPE - -guesscompress() { - case "$1" in - *.gz|*.z) echo "gunzip -c" ;; - *.bz2|*.bz) echo "bunzip2 -c" ;; - *.lz) echo "lzip -dc" ;; - *.lzma) echo "unlzma -c" ;; - *.lzo) echo "lzop -dc" ;; - *.xz) echo "xzdec" ;; - *.zst) echo "zstdcat" ;; - *) echo "cat" ;; - esac -} - -crl_filter() { - if command -v certtool &>/dev/null; then - certtool --crl-info --text --infile "$1" - else - openssl crl -hash -text -noout -in "$1" - fi -} - -csr_filter() { - if command -v certtool &>/dev/null; then - certtool --crq-info --text --infile "$1" - else - openssl req -text -noout -in "$1" - fi -} - -crt_filter() { - if command -v certtool &>/dev/null; then - certtool --certificate-info --text --infile "$1" - else - openssl x509 -hash -text -noout -in "$1" - fi -} - -jks_filter() { - if command -v keytool &>/dev/null; then - keytool -list -keystore "$1" - else - cat "$1" - fi -} - -p12_filter() { - openssl pkcs12 -nokeys -info -in "$1" -} - -lesspipe_file() { - local out=$(file -L -- "$1") - local suffix - case ${out} in - *" 7-zip archive"*) suffix="7z";; - *" ar archive"*) suffix="a";; - *" CAB-Installer"*) suffix="cab";; - *" cpio archive"*) suffix="cpio";; - *" ELF "*) suffix="elf";; - *" LHa"*archive*) suffix="lha";; - *" troff "*) suffix="man";; - *" script text"*) suffix="sh";; - *" shared object"*) suffix="so";; - *" tar archive"*) suffix="tar";; - *" Zip archive"*) suffix="zip";; - *": data") hexdump -C -- "$1"; return 0;; - *) return 1;; - esac - lesspipe "$1" ".${suffix}" - return 0 -} - -lesspipe() { - local match=$2 - [[ -z ${match} ]] && match=$1 - - local DECOMPRESSOR=$(guesscompress "${match}") - - # User filters - if [[ -x ~/.lessfilter ]] ; then - ~/.lessfilter "$1" && exit 0 - fi - - # System filters - shopt -s nullglob - local f - for f in "${XDG_CONFIG_HOME:-~/.config}"/lessfilter.d/* /etc/lessfilter.d/* /usr/lib/lessfilter.d/*; do - if [[ -x ${f} ]]; then - "${f}" "$1" && exit 0 - fi - done - shopt -u nullglob - - local ignore - for ignore in ${LESSIGNORE} ; do - [[ ${match} == *.${ignore} ]] && exit 0 - done - - # Handle non-regular file types. - if [[ -d $1 ]] ; then - ls -alF -- "$1" - return - elif [[ ! -f $1 ]] ; then - # Only return if the stat passes. This is needed to handle pseudo - # arguments like URIs. - stat -- "$1" && return - fi - - case "${match}" in - - ### Doc files ### - *.[0-9n]|*.man|\ - *.[0-9n].bz2|*.man.bz2|\ - *.[0-9n].gz|*.man.gz|\ - *.[0-9n].lzma|*.man.lzma|\ - *.[0-9n].xz|*.man.xz|\ - *.[0-9n].zst|*.man.zst|\ - *.[0-9][a-z].gz|*.[0-9][a-z].gz) - local out=$(${DECOMPRESSOR} -- "$1" | file -) - case ${out} in - *troff*) - # Need to make sure we pass path to man or it will try - # to locate "$1" in the man search paths - if [[ $1 == /* ]] ; then - man -- "$1" - else - man -- "./$1" - fi - ;; - *text*) - ${DECOMPRESSOR} -- "$1" - ;; - *) - # We could have matched a library (libc.so.6), so let - # `file` figure out what the hell this thing is - lesspipe_file "$1" - ;; - esac - ;; - *.dvi) dvi2tty "$1" ;; - *.ps) ps2ascii "$1" || pstotext "$1" ;; - *.pdf) pdftotext "$1" - || ps2ascii "$1" || pstotext "$1" ;; - *.doc) antiword "$1" || catdoc "$1" ;; - *.rtf) unrtf --nopict --text "$1" ;; - *.conf|*.txt|*.log) ;; # force less to work on these directly #150256 - *.json) python -mjson.tool "$1" ;; - - ### URLs ### - ftp://*|http://*|https://|*.htm|*.html) - for b in elinks links2 links lynx ; do - ${b} -dump "$1" && exit 0 - done - html2text -style pretty "$1" - ;; - - ### Tar files ### - *.tar|\ - *.tar.bz2|*.tar.bz|*.tar.gz|*.tar.z|*.tar.zst|\ - *.tar.lz|*.tar.tlz|\ - *.tar.lzma|*.tar.xz) - ${DECOMPRESSOR} -- "$1" | tar tvvf -;; - *.tbz2|*.tbz|*.tgz|*.tlz|*.txz) - lesspipe "$1" "$1.tar.${1##*.t}" ;; - - ### Misc archives ### - *.bz2|\ - *.gz|*.z|\ - *.zst|\ - *.lz|\ - *.lzma|*.xz) ${DECOMPRESSOR} -- "$1" ;; - *.rpm) rpm -qpivl --changelog -- "$1" || rpm2tar -O "$1" | tar tvvf -;; - *.cpi|*.cpio) cpio -itv < "$1" ;; - *.ace) unace l "$1" ;; - *.arc) arc v "$1" ;; - *.arj) arj l -- "$1" || unarj l "$1" ;; - *.cab) cabextract -l -- "$1" ;; - *.lha|*.lzh) lha v "$1" ;; - *.zoo) zoo -list "$1" || unzoo -l "$1" ;; - *.7z|*.exe) 7z l -- "$1" || 7za l -- "$1" || 7zr l -- "$1" ;; - *.a) ar tv "$1" ;; - *.elf) readelf -a -W -- "$1" ;; - *.so) readelf -h -d -s -W -- "$1" ;; - *.mo|*.gmo) msgunfmt -- "$1" ;; - - *.rar|.r[0-9][0-9]) unrar l -- "$1" ;; - - *.jar|*.war|*.ear|*.xpi|*.zip) - unzip -v "$1" || miniunzip -l "$1" || miniunz -l "$1" || zipinfo -v "$1" - ;; - - *.deb|*.udeb) - if type -P dpkg > /dev/null ; then - dpkg --info "$1" - dpkg --contents "$1" - else - ar tv "$1" - ar p "$1" data.tar.gz | tar tzvvf - - fi - ;; - - ### Filesystems ### - *.squashfs) unsquashfs -s "$1" && unsquashfs -ll "$1" ;; - - ### Media ### - *.bmp|*.gif|*.jpeg|*.jpg|*.ico|*.pcd|*.pcx|*.png|*.ppm|*.tga|*.tiff|*.tif|*.webp) - identify -verbose -- "$1" || file -L -- "$1" - ;; - *.asf|*.avi|*.flv|*.mkv|*.mov|*.mp4|*.mpeg|*.mpg|*.qt|*.ram|*.rm|*.webm|*.wmv) - midentify "$1" || file -L -- "$1" - ;; - *.mp3) mp3info "$1" || id3info "$1" ;; - *.ogg) ogginfo "$1" ;; - *.flac) metaflac --list "$1" ;; - *.torrent) torrentinfo "$1" || torrentinfo-console "$1" || ctorrent -x "$1" ;; - *.bin|*.cue|*.raw) - # not all .bin/.raw files are cd images #285507 - # fall back to lesspipe_file if .cue doesn't exist, or if - # cd-info failed to parse things sanely - [[ -e ${1%.*}.cue ]] \ - && cd-info --no-header --no-device-info "$1" \ - || lesspipe_file "$1" - ;; - *.iso) - iso_info=$(isoinfo -d -i "$1") - echo "${iso_info}" - # Joliet output overrides Rock Ridge, so prefer the better Rock - case ${iso_info} in - *$'\n'"Rock Ridge"*) iso_opts="-R";; - *$'\n'"Joliet"*) iso_opts="-J";; - *) iso_opts="";; - esac - isoinfo -l ${iso_opts} -i "$1" - ;; - - ### Encryption stuff ### - *.crl) crl_filter "$1" ;; - *.csr) csr_filter "$1" ;; - *.crt|*.pem) crt_filter "$1" ;; - *.jks) jks_filter "$1" ;; - *.p12|*.pfx) p12_filter "$1" ;; - -# May not be such a good idea :) -# ### Device nodes ### -# /dev/[hs]d[a-z]*) -# fdisk -l "${1:0:8}" -# [[ $1 == *hd* ]] && hdparm -I "${1:0:8}" -# ;; - - ### Everything else ### - *) - case $(( recur++ )) in - # Maybe we didn't match due to case issues ... - 0) lesspipe "$1" "$(echo "$1" | LC_ALL=C tr '[:upper:]' '[:lower:]')" ;; - - # Maybe we didn't match because the file is named weird ... - 1) lesspipe_file "$1" ;; - esac - - # So no matches from above ... finally fall back to an external - # coloring package. No matching here so we don't have to worry - # about keeping in sync with random packages. Any coloring tool - # you use should not output errors about unsupported files to - # stdout. If it does, it's your problem. - - # Allow people to flip color off if they dont want it - case ${LESSCOLOR} in - always) LESSCOLOR=2;; - [yY][eE][sS]|[yY]|1|true) LESSCOLOR=1;; - [nN][oO]|[nN]|0|false) LESSCOLOR=0;; - *) LESSCOLOR=1;; - esac - if [[ ${LESSCOLOR} != "0" ]] && [[ -n ${LESSCOLORIZER=pygmentize} ]] ; then - # 2: Only colorize if user forces it ... - # 1: ... or we know less will handle raw codes -- this will - # not detect -seiRM, so set LESSCOLORIZER yourself - if [[ ${LESSCOLOR} == "2" ]] || [[ " ${LESS} " == *" -"[rR]" "* ]] ; then - LESSQUIET=true ${LESSCOLORIZER} "$1" - fi - fi - - # Nothing left to do but let less deal - exit 0 - ;; - esac -} - -if [[ $# -eq 0 ]] ; then - echo "Usage: lesspipe " -elif [[ $1 == "-V" || $1 == "--version" ]] ; then - cat <<-EOF - lesspipe (git) - Copyright 1999-2023 Gentoo Authors - Mike Frysinger - (with plenty of ideas stolen from other projects/distros) - - EOF - less -V -elif [[ $1 == "-h" || $1 == "--help" ]] ; then - cat <<-EOF - lesspipe: preprocess files before sending them to less - - Usage: lesspipe - - lesspipe specific settings: - LESSCOLOR env - toggle colorizing of output (no/yes/always; default: no) - LESSCOLORIZER env - program used to colorize output (default: pygmentize) - LESSIGNORE - list of extensions to ignore (don't do anything fancy) - - You can create per-user filters as well by creating the executable file: - ~/.lessfilter - One argument is passed to it: the file to display. The script should exit 0 - to indicate it handled the file, or non-zero to tell lesspipe to handle it. - - To use lesspipe, simply add to your environment: - export LESSOPEN="|lesspipe %s" - - For colorization, install dev-python/pygments for the pygmentize program. Note, - if using alternative code2color from sys app-text/lesspipe you may run out of - memory due to #188835. - - Run 'less --help' or 'man less' for more info. - EOF -else - recur=0 - [[ -z ${LESSDEBUG+set} ]] && exec 2>/dev/null - lesspipe "$1" -fi diff --git a/sys-apps/less/files/lesspipe-r4.sh b/sys-apps/less/files/lesspipe-r4.sh new file mode 100644 index 00000000..02a610d0 --- /dev/null +++ b/sys-apps/less/files/lesspipe-r4.sh @@ -0,0 +1,342 @@ +#!/bin/bash +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# Preprocessor for 'less'. Used when this environment variable is set: +# LESSOPEN="|lesspipe %s" + +# TODO: handle compressed files better + +[[ -n ${LESSDEBUG+set} ]] && set -x + +trap 'exit 0' PIPE + +guesscompress() { + case "$1" in + *.gz|*.z) echo "gunzip -c" ;; + *.bz2|*.bz) echo "bunzip2 -c" ;; + *.lz) echo "lzip -dc" ;; + *.lzma) echo "unlzma -c" ;; + *.lzo) echo "lzop -dc" ;; + *.xz) echo "xzdec" ;; + *.zst) echo "zstdcat" ;; + *) echo "cat" ;; + esac +} + +crl_filter() { + if command -v certtool &>/dev/null; then + certtool --crl-info --text --infile "$1" + else + openssl crl -hash -text -noout -in "$1" + fi +} + +csr_filter() { + if command -v certtool &>/dev/null; then + certtool --crq-info --text --infile "$1" + else + openssl req -text -noout -in "$1" + fi +} + +crt_filter() { + if command -v certtool &>/dev/null; then + certtool --certificate-info --text --infile "$1" + else + openssl x509 -hash -text -noout -in "$1" + fi +} + +jks_filter() { + if command -v keytool &>/dev/null; then + keytool -list -keystore "$1" + else + cat "$1" + fi +} + +p12_filter() { + openssl pkcs12 -nokeys -info -in "$1" +} + +lesspipe_file() { + local out=$(file -L -- "$1") + local suffix + case ${out} in + *" 7-zip archive"*) suffix="7z";; + *" ar archive"*) suffix="a";; + *" CAB-Installer"*) suffix="cab";; + *" cpio archive"*) suffix="cpio";; + *" ELF "*) suffix="elf";; + *" LHa"*archive*) suffix="lha";; + *" troff "*) suffix="man";; + *" script text"*) suffix="sh";; + *" shared object"*) suffix="so";; + *" tar archive"*) suffix="tar";; + *" Zip archive"*) suffix="zip";; + *": data") hexdump -C -- "$1"; return 0;; + *) return 1;; + esac + lesspipe "$1" ".${suffix}" + return 0 +} + +lesspipe() { + local match=$2 + [[ -z ${match} ]] && match=$1 + + local DECOMPRESSOR=$(guesscompress "${match}") + + # User filters + if [[ -x ~/.lessfilter ]] ; then + ~/.lessfilter "$1" && exit 0 + fi + + # System filters + shopt -s nullglob + local f + for f in "${XDG_CONFIG_HOME:-~/.config}"/lessfilter.d/* /etc/lessfilter.d/* /usr/lib/lessfilter.d/*; do + if [[ -x ${f} ]]; then + "${f}" "$1" && exit 0 + fi + done + shopt -u nullglob + + local ignore + for ignore in ${LESSIGNORE} ; do + [[ ${match} == *.${ignore} ]] && exit 0 + done + + # Handle non-regular file types. + if [[ -d $1 ]] ; then + ls -alF -- "$1" + return + elif [[ ! -f $1 ]] ; then + # Only return if the stat passes. This is needed to handle pseudo + # arguments like URIs. + stat -- "$1" && return + fi + + case "${match}" in + + ### Doc files ### + *.[0-9n]|*.man|\ + *.[0-9n].bz2|*.man.bz2|\ + *.[0-9n].gz|*.man.gz|\ + *.[0-9n].lzma|*.man.lzma|\ + *.[0-9n].xz|*.man.xz|\ + *.[0-9n].zst|*.man.zst|\ + *.[0-9][a-z].gz|*.[0-9][a-z].gz) + local out=$(${DECOMPRESSOR} -- "$1" | file -) + case ${out} in + *troff*) + # Need to make sure we pass path to man or it will try + # to locate "$1" in the man search paths + if [[ $1 == /* ]] ; then + man -- "$1" + else + man -- "./$1" + fi + ;; + *text*) + ${DECOMPRESSOR} -- "$1" + ;; + *) + # We could have matched a library (libc.so.6), so let + # `file` figure out what the hell this thing is + lesspipe_file "$1" + ;; + esac + ;; + *.dvi) dvi2tty "$1" ;; + *.ps) ps2ascii "$1" || pstotext "$1" ;; + *.pdf) pdftotext "$1" - || ps2ascii "$1" || pstotext "$1" ;; + *.doc) antiword "$1" || catdoc "$1" ;; + *.rtf) unrtf --nopict --text "$1" ;; + *.conf|*.txt|*.log) ;; # force less to work on these directly #150256 + *.json) python -mjson.tool "$1" ;; + + ### URLs ### + ftp://*|http://*|https://|*.htm|*.html) + for b in elinks links2 links lynx ; do + ${b} -dump "$1" && exit 0 + done + html2text -style pretty "$1" + ;; + + ### Tar files ### + *.tar|\ + *.tar.bz2|*.tar.bz|*.tar.gz|*.tar.z|*.tar.zst|\ + *.tar.lz|*.tar.tlz|\ + *.tar.lzma|*.tar.xz) + ${DECOMPRESSOR} -- "$1" | tar tvvf -;; + *.tbz2|*.tbz|*.tgz|*.tlz|*.txz) + lesspipe "$1" "$1.tar.${1##*.t}" ;; + + ### Misc archives ### + *.bz2|\ + *.gz|*.z|\ + *.zst|\ + *.lz|\ + *.lzma|*.xz) ${DECOMPRESSOR} -- "$1" ;; + *.rpm) rpm -qpivl --changelog -- "$1" || rpm2tar -O "$1" | tar tvvf -;; + *.cpi|*.cpio) cpio -itv < "$1" ;; + *.ace) unace l "$1" ;; + *.arc) arc v "$1" ;; + *.arj) arj l -- "$1" || unarj l "$1" ;; + *.cab) cabextract -l -- "$1" ;; + *.lha|*.lzh) lha v "$1" ;; + *.zoo) zoo -list "$1" || unzoo -l "$1" ;; + *.7z|*.exe) 7z l -- "$1" || 7za l -- "$1" || 7zr l -- "$1" ;; + *.a) ar tv "$1" ;; + *.elf) readelf -a -W -- "$1" ;; + *.so) readelf -h -d -s -W -- "$1" ;; + *.mo|*.gmo) msgunfmt -- "$1" ;; + + *.rar|.r[0-9][0-9]) unrar l -- "$1" ;; + + *.jar|*.war|*.ear|*.xpi|*.zip) + unzip -v "$1" || miniunzip -l "$1" || miniunz -l "$1" || zipinfo -v "$1" + ;; + + *.deb|*.udeb) + if type -P dpkg > /dev/null ; then + dpkg --info "$1" + dpkg --contents "$1" + else + ar tv "$1" + ar p "$1" data.tar.gz | tar tzvvf - + fi + ;; + + ### Filesystems ### + *.squashfs) unsquashfs -s "$1" && unsquashfs -ll "$1" ;; + + ### Media ### + *.bmp|*.gif|*.jpeg|*.jpg|*.ico|*.pcd|*.pcx|*.png|*.ppm|*.tga|*.tiff|*.tif|*.webp) + identify -verbose -- "$1" || file -L -- "$1" + ;; + *.asf|*.avi|*.flv|*.mkv|*.mov|*.mp4|*.mpeg|*.mpg|*.qt|*.ram|*.rm|*.webm|*.wmv) + midentify "$1" || file -L -- "$1" + ;; + *.mp3) mp3info "$1" || id3info "$1" ;; + *.ogg) ogginfo "$1" ;; + *.flac) metaflac --list "$1" ;; + *.torrent) torrentinfo "$1" || torrentinfo-console "$1" || ctorrent -x "$1" ;; + *.bin|*.cue|*.raw) + # not all .bin/.raw files are cd images #285507 + # fall back to lesspipe_file if .cue doesn't exist, or if + # cd-info failed to parse things sanely + [[ -e ${1%.*}.cue ]] \ + && cd-info --no-header --no-device-info "$1" \ + || lesspipe_file "$1" + ;; + *.iso) + iso_info=$(isoinfo -d -i "$1") + echo "${iso_info}" + # Joliet output overrides Rock Ridge, so prefer the better Rock + case ${iso_info} in + *$'\n'"Rock Ridge"*) iso_opts="-R";; + *$'\n'"Joliet"*) iso_opts="-J";; + *) iso_opts="";; + esac + isoinfo -l ${iso_opts} -i "$1" + ;; + + ### Encryption stuff ### + *.crl) crl_filter "$1" ;; + *.csr) csr_filter "$1" ;; + *.crt|*.pem) crt_filter "$1" ;; + *.jks) jks_filter "$1" ;; + *.p12|*.pfx) p12_filter "$1" ;; + +# May not be such a good idea :) +# ### Device nodes ### +# /dev/[hs]d[a-z]*) +# fdisk -l "${1:0:8}" +# [[ $1 == *hd* ]] && hdparm -I "${1:0:8}" +# ;; + + ### Everything else ### + *) + case $(( recur++ )) in + # Maybe we didn't match due to case issues ... + 0) lesspipe "$1" "$(echo "$1" | LC_ALL=C tr '[:upper:]' '[:lower:]')" ;; + + # Maybe we didn't match because the file is named weird ... + 1) lesspipe_file "$1" ;; + esac + + # So no matches from above ... finally fall back to an external + # coloring package. No matching here so we don't have to worry + # about keeping in sync with random packages. Any coloring tool + # you use should not output errors about unsupported files to + # stdout. If it does, it's your problem. + + # Allow people to flip color off if they dont want it + case ${LESSCOLOR} in + always) LESSCOLOR=2;; + [yY][eE][sS]|[yY]|1|true) LESSCOLOR=1;; + [nN][oO]|[nN]|0|false) LESSCOLOR=0;; + *) LESSCOLOR=1;; + esac + + [[ -n ${NO_COLOR} ]] && LESSCOLOR=0 + + if [[ ${LESSCOLOR} != "0" ]] && [[ -n ${LESSCOLORIZER=pygmentize -O style=rrt} ]] ; then + # 2: Only colorize if user forces it ... + # 1: ... or we know less will handle raw codes -- this will + # not detect -seiRM, so set LESSCOLORIZER yourself + if [[ ${LESSCOLOR} == "2" ]] || [[ " ${LESS} " == *" -"[rR]" "* ]] ; then + LESSQUIET=true ${LESSCOLORIZER} "$1" + fi + fi + + # Nothing left to do but let less deal + exit 0 + ;; + esac +} + +if [[ $# -eq 0 ]] ; then + echo "Usage: lesspipe " +elif [[ $1 == "-V" || $1 == "--version" ]] ; then + cat <<-EOF + lesspipe (git) + Copyright 1999-2024 Gentoo Authors + Mike Frysinger + (with plenty of ideas stolen from other projects/distros) + + EOF + less -V +elif [[ $1 == "-h" || $1 == "--help" ]] ; then + cat <<-EOF + lesspipe: preprocess files before sending them to less + + Usage: lesspipe + + lesspipe specific settings: + LESSCOLOR env - toggle colorizing of output (no/yes/always; default: yes) + LESSCOLORIZER env - program used to colorize output (default: pygmentize) + LESSIGNORE - list of extensions to ignore (don't do anything fancy) + + You can create per-user filters as well by creating the executable file: + ~/.lessfilter + One argument is passed to it: the file to display. The script should exit 0 + to indicate it handled the file, or non-zero to tell lesspipe to handle it. + + To use lesspipe, simply add to your environment: + export LESSOPEN="|lesspipe %s" + + For colorization, install dev-python/pygments for the pygmentize program. Note, + if using alternative code2color from sys app-text/lesspipe you may run out of + memory due to #188835. + + Run 'less --help' or 'man less' for more info. + EOF +else + recur=0 + [[ -z ${LESSDEBUG+set} ]] && exec 2>/dev/null + lesspipe "$1" +fi diff --git a/sys-apps/less/less-643-r3.ebuild b/sys-apps/less/less-643-r3.ebuild deleted file mode 100644 index 62013910..00000000 --- a/sys-apps/less/less-643-r3.ebuild +++ /dev/null @@ -1,119 +0,0 @@ -# Copyright 1999-2024 Gentoo Authors and Martin V\"ath -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -WANT_AUTOMAKE=none -WANT_LIBTOOL=none -inherit autotools flag-o-matic optfeature toolchain-funcs - -DESCRIPTION="Excellent text file viewer, optionally with additional selection feature" -PATCHN="less-select" -PATCHV="2.15" -PATCHVER="633" -PATCHRUMP="${PATCHN}-${PATCHV}" -PATCHBALL="${PATCHRUMP}.tar.gz" -SELECTDIR="${WORKDIR}/${PATCHRUMP}" -HOMEPAGE="http://www.greenwoodsoftware.com/less/ https://github.com/vaeth/less-select" -SRC_URI="mirror+http://www.greenwoodsoftware.com/less/${P}.tar.gz - less-select? ( https://github.com/vaeth/${PATCHN}/archive/v${PATCHV}.tar.gz -> ${PATCHBALL} )" -RESTRICT="mirror" - -LICENSE="|| ( GPL-3 BSD-2 )" -SLOT="0" -KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" -IUSE="+lesspipe +less-select pcre original-gentoo source test" -RESTRICT="test !test? ( test )" - -DEPEND=" - >=app-misc/editor-wrapper-3 - >=sys-libs/ncurses-5.2:= - pcre? ( dev-libs/libpcre2 ) -" -RDEPEND="${DEPEND} - less-select? ( dev-lang/perl )" -# || ( >=dev-lang/perl-5.10.1 >=virtual/perl-File-Temp-0.19 ) -PDEPEND="lesspipe? ( app-text/lesspipe )" -BDEPEND="test? ( virtual/pkgconfig )" - -PATCHES=( - "${FILESDIR}"/${PN}-643-lesstest-pkg-config.patch - "${FILESDIR}"/${PN}-643-LESSOPEN-escape.patch -) - -pkg_setup() { - if use source && ! use less-select - then ewarn 'ignoring USE=source without USE=less-select' - fi -} - -src_prepare() { - if use less-select - then eapply "${SELECTDIR}/patches/less-${PATCHVER}-select.patch" - "${SELECTDIR}"/after-patch || die "${SELECTDIR}/after-patch failed" - sed -i -e 's|\([^a-zA-Z]\)/etc/less-select-key.bin|\1'"${EPREFIX}"'/etc/less/select-key.bin|g' \ - "${SELECTDIR}/bin/less-select" || die - fi - - default - # Upstream uses unpatched autoconf-2.69, which breaks with clang-16. - # https://bugs.gentoo.org/870412 - eautoreconf -} - -src_configure() { - append-lfs-flags # bug #896316 - - local myeconfargs=( - --with-regex=$(usex pcre pcre2 posix) - --with-editor="${EPREFIX}"/usr/libexec/editor - ) - econf "${myeconfargs[@]}" -} - -src_compile() { - default - if use less-select - then ./lesskey -o normal-key.bin "${SELECTDIR}/keys/less-normal-key.src" || die - ./lesskey -o select-key.bin "${SELECTDIR}/keys/less-select-key.src" || die - fi -} - -src_test() { - emake check VERBOSE=1 CC="$(tc-getCC)" PKG_CONFIG="$(tc-getPKG_CONFIG)" -} - -src_install() { - local a - default - - keepdir /usr/lib/lessfilter.d - keepdir /etc/lessfilter.d - - newbin "${FILESDIR}"/lesspipe-r3.sh lesspipe - - if use original-gentoo - then a="-R -M --shift 5" - else a="-sFRiMX --shift 5" - fi - printf '%s\n' \ - 'LESSOPEN="|lesspipe'$(usex lesspipe .sh)' %s"' \ - "LESS=\"${a}\"" \ - >70less || die - doenvd 70less - - if use less-select - then newdoc "${SELECTDIR}"/README.md README.less-select - dobin "${SELECTDIR}/bin/"* - insinto /etc/less - doins select-key.bin normal-key.bin - if use source - then newins "${SELECTDIR}/keys/less-select-key.src" select-key.src - newins "${SELECTDIR}/keys/less-normal-key.src" normal-key.src - fi - fi -} - -pkg_preinst() { - use lesspipe || optfeature "Colorized output support" dev-python/pygments -} diff --git a/sys-apps/less/less-661-r1.ebuild b/sys-apps/less/less-661-r1.ebuild new file mode 100644 index 00000000..991a6bfc --- /dev/null +++ b/sys-apps/less/less-661-r1.ebuild @@ -0,0 +1,118 @@ +# Copyright 1999-2024 Gentoo Authors and Martin V\"ath +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +WANT_AUTOMAKE=none +WANT_LIBTOOL=none +inherit autotools flag-o-matic optfeature toolchain-funcs + +DESCRIPTION="Excellent text file viewer, optionally with additional selection feature" +PATCHN="less-select" +PATCHV="2.16" +PATCHVER="661" +PATCHRUMP="${PATCHN}-${PATCHV}" +PATCHBALL="${PATCHRUMP}.tar.gz" +SELECTDIR="${WORKDIR}/${PATCHRUMP}" +HOMEPAGE="http://www.greenwoodsoftware.com/less/ https://github.com/vaeth/less-select" +SRC_URI="mirror+http://www.greenwoodsoftware.com/less/${P}.tar.gz + less-select? ( https://github.com/vaeth/${PATCHN}/archive/v${PATCHV}.tar.gz -> ${PATCHBALL} )" +RESTRICT="mirror" + +LICENSE="|| ( GPL-3 BSD-2 )" +SLOT="0" +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" +IUSE="+lesspipe +less-select pcre original-gentoo source test" +RESTRICT="test !test? ( test )" + +DEPEND=" + >=app-misc/editor-wrapper-3 + >=sys-libs/ncurses-5.2:= + pcre? ( dev-libs/libpcre2 ) +" +RDEPEND="${DEPEND} + less-select? ( dev-lang/perl )" +# || ( >=dev-lang/perl-5.10.1 >=virtual/perl-File-Temp-0.19 ) +PDEPEND="lesspipe? ( app-text/lesspipe )" +BDEPEND="test? ( virtual/pkgconfig )" + +PATCHES=( + "${FILESDIR}"/${PN}-643-lesstest-pkg-config.patch +) + +pkg_setup() { + if use source && ! use less-select + then ewarn 'ignoring USE=source without USE=less-select' + fi +} + +src_prepare() { + if use less-select + then eapply "${SELECTDIR}/patches/less-${PATCHVER}-select.patch" + "${SELECTDIR}"/after-patch || die "${SELECTDIR}/after-patch failed" + sed -i -e 's|\([^a-zA-Z]\)/etc/less-select-key.bin|\1'"${EPREFIX}"'/etc/less/select-key.bin|g' \ + "${SELECTDIR}/bin/less-select" || die + fi + + default + # Upstream uses unpatched autoconf-2.69, which breaks with clang-16. + # https://bugs.gentoo.org/870412 + eautoreconf +} + +src_configure() { + append-lfs-flags # bug #896316 + + local myeconfargs=( + --with-regex=$(usex pcre pcre2 posix) + --with-editor="${EPREFIX}"/usr/libexec/editor + ) + econf "${myeconfargs[@]}" +} + +src_compile() { + default + if use less-select + then ./lesskey -o normal-key.bin "${SELECTDIR}/keys/less-normal-key.src" || die + ./lesskey -o select-key.bin "${SELECTDIR}/keys/less-select-key.src" || die + fi +} + +src_test() { + emake check VERBOSE=1 CC="$(tc-getCC)" PKG_CONFIG="$(tc-getPKG_CONFIG)" +} + +src_install() { + local a + default + + keepdir /usr/lib/lessfilter.d + keepdir /etc/lessfilter.d + + newbin "${FILESDIR}"/lesspipe-r4.sh lesspipe + + if use original-gentoo + then a="-R -M --shift 5" + else a="-sFRiMX --shift 5" + fi + printf '%s\n' \ + 'LESSOPEN="|lesspipe'$(usex lesspipe .sh)' %s"' \ + "LESS=\"${a}\"" \ + >70less || die + doenvd 70less + + if use less-select + then newdoc "${SELECTDIR}"/README.md README.less-select + dobin "${SELECTDIR}/bin/"* + insinto /etc/less + doins select-key.bin normal-key.bin + if use source + then newins "${SELECTDIR}/keys/less-select-key.src" select-key.src + newins "${SELECTDIR}/keys/less-normal-key.src" normal-key.src + fi + fi +} + +pkg_preinst() { + use lesspipe || optfeature "Colorized output support" dev-python/pygments +} -- cgit v1.2.3-65-gdbad