diff options
author | Martin Väth <martin@mvath.de> | 2015-01-25 13:14:28 +0100 |
---|---|---|
committer | Martin Väth <martin@mvath.de> | 2015-10-11 10:49:21 +0200 |
commit | b4526de042879697630edd06e030be8e1a055632 (patch) | |
tree | 322cb99edd0b5a791eb6567e0c4a668564901cdf /eclass | |
parent | Bump kernel (diff) | |
download | mv-b4526de042879697630edd06e030be8e1a055632.tar.gz mv-b4526de042879697630edd06e030be8e1a055632.tar.bz2 mv-b4526de042879697630edd06e030be8e1a055632.zip |
Add reduce. Remove autodeps of mv_mozextension. Bump classic-theme-restorer
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/mv_mozextension.eclass | 188 |
1 files changed, 36 insertions, 152 deletions
diff --git a/eclass/mv_mozextension.eclass b/eclass/mv_mozextension.eclass index 2c1405ee..45a7a359 100644 --- a/eclass/mv_mozextension.eclass +++ b/eclass/mv_mozextension.eclass @@ -23,18 +23,6 @@ # set corresponding dependencies and print corresponding messages. : ${MV_MOZ_MOZILLAS=firefox seamonkey} -# @ECLASS-VARIABLE: MV_MOZ_EXTDIR -# @DESCRIPTION: -# If this variable has the special value "*", the extension is copied directly -# into the extension directory of the installed MOZILLA's. -# Otherwise, only symlinks are made in that directory, and the extension is -# installed only once into MV_MOZ_EXTDIR (a default directory is -# chosen if MV_MOZ_EXTDIR is empty). -# If this variable has the special value "?" (default), it acts like "*" or -# "" depending on whether MV_MOZ_MOZILLAS applies to more than 1 installed -# mozilla or not. -: ${MV_MOZ_EXTDIR=?} - inherit eutils multilib case ${EAPI:-0} in @@ -42,28 +30,29 @@ case ${EAPI:-0} in die "EAPI ${EAPI} no longer supported by ${ECLASS}";; esac - +IUSE= RDEPEND='|| (' +REQUIRED_USE='|| (' case ${MV_MOZ_MOZILLAS} in *fire*) + IUSE="${IUSE}${IUSE:+ }firefox firefox-bin" RDEPEND="${RDEPEND} - >=www-client/firefox-21 - >=www-client/firefox-bin-21";; + firefox? ( >=www-client/firefox-21 ) + firefox-bin? ( >=www-client/firefox-bin-21 )" + REQUIRED_USE="${REQUIRED_USE} firefox firefox-bin";; esac case ${MV_MOZ_MOZILLAS} in *sea*) + IUSE="${IUSE}${IUSE:+ }seamonkey seamonkey-bin" RDEPEND="${RDEPEND} - www-client/seamonkey - www-client/seamonkey-bin";; + seamonkey? ( www-client/seamonkey ) + seamonkey-bin? ( www-client/seamonkey-bin )" + REQUIRED_USE="${REQUIRED_USE} seamonkey seamonkey-bin";; esac -RDEPEND=${RDEPEND}' -)' +RDEPEND="${RDEPEND} )" +REQUIRED_USE="${REQUIRED_USE} )" DEPEND='app-arch/unzip' -[ -n "${RDEPEND}" ] && DEPEND="${DEPEND} -${RDEPEND}" - -[ "${MV_MOZ_EXTDIR}" = '*' ] || IUSE='copy-extensions symlink-extensions' mv_mozextension_src_unpack() { local i @@ -81,131 +70,27 @@ mv_mozextension_src_prepare() { EXPORT_FUNCTIONS src_unpack src_prepare -declare -a MV_MOZ_INS MV_MOZ_PKG MV_MOZ_CPY MV_MOZ_DIR - -mv_mozextension_install() { - local MOZILLA_EXTENSIONS_DIRECTORY - MOZILLA_EXTENSIONS_DIRECTORY=${1} - MV_MOZ_INS=() - xpi_install_dirs -} - -mv_mozextension_calc() { - local v - case ${MV_MOZ_MOZILLAS} in - ${1}) - false;; - esac && return - v=`best_version "${2}"` && [ -n "${v}" ] || return - MV_MOZ_PKG+=("${v}") - MV_MOZ_DIR+=("${3}") -} - mv_mozextension_src_install() { - local b d e i j k l s - MV_MOZ_PKG=() - MV_MOZ_DIR=() - b="${EPREFIX}/usr/`get_libdir`/" - e="${EPREFIX}/opt/" - mv_mozextension_calc '*fire*' 'www-client/firefox' "${b}firefox/browser" - mv_mozextension_calc '*fire*' 'www-client/firefox-bin' "${e}firefox/browser" - mv_mozextension_calc '*sea*' 'www-client/seamonkey' "${b}seamonkey" - mv_mozextension_calc '*sea*' 'www-client/seamonkey-bin' "${e}seamonkey" - [ ${#MV_MOZ_DIR[@]} -ne 0 ] || die 'no supported mozilla is installed' - d=${MV_MOZ_EXTDIR} - if [ "${d}" = '?' ] - then if [ ${#MV_MOZ_PKG[@]} -gt 1 ] - then d='' - else d='*' - fi - fi - MV_MOZ_SYM=() - MV_MOZ_LNK=false - if [ "${d}" = '*' ] || ! use symlink-extensions - then MV_MOZ_CPY=: - else MV_MOZ_CPY=false - if [ -n "${d}" ] - then mv_mozextension_install "${d}" - else mv_mozextension_install "${b}mozilla/extensions" - fi - fi - use copy-extensions || MV_MOZ_LNK=: - for i in "${MV_MOZ_DIR[@]}" - do j="${i}/extensions" - ${MV_MOZ_CPY} && mv_mozextension_install "${j}" - for k in "${MV_MOZ_INS[@]}" - do l="${j}/${k##*/}" - MV_MOZ_SYM+=("${l}") - ${MV_MOZ_CPY} || dosym "${ROOT%/}${k}" "${l}" - done - done -} - -mv_mozextension_pkg_preinst() { - local i j - einfo 'checking for switching between dirs and symlinks' - for i in "${MV_MOZ_SYM[@]}" - do j=${ROOT%/}${i} -# There are two forms of installation: -# (1) symlink mozilla-dir/extensions/X -> $MOZILLA_EXTENSIONS_DIRECTORY/X -# (2) data in mozilla-dir/extensions/X -# Since we might switch between (1) and (2), we must take caution, since -# in general portage cannot merge into the live directory properly: - if ${MV_MOZ_CPY} - then test -L "${j}" && { -# We switched from (1) to (2). If this happened, portage would -# actually merge the data of (2) into $MOZILLA_EXTENSIONS_DIRECTORY/X, -# since this is where the symlink from (1) points to. -# Hence, we have to remove this symlink in advance, in this case. - rm -v -- "${j}" - } - else test -d "${j}" && ! test -L "${j}" && { -# We switched from (2) to (1). If this happened, portage cannot -# merge the symlink to the live system, since this can only happen once -# the directory mozilla-dir/extensions/X is removed. -# We could remove this directory here. -# However, removing a directory is a dangerous thing, and so -# we prefer to tell the user only that he has to reemerge the package. - eerror - eerror "It is necessary to reemerge again ${CATEGORY}/${PN}" - eerror '(a directory should be removed in the cleanup after the first emerge' - eerror 'in order to install a symlink of the same name in the second emerge.)' - eerror - break - } - fi - done -} - -mv_mozextension_pkg_postinst() { - local i - [ "${#MV_MOZ_PKG[@]}" -ge 1 ] || die 'no supported mozilla is installed' - elog "${CATEGORY}/${PN} has been installed for the following packages:" - for i in ${MV_MOZ_PKG[@]} - do elog " ${i}" - done - elog "When you install/uninstall/reemerge some of: ${MV_MOZ_MOZILLAS}" - elog "you might need to reemerge ${CATEGORY}/${PN}" - ${MV_MOZ_CPY} || { - elog - elog 'The extension was installed using symlinks. This saves space but may require' - elog 'to remove ~/.mozilla/*/*/extensions.ini for each browser restart.' - } + local b e + b="${EPREFIX}/usr/$(get_libdir)" + e="${EPREFIX}/opt" + mv_mozextension_install firefox "${b}/firefox/browser/extensions" + mv_mozextension_install firefox-bin "${e}/firefox/browser/extensions" + mv_mozextension_install seamonkey "${b}/seamonkey/extensions" + mv_mozextension_install seamonkey-bin "${e}/seamonkey/extensions" } -if [ -n "${MV_MOZ_MOZILLAS}" ] -then EXPORT_FUNCTIONS src_install pkg_preinst pkg_postinst -fi +[ -z "${MV_MOZ_MOZILLAS}" ] || EXPORT_FUNCTIONS src_install xpi_unpack() { - local xpi srcdir + local xpi srcdir u # Not gonna use ${A} as we are looking for a specific option being passed to function # You must specify which xpi to use [ ${#} -eq 0 ] && die \ "Nothing passed to the ${FUNCNAME} command. Please pass which xpi to unpack" - test -d "${S}" || mkdir "${S}" + test -d "${S}" || mkdir "${S}" || die for xpi do einfo "Unpacking ${xpi} to ${S}" xpiname=${xpi%.*} @@ -237,28 +122,20 @@ xpi_install() { local d x # You must tell xpi_install which dir to use - [ ${#} -ne 1 ] && die "${FUNCNAME} takes exactly one argument. Please specify the directory" + [ ${#} -eq 1 ] || die "${FUNCNAME} takes exactly one argument. Please specify the directory" x=${1} # determine id for extension d='{ /\<\(em:\)*id\>/!d; s/.*[\">]\([^\"<>]*\)[\"<].*/\1/; p; q }' - d=`sed -n -e '/install-manifest/,$ '"${d}" "${x}"/install.rdf` \ + d=$(sed -n -e '/install-manifest/,$ '"${d}" "${x}"/install.rdf) \ && [ -n "${d}" ] || die 'failed to determine extension id' - if [ -n "${MOZILLA_EXTENSIONS_DIRECTORY}" ] - then d="${MOZILLA_EXTENSIONS_DIRECTORY}/${d}" - MV_MOZ_INS+=("${d}") - else d="${MOZILLA_FIVE_HOME}/extensions/${d}" - fi + : ${MOZILLA_EXTENSIONS_DIRECTORY:="${MOZILLA_FIVE_HOME}/extensions"} + d="${MOZILLA_EXTENSIONS_DIRECTORY}/${d}" test -d "${D}${d}" || dodir "${d}" || die "failed to create ${d}" - ${MV_MOZ_LNK} && cp -RPl -- "${x}"/* "${D}${d}" || { - ${MV_MOZ_LNK} && \ - ewarn 'Failed to hardlink extension. Falling back to USE=copy-extensions' + cp -RPl -- "${x}"/* "${D}${d}" || { + ewarn 'Failed to hardlink extension. Falling back to USE=copy-extensions' insinto "${d}" && doins -r "${x}"/* - } || { - ${MV_MOZ_LNK} && \ - die 'failed to copy extension. Please retry emerging with USE=copy-extensions' - die 'failed to copy extension' - } + } || die 'failed to copy extension' } # This function is called by mv_mozextension_src_install @@ -270,3 +147,10 @@ xpi_install_dirs() { do [ -n "${d}" ] && test -d "${d}" && xpi_install "${d}" done } + +mv_mozextension_install() { + local MOZILLA_EXTENSIONS_DIRECTORY + use_if_iuse "${1}" || return 0 + MOZILLA_EXTENSIONS_DIRECTORY=${2} + xpi_install_dirs +} |