public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] New eclass: xdg-basedir
@ 2014-01-30  3:37 Mike Gilbert
  2014-01-30  8:11 ` [gentoo-dev] " Gilles Dartiguelongue
  2014-01-30 11:48 ` Michael Palimaka
  0 siblings, 2 replies; 11+ messages in thread
From: Mike Gilbert @ 2014-01-30  3:37 UTC (permalink / raw
  To: Gentoo Dev; +Cc: freedesktop-bugs


[-- Attachment #1.1: Type: text/plain, Size: 302 bytes --]

Here's a simple eclass that pretty much just extracts the XDG stuff from
the gnome2_environment_reset function.

One difference: it creates 3 of the 4 directories under ${HOME} instead
of ${T}, just to mimic the default behavior in the XDG basedir spec a
bit more closely.

Please give a look.

[-- Attachment #1.2: xdg-basedir.eclass --]
[-- Type: text/plain, Size: 1040 bytes --]

# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# @ECLASS: xdg-basedir
# @MAINTAINER:
# freedesktop-bugs@gentoo.org
# @BLURB: Set up directories according to the XDG Base Directory Specification.
# @EXAMPLE:
# @CODE
# inherit xdg-basedir
#
# src_prepare() {
# 	xdg-basedir-setup
# }
# @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: xdg-basedir-setup
# @DESCRIPTION:
# Creates sensible locations for the following environment variables:
# XDG_DATA_HOME
# XDG_CONFIG_HOME
# XDG_CACHE_HOME
# XDG_RUNTIME_DIR
xdg-basedir-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
}

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 230 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [gentoo-dev] Re: New eclass: xdg-basedir
  2014-01-30  3:37 [gentoo-dev] New eclass: xdg-basedir Mike Gilbert
@ 2014-01-30  8:11 ` Gilles Dartiguelongue
  2014-01-30  8:24   ` Jonathan Callen
  2014-01-30  8:29   ` Ulrich Mueller
  2014-01-30 11:48 ` Michael Palimaka
  1 sibling, 2 replies; 11+ messages in thread
From: Gilles Dartiguelongue @ 2014-01-30  8:11 UTC (permalink / raw
  To: Gentoo Dev; +Cc: freedesktop-bugs

Le mercredi 29 janvier 2014 à 22:37 -0500, Mike Gilbert a écrit :
> One difference: it creates 3 of the 4 directories under ${HOME}
> instead
> of ${T}, just to mimic the default behavior in the XDG basedir spec a
> bit more closely.

The thing with ${HOME} is that it should not be a directory where XDG
compliants tools should be able to store anything permanent while
building since this would affect consecutive builds (say
gobject-introspection, gstreamer registry, etc).

This is why it is set to ${T} in gnome2-utils.eclass.

-- 
Gilles Dartiguelongue <eva@gentoo.org>
Gentoo



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [gentoo-dev] Re: New eclass: xdg-basedir
  2014-01-30  8:11 ` [gentoo-dev] " Gilles Dartiguelongue
@ 2014-01-30  8:24   ` Jonathan Callen
  2014-01-30  8:29   ` Ulrich Mueller
  1 sibling, 0 replies; 11+ messages in thread
From: Jonathan Callen @ 2014-01-30  8:24 UTC (permalink / raw
  To: Gilles Dartiguelongue, Gentoo Dev; +Cc: freedesktop-bugs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 01/30/2014 03:11 AM, Gilles Dartiguelongue wrote:
> Le mercredi 29 janvier 2014 à 22:37 -0500, Mike Gilbert a écrit :
>> One difference: it creates 3 of the 4 directories under ${HOME} instead of ${T}, just to
>> mimic the default behavior in the XDG basedir spec a bit more closely.
> 
> The thing with ${HOME} is that it should not be a directory where XDG compliants tools should
> be able to store anything permanent while building since this would affect consecutive builds
> (say gobject-introspection, gstreamer registry, etc).
> 
> This is why it is set to ${T} in gnome2-utils.eclass.
> 

I don't know about other package managers, but portage at least sets $HOME to
${PORTAGE_TMPDIR}/portage/${CATEGORY}/${PF}/homedir, so this is a non-issue for portage.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCgAGBQJS6gxWAAoJELHSF2kinlg43+0QAIRQta3FrJCG0rwC8eVN0TrQ
heU/UG5xxBXlnYfSx1KZMH2lasGsZ6d31oycW404muSt7L7gOnpQGAa0upXGMMeq
aC6dKyxj5psb0WQRp4NeNkofPyGzOGlK7LYiEgGdl63yEadWkU+1cTK8HCwNpYEt
iOyDE5o/W05M3iPSkdjetrvADh2w3jK6paVekPWKoeawADalJQ9pjPcNUdiNZSzb
D2L7Td/IAiEOUYt6sQVTs4idExhDc3ndSFNcd8Z/C1/L60EZlJd+CWcP7mReOJkA
pToVXOAACxCRUBR4tUq23BZmBGN7d891SfybLbkAc/UjyS7f1gvCLPq4WLvmE+G/
wVmqbnhilRkfP/ecjaZKDg+l32sf+yNbqth+aD9CvYvIo4wvhbFqxlu3tyut37fn
OdlwWi6vrMIHicem5NBx/u7E7lh/mnUFKGtPBY/jSPlPCGf/D2T9ET4M7PH5UIRQ
fQePKx1GrNvlm5R80qENl/qL72NxX5sEd+fFZ4O6utEnceKQFcLwn6js6HsHetXM
DQsEsiCnex+f204MQ+fFInqNU5Sfk5u207zwLELDiinfms9jSSsa6ovemC7NtmNq
bJZagpdm51Y5oKjJLZhHad3gwc5u1uJnc9vZGOYeoO0tlD0ad3Zq5PRYkxouWTqQ
5YrXNfLdT0tQ/NXngdWe
=JJd7
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [gentoo-dev] Re: New eclass: xdg-basedir
  2014-01-30  8:11 ` [gentoo-dev] " Gilles Dartiguelongue
  2014-01-30  8:24   ` Jonathan Callen
@ 2014-01-30  8:29   ` Ulrich Mueller
  2014-01-30  8:35     ` Gilles Dartiguelongue
  1 sibling, 1 reply; 11+ messages in thread
From: Ulrich Mueller @ 2014-01-30  8:29 UTC (permalink / raw
  To: gentoo-dev; +Cc: freedesktop-bugs

[-- Attachment #1: Type: text/plain, Size: 652 bytes --]

>>>>> On Thu, 30 Jan 2014, Gilles Dartiguelongue wrote:

> The thing with ${HOME} is that it should not be a directory where
> XDG compliants tools should be able to store anything permanent
> while building since this would affect consecutive builds (say
> gobject-introspection, gstreamer registry, etc).

> This is why it is set to ${T} in gnome2-utils.eclass.

HOME is as temporary as T during build time. PMS says: "The full path
to an appropriate temporary directory for use by any programs invoked
by the ebuild that may read or modify the home directory."

With Portage, HOME will point to:
${PORTAGE_TMPDIR}/${CATEGORY}/${PF}/homedir/

Ulrich

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] Re: New eclass: xdg-basedir
  2014-01-30  8:29   ` Ulrich Mueller
@ 2014-01-30  8:35     ` Gilles Dartiguelongue
  0 siblings, 0 replies; 11+ messages in thread
From: Gilles Dartiguelongue @ 2014-01-30  8:35 UTC (permalink / raw
  To: Ulrich Mueller; +Cc: gentoo-dev, freedesktop-bugs

[-- Attachment #1: Type: text/plain, Size: 835 bytes --]

Le jeudi 30 janvier 2014 à 09:29 +0100, Ulrich Mueller a écrit :
> >>>>> On Thu, 30 Jan 2014, Gilles Dartiguelongue wrote:
> 
> > The thing with ${HOME} is that it should not be a directory where
> > XDG compliants tools should be able to store anything permanent
> > while building since this would affect consecutive builds (say
> > gobject-introspection, gstreamer registry, etc).
> 
> > This is why it is set to ${T} in gnome2-utils.eclass.
> 
> HOME is as temporary as T during build time. PMS says: "The full path
> to an appropriate temporary directory for use by any programs invoked
> by the ebuild that may read or modify the home directory."
> 
> With Portage, HOME will point to:
> ${PORTAGE_TMPDIR}/${CATEGORY}/${PF}/homedir/
> 

Very well then.

-- 
Gilles Dartiguelongue <eva@gentoo.org>
Gentoo

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [gentoo-dev] Re: New eclass: xdg-basedir
  2014-01-30  3:37 [gentoo-dev] New eclass: xdg-basedir Mike Gilbert
  2014-01-30  8:11 ` [gentoo-dev] " Gilles Dartiguelongue
@ 2014-01-30 11:48 ` Michael Palimaka
  2014-01-30 13:03   ` Ulrich Mueller
  2014-01-30 17:32   ` [gentoo-dev] Re: New eclass: xdg-basedir Mike Gilbert
  1 sibling, 2 replies; 11+ messages in thread
From: Michael Palimaka @ 2014-01-30 11:48 UTC (permalink / raw
  To: gentoo-dev; +Cc: freedesktop-bugs

On 01/30/2014 02:37 PM, Mike Gilbert wrote:
> Here's a simple eclass that pretty much just extracts the XDG stuff from
> the gnome2_environment_reset function.
> 
> One difference: it creates 3 of the 4 directories under ${HOME} instead
> of ${T}, just to mimic the default behavior in the XDG basedir spec a
> bit more closely.
> 
> Please give a look.
> 

Hi,

Thanks for working on this.

Two thoughts:

1. Would it be worth consolidating this, fdo-mime.eclass, and some other
gnome2-utils stuff (eg. gnome2_icon_cache_update) into a larger
freedesktop eclass?

2. xdg-basedir-setup -> xdg-basedir_setup is more consistent with other
modern eclasses, especially if there are additional functions in the future.

Best regards,
Michael



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [gentoo-dev] Re: New eclass: xdg-basedir
  2014-01-30 11:48 ` Michael Palimaka
@ 2014-01-30 13:03   ` Ulrich Mueller
  2014-01-30 14:45     ` Jeroen Roovers
  2014-01-30 17:32   ` [gentoo-dev] Re: New eclass: xdg-basedir Mike Gilbert
  1 sibling, 1 reply; 11+ messages in thread
From: Ulrich Mueller @ 2014-01-30 13:03 UTC (permalink / raw
  To: gentoo-dev; +Cc: freedesktop-bugs

[-- Attachment #1: Type: text/plain, Size: 631 bytes --]

>>>>> On Thu, 30 Jan 2014, Michael Palimaka wrote:

> 2. xdg-basedir-setup -> xdg-basedir_setup is more consistent with
> other modern eclasses, especially if there are additional functions
> in the future.

It may be little known, but strictly speaking, hyphens in bash
identifiers are illegal:

`name'
     A `word' consisting solely of letters, numbers, and underscores,
     and beginning with a letter or underscore.  `Name's are used as
     shell variable and function names.  Also referred to as an
     `identifier'.

This isn't specific to xdg-basedir though, but a problem that most of
our eclasses suffer from.

Ulrich

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] Re: New eclass: xdg-basedir
  2014-01-30 13:03   ` Ulrich Mueller
@ 2014-01-30 14:45     ` Jeroen Roovers
  2014-01-30 15:44       ` [gentoo-dev] Shell function names (was: New eclass: xdg-basedir) Ulrich Mueller
  0 siblings, 1 reply; 11+ messages in thread
From: Jeroen Roovers @ 2014-01-30 14:45 UTC (permalink / raw
  To: gentoo-dev

On Thu, 30 Jan 2014 14:03:52 +0100
Ulrich Mueller <ulm@gentoo.org> wrote:

> It may be little known, but strictly speaking, hyphens in bash
> identifiers are illegal:
> 
> `name'
>      A `word' consisting solely of letters, numbers, and underscores,
>      and beginning with a letter or underscore.  `Name's are used as
>      shell variable and function names.  Also referred to as an
>      `identifier'.

That looks wrong for all kinds of reasons and it is directly
contradicted in the same document and in the source code.

But we digress... :)


Regards,
     jer


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [gentoo-dev] Shell function names (was: New eclass: xdg-basedir)
  2014-01-30 14:45     ` Jeroen Roovers
@ 2014-01-30 15:44       ` Ulrich Mueller
  0 siblings, 0 replies; 11+ messages in thread
From: Ulrich Mueller @ 2014-01-30 15:44 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 699 bytes --]

>>>>> On Thu, 30 Jan 2014, Jeroen Roovers wrote:

>> It may be little known, but strictly speaking, hyphens in bash
>> identifiers are illegal:
>> 
>> `name' A `word' consisting solely of letters, numbers, and
>> underscores, and beginning with a letter or underscore. `Name's are
>> used as shell variable and function names. Also referred to as an
>> `identifier'.

> That looks wrong for all kinds of reasons and it is directly
> contradicted in the same document and in the source code.

Sure, the implementation is so sloppy that it would even allow
^+-=[*]{@}:,./?%!!!11eleven!! as the name of a function. Which doesn't
imply that we should use such undocumented features in our code.

Ulrich

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] Re: New eclass: xdg-basedir
  2014-01-30 11:48 ` Michael Palimaka
  2014-01-30 13:03   ` Ulrich Mueller
@ 2014-01-30 17:32   ` Mike Gilbert
  2014-01-30 17:45     ` Michael Palimaka
  1 sibling, 1 reply; 11+ messages in thread
From: Mike Gilbert @ 2014-01-30 17:32 UTC (permalink / raw
  To: Gentoo Dev; +Cc: freedesktop-bugs

On Thu, Jan 30, 2014 at 6:48 AM, Michael Palimaka <kensington@gentoo.org> wrote:
> On 01/30/2014 02:37 PM, Mike Gilbert wrote:
>> Here's a simple eclass that pretty much just extracts the XDG stuff from
>> the gnome2_environment_reset function.
>>
>> One difference: it creates 3 of the 4 directories under ${HOME} instead
>> of ${T}, just to mimic the default behavior in the XDG basedir spec a
>> bit more closely.
>>
>> Please give a look.
>>
>
> Hi,
>
> Thanks for working on this.
>
> Two thoughts:
>
> 1. Would it be worth consolidating this, fdo-mime.eclass, and some other
> gnome2-utils stuff (eg. gnome2_icon_cache_update) into a larger
> freedesktop eclass?
>

That sounds like a reasonable idea to me, but I'm not sure I'm the
right person to make that call. I don't maintain many desktop
packages.

If some others chime in saying this would be desirable, I could
certainly work on that. Ideally, I would like the freedesktop
maintainers to agree on any/all functions that should be moved to the
new eclass.

Otherwise, I will stick with the current xdg-basedir eclass and leave
the consolidation work to someone else.

> 2. xdg-basedir-setup -> xdg-basedir_setup is more consistent with other
> modern eclasses, especially if there are additional functions in the future.
>

Personally, I think that looks stupid. ^_^ Not something I'm going to
fight over if it bothers people though.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [gentoo-dev] Re: New eclass: xdg-basedir
  2014-01-30 17:32   ` [gentoo-dev] Re: New eclass: xdg-basedir Mike Gilbert
@ 2014-01-30 17:45     ` Michael Palimaka
  0 siblings, 0 replies; 11+ messages in thread
From: Michael Palimaka @ 2014-01-30 17:45 UTC (permalink / raw
  To: gentoo-dev; +Cc: freedesktop-bugs

On 01/31/2014 04:32 AM, Mike Gilbert wrote:
> On Thu, Jan 30, 2014 at 6:48 AM, Michael Palimaka <kensington@gentoo.org> wrote:
>> On 01/30/2014 02:37 PM, Mike Gilbert wrote:
>>> Here's a simple eclass that pretty much just extracts the XDG stuff from
>>> the gnome2_environment_reset function.
>>>
>>> One difference: it creates 3 of the 4 directories under ${HOME} instead
>>> of ${T}, just to mimic the default behavior in the XDG basedir spec a
>>> bit more closely.
>>>
>>> Please give a look.
>>>
>>
>> Hi,
>>
>> Thanks for working on this.
>>
>> Two thoughts:
>>
>> 1. Would it be worth consolidating this, fdo-mime.eclass, and some other
>> gnome2-utils stuff (eg. gnome2_icon_cache_update) into a larger
>> freedesktop eclass?
>>
> 
> That sounds like a reasonable idea to me, but I'm not sure I'm the
> right person to make that call. I don't maintain many desktop
> packages.
> 
> If some others chime in saying this would be desirable, I could
> certainly work on that. Ideally, I would like the freedesktop
> maintainers to agree on any/all functions that should be moved to the
> new eclass.

Speaking as part of KDE team which is part of freedesktop, I would
specifically like to see:

* xdg-basedir-setup
* fdo-mime_desktop_database_update
* fdo-mime_mime_database_update
* gnome2_icon_savelist
* gnome2_icon_cache_update

I understand the GNOME team had some ideas too (I saw a mail but it
didn't end up on the list here), so hopefully they will chime in as well.



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-01-30 17:46 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-30  3:37 [gentoo-dev] New eclass: xdg-basedir Mike Gilbert
2014-01-30  8:11 ` [gentoo-dev] " Gilles Dartiguelongue
2014-01-30  8:24   ` Jonathan Callen
2014-01-30  8:29   ` Ulrich Mueller
2014-01-30  8:35     ` Gilles Dartiguelongue
2014-01-30 11:48 ` Michael Palimaka
2014-01-30 13:03   ` Ulrich Mueller
2014-01-30 14:45     ` Jeroen Roovers
2014-01-30 15:44       ` [gentoo-dev] Shell function names (was: New eclass: xdg-basedir) Ulrich Mueller
2014-01-30 17:32   ` [gentoo-dev] Re: New eclass: xdg-basedir Mike Gilbert
2014-01-30 17:45     ` Michael Palimaka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox