diff options
author | Martin Väth <martin@mvath.de> | 2011-06-07 07:54:51 +0200 |
---|---|---|
committer | Martin Väth <martin@mvath.de> | 2015-10-11 10:46:35 +0200 |
commit | 0450dc222439bd83c1a5b6aaee6b5abb85ad4cd1 (patch) | |
tree | 7dcf24b17028fdb62dfeb2a84f4fc7c13ed39af4 /sys-apps/less | |
parent | Add zsh-syntax-highlighting (diff) | |
download | mv-0450dc222439bd83c1a5b6aaee6b5abb85ad4cd1.tar.gz mv-0450dc222439bd83c1a5b6aaee6b5abb85ad4cd1.tar.bz2 mv-0450dc222439bd83c1a5b6aaee6b5abb85ad4cd1.zip |
rename sys-apps/less-select -> sys-apps/less[less-select]
Diffstat (limited to 'sys-apps/less')
-rw-r--r-- | sys-apps/less/ChangeLog | 77 | ||||
-rw-r--r-- | sys-apps/less/Manifest | 10 | ||||
-rw-r--r-- | sys-apps/less/files/README.Gentoo | 22 | ||||
-rw-r--r-- | sys-apps/less/files/code2color.patch | 34 | ||||
-rw-r--r-- | sys-apps/less/files/lesspipe.sh | 267 | ||||
-rw-r--r-- | sys-apps/less/less-443.ebuild | 91 | ||||
-rw-r--r-- | sys-apps/less/metadata.xml | 13 |
7 files changed, 514 insertions, 0 deletions
diff --git a/sys-apps/less/ChangeLog b/sys-apps/less/ChangeLog new file mode 100644 index 00000000..5660f7fb --- /dev/null +++ b/sys-apps/less/ChangeLog @@ -0,0 +1,77 @@ +# ChangeLog for sys-apps/less +# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 +# $Header $ + +*less-443.ebuild (11 Apr 2011) + + 06 Jun 2011; Martin Väth <martin@mvath.de> + -less-select-443.ebuild +less-443.ebuild + Rename into less to avoid problems with portage hard-depending on less. + In fact, less-select is just less with additional options which therefore + should be provided by a useflag. + +*less-select-443.ebuild (11 Apr 2011) + + 11 Apr 2011; Martin Väth <martin@mvath.de> + Bump less version. Remove old ebuild. + +*less-select-441.ebuild (28 Feb 2011) + + 29 Feb 2011; Martin Väth <martin@mvath.de> + Bump less version. Remove old ebuild. + +*less-select-440.ebuild (06 Jan 2011) + + 04 Jan 2011; Martin Väth <martin@mvath.de> + Bump less version. Remove old ebuild. + +*less-select-438.ebuild (01 Jan 2011) + + 04 Jan 2011; Martin Väth <martin@mvath.de> + Bump to EAPI=4. + + 01 Jan 2011; Martin Väth <martin@mvath.de> : + Bump less version. Remove old ebuild. + +*less-select-436-r1.ebuild (30 Mar 2010) + + 12 Jun 2010; Martin Väth <martin@mvath.de> : + Remove unneeded files/less.envd. Remove arches which I never tested. + + 30 Mar 2010; Martin Väth <martin@mvath.de> : + -less-select-436.ebuild +less-select-436-r1.ebuild files/lesspipe.sh: + Update lesspipe.sh and related changes of sys-apps/less in portage tree. + + 22 Jul 2009; Martin Väth <martin@mvath.de> : + Version bump to less-select-436 + + 12 Apr 2009; Martin Väth <martin@mvath.de> : + Version bump to less-select-429 + + 09 Feb 2009; Martin Väth <martin@mvath.de> : + Version bump to less-select-424 + + 04 Jan 2008; Martin Väth <martin@mvath.de> : + Version bump to less-select-418 + + 29 Nov 2007; Martin Väth <martin@mvath.de> : + Version bump to less-select-416 + + 16 Nov 2007; Martin Väth <martin@mvath.de> : + Version bump to less-select-415 + + 10 Oct 2007; Martin Väth <martin@mvath.de> : + Version bump to less-select-409 + + 29 Jun 2007; Martin Väth <martin@mvath.de> : + Version bump to less-select-406 + + 29 Dec 2005; Martin Väth <martin@mvath.de> : + Version bump to less-select-394 + + 03 Dec 2005; Martin Väth <martin@mvath.de> : + Version bump to less-select-393 + + 06 Mar 2005; Martin Väth <martin@mvath.de> : + Initial version based on less-382-r2.ebuild + diff --git a/sys-apps/less/Manifest b/sys-apps/less/Manifest new file mode 100644 index 00000000..cd18bf9d --- /dev/null +++ b/sys-apps/less/Manifest @@ -0,0 +1,10 @@ +AUX README.Gentoo 823 RMD160 be59c37906fca17fa25f6781d3f5e7abc114dc57 SHA1 5a1f126af728f5220b97623050e2f9b1ea5ae58e SHA256 3985fd1810f660ea1c1f2732f719b069b6934d62d8d9e8a09287e63f049ba27d +AUX code2color.patch 1110 RMD160 712f7b79c94f92ee62825d5f53627f18fae693d2 SHA1 a82f937f3a923b52adc4f14cfc9b641903884839 SHA256 a3887126826ef0b4b821bd97cf4e7abfc8b1c9280bf2bb18a2a4cec9a2973936 +AUX less.envd 52 RMD160 400b9cd58e087f3f6f3e4842200ceb26210b5848 SHA1 5a15cc633fb90bb1a4715b7b883d788c05e74eda SHA256 d724a22a0f9ea78510b1cde8ca65ae3e6991d7b4271ecf384bdebc3cbe935be5 +AUX lesspipe.sh 7245 RMD160 c7fb8ed5351864a4e5735118a47b018b7f0c9635 SHA1 05018b6749b182b36d92f8d0cda8846f23cf9dae SHA256 ac4130bd95c0dcbfbffb3b9e3b88b39540af23ca356b8ba75907f41990a6c250 +DIST code2color 199875 RMD160 378d340a20c3fe500f19116220d54816fe279225 SHA1 b30526dd52c747b8bd6dcf53cf5cc94824c47feb SHA256 ce63f148293a81b0fe5e072f33285f9bf4f1d832f64b23a2220519674a47091d +DIST less-443.tar.gz 307234 RMD160 e5e7b72266d218a225be7d28c4b8d8d9c0fc75d2 SHA1 72cf3d3c77990e04ad04ea63b377b893c8a7a2cd SHA256 a4c3e8af81fd0944941ee7c74eecc7759422a227df52335e899e69de5eae30ca +DIST less-select-patch-436.tar.gz 47383 RMD160 5ccbe853d1f6ce5940f283bd8265ce8b75e20363 SHA1 21f3f8b16be8cd0724820c167d6f685d236cec36 SHA256 bbdd0ee9241803b8de719c358090354bde63472d1df6db271a50be51bfc800f3 +EBUILD less-443.ebuild 2709 RMD160 30d7f6b932991e05bf8397d8bdb324016bf9e205 SHA1 68d4c720e74fea15689ddf4ad9592a7d580851c5 SHA256 42f9d68ceb3e9218ab7cbf01ad08ff50933464e751418674e071ff0d842b175f +MISC ChangeLog 2616 RMD160 cb957b86064f7a6af1aecbba7d9a77912d907f5e SHA1 2c5750f87ccf55bf6b11a5eb6cf2216054aa93bd SHA256 1141172224cc5841f6c458862e836c0f2dbe46de21e60934972a227e55926bdc +MISC metadata.xml 467 RMD160 e69ea2344bdb9a8dcc204f8c3b9f082a8851b0e4 SHA1 6f8b9d9fb00ab400b4a1465c389338b9b34089a2 SHA256 a99d1ace3f8e4336bae975c7adff6152dbceddcaaca56084db59aaed8cdc136f diff --git a/sys-apps/less/files/README.Gentoo b/sys-apps/less/files/README.Gentoo new file mode 100644 index 00000000..dca83280 --- /dev/null +++ b/sys-apps/less/files/README.Gentoo @@ -0,0 +1,22 @@ +This version of less comes with some Gentoo enhancements: + - default lesspipe.sh script to "view" files + - colorization support + +To see what file types are supported, just read the /usr/bin/lesspipe.sh +script (it's just a plain text bash script). + +Colorization support is disabled by default. To enable it, export the +LESSCOLOR variable to "yes": + $ export LESSCOLOR=yes + +We also provide a colorization script, 'code2color', that is used by +default. If you wish to use another script, simply export the LESSCOLORIZER +variable to name of the script: + $ export LESSCOLORIZER=some-other-script + +If you want to use the code2color script and the default color schemes are +not acceptable, you can develop your own schemes and save them in one of +the following places: + /etc/code2color + ~/.code2color + CODE2COLOR_CONFIG env var diff --git a/sys-apps/less/files/code2color.patch b/sys-apps/less/files/code2color.patch new file mode 100644 index 00000000..5d4ac7fe --- /dev/null +++ b/sys-apps/less/files/code2color.patch @@ -0,0 +1,34 @@ +--- code2color ++++ code2color +@@ -163,11 +163,11 @@ + # building up the database + # newer entries overwrite old ones + my @CONFIG_FILES; +- push @CONFIG_FILES, "/etc/code2html.config"; ++ push @CONFIG_FILES, "/etc/code2color"; + push @CONFIG_FILES, +- $ENV{'HOME'}."/.code2html.config" if $ENV{'HOME'}; ++ $ENV{'HOME'}."/.code2color" if $ENV{'HOME'}; + push @CONFIG_FILES, +- split(/:/,$ENV{'CODE2HTML_CONFIG'}) if $ENV{'CODE2HTML_CONFIG'}; ++ split(/:/,$ENV{'CODE2COLOR_CONFIG'}) if $ENV{'CODE2COLOR_CONFIG'}; + push @CONFIG_FILES, + split(/:/,$params{'langfile'}) if $params{'langfile'}; + +@@ -446,7 +446,6 @@ + + $_[2] = $langmode; + $_[3] = $alt_langmode; +- print "==> append : to filename to switch off syntax highlighting\n"; + return \$code; + }; + +@@ -3192,7 +3192,7 @@ + # + + $LANGUAGE{'shellscript'} = { +- 'filename' => '\\.(sh|shell)$', ++ 'filename' => '\\.(ebuild|eclass|sh|shell)$', + 'regex' => '^\\s*#\\s*![^\\s]*(sh|bash|ash|zsh|ksh)', + 'patterns' => [ { + 'name' => 'comment', diff --git a/sys-apps/less/files/lesspipe.sh b/sys-apps/less/files/lesspipe.sh new file mode 100644 index 00000000..b656e306 --- /dev/null +++ b/sys-apps/less/files/lesspipe.sh @@ -0,0 +1,267 @@ +#!/bin/bash +# +# Preprocessor for 'less'. Used when this environment variable is set: +# LESSOPEN="|lesspipe %s" + +# TODO: handle compressed files better + +[[ -n ${LESSDEBUG} ]] && set -x + +trap 'exit 0' PIPE + +guesscompress() { + case "$1" in + *.gz|*.z) echo "gunzip -c" ;; + *.bz2|*.bz) echo "bunzip2 -c" ;; + *.lz) echo "lzip -c" ;; + *.lzma) echo "unlzma -c" ;; + *.xz) echo "xzdec" ;; + *) 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 + + case "$match" in + + ### Doc files ### + *.[0-9n]|*.man|\ + *.[0-9n].bz2|*.man.bz2|\ + *.[0-9n].gz|*.man.gz|\ + *.[0-9n].lzma|*.man.lzma|\ + *.[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|*.pdf) ps2ascii "$1" || pstotext "$1" || pdftotext "$1" ;; + *.doc) antiword "$1" || catdoc "$1" ;; + *.rtf) unrtf --nopict --text "$1" ;; + *.conf|*.txt|*.log) ;; # force less to work on these directly #150256 + + ### URLs ### + ftp://*|http://*|*.htm|*.html) + for b in 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.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|\ + *.lz|\ + *.lzma|*.xz) ${DECOMPRESSOR} -- "$1" ;; + *.rpm) rpm -qpivl --changelog -- "$1" ;; + *.cpi|*.cpio) cpio -itv < "$1" ;; + *.ace) unace l "$1" ;; + *.arc) arc v "$1" ;; + *.arj) 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" ;; + *.a) ar tv "$1" ;; + *.elf) readelf -a -- "$1" ;; + *.so) readelf -h -d -s -- "$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) + identify "$1" || file -L -- "$1" + ;; + *.avi|*.mpeg|*.mpg|*.mov|*.qt|*.wmv|*.asf|*.rm|*.ram) + 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, so fall back to hexdump + 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" ;; + *.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 + ${LESSCOLORIZER} "$1" + fi + fi + + # Nothing left to do but let less deal + exit 0 + ;; + esac +} + +if [[ -z $1 ]] ; then + echo "Usage: lesspipe <file>" +elif [[ $1 == "-V" || $1 == "--version" ]] ; then + Id="cvsid" + cat <<-EOF + $Id: lesspipe.sh,v 1.45 2011/01/20 03:26:14 vapier Exp $ + Copyright 2001-2010 Gentoo Foundation + 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: preproccess files before sending them to less + + Usage: lesspipe <file> + + lesspipe specific settings: + LESSCOLOR env - toggle colorizing of output (no/yes/always) + 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. + + To use lesspipe, simply add to your environment: + export LESSOPEN="|lesspipe %s" + + Run 'less --help' or 'man less' for more info + EOF +elif [[ -d $1 ]] ; then + ls -alF -- "$1" +else + recur=0 + [[ -n ${LESSDEBUG} ]] \ + && lesspipe "$1" \ + || lesspipe "$1" 2> /dev/null +fi diff --git a/sys-apps/less/less-443.ebuild b/sys-apps/less/less-443.ebuild new file mode 100644 index 00000000..58a86623 --- /dev/null +++ b/sys-apps/less/less-443.ebuild @@ -0,0 +1,91 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header $ + +EAPI="4" +inherit eutils + +DESCRIPTION="Excellent text file viewer, optionally with additional selection feature" +HOMEPAGE="http://www.greenwoodsoftware.com/less/" +PATCHVER=436 +SRC_URI="http://www.greenwoodsoftware.com/less/${P}.tar.gz + http://www-zeuthen.desy.de/~friebel/unix/less/code2color + less-select? ( http://www.mathematik.uni-wuerzburg.de/~vaeth/download/less-select-patch-${PATCHVER}.tar.gz )" + +LICENSE="|| ( GPL-3 BSD-2 )" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd" +IUSE="+less-select original-gentoo unicode" + +DEPEND=">=sys-libs/ncurses-5.2" + +SELECTDIR="./less-select-patch-${PATCHVER}" + +src_unpack() { + unpack ${P}.tar.gz + cd "${S}" + cp "${DISTDIR}"/code2color "${S}"/ + if use less-select + then unpack "less-select-patch-${PATCHVER}.tar.gz" + fi +} + +src_prepare() { + epatch "${FILESDIR}"/code2color.patch + if use less-select + then mv -- "${SELECTDIR}/INSTALL" "${SELECTDIR}/README.less-select" + if test -e "${SELECTDIR}/less-${PV}-select.patch" + then epatch "${SELECTDIR}/less-${PV}-select.patch" || die "Patch less-${PV}-select failed" + else epatch "${SELECTDIR}/less-${PATCHVER}-select.patch" || die "Patch less-${PATCHVER}-select failed" + fi + "${SELECTDIR}"/after-patch || die "${SELECTDIR}/after-patch failed" + fi +} + +yesno() { use $1 && echo yes || echo no ; } +src_configure() { + export ac_cv_lib_ncursesw_initscr=$(yesno unicode) + export ac_cv_lib_ncurses_initscr=$(yesno !unicode) + econf || die +} + +src_compile() { + default_src_compile + if use less-select + then ./lesskey -o less-normal-key.bin "${SELECTDIR}/less-normal-key.src" || die + ./lesskey -o less-select-key.bin "${SELECTDIR}/less-select-key.src" || die + fi +} + +src_install() { + local a + default_src_install + + dobin code2color || die "dobin" + newbin "${FILESDIR}"/lesspipe.sh lesspipe || die "newbin" + dosym lesspipe /usr/bin/lesspipe.sh + newenvd "${FILESDIR}"/less.envd 70less + + dodoc NEWS README* "${FILESDIR}"/README.Gentoo + + if use original-gentoo + then a="-R -M --shift 5" + else a="-sFRiMX --shift 5" + fi + printf '%s\n' 'LESSOPEN="|lesspipe.sh %s"' "LESS=\"${a}\"" >70less + doenv 70less + + if use less-select + then dodoc "${SELECTDIR}"/README.less-select + newbin "${SELECTDIR}/less-select" less-select + insinto /etc + newins less-normal-key.bin lesskey.bin + newins less-select-key.bin less-select-key.bin + newins "${SELECTDIR}/less-normal-key.src" lesskey.src + newins "${SELECTDIR}/less-select-key.src" less-select-key.src + fi +} + +pkg_postinst() { + einfo "lesspipe offers colorization options. Run 'lesspipe -h' for info." +} diff --git a/sys-apps/less/metadata.xml b/sys-apps/less/metadata.xml new file mode 100644 index 00000000..7c6bad45 --- /dev/null +++ b/sys-apps/less/metadata.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<herd>base-system</herd> +<maintainer> + <email>martin@mvath.de</email> + <name>Martin Väth</name> +</maintainer> +<use> + <flag name="original-gentoo">Use the gentoo default for the LESS variable.</flag> + <flag name="less-select">Add the less-select feature (additional options and a binary helper).</flag> +</use> +</pkgmetadata> |