diff options
author | Martin Väth <martin@mvath.de> | 2010-03-28 12:13:38 +0200 |
---|---|---|
committer | Martin Väth <vaeth@mathematik.uni-wuerzburg.de> | 2010-03-28 12:13:38 +0200 |
commit | 3c20a4557767ea27aef7df1f4443dada90d06138 (patch) | |
tree | b8bf2e2934314313ed99330577d4906b79d8f5aa /sys-apps/less-select | |
download | mv-3c20a4557767ea27aef7df1f4443dada90d06138.tar.gz mv-3c20a4557767ea27aef7df1f4443dada90d06138.tar.bz2 mv-3c20a4557767ea27aef7df1f4443dada90d06138.zip |
Import of the mv overlay
Diffstat (limited to 'sys-apps/less-select')
-rw-r--r-- | sys-apps/less-select/ChangeLog | 37 | ||||
-rw-r--r-- | sys-apps/less-select/Manifest | 10 | ||||
-rw-r--r-- | sys-apps/less-select/files/README.Gentoo | 22 | ||||
-rw-r--r-- | sys-apps/less-select/files/code2color.patch | 34 | ||||
-rw-r--r-- | sys-apps/less-select/files/less.envd | 2 | ||||
-rw-r--r-- | sys-apps/less-select/files/lesspipe.sh | 267 | ||||
-rw-r--r-- | sys-apps/less-select/less-select-436.ebuild | 69 | ||||
-rw-r--r-- | sys-apps/less-select/metadata.xml | 12 |
8 files changed, 453 insertions, 0 deletions
diff --git a/sys-apps/less-select/ChangeLog b/sys-apps/less-select/ChangeLog new file mode 100644 index 00000000..21cb19e1 --- /dev/null +++ b/sys-apps/less-select/ChangeLog @@ -0,0 +1,37 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header $ + + 22 Jul 2009; Martin Väth <martin@mvath.de> : + Version bump to less-436 + + 12 Apr 2009; Martin Väth <martin@mvath.de> : + Version bump to less-429 + + 09 Feb 2009; Martin Väth <martin@mvath.de> : + Version bump to less-424 + + 04 Jan 2008; Martin Väth <martin@mvath.de> : + Version bump to less-418 + + 29 Nov 2007; Martin Väth <martin@mvath.de> : + Version bump to less-416 + + 16 Nov 2007; Martin Väth <martin@mvath.de> : + Version bump to less-415 + + 10 Oct 2007; Martin Väth <martin@mvath.de> : + Version bump to less-409 + + 29 Jun 2007; Martin Väth <martin@mvath.de> : + Version bump to less-406 + + 29 Dec 2005; Martin Väth <martin@mvath.de> : + Version bump to less-394 + + 03 Dec 2005; Martin Väth <martin@mvath.de> : + Version bump to less-393 + + 06 Mar 2005; Martin Väth <martin@mvath.de> : + Initial version based on less-382-r2.ebuild + diff --git a/sys-apps/less-select/Manifest b/sys-apps/less-select/Manifest new file mode 100644 index 00000000..52ce5525 --- /dev/null +++ b/sys-apps/less-select/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 50 RMD160 e9d7b2497aa81e13b740dc765c0fc87d4f1f2f8e SHA1 f903d459e7f0b2c14009304bebb7a045a7cccf9d SHA256 1f186ac4f500c842a9016702b3d7e9d69fe161db23cf56c316ed7f5a51da6a4e +AUX lesspipe.sh 6966 RMD160 0101ee8ceea57e5c31e1e38cf417e47bcc5f8a78 SHA1 8142b1755bd545be21b42eda0c966c8fb7d2ec0d SHA256 d3e2d7c7f97cd2ff6ccdadea20d1fc5591dbbd17ac7c6757249ecfc2c4ac68a4 +DIST code2color 199875 RMD160 378d340a20c3fe500f19116220d54816fe279225 SHA1 b30526dd52c747b8bd6dcf53cf5cc94824c47feb SHA256 ce63f148293a81b0fe5e072f33285f9bf4f1d832f64b23a2220519674a47091d +DIST less-436.tar.gz 303921 RMD160 b186b76fcdbf38056b32fbc1b54877dccf64a8ec SHA1 f78998a1a79a7e1962c901dd41bdc3d1c2005471 SHA256 57a16ff07431a9af45cf1cd5b374e1066d019304219f0d156e22bb8c4d6734d2 +DIST less-select-patch-436.tar.gz 47383 RMD160 5ccbe853d1f6ce5940f283bd8265ce8b75e20363 SHA1 21f3f8b16be8cd0724820c167d6f685d236cec36 SHA256 bbdd0ee9241803b8de719c358090354bde63472d1df6db271a50be51bfc800f3 +EBUILD less-select-436.ebuild 2291 RMD160 e7145dd25beeeabfebf141f61dab90d0f066d2a2 SHA1 0bd3f839229c468a0e1670fac2d2916cd395a322 SHA256 e84ec916e7a47238de3ff00546ebced5551c72c561ea1b72502a16689471e42e +MISC ChangeLog 1173 RMD160 e50821f7ba68924ac9efb539d0e1f3cd24f71d9e SHA1 f982dd0c85cc28953cd7a7cecd8c4d6642e39bbc SHA256 8bb38d02108a7267e88cc12aaa4b93410693258b8f0f3bab5154877dfcbcdcdc +MISC metadata.xml 519 RMD160 0bddd9edd8deaf798fff7f50d3e6cdb00daff1b9 SHA1 4a5eb0f9ca4a380d0c9268e6d0e8ba4a54fbb256 SHA256 100c0d2dc9aacdc78d678da8b5ed7d0a36bd1fe5b7ea06345ded87afd9cda442 diff --git a/sys-apps/less-select/files/README.Gentoo b/sys-apps/less-select/files/README.Gentoo new file mode 100644 index 00000000..dca83280 --- /dev/null +++ b/sys-apps/less-select/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-select/files/code2color.patch b/sys-apps/less-select/files/code2color.patch new file mode 100644 index 00000000..5d4ac7fe --- /dev/null +++ b/sys-apps/less-select/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-select/files/less.envd b/sys-apps/less-select/files/less.envd new file mode 100644 index 00000000..200171c0 --- /dev/null +++ b/sys-apps/less-select/files/less.envd @@ -0,0 +1,2 @@ +LESSOPEN="|lesspipe.sh %s" +LESS="-R -M --shift 5" diff --git a/sys-apps/less-select/files/lesspipe.sh b/sys-apps/less-select/files/lesspipe.sh new file mode 100644 index 00000000..afa7dc99 --- /dev/null +++ b/sys-apps/less-select/files/lesspipe.sh @@ -0,0 +1,267 @@ +#!/bin/bash +# +# Preprocessor for 'less'. Used when this environment variable is set: +# LESSOPEN="|lesspipe.sh %s" + +# TODO: handle compressed files better + +trap 'exit 0' PIPE + +guesscompress() { + case "$1" in + *.gz|*.z) echo "gunzip -c" ;; + *.bz2) 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|*.tbz2|*.tbz|\ + *.tar.gz|*.tgz|*.tar.z|\ + *.tar.lz|*.tar.tlz|\ + *.tar.lzma|*.tar.xz) + ${DECOMPRESSOR} -- "$1" | tar tvvf -;; + + ### 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) 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 + ;; + + ### 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-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" + ;; + + ### Source code ### + *.awk|*.groff|*.java|*.js|*.m4|*.php|*.pl|*.pm|*.pod|*.sh|\ + *.ad[asb]|*.asm|*.inc|*.[ch]|*.[ch]pp|*.[ch]xx|*.cc|*.hh|\ + *.lsp|*.l|*.pas|*.p|*.xml|*.xps|*.xsl|*.axp|*.ppd|*.pov|\ + *.diff|*.patch|*.py|*.rb|*.sql|*.ebuild|*.eclass) + + # Allow people to flip color off if they dont want it + case ${LESSCOLOR} in + always) LESSCOLOR=2;; + [yY][eE][sS]|1|true) LESSCOLOR=1;; + [nN][oO]|0|false) LESSCOLOR=0;; + *) LESSCOLOR=0;; # default to no color #188835 + esac + [[ ${LESSCOLORIZER+set} != "set" ]] && LESSCOLORIZER=code2color + if [[ ${LESSCOLOR} == "0" ]] || [[ -z ${LESSCOLORIZER} ]] ; then + # let less itself handle these files + exit 0 + fi + + # 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" + exit 0 + fi + ;; + +# 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 ### + *) + # Sanity check + [[ ${recur} == 2 ]] && exit 0 + + # Maybe we didn't match due to case issues ... + if [[ ${recur} == 0 ]] ; then + recur=1 + lesspipe "$1" "$(echo $1 | LC_ALL=C tr '[:upper:]' '[:lower:]')" + + # Maybe we didn't match because the file is named weird ... + else + recur=2 + lesspipe_file "$1" + fi + + exit 0 + ;; + esac +} + +if [[ -z $1 ]] ; then + echo "Usage: lesspipe.sh <file>" +elif [[ $1 == "-V" || $1 == "--version" ]] ; then + Id="cvsid" + cvsid="$Id: lesspipe.sh,v 1.35 2009/04/11 23:20:51 vapier Exp $" + cat <<-EOF + $cvsid + Copyright 2001-2009 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.sh: preproccess files before sending them to less + + Usage: lesspipe.sh <file> + + lesspipe.sh 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.sh, simply add to your environment: + export LESSOPEN="|lesspipe.sh %s" + + Run 'less --help' or 'man less' for more info + EOF +elif [[ -d $1 ]] ; then + ls -alF -- "$1" +else + recur=0 + lesspipe "$1" 2> /dev/null +fi diff --git a/sys-apps/less-select/less-select-436.ebuild b/sys-apps/less-select/less-select-436.ebuild new file mode 100644 index 00000000..fbdcd17d --- /dev/null +++ b/sys-apps/less-select/less-select-436.ebuild @@ -0,0 +1,69 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header $ + +inherit eutils + +DESCRIPTION="Excellent text file viewer, patched with additional selection feature" +HOMEPAGE="http://www.greenwoodsoftware.com/less/" +PATCHVER=436 +SRC_URI="http://www.greenwoodsoftware.com/less/less-${PV}.tar.gz + http://www-zeuthen.desy.de/~friebel/unix/less/code2color + http://www.mathematik.uni-wuerzburg.de/~vaeth/download/less-select-patch-${PATCHVER}.tar.gz" + +LICENSE="|| ( GPL-3 less )" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd" +IUSE="unicode dummy-less" + +DEPEND=">=sys-libs/ncurses-5.2 + !dummy-less? ( !sys-apps/less )" + +S="${WORKDIR}/less-${PV}" + +MYSUBDIR="${S}/less-select-patch-${PATCHVER}" + +src_unpack() { + cd "${WORKDIR}" + unpack "less-${PV}.tar.gz" + cd "${S}" + cp "${DISTDIR}"/code2color "${S}"/ + epatch "${FILESDIR}"/code2color.patch + unpack "less-select-patch-${PATCHVER}.tar.gz" + mv "${MYSUBDIR}/INSTALL" "${MYSUBDIR}/README.less-select" + if [ -e "${MYSUBDIR}/less-${PV}-select.patch" ]; then + epatch "${MYSUBDIR}/less-${PV}-select.patch" || die "Patch less-${PV}-select failed" + else + epatch "${MYSUBDIR}/less-${PATCHVER}-select.patch" || die "Patch less-${PATCHVER}-select failed" + fi + "${MYSUBDIR}"/after-patch || die "${MYSUBDIR}/after-patch failed" +} + +yesno() { use $1 && echo yes || echo no ; } +src_compile() { + export ac_cv_lib_ncursesw_initscr=$(yesno unicode) + export ac_cv_lib_ncurses_initscr=$(yesno !unicode) + econf || die + emake || die + ./lesskey -o less-normal-key.bin "${MYSUBDIR}/less-normal-key.src" || die + ./lesskey -o less-select-key.bin "${MYSUBDIR}/less-select-key.src" || die +} + +src_install() { + emake install DESTDIR="${D}" || die + + dobin code2color || die "dobin" + newbin "${FILESDIR}"/lesspipe.sh lesspipe.sh || die "newbin" + echo 'LESS="-sFR -iMX --shift 5"' > 70less + doenvd 70less + + dodoc NEWS README* "${FILESDIR}"/README.Gentoo "${MYSUBDIR}"/README.less-select + + newbin "${MYSUBDIR}/less-select" less-select + + insinto /etc + newins less-normal-key.bin lesskey.bin + newins less-select-key.bin less-select-key.bin + newins "${MYSUBDIR}/less-normal-key.src" lesskey.src + newins "${MYSUBDIR}/less-select-key.src" less-select-key.src +} diff --git a/sys-apps/less-select/metadata.xml b/sys-apps/less-select/metadata.xml new file mode 100644 index 00000000..2e57c026 --- /dev/null +++ b/sys-apps/less-select/metadata.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<herd>no-herd</herd> + <maintainer> + <email>martin@mvath.de</email> + <name>Martin Väth</name> + </maintainer> + <use> + <flag name="dummy-less">Set this if you use /etc/portage/env/sys-apps/less to install only a dummy version of less. Only useful if you want to get informed about new less ebuilds by portage despite using less-select.</flag> + </use> +</pkgmetadata> |