public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/, sys-apps/less/files/
@ 2019-06-12  8:47 Lars Wendler
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Wendler @ 2019-06-12  8:47 UTC (permalink / raw
  To: gentoo-commits

commit:     074c17de1b43b239b62178de7703fd1269f6eb8a
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 12 07:37:47 2019 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Wed Jun 12 08:47:34 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=074c17de

sys-apps/less: Removed old.

Package-Manager: Portage-2.3.67, Repoman-2.3.14
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>

 sys-apps/less/Manifest                       |  1 -
 sys-apps/less/files/less-549-mouse_fix.patch | 51 ----------------------------
 sys-apps/less/less-549-r1.ebuild             | 48 --------------------------
 3 files changed, 100 deletions(-)

diff --git a/sys-apps/less/Manifest b/sys-apps/less/Manifest
index 5b6c66ae85a..0b4db6a37fa 100644
--- a/sys-apps/less/Manifest
+++ b/sys-apps/less/Manifest
@@ -1,5 +1,4 @@
 DIST less-530.tar.gz 339723 BLAKE2B 9321548b06330c0b1b5b5a36147f5b9348619ff15d907808744b89581edeb4d8c2118ba455d024a23850902cac4d2c34d1e7b9897e02769584315c0e67ef667e SHA512 8d83a18b5648c4fe85921a563aa2c40bcf495aeb611098c83cd167b1e2f706649846cdf457c8506ae2683ab362ad970a0b261747349673020894bccdb9acbc10
 DIST less-531.tar.gz 340466 BLAKE2B 6ac75b623fce478114d18cff429659499fedf4ef1a7bb067465ace91c28a7968efb224a4994a1e376a8cf40b110492f10ecda634628029107b38187044a0cd1e SHA512 180b665f194d7cc40d4bbb37bd64b10be463c0705e81795bef84b20dbba1c61825bb3e3da8bcd79f9176bb3af7b1f4e4c3dfe0829a5a2195a11f5b42294daca1
-DIST less-549.tar.gz 346978 BLAKE2B 840ff54567d241cd4cfb90e91d3e004da09a3dfe4b8595aebdf69e0fb9c534e9da3bfe4953d51fcab67c86fbaa1e7bd9f318bd18856bf051895995715df7e827 SHA512 f0f86db00ee7a0ed638dfe2183e5cd6a9728d6e4cb9f054a746716abf6fe297f33b6f1d44bd4eac8ad360da564c4ea50cd6f41d297f857c78414961d28f4155c
 DIST less-550.tar.gz 347026 BLAKE2B b033cb09d1bb9624c56db14084c73e5154e36cebd3f757dd2cb1b012b8797e7647d152bb67ce4ea9c2d188b1252fd7ddfd8a113656af5ec9a1e688145d4d9265 SHA512 a3d2769d90589a8e6afbfc9ac10cd1b544e0b0bbe28884e5ad980a71c541a37545c11d3450984b346b516fe082dfc0cf89d246c5a2d6002a7a2b4a4296a15494
 DIST less-551.tar.gz 347007 BLAKE2B 033a043340f888616c8342703597b9232ae1c8e62775d3ee0187599c3d9d9824fdbc7543ca90cdc535b2077a8bcbefe322887ad29289620191d8cf6ff86ddd04 SHA512 ef5296b9ebd72f83c05cad8a0f7a5eec2290e9b358ee725e09e8541bd95f94c0e14ea22aa04b287a0654079338eaeae813f2235b8e9f819fbbc9040dd65a9585

diff --git a/sys-apps/less/files/less-549-mouse_fix.patch b/sys-apps/less/files/less-549-mouse_fix.patch
deleted file mode 100644
index 495073a32a4..00000000000
--- a/sys-apps/less/files/less-549-mouse_fix.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From d5015d29f79e70fb70489616c0f2d0ff32e52898 Mon Sep 17 00:00:00 2001
-From: Mark Nudelman <markn@greenwoodsoftware.com>
-Date: Sat, 16 Feb 2019 07:20:42 -0800
-Subject: [PATCH] Don't emit mouse controls if --mouse is not set.
-
----
- screen.c | 10 ++++++----
- 1 file changed, 6 insertions(+), 4 deletions(-)
-
-diff --git a/screen.c b/screen.c
-index 9a32685..b58fe26 100644
---- a/screen.c
-+++ b/screen.c
-@@ -1549,6 +1549,8 @@ win32_deinit_term(VOID_PARAM)
- 	public void
- init_mouse(VOID_PARAM)
- {
-+	if (!mousecap)
-+		return;
- #if !MSDOS_COMPILER
- 	tputs(sc_s_mousecap, sc_height, putchr);
- #else
-@@ -1565,6 +1567,8 @@ init_mouse(VOID_PARAM)
- 	public void
- deinit_mouse(VOID_PARAM)
- {
-+	if (!mousecap)
-+		return;
- #if !MSDOS_COMPILER
- 	tputs(sc_e_mousecap, sc_height, putchr);
- #else
-@@ -1587,8 +1591,7 @@ init(VOID_PARAM)
- 			tputs(sc_init, sc_height, putchr);
- 		if (!no_keypad)
- 			tputs(sc_s_keypad, sc_height, putchr);
--		if (mousecap)
--			init_mouse();
-+		init_mouse();
- 	}
- 	if (top_scroll) 
- 	{
-@@ -1626,8 +1629,7 @@ deinit(VOID_PARAM)
- #if !MSDOS_COMPILER
- 	if (!(quit_if_one_screen && one_screen))
- 	{
--		if (mousecap)
--			deinit_mouse();
-+		deinit_mouse();
- 		if (!no_keypad)
- 			tputs(sc_e_keypad, sc_height, putchr);
- 		if (!no_init)

diff --git a/sys-apps/less/less-549-r1.ebuild b/sys-apps/less/less-549-r1.ebuild
deleted file mode 100644
index 8eff7a5d6ea..00000000000
--- a/sys-apps/less/less-549-r1.ebuild
+++ /dev/null
@@ -1,48 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-DESCRIPTION="Excellent text file viewer"
-HOMEPAGE="http://www.greenwoodsoftware.com/less/"
-SRC_URI="http://www.greenwoodsoftware.com/less/${P}.tar.gz"
-
-LICENSE="|| ( GPL-3 BSD-2 )"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="pcre unicode"
-
-DEPEND=">=app-misc/editor-wrapper-3
-	>=sys-libs/ncurses-5.2:0=
-	pcre? ( dev-libs/libpcre2 )"
-RDEPEND="${DEPEND}"
-
-PATCHES=(
-	"${FILESDIR}"/${P}-mouse_fix.patch #678102
-)
-
-src_configure() {
-	export ac_cv_lib_ncursesw_initscr=$(usex unicode)
-	export ac_cv_lib_ncurses_initscr=$(usex !unicode)
-	local myeconfargs=(
-		--with-regex=$(usex pcre pcre2 posix)
-		--with-editor="${EPREFIX}"/usr/libexec/editor
-	)
-	econf "${myeconfargs[@]}"
-}
-
-src_install() {
-	default
-
-	newbin "${FILESDIR}"/lesspipe.sh lesspipe
-	newenvd "${FILESDIR}"/less.envd 70less
-}
-
-pkg_preinst() {
-	if has_version "<${CATEGORY}/${PN}-483-r1" ; then
-		elog "The lesspipe.sh symlink has been dropped.  If you are still setting"
-		elog "LESSOPEN to that, you will need to update it to '|lesspipe %s'."
-		elog "Colorization support has been dropped.  If you want that, check out"
-		elog "the new app-text/lesspipe package."
-	fi
-}


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/, sys-apps/less/files/
@ 2020-10-20 21:00 Thomas Deutschmann
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Deutschmann @ 2020-10-20 21:00 UTC (permalink / raw
  To: gentoo-commits

commit:     5fceed2b941748287f5a9da78f770758b62dcec2
Author:     Alan Swanson <reiver <AT> improbability <DOT> net>
AuthorDate: Tue Oct 20 20:59:09 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Tue Oct 20 21:00:45 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5fceed2b

sys-apps/less: lesspipe: add support for zstd compressed files

Signed-off-by: Alan Swanson <reiver <AT> improbability.net>
Closes: https://bugs.gentoo.org/727850
Package-Manager: Portage-3.0.8, Repoman-3.0.2
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 sys-apps/less/files/lesspipe-r1.sh | 287 +++++++++++++++++++++++++++++++++++++
 sys-apps/less/less-563-r1.ebuild   |  44 ++++++
 2 files changed, 331 insertions(+)

diff --git a/sys-apps/less/files/lesspipe-r1.sh b/sys-apps/less/files/lesspipe-r1.sh
new file mode 100644
index 00000000000..9dcfea1d639
--- /dev/null
+++ b/sys-apps/less/files/lesspipe-r1.sh
@@ -0,0 +1,287 @@
+#!/bin/bash
+# Copyright 1999-2020 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
+}
+
+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
+
+	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) openssl crl -hash -text -noout -in "$1" ;;
+	*.csr) openssl req -text -noout -in "$1" ;;
+	*.crt|*.pem) openssl x509 -hash -text -noout -in "$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=0;; # default to no color #188835
+		esac
+		if [[ ${LESSCOLOR} != "0" ]] && [[ -n ${LESSCOLORIZER=code2color} ]] ; 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 <file>"
+elif [[ $1 == "-V" || $1 == "--version" ]] ; then
+	cat <<-EOF
+		lesspipe (git)
+		Copyright 1999-2019 Gentoo Authors
+		Mike Frysinger <vapier@gentoo.org>
+		     (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 <file>
+
+		lesspipe specific settings:
+		  LESSCOLOR env     - toggle colorizing of output (no/yes/always; default: no)
+		  LESSCOLORIZER env - program used to colorize output (default: code2color)
+		  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"
+
+		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-563-r1.ebuild b/sys-apps/less/less-563-r1.ebuild
new file mode 100644
index 00000000000..ecac3dfb95c
--- /dev/null
+++ b/sys-apps/less/less-563-r1.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="Excellent text file viewer"
+HOMEPAGE="http://www.greenwoodsoftware.com/less/"
+SRC_URI="http://www.greenwoodsoftware.com/less/${P}.tar.gz"
+
+LICENSE="|| ( GPL-3 BSD-2 )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="pcre unicode"
+
+DEPEND=">=app-misc/editor-wrapper-3
+	>=sys-libs/ncurses-5.2:0=
+	pcre? ( dev-libs/libpcre2 )"
+RDEPEND="${DEPEND}"
+
+src_configure() {
+	export ac_cv_lib_ncursesw_initscr=$(usex unicode)
+	export ac_cv_lib_ncurses_initscr=$(usex !unicode)
+	local myeconfargs=(
+		--with-regex=$(usex pcre pcre2 posix)
+		--with-editor="${EPREFIX}"/usr/libexec/editor
+	)
+	econf "${myeconfargs[@]}"
+}
+
+src_install() {
+	default
+
+	newbin "${FILESDIR}"/lesspipe-r1.sh lesspipe
+	newenvd "${FILESDIR}"/less.envd 70less
+}
+
+pkg_preinst() {
+	if has_version "<${CATEGORY}/${PN}-483-r1" ; then
+		elog "The lesspipe.sh symlink has been dropped.  If you are still setting"
+		elog "LESSOPEN to that, you will need to update it to '|lesspipe %s'."
+		elog "Colorization support has been dropped.  If you want that, check out"
+		elog "the new app-text/lesspipe package."
+	fi
+}


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/, sys-apps/less/files/
@ 2023-08-13  3:05 Sam James
  0 siblings, 0 replies; 4+ messages in thread
From: Sam James @ 2023-08-13  3:05 UTC (permalink / raw
  To: gentoo-commits

commit:     d6404dafdf171eec9933510a160a4506776127e9
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 13 02:56:17 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Aug 13 03:01:02 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d6404daf

sys-apps/less: add 643

Closes: https://bugs.gentoo.org/910700
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-apps/less/Manifest                             |  1 +
 .../less/files/less-643-lesstest-pkg-config.patch  | 34 ++++++++++++++++
 .../less/{less-9999.ebuild => less-643.ebuild}     | 46 +++++++++++++---------
 sys-apps/less/less-9999.ebuild                     | 46 +++++++++++++---------
 4 files changed, 91 insertions(+), 36 deletions(-)

diff --git a/sys-apps/less/Manifest b/sys-apps/less/Manifest
index e7ca470d197a..becfdcc62104 100644
--- a/sys-apps/less/Manifest
+++ b/sys-apps/less/Manifest
@@ -1,3 +1,4 @@
 DIST less-608.tar.gz 362346 BLAKE2B 988940745fef1222c43b0bf4edec7cc7206ded0ac5d89d3faf4dab706a249913581c2fe7aa6063cf3d717176ed07b69299d3e791ba8a60358483fe9d1bf7f7c6 SHA512 7945b7f88921832ebb1b45fba8cbb449ee0133342796b654a52c146dfff3d84db18724ee84e53349eeea6017a0ebe2d8eb5366210275981dde7bb7190118fa66
 DIST less-632.tar.gz 375440 BLAKE2B 26c27a2e25882a4ce34e5e6e83bc0af784c8d4e8ac20691e0e31f1021bfb30f96e07024a6ff1ad634f7812875e0d920bd52394ccdba47a2a944ba7de92aa4c97 SHA512 5104f1fd76cdd59dfa957a61f8ccffe7c6e79345b94a5961abbd30f2d059f2b6d4b359a27dd5528993e5e1248c655439c1e4a39fd92234e4af23c7167f69f066
 DIST less-633.tar.gz 375733 BLAKE2B e9df180794af365f86734c6b8fde766c1bba42b111717ee5e1cf11001fc7ec3d78910db9bb7c51a76816086f599808b1b60f514011ec40e37650d6bc4f8b3d5c SHA512 a29aaf72abca07fb29d12f218bbd422a39e3898b3d53e8dbd5265ae47ecf68b88c3381aa3a9bf7caa8db1e2d8e2c138b333f0d69fddd4cf014e39118c53f7fb1
+DIST less-643.tar.gz 592291 BLAKE2B 6dc60dc2e8db05afdae466877a1d26a3008ff5378bbbf2fbdf9efc4f87c0fcfde5703d44a24d4355c98d3a5f438bdb51173150f2a69f801d9c8e4a7401d71b53 SHA512 6a324ac54e22429ac652dc303bc1fe48933555d1cbf8ad7ecf345940910c014fef9551a3219743cfb7115e356b5841ae97d6ce62e7a1ba1e3300d243efca34d9

diff --git a/sys-apps/less/files/less-643-lesstest-pkg-config.patch b/sys-apps/less/files/less-643-lesstest-pkg-config.patch
new file mode 100644
index 000000000000..cd5f6f3047ba
--- /dev/null
+++ b/sys-apps/less/files/less-643-lesstest-pkg-config.patch
@@ -0,0 +1,34 @@
+https://github.com/gwsw/less/pull/412
+
+From 5d884b29fb11c2686b804428f483f4607334eb68 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Sun, 13 Aug 2023 03:57:25 +0100
+Subject: [PATCH] lesstest: use pkg-config to find ncurses libraries
+
+Fails to build with split tinfo otherwise like:
+```
+
+x86_64-pc-linux-gnu-gcc -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches -Wreturn-type      -ggdb3 -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,-z,pack-relative-relocs    -ggdb3 -o lesstest display.o env.o lesstest.o parse.o pipeline.o log.o run.o term.o wchar.o -lncurses
+/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: display.o: in function `display_screen':
+/var/tmp/portage/sys-apps/less-643/work/less-643/lesstest/display.c:86:(.text+0x2e0): undefined reference to `tgoto'
+/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: term.o: in function `setup_mode':
+/var/tmp/portage/sys-apps/less-643/work/less-643/lesstest/term.c:83:(.text+0x18): undefined reference to `tgetstr'
+[...]
+```
+
+Going forward, we may want to just add a Makefile.in which configure handles
+to the lesstest subdir.
+
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/lesstest/Makefile
++++ b/lesstest/Makefile
+@@ -1,7 +1,8 @@
+ CC ?= gcc
+ CFLAGS ?= -Wall -O2
+ LDFLAGS ?=
+-TERMLIB = -lncurses
++PKG_CONFIG ?= pkg-config
++TERMLIB ?= $(shell ${PKG_CONFIG} --libs ncurses)
+ srcdir ?= .
+ 
+ all: lesstest lt_screen 

diff --git a/sys-apps/less/less-9999.ebuild b/sys-apps/less/less-643.ebuild
similarity index 70%
copy from sys-apps/less/less-9999.ebuild
copy to sys-apps/less/less-643.ebuild
index cbd0aff28900..559db6a78878 100644
--- a/sys-apps/less/less-9999.ebuild
+++ b/sys-apps/less/less-643.ebuild
@@ -3,34 +3,39 @@
 
 EAPI=8
 
+# Releases are usually first a beta then promoted to stable if no
+# issues were found. Upstream explicitly ask "to not generally distribute"
+# the beta versions. It's okay to keyword beta versions if they fix
+# a serious bug, but otherwise try to avoid it.
+
 WANT_AUTOMAKE=none
 WANT_LIBTOOL=none
+inherit autotools flag-o-matic optfeature toolchain-funcs
+
+DESCRIPTION="Excellent text file viewer"
+HOMEPAGE="https://www.greenwoodsoftware.com/less/"
+
+MY_PV=${PV/_beta/-beta}
+MY_P=${PN}-${MY_PV}
 
 if [[ ${PV} == 9999 ]]; then
 	EGIT_REPO_URI="https://github.com/gwsw/less"
 	inherit git-r3
-fi
-
-inherit autotools flag-o-matic optfeature
+else
+	SRC_URI="https://www.greenwoodsoftware.com/less/${MY_P}.tar.gz"
 
-# Releases are usually first a beta then promoted to stable if no
-# issues were found. Upstream explicitly ask "to not generally distribute"
-# the beta versions. It's okay to keyword beta versions if they fix
-# a serious bug, but otherwise try to avoid it.
+	if [[ ${PV} != *_beta* ]] ; then
+		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"
+	fi
+fi
 
-MY_PV=${PV/_beta/-beta}
-MY_P=${PN}-${MY_PV}
-DESCRIPTION="Excellent text file viewer"
-HOMEPAGE="https://www.greenwoodsoftware.com/less/"
-[[ ${PV} != 9999 ]] && SRC_URI="https://www.greenwoodsoftware.com/less/${MY_P}.tar.gz"
 S="${WORKDIR}"/${MY_P/?beta}
 
 LICENSE="|| ( GPL-3 BSD-2 )"
 SLOT="0"
-if [[ ${PV} != 9999 && ${PV} != *_beta* ]] ; then
-	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"
-fi
-IUSE="pcre"
+IUSE="pcre test"
+# chinese1, utf8-2
+RESTRICT="test !test? ( test )"
 
 DEPEND="
 	>=app-misc/editor-wrapper-3
@@ -38,9 +43,10 @@ DEPEND="
 	pcre? ( dev-libs/libpcre2 )
 "
 RDEPEND="${DEPEND}"
+BDEPEND="test? ( virtual/pkgconfig )"
 
 PATCHES=(
-	"${FILESDIR}"/${PN}-633-tinfow.patch
+	"${FILESDIR}"/${PN}-643-lesstest-pkg-config.patch
 )
 
 src_prepare() {
@@ -63,7 +69,7 @@ src_configure() {
 }
 
 src_test() {
-	emake check VERBOSE=1
+	emake check VERBOSE=1 CC="$(tc-getCC)" PKG_CONFIG="$(tc-getPKG_CONFIG)"
 }
 
 src_install() {
@@ -80,4 +86,8 @@ pkg_preinst() {
 		elog "The lesspipe.sh symlink has been dropped.  If you are still setting"
 		elog "LESSOPEN to that, you will need to update it to '|lesspipe %s'."
 	fi
+
+	if has_version "<${CATEGORY}/${PN}-643" ; then
+		elog "less now colorizes by default. To disable this, set LESSCOLOR=no."
+	fi
 }

diff --git a/sys-apps/less/less-9999.ebuild b/sys-apps/less/less-9999.ebuild
index cbd0aff28900..559db6a78878 100644
--- a/sys-apps/less/less-9999.ebuild
+++ b/sys-apps/less/less-9999.ebuild
@@ -3,34 +3,39 @@
 
 EAPI=8
 
+# Releases are usually first a beta then promoted to stable if no
+# issues were found. Upstream explicitly ask "to not generally distribute"
+# the beta versions. It's okay to keyword beta versions if they fix
+# a serious bug, but otherwise try to avoid it.
+
 WANT_AUTOMAKE=none
 WANT_LIBTOOL=none
+inherit autotools flag-o-matic optfeature toolchain-funcs
+
+DESCRIPTION="Excellent text file viewer"
+HOMEPAGE="https://www.greenwoodsoftware.com/less/"
+
+MY_PV=${PV/_beta/-beta}
+MY_P=${PN}-${MY_PV}
 
 if [[ ${PV} == 9999 ]]; then
 	EGIT_REPO_URI="https://github.com/gwsw/less"
 	inherit git-r3
-fi
-
-inherit autotools flag-o-matic optfeature
+else
+	SRC_URI="https://www.greenwoodsoftware.com/less/${MY_P}.tar.gz"
 
-# Releases are usually first a beta then promoted to stable if no
-# issues were found. Upstream explicitly ask "to not generally distribute"
-# the beta versions. It's okay to keyword beta versions if they fix
-# a serious bug, but otherwise try to avoid it.
+	if [[ ${PV} != *_beta* ]] ; then
+		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"
+	fi
+fi
 
-MY_PV=${PV/_beta/-beta}
-MY_P=${PN}-${MY_PV}
-DESCRIPTION="Excellent text file viewer"
-HOMEPAGE="https://www.greenwoodsoftware.com/less/"
-[[ ${PV} != 9999 ]] && SRC_URI="https://www.greenwoodsoftware.com/less/${MY_P}.tar.gz"
 S="${WORKDIR}"/${MY_P/?beta}
 
 LICENSE="|| ( GPL-3 BSD-2 )"
 SLOT="0"
-if [[ ${PV} != 9999 && ${PV} != *_beta* ]] ; then
-	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"
-fi
-IUSE="pcre"
+IUSE="pcre test"
+# chinese1, utf8-2
+RESTRICT="test !test? ( test )"
 
 DEPEND="
 	>=app-misc/editor-wrapper-3
@@ -38,9 +43,10 @@ DEPEND="
 	pcre? ( dev-libs/libpcre2 )
 "
 RDEPEND="${DEPEND}"
+BDEPEND="test? ( virtual/pkgconfig )"
 
 PATCHES=(
-	"${FILESDIR}"/${PN}-633-tinfow.patch
+	"${FILESDIR}"/${PN}-643-lesstest-pkg-config.patch
 )
 
 src_prepare() {
@@ -63,7 +69,7 @@ src_configure() {
 }
 
 src_test() {
-	emake check VERBOSE=1
+	emake check VERBOSE=1 CC="$(tc-getCC)" PKG_CONFIG="$(tc-getPKG_CONFIG)"
 }
 
 src_install() {
@@ -80,4 +86,8 @@ pkg_preinst() {
 		elog "The lesspipe.sh symlink has been dropped.  If you are still setting"
 		elog "LESSOPEN to that, you will need to update it to '|lesspipe %s'."
 	fi
+
+	if has_version "<${CATEGORY}/${PN}-643" ; then
+		elog "less now colorizes by default. To disable this, set LESSCOLOR=no."
+	fi
 }


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/, sys-apps/less/files/
@ 2024-06-30 19:35 Sam James
  0 siblings, 0 replies; 4+ messages in thread
From: Sam James @ 2024-06-30 19:35 UTC (permalink / raw
  To: gentoo-commits

commit:     3b76030b38cd62f190cfda1203192af26ce7fb4f
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 30 19:33:08 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jun 30 19:34:17 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3b76030b

sys-apps/less: add 661, lesspipe fixes

* Add 661
* lesspipe: respect NO_COLOR
* lesspipe: fix documentation for colour default
* lesspipe: choose a better colour theme ('rrt'). Another considered option
  was 'igor'.

Closes: https://bugs.gentoo.org/924627
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-apps/less/Manifest                             |   1 +
 sys-apps/less/files/lesspipe-r4.sh                 | 342 +++++++++++++++++++++
 .../less/{less-9999.ebuild => less-661.ebuild}     |   6 +-
 sys-apps/less/less-9999.ebuild                     |   6 +-
 4 files changed, 349 insertions(+), 6 deletions(-)

diff --git a/sys-apps/less/Manifest b/sys-apps/less/Manifest
index 89d58fe3f561..62c721c725b9 100644
--- a/sys-apps/less/Manifest
+++ b/sys-apps/less/Manifest
@@ -1,2 +1,3 @@
 DIST less-633.tar.gz 375733 BLAKE2B e9df180794af365f86734c6b8fde766c1bba42b111717ee5e1cf11001fc7ec3d78910db9bb7c51a76816086f599808b1b60f514011ec40e37650d6bc4f8b3d5c SHA512 a29aaf72abca07fb29d12f218bbd422a39e3898b3d53e8dbd5265ae47ecf68b88c3381aa3a9bf7caa8db1e2d8e2c138b333f0d69fddd4cf014e39118c53f7fb1
 DIST less-643.tar.gz 592291 BLAKE2B 6dc60dc2e8db05afdae466877a1d26a3008ff5378bbbf2fbdf9efc4f87c0fcfde5703d44a24d4355c98d3a5f438bdb51173150f2a69f801d9c8e4a7401d71b53 SHA512 6a324ac54e22429ac652dc303bc1fe48933555d1cbf8ad7ecf345940910c014fef9551a3219743cfb7115e356b5841ae97d6ce62e7a1ba1e3300d243efca34d9
+DIST less-661.tar.gz 648198 BLAKE2B c1fa9a7a646fcc1203945e00c35fe41bddef0c564e30f120a37e417ecd5c60d234e0253a2e18123508dd5c0313bce346dc7752e96cdc1b067bd07a2a39818b42 SHA512 49d81ff9e79d43ce0271490e3bffd590b4aed5fcb387bc8eb3128de99e5b5a5ede2e2818b546f6e3a140fa6261f1de3dfba1231f7ff7ef18502bb7030eaea1b5

diff --git a/sys-apps/less/files/lesspipe-r4.sh b/sys-apps/less/files/lesspipe-r4.sh
new file mode 100644
index 000000000000..02a610d010ff
--- /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 <file>"
+elif [[ $1 == "-V" || $1 == "--version" ]] ; then
+	cat <<-EOF
+		lesspipe (git)
+		Copyright 1999-2024 Gentoo Authors
+		Mike Frysinger <vapier@gentoo.org>
+		     (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 <file>
+
+		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-9999.ebuild b/sys-apps/less/less-661.ebuild
similarity index 94%
copy from sys-apps/less/less-9999.ebuild
copy to sys-apps/less/less-661.ebuild
index 186eda3b6814..8a2a1fa41f36 100644
--- a/sys-apps/less/less-9999.ebuild
+++ b/sys-apps/less/less-661.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -78,12 +78,12 @@ src_install() {
 	keepdir /usr/lib/lessfilter.d
 	keepdir /etc/lessfilter.d
 
-	newbin "${FILESDIR}"/lesspipe-r3.sh lesspipe
+	newbin "${FILESDIR}"/lesspipe-r4.sh lesspipe
 	newenvd "${FILESDIR}"/less.envd 70less
 }
 
 pkg_preinst() {
-	optfeature "Colorized output supprt" dev-python/pygments
+	optfeature "Colorized output support" dev-python/pygments
 
 	if has_version "<${CATEGORY}/${PN}-483-r1" ; then
 		elog "The lesspipe.sh symlink has been dropped.  If you are still setting"

diff --git a/sys-apps/less/less-9999.ebuild b/sys-apps/less/less-9999.ebuild
index 186eda3b6814..8a2a1fa41f36 100644
--- a/sys-apps/less/less-9999.ebuild
+++ b/sys-apps/less/less-9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -78,12 +78,12 @@ src_install() {
 	keepdir /usr/lib/lessfilter.d
 	keepdir /etc/lessfilter.d
 
-	newbin "${FILESDIR}"/lesspipe-r3.sh lesspipe
+	newbin "${FILESDIR}"/lesspipe-r4.sh lesspipe
 	newenvd "${FILESDIR}"/less.envd 70less
 }
 
 pkg_preinst() {
-	optfeature "Colorized output supprt" dev-python/pygments
+	optfeature "Colorized output support" dev-python/pygments
 
 	if has_version "<${CATEGORY}/${PN}-483-r1" ; then
 		elog "The lesspipe.sh symlink has been dropped.  If you are still setting"


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-06-30 19:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-13  3:05 [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/, sys-apps/less/files/ Sam James
  -- strict thread matches above, loose matches on Subject: below --
2024-06-30 19:35 Sam James
2020-10-20 21:00 Thomas Deutschmann
2019-06-12  8:47 Lars Wendler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox