commit:     bb7b6b0caf02195a62ba5aeefade48dab6bf421f
Author:     WuYiyang <xgreenlandforwyy <AT> gmail <DOT> com>
AuthorDate: Fri Feb  5 06:05:22 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Feb  5 07:00:44 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bb7b6b0c

app-misc/neofetch: Gentoo Prefix support

* Move install location inside prefix
* hprefixify neofetch to recognize prefix environment
* Modify neofetch to enable counting packages installed by portage in prefix
(this will also keep the host system's packages manager's information, except
for using gentoo prefix upon gentoo)

Closes: https://bugs.gentoo.org/693526
Package-Manager: Portage-3.0.14, Repoman-3.0.2
Signed-off-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/19341
Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-misc/neofetch/neofetch-7.1.0.ebuild | 14 +++++++++++++-
 app-misc/neofetch/neofetch-9999.ebuild  | 14 +++++++++++++-
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/app-misc/neofetch/neofetch-7.1.0.ebuild 
b/app-misc/neofetch/neofetch-7.1.0.ebuild
index 1b5936a8511..8c04178cf5f 100644
--- a/app-misc/neofetch/neofetch-7.1.0.ebuild
+++ b/app-misc/neofetch/neofetch-7.1.0.ebuild
@@ -1,8 +1,10 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
 
+inherit prefix
+
 if [[ ${PV} != *9999* ]]; then
        SRC_URI="https://github.com/dylanaraps/${PN}/archive/${PV}/${P}.tar.gz";
        KEYWORDS="amd64 ~arm64 ~mips ~ppc64 x86"
@@ -26,3 +28,13 @@ RDEPEND="sys-apps/pciutils
                x11-apps/xrandr
                x11-apps/xwininfo
        )"
+
+export PREFIX=${EPREFIX}/usr
+
+src_prepare () {
+       if use prefix; then
+               hprefixify neofetch
+               sed -e "/has emerge/s:\${br_prefix}:${EPREFIX}:" -i neofetch
+       fi
+       default
+}

diff --git a/app-misc/neofetch/neofetch-9999.ebuild 
b/app-misc/neofetch/neofetch-9999.ebuild
index 2b82020241d..7ab81b16a8a 100644
--- a/app-misc/neofetch/neofetch-9999.ebuild
+++ b/app-misc/neofetch/neofetch-9999.ebuild
@@ -1,8 +1,10 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
 
+inherit prefix
+
 if [[ ${PV} != *9999* ]]; then
        SRC_URI="https://github.com/dylanaraps/${PN}/archive/${PV}/${P}.tar.gz";
        KEYWORDS="~amd64 ~arm64 ~mips ~ppc64 ~x86"
@@ -26,3 +28,13 @@ RDEPEND="sys-apps/pciutils
                x11-apps/xrandr
                x11-apps/xwininfo
        )"
+
+export PREFIX=${EPREFIX}/usr
+
+src_prepare () {
+       if use prefix; then
+               hprefixify neofetch
+               sed -e "/has emerge/s:\${br_prefix}:${EPREFIX}:" -i neofetch
+       fi
+       default
+}

Reply via email to