commit:     0553e130788c33c3e297548725773ca21d603d19
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Dec  5 19:50:55 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Dec  6 14:46:40 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0553e130

app-alternatives/gzip: Use app-alternatives.eclass

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 app-alternatives/gzip/gzip-0.ebuild | 47 ++++++++++++++++++-------------------
 1 file changed, 23 insertions(+), 24 deletions(-)

diff --git a/app-alternatives/gzip/gzip-0.ebuild 
b/app-alternatives/gzip/gzip-0.ebuild
index 29e0808da453..77090242607d 100644
--- a/app-alternatives/gzip/gzip-0.ebuild
+++ b/app-alternatives/gzip/gzip-0.ebuild
@@ -3,20 +3,18 @@
 
 EAPI=8
 
-DESCRIPTION="gzip symlinks"
-HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Base/Alternatives";
-SRC_URI=""
-S=${WORKDIR}
+ALTERNATIVES=(
+       "reference:>=app-arch/gzip-1.12-r3"
+       "pigz:app-arch/pigz[-symlink(-)]"
+)
+
+inherit app-alternatives
 
-LICENSE="CC0-1.0"
-SLOT="0"
+DESCRIPTION="gzip symlinks"
 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="pigz +reference split-usr"
-REQUIRED_USE="^^ ( pigz reference )"
+IUSE="split-usr"
 
 RDEPEND="
-       pigz? ( app-arch/pigz[-symlink(-)] )
-       reference? ( >=app-arch/gzip-1.12-r3 )
        !<app-arch/gzip-1.12-r3
        !app-arch/pigz[symlink(-)]
 "
@@ -25,20 +23,21 @@ src_install() {
        local usr_prefix=
        use split-usr && usr_prefix=../usr/bin/
 
-       if use pigz; then
-               dosym "${usr_prefix}pigz" /bin/gzip
-               dosym gzip /bin/gunzip
-               dosym gzip /bin/zcat
-               newman - gzip.1 <<<".so pigz.1"
-       elif use reference; then
-               dosym gzip-reference /bin/gzip
-               # gzip uses shell wrappers rather than argv[0]
-               dosym gunzip-reference /bin/gunzip
-               dosym zcat-reference /bin/zcat
-               newman - gzip.1 <<<".so gzip-reference.1"
-       else
-               die "Invalid USE flag combination (broken REQUIRED_USE?)"
-       fi
+       case $(get_alternative) in
+               pigz)
+                       dosym "${usr_prefix}pigz" /bin/gzip
+                       dosym gzip /bin/gunzip
+                       dosym gzip /bin/zcat
+                       newman - gzip.1 <<<".so pigz.1"
+                       ;;
+               reference)
+                       dosym gzip-reference /bin/gzip
+                       # gzip uses shell wrappers rather than argv[0]
+                       dosym gunzip-reference /bin/gunzip
+                       dosym zcat-reference /bin/zcat
+                       newman - gzip.1 <<<".so gzip-reference.1"
+                       ;;
+       esac
 
        newman - gunzip.1 <<<".so gzip.1"
        newman - zcat.1 <<<".so gzip.1"

Reply via email to