From 14aa2dffe8627e17e9a858642744648fa466a2a7 Mon Sep 17 00:00:00 2001 From: Martin Väth Date: Thu, 7 Apr 2016 21:15:26 +0200 Subject: Follow gentoo concerning handling of lesspipe --- sys-apps/less/Manifest | 1 - sys-apps/less/files/code2color-0.2.patch | 26 -------- sys-apps/less/files/lesspipe.sh | 27 +++++--- sys-apps/less/less-483-r1.ebuild | 92 ++++++++++++++++++++++++++ sys-apps/less/less-483.ebuild | 109 ------------------------------- sys-apps/less/metadata.xml | 2 +- 6 files changed, 110 insertions(+), 147 deletions(-) delete mode 100644 sys-apps/less/files/code2color-0.2.patch create mode 100644 sys-apps/less/less-483-r1.ebuild delete mode 100644 sys-apps/less/less-483.ebuild (limited to 'sys-apps/less') diff --git a/sys-apps/less/Manifest b/sys-apps/less/Manifest index f2e3a449..0f090058 100644 --- a/sys-apps/less/Manifest +++ b/sys-apps/less/Manifest @@ -1,3 +1,2 @@ -DIST code2color-0.2 200711 SHA256 2365c9009b1cc3c30430b88775ec402164df105fd12364871d05dcaed20be954 DIST less-483.tar.gz 316897 SHA256 7ebb1a0a141a94f863c0b83eff94fb115d716802fabe8007e442adbaf81ce41f DIST less-select-2.6.tar.gz 26354 SHA256 df4ab8f17568cabd864358e5f0a765241f586b8c30341116a649db91db9048bf diff --git a/sys-apps/less/files/code2color-0.2.patch b/sys-apps/less/files/code2color-0.2.patch deleted file mode 100644 index f8a78250..00000000 --- a/sys-apps/less/files/code2color-0.2.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- 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'}; - -@@ -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 index 6edaa3ce..291d6d66 100644 --- a/sys-apps/less/files/lesspipe.sh +++ b/sys-apps/less/files/lesspipe.sh @@ -59,6 +59,15 @@ lesspipe() { [[ ${match} == *.${ignore} ]] && exit 0 done + # Handle non-regular file types. + if [[ -d $1 ]] ; then + ls -alF -- "$1" + return + elif [[ ! -f $1 ]] ; then + stat "$1" + return + fi + case "${match}" in ### Doc files ### @@ -90,7 +99,8 @@ lesspipe() { esac ;; *.dvi) dvi2tty "$1" ;; - *.ps|*.pdf) ps2ascii "$1" || pstotext "$1" || pdftotext "$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 @@ -234,14 +244,12 @@ lesspipe() { if [[ -z $1 ]] ; then echo "Usage: lesspipe " elif [[ $1 == "-V" || $1 == "--version" ]] ; then - Id="cvsid" cat <<-EOF - $Id$ - Copyright 2001-2013 Gentoo Foundation + lesspipe (git) + Copyright 2001-2016 Gentoo Foundation Mike Frysinger (with plenty of ideas stolen from other projects/distros) - EOF less -V elif [[ $1 == "-h" || $1 == "--help" ]] ; then @@ -251,21 +259,20 @@ elif [[ $1 == "-h" || $1 == "--help" ]] ; then Usage: lesspipe lesspipe specific settings: - LESSCOLOR env - toggle colorizing of output (no/yes/always) + 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. + 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 + Run 'less --help' or 'man less' for more info. EOF -elif [[ -d $1 ]] ; then - ls -alF -- "$1" else recur=0 [[ -n ${LESSDEBUG} ]] \ diff --git a/sys-apps/less/less-483-r1.ebuild b/sys-apps/less/less-483-r1.ebuild new file mode 100644 index 00000000..11b232c2 --- /dev/null +++ b/sys-apps/less/less-483-r1.ebuild @@ -0,0 +1,92 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=6 + +DESCRIPTION="Excellent text file viewer, optionally with additional selection feature" +PATCHN="less-select" +PATCHV="2.6" +PATCHVER="466" +PATCHRUMP="${PATCHN}-${PATCHV}" +PATCHBALL="${PATCHRUMP}.tar.gz" +SELECTDIR="${WORKDIR}/${PATCHRUMP}" +HOMEPAGE="http://www.greenwoodsoftware.com/less/ https://github.com/vaeth/${PATCHN}" +SRC_URI="http://www.greenwoodsoftware.com/less/${P}.tar.gz + less-select? ( https://github.com/vaeth/${PATCHN}/archive/v${PATCHV}.tar.gz -> ${PATCHBALL} )" + +LICENSE="|| ( GPL-3 BSD-2 )" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~arm-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="+lesspipe +less-select pcre original-gentoo source unicode" + +DEPEND=">=app-misc/editor-wrapper-3 + >=sys-libs/ncurses-5.2:0= + pcre? ( dev-libs/libpcre )" +RDEPEND="${DEPEND} + less-select? ( dev-lang/perl )" +# || ( >=dev-lang/perl-5.10.1 >=virtual/perl-File-Temp-0.19 ) +PDEPEND="lesspipe? ( app-text/lesspipe )" + +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 + chmod a+x configure || die + eapply_user +} + +src_configure() { + export ac_cv_lib_ncursesw_initscr=$(usex unicode) + export ac_cv_lib_ncurses_initscr=$(usex !unicode) + econf \ + --with-regex=$(usex pcre pcre posix) \ + --with-editor="${EPREFIX}"/usr/libexec/editor +} + +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_install() { + local a b + default + + newbin "${FILESDIR}"/lesspipe.sh lesspipe + + if use original-gentoo + then a="-R -M --shift 5" + else a="-sFRiMX --shift 5" + fi + printf '%s\n' \ + 'LESSOPEN="|lesspipe'$(! use lesspipe || echo .sh)'%s"' \ + "LESS=\"${a}\"" \ + >70less || die + doenvd 70less + + dodoc "${FILESDIR}"/README.Gentoo + + if use less-select + then newdoc "${SELECTDIR}"/README 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 +} diff --git a/sys-apps/less/less-483.ebuild b/sys-apps/less/less-483.ebuild deleted file mode 100644 index 6ce6c2bc..00000000 --- a/sys-apps/less/less-483.ebuild +++ /dev/null @@ -1,109 +0,0 @@ -# Copyright 1999-2016 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -EAPI=6 - -CODE2COLOR_PV="0.2" -CODE2COLOR_P="code2color-${CODE2COLOR_PV}" -DESCRIPTION="Excellent text file viewer, optionally with additional selection feature" -PATCHN="less-select" -PATCHV="2.6" -PATCHVER="466" -PATCHRUMP="${PATCHN}-${PATCHV}" -PATCHBALL="${PATCHRUMP}.tar.gz" -SELECTDIR="${WORKDIR}/${PATCHRUMP}" -HOMEPAGE="http://www.greenwoodsoftware.com/less/ https://github.com/vaeth/${PATCHN}" -SRC_URI="http://www.greenwoodsoftware.com/less/${P}.tar.gz - less-select? ( https://github.com/vaeth/${PATCHN}/archive/v${PATCHV}.tar.gz -> ${PATCHBALL} ) - http://www-zeuthen.desy.de/~friebel/unix/less/code2color -> ${CODE2COLOR_P}" - -LICENSE="|| ( GPL-3 BSD-2 )" -SLOT="0" -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~arm-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" -IUSE="+lesspipe +less-select pcre original-gentoo source unicode" - -DEPEND=">=app-misc/editor-wrapper-3 - >=sys-libs/ncurses-5.2:0= - pcre? ( dev-libs/libpcre )" -RDEPEND="${DEPEND} - less-select? ( dev-lang/perl )" -# || ( >=dev-lang/perl-5.10.1 >=virtual/perl-File-Temp-0.19 ) -PDEPEND="lesspipe? ( sys-apps/lesspipe )" - -pkg_setup() { - if use source && ! use less-select - then ewarn 'ignoring USE=source without USE=less-select' - fi -} - -src_unpack() { - unpack ${P}.tar.gz - cp "${DISTDIR}/${CODE2COLOR_P}" "${S}"/code2color || die - if use less-select - then unpack ${PATCHBALL} - 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 - eapply -p0 "${FILESDIR}/${CODE2COLOR_P}.patch" - chmod a+x configure || die - eapply_user -} - -src_configure() { - export ac_cv_lib_ncursesw_initscr=$(usex unicode) - export ac_cv_lib_ncurses_initscr=$(usex !unicode) - econf \ - --with-regex=$(usex pcre pcre posix) \ - --with-editor="${EPREFIX}"/usr/libexec/editor -} - -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_install() { - local a - default - - if ! use lesspipe - then dobin code2color - newbin "${FILESDIR}"/lesspipe.sh lesspipe - dosym lesspipe /usr/bin/lesspipe.sh - fi - 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 - doenvd 70less - - dodoc "${FILESDIR}"/README.Gentoo - - if use less-select - then newdoc "${SELECTDIR}"/README 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_postinst() { - use lesspipe || \ - elog "lesspipe offers colorization options. Run 'lesspipe -h' for info." -} diff --git a/sys-apps/less/metadata.xml b/sys-apps/less/metadata.xml index d56b6e96..812305c4 100644 --- a/sys-apps/less/metadata.xml +++ b/sys-apps/less/metadata.xml @@ -21,7 +21,7 @@ Use the gentoo default for the LESS variable. - Use sys-apps/lesspipe instead of Gentoo's default lesspipe.sh. + Default to lesspipe.sh from app-text/lesspipe instead of the gentoo specific lesspipe. Add the less-select feature (additional options and a binary helper). Install sources for keybindings (only useful with less-select). -- cgit v1.2.3-65-gdbad