FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Development

 
 
LinkBack Thread Tools
 
Old 12-17-2009, 02:09 AM
Joe Sapp
 
Default Major changes to gdesklets.eclass

Hi all,

I've been wanting to make some changes to this eclass for a while since I've
been putting on some bandages to make things work. This is a rather major
overhaul. Basically packaging upstream got a lot more regulated since obz and
I wrote the original eclass [1], so we can simplify many things. This results
in trivial ebuilds, ease of maintaining, quicker installs, and (I think) a
better user interface.

Anyways, a diff would be useless so I've attached the proposed eclass [2].

My plan for updating the tree is as follows:
1) Wait until at least 25 January 2010, discussing on the gentoo-dev ml
2) As long as there are no pending items for review, I will test with all
current x11-plugins/desklet-* ebuilds, diffing the "old" and "new" directories
3) Commit the new eclass
4) Tweak the x11-plugins/desklet-* ebuilds to remove unneeded variables

Please let me know what you think.

Thanks,
Joe

--
[1]
http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/gdesklets.eclass?view=markup
[2] http://dev.gentoo.org/~nixphoeni/gdesklets/eclass/gdesklets-20091101.eclass
# Copyright 2004-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: $

# @ECLASS: gdesklets.eclass
# @MAINTAINER:
# gdesklets@gentoo.org
# @BLURB: Installation functions for Desklets and Controls supported
# by gDesklets
# @DESCRIPTION:
# The gdesklets eclass provides a simple way to create ebuilds for
# globally installing desktop applets ("Desklets") and supporting code
# ("Controls") used in the gDesklets framework (provided by
# gnome-extra/gdesklets-core)
#
# This eclass assumes a package following the instructions at
# http://gdesklets.de/index.php?q=node/2 . Specifically, the package
# should be a Desklet or Control ONLY (and *not* a Sensor). You
# technically could have an ebuild that works around this limitation,
# but no new packages should be added to the tree that do this (mainly
# for ease of maintenance).
#
# Original authors: Joe Sapp <nixphoeni@gentoo.org>
# Mike Gardiner <obz@gentoo.org>

# @ECLASS_VARIABLE: DESKLET_NAME
# @DESCRIPTION:
# *Optional* The name of the Desklet, if the package is one. The
# default is to assume a Desklet with the name being ${PN} without the
# "desklet-" prefix.

# @ECLASS_VARIABLE: CONTROL_NAME
# @DESCRIPTION:
# *Optional* The name of the Control, if the package is one.

# @ECLASS_VARIABLE: DOCS
# @DESCRIPTION:
# Anything (like a README) that should be dodoc'd.

# @ECLASS_VARIABLE: SLOT
# @DESCRIPTION:
# Set only if the package is a Control and it provides a different
# interface (i.e. expands to a different install directory) than a
# previous version.

inherit eutils multilib python

if [[ -n "${CONTROL_NAME}" ]]; then
debug-print "Looking for a Control named "${CONTROL_NAME}""
MY_PN="${CONTROL_NAME}"
SRC_URI="http://gdesklets.de/files/controls/${MY_PN}/${MY_PN}-${PV}.tar.gz"
unset DESKLET_NAME
else # [[ -n "${DESKLET_NAME}" ]]; then
# Assume an unset DESKLET_NAME means the name is ${PN} without
# the "desklet-" prefix
[[ -z "${DESKLET_NAME}" ]] && DESKLET_NAME="${PN#desklet-}"
debug-print "Looking for a Desklet named "${DESKLET_NAME}""
MY_PN="${DESKLET_NAME}"
SRC_URI="http://gdesklets.de/files/desklets/${MY_PN}/${MY_PN}-${PV}.tar.gz"
fi

MY_P="${MY_PN}-${PV}"
S="${WORKDIR}/${MY_PN}"

SLOT="0"
# Ebuild writer shouldn't need to touch these (except maybe RDEPEND)
IUSE=""
RDEPEND=">=gnome-extra/gdesklets-core-0.36.1-r3"

GDESKLETS_INST_DIR="${ROOT:-/}usr/$(get_libdir)/gdesklets"

# @FUNCTION: gdesklets_src_install
# @DESCRIPTION:
# Installs a Desklet or Control depending on which is set of
# CONTROL_NAME or DESKLET_NAME
gdesklets_src_install() {

debug-print-function $FUNCNAME $*

# Disable compilation of included python modules (for Controls)
python_disable_pyc

# Avoid sandbox violations caused by misbehaving packages (bug #128289)
addwrite "${ROOT}/root/.gnome2"

# Both Displays and Controls only need to be readable
insopts -m0744

# Check to see if DISPLAY is set for the
# gdesklets-control-getid script to run without error
[ -z "${DISPLAY}" ] && DISPLAY=""
export DISPLAY

debug-print-section docs_install

# Install some docs if so requested (and then delete them so they
# don't get copied into the installation directory)
[[ -n "${DOCS}" ]] && dodoc ${DOCS} &&
rm -f ${DOCS}
debug-print "Installed and deleted ${DOCS}"
# LICENSE doesn't need to get installed if it exists
find . -name LICENSE -delete

if [[ -n "${DESKLET_NAME}" ]]; then

debug-print-section display_install

# Base installation directory for displays from this desklet
INSDIR="${GDESKLETS_INST_DIR}/Displays/${DESKLET_NAME}"

debug-print "Installing into ${INSDIR}"
debug-print "Exiting Display-specific installation code"

elif [[ -n "${CONTROL_NAME}" ]]; then

debug-print-section control_install

# Unique name for this Control and its interface
CTRL_DIRNAME=$( "${GDESKLETS_INST_DIR}/gdesklets-control-getid" `pwd` )
einfo "Installing Control ${CTRL_DIRNAME}"

# Base installation directory for this Control
INSDIR="${GDESKLETS_INST_DIR}/Controls/${CTRL_DIRNAME}"
debug-print "Installing into ${INSDIR}"

# Mercilessly delete all existing compiled code
find . -iname '*.py[co]' -delete

debug-print "Exiting Control-specific installation code"

else
die "nothing to install, is the ebuild written correctly?"
fi

debug-print-section common_install

# Create the proper subdirectory in the global Controls or
# Displays directory
dodir "${INSDIR}"
insinto "${INSDIR}"
doins -r *

}

# @FUNCTION: gdesklets_pkg_postinst
# @DESCRIPTION:
# Marks the Control for rebuilding on Python version change and
# compiles the Python code or display a useful message to the user,
# depending on which of CONTROL_NAME or DESKLET_NAME is set.
gdesklets_pkg_postinst() {

# The only time compilation of python modules should occur is
# for Controls, since Displays are run from inside the sandbox
# (and therefore can't be compiled).
if [[ -n "${CONTROL_NAME}" ]]; then

CTRL_DIRNAME=$( "${GDESKLETS_INST_DIR}/gdesklets-control-getid" `pwd` )
python_need_rebuild
python_mod_optimize "${GDESKLETS_INST_DIR}/Controls/${CTRL_DIRNAME}"

else

einfo "Each user can now add this desklet to their desktop through the"
einfo "gDesklets shell or the command line (.display files can be"
einfo "found in ${GDESKLETS_INST_DIR}/Displays/${DESKLET_NAME})."

fi

}

EXPORT_FUNCTIONS src_install pkg_postinst
 
Old 12-29-2009, 07:54 AM
Christian Faulhammer
 
Default Major changes to gdesklets.eclass

Hi,

Joe Sapp <nixphoeni@gentoo.org>:
> Anyways, a diff would be useless so I've attached the proposed eclass
> [2].

Looks fine so far. What puzzled me is the documentation of the SLOT
variable. What is the motivation to do so?

* Sometimes you give a default on undefined ROOT variable, sometimes
not. Please make it consistent for cosmetic reasons.
* addwrite "${ROOT}/root/.gnome2": Is this unconditionally necessary?
Or could a "boolean" in the ebuild be set to activate it?
* DISPLAY variable export could be done with the assignment. Or is the
export always needed?
* Is the file name LICENSE always used for the license or is COPYING
for example also possible?
* einfo "Installing Control ${CTRL_DIRNAME}": Is not mirrored in the
desklet branch of the if clause.

V-Li

--
Christian Faulhammer, Gentoo Lisp project
<URL:http://www.gentoo.org/proj/en/lisp/>, #gentoo-lisp on FreeNode

<URL:http://gentoo.faulhammer.org/>
 
Old 01-03-2010, 07:55 PM
Joe Sapp
 
Default Major changes to gdesklets.eclass

Thanks for looking at this Christian.

On 12/29/2009 03:54 AM, Christian Faulhammer wrote:
> Looks fine so far. What puzzled me is the documentation of the SLOT
> variable. What is the motivation to do so?

It would be possible for two different versions of a Control to be installed
and work with gdesklets-core. An id string is calculated based on the
interface to the Control, and this string is used by the Desklet to reference
the Control. So if two versions of a Control have different interfaces,
Desklet "A" could use the older version and Desklet "B" could use the newer
version. The core program would allow it and I'd like to provide the support
for doing this in portage. This is why obz and I originally chose to install
to a directory identified by the Control name and its id string (i.e.
"/usr/lib/gdesklets/Controls/ImageSlideShow_cdu4rwmfeuauyw2wwuaczc3lr-2").

> * Sometimes you give a default on undefined ROOT variable, sometimes
> not. Please make it consistent for cosmetic reasons.

Okay. I guess since the PMS specifies that it "must be non-empty and end in a
trailing slash", I will remove the default on undefined.

> * addwrite "${ROOT}/root/.gnome2": Is this unconditionally necessary?
> Or could a "boolean" in the ebuild be set to activate it?

Unfortunately, it seems to be unconditionally necessary. Bug #128289 [1]
still seems to apply upstream (see comment #18). I have not looked into glib
source code since this issue was originally "fixed" [2].

> * DISPLAY variable export could be done with the assignment. Or is the
> export always needed?

Done. I would like this to go away, but haven't touched the
gdesklets-control-getid script in a long time. The easy way was to export
DISPLAY.

> * Is the file name LICENSE always used for the license or is COPYING
> for example also possible?

I believe it will always be LICENSE if packaged according to upstream [3]. I
believe it is not allowed to be something else in order to be uploaded to the
main site, but as the link is down atm I can't check it.

> * einfo "Installing Control ${CTRL_DIRNAME}": Is not mirrored in the
> desklet branch of the if clause.

True. Originally it was mirrored, but some Desklets in the tree (I'm thinking
of x11-plugins/desklet-ftb right now) contain multiple Desklets (I can't
remember if this is allowed any more with the requirements specified in [3],
but I'm open to suggestions). I thought it was a good compromise to have the
einfo lines in pkg_postinst. The difference between the two is that multiple
Controls cannot be packaged together (both under the new upstream packaging
requirements and for this eclass to work).

Patch to the original revision is attached.

--
Joe

[1] http://bugs.gentoo.org/show_bug.cgi?id=128289#c18
[2] http://bugs.gentoo.org/show_bug.cgi?id=126890
[3] http://gdesklets.de/index.php?q=node/2
--- gdesklets-20091101.eclass 2009-12-16 22:06:05.000000000 -0500
+++ gdesklets-20090103.eclass 2010-01-03 15:52:53.000000000 -0500
@@ -67,7 +67,7 @@
IUSE=""
RDEPEND=">=gnome-extra/gdesklets-core-0.36.1-r3"

-GDESKLETS_INST_DIR="${ROOT:-/}usr/$(get_libdir)/gdesklets"
+GDESKLETS_INST_DIR="${ROOT}usr/$(get_libdir)/gdesklets"

# @FUNCTION: gdesklets_src_install
# @DESCRIPTION:
@@ -88,8 +88,7 @@

# Check to see if DISPLAY is set for the
# gdesklets-control-getid script to run without error
- [ -z "${DISPLAY}" ] && DISPLAY=""
- export DISPLAY
+ [ -z "${DISPLAY}" ] && export DISPLAY=""

debug-print-section docs_install
 
Old 02-08-2010, 07:19 AM
Christian Faulhammer
 
Default Major changes to gdesklets.eclass

Hi,

Joe Sapp <nixphoeni@gentoo.org>:
> Thanks for looking at this Christian.

Sorry for the late reply.

> Patch to the original revision is attached.

I am fine with it.

V-Li

--
Christian Faulhammer, Gentoo Lisp project
<URL:http://www.gentoo.org/proj/en/lisp/>, #gentoo-lisp on FreeNode

<URL:http://gentoo.faulhammer.org/>
 

Thread Tools




All times are GMT. The time now is 02:36 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org