Fix electron-eselect and add electron-bin-7.0.1

This commit is contained in:
layman 2019-11-08 20:32:53 -08:00
parent 41dd495ffc
commit 115f847edd
5 changed files with 125 additions and 130 deletions

View File

@ -1,10 +1,11 @@
inherit config
inherit config multilib
DESCRIPTION="Manage electron versions"
MAINTAINER="rexerton.rexy@tutamail.com"
VERSION="2.2"
USR_PATH="${EROOT%/}/usr"
OPT_PATH="${EROOT%/}/opt"
active_slot() {
if [ -h "${USR_PATH}/bin/electron" ];then
@ -56,15 +57,34 @@ describe_set() {
echo "Set the symlink for the electron application"
}
_create_symlinks() {
local version_name="$1"
local libdir="$(get_libdir)"
ln -sf "${USR_PATH}/bin/${version_name}" "${USR_PATH}/bin/electron" || die
if [ -d "${USR_PATH}/${libdir}/${version_name}" ];then
ln -sf "${USR_PATH}/${libdir}/${version_name}" "${USR_PATH}/${libdir}/electron" || die
elif [ -d "${OPT_PATH}/electron/${version_name}" ];then
ln -sf "${OPT_PATH}/electron/${version_name}" "${USR_PATH}/${libdir}/electron" || die
elif [ -h "${USR_PATH}/${libdir}/electron" ];then
rm "${USR_PATH}/${libdir}/electron"
fi
if [ -d "${USR_PATH}/include/${version_name}" ];then
ln -sf "${USR_PATH}/include/${version_name}" "${USR_PATH}/include/electron" || die
elif [ -h "${USR_PATH}/include/electron" ];then
rm "${USR_PATH}/include/electron"
fi
}
do_set() {
local selected="$1"
if [ -e "${USR_PATH}/bin/${selected}" ] && [[ "${selected}" =~ ^electron(-bin)?-[1-9][0-9.]+(-r[1-9]+)? ]];then
ln -sf "${USR_PATH}/bin/${selected}" "${USR_PATH}/bin/electron" || die
_create_symlinks "${selected}"
return
elif [[ "${selected}" =~ ^[1-9][0-9]*$ ]];then
slots=( $(get_slots) )
if [ "${selected}" -le ${#slots[@]} ];then
ln -sf "${USR_PATH}/bin/${slots[$((selected-1))]}" "${USR_PATH}/bin/electron" || die
_create_symlinks "${slots[$((selected-1))]}"
return
fi
fi
@ -72,9 +92,11 @@ do_set() {
die -q "Not a valid slot"
}
describe_unset() {
echo "Remove electron symlink"
echo "Remove electron symlinks"
}
do_unset() {
[ -h "${USR_PATH}/bin/electron" ] && rm /usr/bin/electron
[ -h "${USR_PATH}/bin/electron" ] && rm "${USR_PATH}/bin/electron"
[ -h "${USR_PATH}/$(get_libdir)/electron" ] && rm "${USR_PATH}/$(get_libdir)/electron"
[ -h "${USR_PATH}/include/electron" ] && rm "${USR_PATH}/include/electron"
}

View File

@ -2,3 +2,7 @@ DIST electron-bin-6.1.2-arm64.zip 62659406 BLAKE2B d6c7a2ee2f1b23ffb279e99bb373a
DIST electron-bin-6.1.2-armv7l.zip 54847158 BLAKE2B dab8ab35f2f01cc3b31bb380530948006b1a58216aa6b0f0f00b6b838426f8e48cf7a6c772adc3154a7343067c5768e1625290709459d4f0bb680b4f9a35e1ad SHA512 138f2b6a6b34274a0bf6727ed465219b9fd837b6fb71e304a52686e20bb2dba5136a30f1e2e3b7963a983e9b00469a22d47684c0b421af56dbb56ae749728f32
DIST electron-bin-6.1.2-ia32.zip 63275754 BLAKE2B 8b09c2529517441e407737787dca397084c7c1a3b67cb6cfc6f3d770ba1f20bc0ad7fc7933d824b67c8c27093f021b2b4ec8742147f83ab31f2b52a15a1b8bd2 SHA512 95f4c244ac7151b39755e5147784e4f3c7511626da67928eb8c7849ce0ad45e70ebcd8f1356be09ac06ae13304f6abfcc0c74d45357931bc79b408db12edf5af
DIST electron-bin-6.1.2-x64.zip 62392558 BLAKE2B a7c57e223d53db9ee46a8aeff9695a6079fdc17ed944b66b65a2833abea06cd9a123741cb41f560964c7fa0ad867f66c4b45a1286f81d6f257a499a6f7eb9efd SHA512 4ad62113908077308c8976d5c71795ff027b6e633d2530605887f59f2d1d77c37711a644effce0a7183f34443cc3b34f9e99f58576d9981fa356d060b9adfdce
DIST electron-bin-7.0.1-arm64.zip 68304801 BLAKE2B 66dde3218c7f1e42ebc97a0c3b08ed9f6e410e370b02cc5f668ebb162e658fc82740667da681ecf36d2257485f4a8482686d228a809c44b819dcf51b0177fe5d SHA512 f9a5a9c307a61b1f25784ab0e11ce668a08d20384ed7c21969861bfded17b14f9ef0c346fbeeb1b4e1dba3055eb4e5e0e297138788d11bf5130d6faf59d20dc5
DIST electron-bin-7.0.1-armv7l.zip 60989577 BLAKE2B 73f7f4217a15193a798d3fe2bf59574ddc1af21f71331c2a56c2aa202f24d5539b0ee15065df62bbd4ed5352c5c8fa91cfd6d11797a49263ccd3a2cf0bf797f7 SHA512 c3645430683ef97f3aa5ef105783aae40870103294ed9d2fa788395ada91e4e76cbbaacb2eccc61773fa2d9de65befa0c8ee11a642a35ca2c0d5d9408846f99c
DIST electron-bin-7.0.1-ia32.zip 70673464 BLAKE2B ee3158882a3954b6e2e31e14d0c4f4f11db371fa58d5a07c55fa4762d8d0164f3f45da4c28b2b82b332b21ec668a8372b6f31d9ac883c23c6c9d374f51a7de75 SHA512 89c81fd16cb11452b78780fe79ab8ca8d29c23e44472e8692f84a755fdd051c64e16dcdcc7d6cf789a36b52d8774ec7d75af11759b69ae7615a76b72c59aa871
DIST electron-bin-7.0.1-x64.zip 69139867 BLAKE2B 5bdf01f52f7ca23248766c00d3643292bf71946d48b4cad3bdb088cb4444783a7649a3c1b1ba00053c76ebea355a948014cfe4a01c9d0351f66af6f02ef9a932 SHA512 fc1670128645be2c80f265ae82a586506488f644d5b9df896861b262769276074c053263efa42f962e1a1bb346334d492a489b61f6804ec776c3bfc6d98c493a

View File

@ -0,0 +1,94 @@
# Copyright 2019 rexy712
# Distributed under the terms of the GNU General Public License v3
EAPI=7
CHROMIUM_LANGS="
am ar bg bn ca cs da de el en-GB en-US es es-419 et fa fi fil fr gu he hi hr
hu id it ja kn ko lt lv ml mr ms nb nl pl pt-BR pt-PT ro ru sk sl sr sv sw
ta te th tr uk vi zh-CN zh-TW
"
inherit chromium-2
MY_PN="${PN/-bin}"
VERSION_MAJ="$(ver_cut 1)"
VERSION_MIN="$(ver_cut 2)"
SRC_URI_BASE="https://github.com/electron/electron/releases/download"
DESCRIPTION="Cross platform application development framework based on web technologies"
HOMEPAGE="https://electron.atom.io"
SRC_URI="
amd64? ( ${SRC_URI_BASE}/v${PV}/${MY_PN}-v${PV}-linux-x64.zip -> ${P}-x64.zip )
arm? ( ${SRC_URI_BASE}/v${PV}/${MY_PN}-v${PV}-linux-armv7l.zip -> ${P}-armv7l.zip )
arm64? ( ${SRC_URI_BASE}/v${PV}/${MY_PN}-v${PV}-linux-arm64.zip -> ${P}-arm64.zip )
x86? ( ${SRC_URI_BASE}/v${PV}/${MY_PN}-v${PV}-linux-ia32.zip -> ${P}-ia32.zip )
"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="${VERSION_MAJ}/${VERSION_MIN}"
KEYWORDS="-* ~amd64 ~arm ~arm64 ~x86"
IUSE="+suid"
RDEPEND="
dev-libs/atk
dev-libs/expat
dev-libs/glib:2
dev-libs/nss
media-gfx/graphite2
media-libs/alsa-lib
media-libs/fontconfig:1.0
media-libs/libepoxy
media-libs/libpng
net-print/cups
sys-apps/dbus
virtual/opengl
x11-libs/cairo
x11-libs/gdk-pixbuf:2
x11-libs/gtk+:3
x11-libs/libxcb
x11-libs/libXScrnSaver
x11-libs/libXtst
x11-libs/pango
"
DEPEND="
app-arch/unzip
>=app-eselect/eselect-electron-2.2
"
S="${WORKDIR}"
OPTPATH="opt/${MY_PN}/${PN}-${VERSION_MAJ}.${VERSION_MIN}"
QA_PRESTRIPPED="${OPTPATH}/.*"
pkg_setup() {
# Silence linux-info_pkg_setup()
:;
}
src_prepare() {
pushd locales > /dev/null || die
chromium_remove_language_paks
popd > /dev/null || die
default
}
src_install() {
dodir "/${OPTPATH}"
# Note: intentionally not using "doins" so that we preserve +x bits
cp -r ./* "${ED}/${OPTPATH}" || die
use suid && chmod 4755 "${ED}/${OPTPATH}/chrome-sandbox"
dosym "../../${OPTPATH}/electron" "/usr/bin/${PN}-${VERSION_MAJ}.${VERSION_MIN}"
}
pkg_postinst() {
if [ "$(eselect electron show)" == "(none)" ];then
eselect electron set "${PN}-${VERSION_MAJ}.${VERSION_MIN}"
fi
}
pkg_postrm() {
if [ "$(eselect electron show)" == "(none)" ];then
eselect electron set 1
fi
}

View File

@ -1,23 +0,0 @@
# Copyright 2019 rexy712
# Distributed under the terms of the GNU General Public License v3
EAPI=7
DESCRIPTION="Manages versions of electron executables"
HOMEPAGE="https://www.gentoo.org/"
SRC_URI=""
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64"
IUSE=""
DEPEND="app-admin/eselect"
RDEPEND=""
S="${FILESDIR}"
src_install() {
insinto /usr/share/eselect/modules
newins "${FILESDIR}"/electron-${PV}.eselect electron.eselect
}

View File

@ -1,102 +0,0 @@
inherit config multilib
DESCRIPTION="Manage electron versions"
MAINTAINER="rexerton.rexy@tutamail.com"
VERSION="2.2"
USR_PATH="${EROOT%/}/usr"
OPT_PATH="${EROOT%/}/opt"
active_slot() {
if [ -h "${USR_PATH}/bin/electron" ];then
readlink "${USR_PATH}/bin/electron" | xargs basename
else
echo "(none)"
fi
}
get_slots() {
local found_slots=()
for slot in $(find "${USR_PATH}/bin" -mindepth 1 -maxdepth 1 \( -type f -o -type l \) -regex "${USR_PATH}"'/bin/electron\(-bin\)?-[1-9][0-9.]+\(-r[1-9]+\)?$');do
[ -x "${slot}" ] && found_slots+=( "${slot##*/}" )
done
echo ${found_slots[@]}
}
describe_list() {
echo "List available electron slots"
}
do_list() {
write_list_start "Available electron slots"
if $(is_output_mode brief);then
echo $(get_slots)
else
i=1
for slot in $(get_slots);do
case "${slot}" in
"$(active_slot)" )
write_kv_list_entry "$i) $(highlight_marker ${slot})";;
*)
write_kv_list_entry "$i) ${slot}";;
esac
i=$((i+1))
done
[ -z "$(get_slots)" ] && write_warning_msg "No slots available."
fi
}
describe_show() {
echo "Get active slot"
}
do_show() {
echo "$(active_slot)"
}
describe_set() {
echo "Set the symlink for the electron application"
}
_create_symlinks() {
local version_name="$1"
local libdir="$(get_libdir)"
ln -sf "${USR_PATH}/bin/${version_name}" "${USR_PATH}/bin/electron" || die
if [ -d "${USR_PATH}/${libdir}/${version_name}" ];then
ln -sf "${USR_PATH}/${libdir}/${version_name}" "${USR_PATH}/${libdir}/electron" || die
elif [ -d "${OPT_PATH}/electron/${version_name}" ];then
ln -sf "${OPT_PATH}/electron/${version_name}" "${USR_PATH}/${libdir}/electron" || die
elif [ -h "${USR_PATH}/${libdir}/electron" ];then
rm "${USR_PATH}/${libdir}/electron"
fi
if [ -d "${USR_PATH}/include/${version_name}" ];then
ln -sf "${USR_PATH}/include/${version_name}" "${USR_PATH}/include/electron" || die
elif [ -h "${USR_PATH}/include/electron" ];then
rm "${USR_PATH}/include/electron"
fi
}
do_set() {
local selected="$1"
if [ -e "${USR_PATH}/bin/${selected}" ] && [[ "${selected}" =~ ^electron(-bin)?-[1-9][0-9.]+(-r[1-9]+)? ]];then
_create_symlinks "${selected}"
return
elif [[ "${selected}" =~ ^[1-9][0-9]*$ ]];then
slots=( $(get_slots) )
if [ "${selected}" -le ${#slots[@]} ];then
_create_symlinks "${slots[$((selected-1))]}"
return
fi
fi
die -q "Not a valid slot"
}
describe_unset() {
echo "Remove electron symlinks"
}
do_unset() {
[ -h "${USR_PATH}/bin/electron" ] && rm "${USR_PATH}/bin/electron"
[ -h "${USR_PATH}/$(get_libdir)/electron" ] && rm "${USR_PATH}/$(get_libdir)/electron"
[ -h "${USR_PATH}/include/electron" ] && rm "${USR_PATH}/include/electron"
}