From 7b15ff9a792c56dd26d1ea834dab34acfa2db52a Mon Sep 17 00:00:00 2001 From: Dongsu Park Date: Fri, 17 Feb 2023 11:15:36 +0100 Subject: [PATCH] sys-apps/less: update to 608-r2 Update sys-apps/less to 608-r2, mainly to address CVE-2022-46663. Gentoo commit: 5266422ebb13eb9acbcb976a9f42232f1c3bb0d9 --- .../portage-stable/sys-apps/less/Manifest | 6 +- .../less/files/less-608-CVE-2022-46663.patch | 22 ++++++ .../sys-apps/less/files/less-608-procfs.patch | 45 +++++++++++ .../sys-apps/less/less-590.ebuild | 44 ----------- .../{less-581.2.ebuild => less-608-r1.ebuild} | 18 ++++- .../{less-589.ebuild => less-608-r2.ebuild} | 22 +++++- .../sys-apps/less/less-618_beta.ebuild | 69 +++++++++++++++++ .../sys-apps/less/less-623_beta.ebuild | 77 +++++++++++++++++++ .../sys-apps/less/less-9999.ebuild | 77 +++++++++++++++++++ 9 files changed, 328 insertions(+), 52 deletions(-) create mode 100644 sdk_container/src/third_party/portage-stable/sys-apps/less/files/less-608-CVE-2022-46663.patch create mode 100644 sdk_container/src/third_party/portage-stable/sys-apps/less/files/less-608-procfs.patch delete mode 100644 sdk_container/src/third_party/portage-stable/sys-apps/less/less-590.ebuild rename sdk_container/src/third_party/portage-stable/sys-apps/less/{less-581.2.ebuild => less-608-r1.ebuild} (68%) rename sdk_container/src/third_party/portage-stable/sys-apps/less/{less-589.ebuild => less-608-r2.ebuild} (66%) create mode 100644 sdk_container/src/third_party/portage-stable/sys-apps/less/less-618_beta.ebuild create mode 100644 sdk_container/src/third_party/portage-stable/sys-apps/less/less-623_beta.ebuild create mode 100644 sdk_container/src/third_party/portage-stable/sys-apps/less/less-9999.ebuild diff --git a/sdk_container/src/third_party/portage-stable/sys-apps/less/Manifest b/sdk_container/src/third_party/portage-stable/sys-apps/less/Manifest index 32c93d3198..46a99b17fb 100644 --- a/sdk_container/src/third_party/portage-stable/sys-apps/less/Manifest +++ b/sdk_container/src/third_party/portage-stable/sys-apps/less/Manifest @@ -1,3 +1,3 @@ -DIST less-581.2.tar.gz 349230 BLAKE2B 3f9d3c94f3d9eae5ecd033c5f16a575bd3a179ca335b0318e097a916c6713379cafbe6c57459e86866e890a432fb02be9102726b35c46d9bdd07ca1b35f83058 SHA512 b1189396c798d7cb8655175f31b1af6163dcf8e8d7a72531161cc8396e72e0cf5858ce7b39173be603f9f16eda498f2805cf42c2b92ec6970fd9d2b603fb7b92 -DIST less-589.tar.gz 352390 BLAKE2B d91eaf0e4a3c14bb8a1c1b820965922c9e795cc8c6489c04dad79d14bc634db1e8e20aae9578ca5375d4d1f1fb861a510527ee9433437457d653453eabf5dce9 SHA512 c2a610c894e98853e73d83cf2c7e94ff75a868280b2ab7fa01676c35d35fdbba808f3630fa4954eca40f0823e654df4c287885499bb24f4d0b7b4558fb91977e -DIST less-590.tar.gz 352574 BLAKE2B 0f640f1b6b4d4925c4904ee77460e8becd2dae168fe5c1483bf6a9cfabe9eb0abdc4d4811507ba88a2b4cff6c238158bd8b4463b63d3d7863b44ce8538d32adb SHA512 426fa5840fd43c17bd5a452ad35ad24f2d6684623c6914403fd0059af62266bf2138e6828c7d73a1cef26a736c0d2b8ed4ab180eea8297281dae79a4228eb903 +DIST less-608.tar.gz 362346 BLAKE2B 988940745fef1222c43b0bf4edec7cc7206ded0ac5d89d3faf4dab706a249913581c2fe7aa6063cf3d717176ed07b69299d3e791ba8a60358483fe9d1bf7f7c6 SHA512 7945b7f88921832ebb1b45fba8cbb449ee0133342796b654a52c146dfff3d84db18724ee84e53349eeea6017a0ebe2d8eb5366210275981dde7bb7190118fa66 +DIST less-618-beta.tar.gz 365786 BLAKE2B b1957ab49059a2df14d8ba5daf1d8543adc4546c44b537d86959e2e1fe2df93f99ceb8ef47097b6f84f75f7740e161269b4e1d5dd263b8171212c87e650a02fe SHA512 6197aa20c77a846e53b376aa63c2863242c40663e72213f66c3597bd8c38a9458163d0c9ba0ca7690574c07348bb7d3e108c3b50dbbedbc9e5707a14d946b280 +DIST less-623-beta.tar.gz 373094 BLAKE2B 661fdb129678a57ef2188b4cd89809b14eaae62b98bb8ec2394cb7b48faf10a3ccdb690f371178e9ed43548ebce1af840cb5042e9019fa747bcec2dca4158dc7 SHA512 60843c668f90ae47cdf4d10849a63481ab67af679b831cbe8955861ae9f238006322734ec3ae49d9aced7927018bf3e0d9fdab98077289b4ffc78f6075041667 diff --git a/sdk_container/src/third_party/portage-stable/sys-apps/less/files/less-608-CVE-2022-46663.patch b/sdk_container/src/third_party/portage-stable/sys-apps/less/files/less-608-CVE-2022-46663.patch new file mode 100644 index 0000000000..a358dd6f1a --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/sys-apps/less/files/less-608-CVE-2022-46663.patch @@ -0,0 +1,22 @@ +https://bugs.gentoo.org/893530 +https://github.com/gwsw/less/commit/a78e1351113cef564d790a730d657a321624d79c + +From a78e1351113cef564d790a730d657a321624d79c Mon Sep 17 00:00:00 2001 +From: Mark Nudelman +Date: Fri, 7 Oct 2022 19:25:46 -0700 +Subject: [PATCH] End OSC8 hyperlink on invalid embedded escape sequence. + +--- a/line.c ++++ b/line.c +@@ -633,8 +633,8 @@ ansi_step(pansi, ch) + /* Hyperlink ends with \7 or ESC-backslash. */ + if (ch == '\7') + return ANSI_END; +- if (pansi->prev_esc && ch == '\\') +- return ANSI_END; ++ if (pansi->prev_esc) ++ return (ch == '\\') ? ANSI_END : ANSI_ERR; + pansi->prev_esc = (ch == ESC); + return ANSI_MID; + } + diff --git a/sdk_container/src/third_party/portage-stable/sys-apps/less/files/less-608-procfs.patch b/sdk_container/src/third_party/portage-stable/sys-apps/less/files/less-608-procfs.patch new file mode 100644 index 0000000000..4f66322b81 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/sys-apps/less/files/less-608-procfs.patch @@ -0,0 +1,45 @@ +From 03f011f219a6d6068c4ccd07dbd8dcd50641ff10 Mon Sep 17 00:00:00 2001 +From: Mark Nudelman +Date: Tue, 20 Sep 2022 12:32:30 -0700 +Subject: [PATCH] Fix reading procfs files on Linux: bad detection of + HAVE_PROCFS. + +diff --git a/ch.c b/ch.c +index bfad09c7..fcf136b9 100644 +--- a/ch.c ++++ b/ch.c +@@ -28,6 +28,9 @@ extern ino_t curr_ino; + + #if HAVE_PROCFS + #include ++#if HAVE_LINUX_MAGIC_H ++#include ++#endif + #endif + + typedef POSITION BLOCKNUM; +diff --git a/configure.ac b/configure.ac +index f7c64814..b10adce9 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -37,7 +37,7 @@ AC_SEARCH_LIBS([regcmp], [gen intl PW]) + + # Checks for header files. + AC_HEADER_STDC +-AC_CHECK_HEADERS([ctype.h errno.h fcntl.h limits.h stdio.h stdlib.h string.h termcap.h termio.h termios.h time.h unistd.h values.h sys/ioctl.h sys/stream.h wctype.h]) ++AC_CHECK_HEADERS([ctype.h errno.h fcntl.h limits.h stdio.h stdlib.h string.h termcap.h termio.h termios.h time.h unistd.h values.h linux/magic.h sys/ioctl.h sys/stream.h wctype.h]) + + # Checks for typedefs, structures, and compiler characteristics. + AC_HEADER_STAT +@@ -271,7 +271,10 @@ AC_TRY_COMPILE([#include + [struct stat s; dev_t dev = s.st_dev; ino_t ino = s.st_ino;], + [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STAT_INO)], [AC_MSG_RESULT(no)]) + AC_MSG_CHECKING(for procfs) +-AC_TRY_COMPILE([#include ], ++AC_TRY_COMPILE([#include ++#if HAVE_LINUX_MAGIC_H ++#include ++#endif], + [struct statfs s; s.f_type = PROC_SUPER_MAGIC; (void) fstatfs(0,&s); ], + [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_PROCFS)], [AC_MSG_RESULT(no)]) + diff --git a/sdk_container/src/third_party/portage-stable/sys-apps/less/less-590.ebuild b/sdk_container/src/third_party/portage-stable/sys-apps/less/less-590.ebuild deleted file mode 100644 index 10671e00e6..0000000000 --- a/sdk_container/src/third_party/portage-stable/sys-apps/less/less-590.ebuild +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright 1999-2021 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 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~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 -} diff --git a/sdk_container/src/third_party/portage-stable/sys-apps/less/less-581.2.ebuild b/sdk_container/src/third_party/portage-stable/sys-apps/less/less-608-r1.ebuild similarity index 68% rename from sdk_container/src/third_party/portage-stable/sys-apps/less/less-581.2.ebuild rename to sdk_container/src/third_party/portage-stable/sys-apps/less/less-608-r1.ebuild index 10671e00e6..0ad903424e 100644 --- a/sdk_container/src/third_party/portage-stable/sys-apps/less/less-581.2.ebuild +++ b/sdk_container/src/third_party/portage-stable/sys-apps/less/less-608-r1.ebuild @@ -1,7 +1,11 @@ -# Copyright 1999-2021 Gentoo Authors +# Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 +WANT_AUTOMAKE=none +WANT_LIBTOOL=none + +inherit autotools DESCRIPTION="Excellent text file viewer" HOMEPAGE="http://www.greenwoodsoftware.com/less/" @@ -9,7 +13,7 @@ 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 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" IUSE="pcre unicode" DEPEND=">=app-misc/editor-wrapper-3 @@ -17,6 +21,16 @@ DEPEND=">=app-misc/editor-wrapper-3 pcre? ( dev-libs/libpcre2 )" RDEPEND="${DEPEND}" +src_prepare() { + local PATCHES=( + "${FILESDIR}/less-608-procfs.patch" + ) + default + # Upstream uses unpatched autoconf-2.69, which breaks with clang-16. + # https://bugs.gentoo.org/870412 + eautoreconf +} + src_configure() { export ac_cv_lib_ncursesw_initscr=$(usex unicode) export ac_cv_lib_ncurses_initscr=$(usex !unicode) diff --git a/sdk_container/src/third_party/portage-stable/sys-apps/less/less-589.ebuild b/sdk_container/src/third_party/portage-stable/sys-apps/less/less-608-r2.ebuild similarity index 66% rename from sdk_container/src/third_party/portage-stable/sys-apps/less/less-589.ebuild rename to sdk_container/src/third_party/portage-stable/sys-apps/less/less-608-r2.ebuild index c91345dc9f..8777d5546a 100644 --- a/sdk_container/src/third_party/portage-stable/sys-apps/less/less-589.ebuild +++ b/sdk_container/src/third_party/portage-stable/sys-apps/less/less-608-r2.ebuild @@ -1,7 +1,11 @@ -# Copyright 1999-2021 Gentoo Authors +# Copyright 1999-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -EAPI=7 +EAPI=8 + +WANT_AUTOMAKE=none +WANT_LIBTOOL=none +inherit autotools DESCRIPTION="Excellent text file viewer" HOMEPAGE="http://www.greenwoodsoftware.com/less/" @@ -9,7 +13,7 @@ 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 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" IUSE="pcre unicode" DEPEND=">=app-misc/editor-wrapper-3 @@ -17,6 +21,18 @@ DEPEND=">=app-misc/editor-wrapper-3 pcre? ( dev-libs/libpcre2 )" RDEPEND="${DEPEND}" +src_prepare() { + local PATCHES=( + "${FILESDIR}/less-608-procfs.patch" + "${FILESDIR}/less-608-CVE-2022-46663.patch" + ) + + default + # Upstream uses unpatched autoconf-2.69, which breaks with clang-16. + # https://bugs.gentoo.org/870412 + eautoreconf +} + src_configure() { export ac_cv_lib_ncursesw_initscr=$(usex unicode) export ac_cv_lib_ncurses_initscr=$(usex !unicode) diff --git a/sdk_container/src/third_party/portage-stable/sys-apps/less/less-618_beta.ebuild b/sdk_container/src/third_party/portage-stable/sys-apps/less/less-618_beta.ebuild new file mode 100644 index 0000000000..afce93c3d2 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/sys-apps/less/less-618_beta.ebuild @@ -0,0 +1,69 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +WANT_AUTOMAKE=none +WANT_LIBTOOL=none + +if [[ ${PV} == 9999 ]]; then + EGIT_REPO_URI="https://github.com/gwsw/less" + inherit git-r3 +fi + +inherit autotools + +# 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. + +MY_PV=${PV/_beta/-beta} +MY_P=${PN}-${MY_PV} +DESCRIPTION="Excellent text file viewer" +HOMEPAGE="http://www.greenwoodsoftware.com/less/" +[[ ${PV} != 9999 ]] && SRC_URI="http://www.greenwoodsoftware.com/less/${MY_P}.tar.gz" +S="${WORKDIR}"/${MY_P/?beta} + +LICENSE="|| ( GPL-3 BSD-2 )" +SLOT="0" +#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="pcre" + +DEPEND=">=app-misc/editor-wrapper-3 + >=sys-libs/ncurses-5.2:0= + pcre? ( dev-libs/libpcre2 )" +RDEPEND="${DEPEND}" + +src_prepare() { + default + # Per upstream README to prepare live build + [[ ${PV} == 9999 ]] && emake -f Makefile.aut distfiles + # Upstream uses unpatched autoconf-2.69, which breaks with clang-16. + # https://bugs.gentoo.org/870412 + eautoreconf +} + +src_configure() { + 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 +} diff --git a/sdk_container/src/third_party/portage-stable/sys-apps/less/less-623_beta.ebuild b/sdk_container/src/third_party/portage-stable/sys-apps/less/less-623_beta.ebuild new file mode 100644 index 0000000000..84957e8ecc --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/sys-apps/less/less-623_beta.ebuild @@ -0,0 +1,77 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +WANT_AUTOMAKE=none +WANT_LIBTOOL=none + +if [[ ${PV} == 9999 ]]; then + EGIT_REPO_URI="https://github.com/gwsw/less" + inherit git-r3 +fi + +inherit autotools + +# 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. + +MY_PV=${PV/_beta/-beta} +MY_P=${PN}-${MY_PV} +DESCRIPTION="Excellent text file viewer" +HOMEPAGE="http://www.greenwoodsoftware.com/less/" +[[ ${PV} != 9999 ]] && SRC_URI="http://www.greenwoodsoftware.com/less/${MY_P}.tar.gz" +S="${WORKDIR}"/${MY_P/?beta} + +LICENSE="|| ( GPL-3 BSD-2 )" +SLOT="0" +#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="pcre" +# As of 623_beta, lesstest is not included in dist tarballs +RESTRICT="test" + +DEPEND=" + >=app-misc/editor-wrapper-3 + >=sys-libs/ncurses-5.2:= + pcre? ( dev-libs/libpcre2 ) +" +RDEPEND="${DEPEND}" + +src_prepare() { + default + # Per upstream README to prepare live build + [[ ${PV} == 9999 ]] && emake -f Makefile.aut distfiles + # Upstream uses unpatched autoconf-2.69, which breaks with clang-16. + # https://bugs.gentoo.org/870412 + eautoreconf +} + +src_configure() { + local myeconfargs=( + --with-regex=$(usex pcre pcre2 posix) + --with-editor="${EPREFIX}"/usr/libexec/editor + ) + econf "${myeconfargs[@]}" +} + +src_test() { + emake check VERBOSE=1 +} + +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 +} diff --git a/sdk_container/src/third_party/portage-stable/sys-apps/less/less-9999.ebuild b/sdk_container/src/third_party/portage-stable/sys-apps/less/less-9999.ebuild new file mode 100644 index 0000000000..84957e8ecc --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/sys-apps/less/less-9999.ebuild @@ -0,0 +1,77 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +WANT_AUTOMAKE=none +WANT_LIBTOOL=none + +if [[ ${PV} == 9999 ]]; then + EGIT_REPO_URI="https://github.com/gwsw/less" + inherit git-r3 +fi + +inherit autotools + +# 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. + +MY_PV=${PV/_beta/-beta} +MY_P=${PN}-${MY_PV} +DESCRIPTION="Excellent text file viewer" +HOMEPAGE="http://www.greenwoodsoftware.com/less/" +[[ ${PV} != 9999 ]] && SRC_URI="http://www.greenwoodsoftware.com/less/${MY_P}.tar.gz" +S="${WORKDIR}"/${MY_P/?beta} + +LICENSE="|| ( GPL-3 BSD-2 )" +SLOT="0" +#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="pcre" +# As of 623_beta, lesstest is not included in dist tarballs +RESTRICT="test" + +DEPEND=" + >=app-misc/editor-wrapper-3 + >=sys-libs/ncurses-5.2:= + pcre? ( dev-libs/libpcre2 ) +" +RDEPEND="${DEPEND}" + +src_prepare() { + default + # Per upstream README to prepare live build + [[ ${PV} == 9999 ]] && emake -f Makefile.aut distfiles + # Upstream uses unpatched autoconf-2.69, which breaks with clang-16. + # https://bugs.gentoo.org/870412 + eautoreconf +} + +src_configure() { + local myeconfargs=( + --with-regex=$(usex pcre pcre2 posix) + --with-editor="${EPREFIX}"/usr/libexec/editor + ) + econf "${myeconfargs[@]}" +} + +src_test() { + emake check VERBOSE=1 +} + +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 +}