From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 8795F1391DB for ; Wed, 19 Mar 2014 15:39:49 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3CFE0E096B; Wed, 19 Mar 2014 15:39:46 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id BCCB9E096B for ; Wed, 19 Mar 2014 15:39:45 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E7B6B33FD7F for ; Wed, 19 Mar 2014 15:39:44 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id 8FDA618875 for ; Wed, 19 Mar 2014 15:39:43 +0000 (UTC) From: "Michael Palimaka" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michael Palimaka" Message-ID: <1395243560.3fd58117440da636c6db858217af2b2652da9d1e.kensington@gentoo> Subject: [gentoo-commits] proj/kde:master commit in: eclass/ X-VCS-Repository: proj/kde X-VCS-Files: eclass/freedesktop.eclass X-VCS-Directories: eclass/ X-VCS-Committer: kensington X-VCS-Committer-Name: Michael Palimaka X-VCS-Revision: 3fd58117440da636c6db858217af2b2652da9d1e X-VCS-Branch: master Date: Wed, 19 Mar 2014 15:39:43 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: e78534c3-f092-4235-afeb-58e8478eab43 X-Archives-Hash: 24b9e3fb02d8dc4e3052831584f44e9e commit: 3fd58117440da636c6db858217af2b2652da9d1e Author: Michael Palimaka gentoo org> AuthorDate: Wed Mar 19 15:39:20 2014 +0000 Commit: Michael Palimaka gentoo org> CommitDate: Wed Mar 19 15:39:20 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/kde.git;a=commit;h=3fd58117 [eclass] Add initial draft of freedesktop eclass. --- eclass/freedesktop.eclass | 70 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/eclass/freedesktop.eclass b/eclass/freedesktop.eclass new file mode 100644 index 0000000..ed2250d --- /dev/null +++ b/eclass/freedesktop.eclass @@ -0,0 +1,70 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +# @ECLASS: freedesktop +# @MAINTAINER: +# freedesktop-bugs@gentoo.org +# @BLURB: Useful functions for working with freedesktop-compliant applications +# @DESCRIPTION: +# Set up directories according to the XDG Base Directory Specification. +# Also provides functions for updating desktop, mime, and icon caches. +# @EXAMPLE: +# @CODE +# inherit freedesktop +# +# pkg_setup() { +# freedesktop_setup +# } +# pkg_postinst() { +# freedesktop_desktop_database_update +# freedesktop_mime_database_update +# } +# @CODE + +# Unset these globally to avoid leaking values from the calling environment. +unset XDG_DATA_HOME XDG_CONFIG_HOME XDG_CACHE_HOME XDG_RUNTIME_DIR + +# @FUNCTION: freedesktop_setup +# @DESCRIPTION: +# Creates sensible locations for the following environment variables: +# XDG_DATA_HOME +# XDG_CONFIG_HOME +# XDG_CACHE_HOME +# XDG_RUNTIME_DIR +freedesktop_setup() { + export XDG_DATA_HOME="${HOME}/.local/share" + export XDG_CONFIG_HOME="${HOME}/.config" + export XDG_CACHE_HOME="${HOME}/.cache" + export XDG_RUNTIME_DIR="${T}/run" + mkdir -p "${XDG_DATA_HOME}" "${XDG_CONFIG_HOME}" "${XDG_CACHE_HOME}" || die + mkdir -p -m 0700 "${XDG_RUNTIME_DIR}" || die +} + +# @FUNCTION: freedesktop_desktop_database_update +# @DESCRIPTION: +# Updates the desktop database. +# Generates a list of mimetypes linked to applications that can handle them +fdo-mime_desktop_database_update() { + has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= + has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}" + if [ -x "${EPREFIX}/usr/bin/update-desktop-database" ] + then + einfo "Updating desktop mime database ..." + "${EPREFIX}/usr/bin/update-desktop-database" -q "${EROOT}usr/share/applications" + fi +} + +# @FUNCTION: freedesktop_mime_database_update +# @DESCRIPTION: +# Update the mime database. +# Creates a general list of mime types from several sources +freedesktop_mime_database_update() { + has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= + has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}" + if [ -x "${EPREFIX}/usr/bin/update-mime-database" ] + then + einfo "Updating shared mime info database ..." + "${EPREFIX}/usr/bin/update-mime-database" "${EROOT}usr/share/mime" + fi +}