Re: [gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update

2013-09-11 Thread Gilles Dartiguelongue
Le mardi 10 septembre 2013 à 17:10 +0200, Fabian Groffen a écrit :
 On 10-09-2013 06:22:38 -0400, Ian Stakenvicius wrote:
   pkg_preinst() {
  gnome2_gdk_pixbuf_savelist
   +
   +   # Make sure loaders.cache belongs to gdk-pixbuf alone
   +   local cache=usr/$(get_libdir)/${PN}-2.0/2.10.0/loaders.cache
   +
   +   if [[ -e ${ROOT}${cache} ]]; then
   +   cp ${ROOT}${cache} ${D}/${cache} || die
   +   else
   +   touch ${D}/${cache} || die
   +   fi
   }
   
   pkg_postinst() {
   
  
  
  shouldn't that be EROOT ?
 
 and ED in that case too

Do we still use that in EAPI  3 ?

-- 
Gilles Dartiguelongue e...@gentoo.org
Gentoo




Re: [gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update

2013-09-11 Thread Fabian Groffen
On 11-09-2013 10:51:22 +0200, Gilles Dartiguelongue wrote:
   shouldn't that be EROOT ?
  
  and ED in that case too
 
 Do we still use that in EAPI  3 ?

EROOT = ROOT + EPREFIX
ED = D + EPREFIX

Unless I misunderstand your question, that means yes, we do to me.

Fabian


-- 
Fabian Groffen
Gentoo on a different level


signature.asc
Description: Digital signature


Re: [gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update

2013-09-10 Thread Ian Stakenvicius

On 2013-09-09, at 7:31 PM, Alex Xu alex_y...@yahoo.ca wrote:

 On 09/09/13 08:29 PM, Gilles Dartiguelongue wrote:
 
 Index: gdk-pixbuf-2.28.2.ebuild
 ===
 RCS file: 
 /var/cvsroot/gentoo-x86/x11-libs/gdk-pixbuf/gdk-pixbuf-2.28.2.ebuild,v
 retrieving revision 1.3
 diff -u -B -r1.3 gdk-pixbuf-2.28.2.ebuild
 --- gdk-pixbuf-2.28.2.ebuild3 Sep 2013 21:59:11 -1.3
 +++ gdk-pixbuf-2.28.2.ebuild9 Sep 2013 22:28:20 -
 @@ -67,6 +67,15 @@
  
  pkg_preinst() {
 gnome2_gdk_pixbuf_savelist
 +
 +# Make sure loaders.cache belongs to gdk-pixbuf alone
 +local 
 cache=usr/$(get_libdir)/${PN}-2.0/2.10.0/loaders.cache
 +
 +if [[ -e ${ROOT}${cache} ]]; then
 +cp ${ROOT}${cache} ${D}/${cache} || die
 +else
 +touch ${D}/${cache} || die
 +fi
  }
  
  pkg_postinst() {
 
 Index: gdk-pixbuf-2.28.2.ebuild
 ===
 RCS file:
 /var/cvsroot/gentoo-x86/x11-libs/gdk-pixbuf/gdk-pixbuf-2.28.2.ebuild,v
 retrieving revision 1.3
 diff -u -B -r1.3 gdk-pixbuf-2.28.2.ebuild
 --- gdk-pixbuf-2.28.2.ebuild3 Sep 2013 21:59:11 -   1.3
 +++ gdk-pixbuf-2.28.2.ebuild9 Sep 2013 22:28:20 -
 @@ -67,6 +67,15 @@
 
 pkg_preinst() {
gnome2_gdk_pixbuf_savelist
 +
 +   # Make sure loaders.cache belongs to gdk-pixbuf alone
 +   local cache=usr/$(get_libdir)/${PN}-2.0/2.10.0/loaders.cache
 +
 +   if [[ -e ${ROOT}${cache} ]]; then
 +   cp ${ROOT}${cache} ${D}/${cache} || die
 +   else
 +   touch ${D}/${cache} || die
 +   fi
 }
 
 pkg_postinst() {
 


shouldn't that be EROOT ?


Re: [gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update

2013-09-10 Thread Fabian Groffen
On 10-09-2013 06:22:38 -0400, Ian Stakenvicius wrote:
  pkg_preinst() {
 gnome2_gdk_pixbuf_savelist
  +
  +   # Make sure loaders.cache belongs to gdk-pixbuf alone
  +   local cache=usr/$(get_libdir)/${PN}-2.0/2.10.0/loaders.cache
  +
  +   if [[ -e ${ROOT}${cache} ]]; then
  +   cp ${ROOT}${cache} ${D}/${cache} || die
  +   else
  +   touch ${D}/${cache} || die
  +   fi
  }
  
  pkg_postinst() {
  
 
 
 shouldn't that be EROOT ?

and ED in that case too


-- 
Fabian Groffen
Gentoo on a different level



Re: [gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update

2013-09-09 Thread Gilles Dartiguelongue
As a follow up to this discussion, I came with the attached patch. It
appears to work ok for regular merges and binpkg merges with
FEATURES=collision-protect.

Per my reading of PMS it does not appear to violate anything so I guess
it is ok.

-- 
Gilles Dartiguelongue e...@gentoo.org
Gentoo
Index: gdk-pixbuf-2.28.2.ebuild
===
RCS file: /var/cvsroot/gentoo-x86/x11-libs/gdk-pixbuf/gdk-pixbuf-2.28.2.ebuild,v
retrieving revision 1.3
diff -u -B -r1.3 gdk-pixbuf-2.28.2.ebuild
--- gdk-pixbuf-2.28.2.ebuild	3 Sep 2013 21:59:11 -	1.3
+++ gdk-pixbuf-2.28.2.ebuild	9 Sep 2013 22:28:20 -
@@ -67,6 +67,15 @@
 
 pkg_preinst() {
 	gnome2_gdk_pixbuf_savelist
+
+	# Make sure loaders.cache belongs to gdk-pixbuf alone
+	local cache=usr/$(get_libdir)/${PN}-2.0/2.10.0/loaders.cache
+
+	if [[ -e ${ROOT}${cache} ]]; then
+		cp ${ROOT}${cache} ${D}/${cache} || die
+	else
+		touch ${D}/${cache} || die
+	fi
 }
 
 pkg_postinst() {


Re: [gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update

2013-09-09 Thread hasufell
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 09/10/2013 02:29 AM, Gilles Dartiguelongue wrote:
 As a follow up to this discussion, I came with the attached patch.
 It appears to work ok for regular merges and binpkg merges with 
 FEATURES=collision-protect.
 
 Per my reading of PMS it does not appear to violate anything so I
 guess it is ok.
 

unreadable diff
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.20 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJSLldDAAoJEFpvPKfnPDWzAlEIAKieKaMfao/xpimPOWShEZZW
AedAHki/r5b4IsZBYeE3m971SBWXMYvL4W7KAGPiLHeUzKXzN6wYLLx5Bru/uWnP
Gh7WYYnCq93Z9VnPXeeUd6Cau7cNSdcMEfjE4BRA06aNu2KSdXV3rC5PTTVM5KX0
VJ9BgjzvCs9YDzv2pmsBthoVAZv4zqrpDXLJJD6yzCyFQN/rHntnzij3aYUEAGVu
99axU7nWUrbBFOQ4C+J0ANSS1gkd+rmFudWnQ9pBpzPpPD4aQUwLTFc6+bf3Beho
jeD8TVAkUqr5OcuF278E0Rg0nqN/rvi8wglbO6855NTYi1SdNRJncujzOmc2gNI=
=DDxq
-END PGP SIGNATURE-



Re: [gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update

2013-09-09 Thread Alex Xu
On 09/09/13 08:29 PM, Gilles Dartiguelongue wrote:
 
 Index: gdk-pixbuf-2.28.2.ebuild
 ===
 RCS file: 
 /var/cvsroot/gentoo-x86/x11-libs/gdk-pixbuf/gdk-pixbuf-2.28.2.ebuild,v
 retrieving revision 1.3
 diff -u -B -r1.3 gdk-pixbuf-2.28.2.ebuild
 --- gdk-pixbuf-2.28.2.ebuild   3 Sep 2013 21:59:11 -   
 1.3
 +++ gdk-pixbuf-2.28.2.ebuild   9 Sep 2013 22:28:20 -
 @@ -67,6 +67,15 @@
  
  pkg_preinst() {
 gnome2_gdk_pixbuf_savelist
 +
 +  # Make sure loaders.cache belongs to gdk-pixbuf alone
 +  local 
 cache=usr/$(get_libdir)/${PN}-2.0/2.10.0/loaders.cache
 +
 +  if [[ -e ${ROOT}${cache} ]]; then
 +  cp ${ROOT}${cache} ${D}/${cache} || die
 +  else
 +  touch ${D}/${cache} || die
 +  fi
  }
  
  pkg_postinst() {

Index: gdk-pixbuf-2.28.2.ebuild
===
RCS file:
/var/cvsroot/gentoo-x86/x11-libs/gdk-pixbuf/gdk-pixbuf-2.28.2.ebuild,v
retrieving revision 1.3
diff -u -B -r1.3 gdk-pixbuf-2.28.2.ebuild
--- gdk-pixbuf-2.28.2.ebuild3 Sep 2013 21:59:11 -   1.3
+++ gdk-pixbuf-2.28.2.ebuild9 Sep 2013 22:28:20 -
@@ -67,6 +67,15 @@

 pkg_preinst() {
gnome2_gdk_pixbuf_savelist
+
+   # Make sure loaders.cache belongs to gdk-pixbuf alone
+   local cache=usr/$(get_libdir)/${PN}-2.0/2.10.0/loaders.cache
+
+   if [[ -e ${ROOT}${cache} ]]; then
+   cp ${ROOT}${cache} ${D}/${cache} || die
+   else
+   touch ${D}/${cache} || die
+   fi
 }

 pkg_postinst() {



signature.asc
Description: OpenPGP digital signature


Re: [gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update

2013-09-04 Thread Gilles Dartiguelongue
One last point to handle, how to migrate gdk-pixbuf.cache so that it is
owned by the ebuild ?

I've discussed this with Michał and it seems two options are possible.

1. rm the file on the filesystem in pkg_preinst in gdk-pixbuf ebuild
pros:
  - works immediately without fiddling with profiles (see 2)
cons:
  - no idea what PMS says about it, Michał told me it shouldn't work yet
my testing proves otherwise.
  - leaves the system with no loaders.cache for a while which could
result in apps starting with no lots of missing icons.

2. use COLLISION_IGNORE in profiles/base/make.conf
pros:
  - does not leave the system without the cache file
cons:
  - add a setting to base/make.conf for a long period of time to ensure
most of our user have migrated (how long would it be btw, 6 months, 1
year ?)
  - does not protect other packages from owning the package due to this
very solution for the time the setting is left in base/make.conf

3. write a news item and let users handle it


Is there any other solution or is there any other point that would move
the balance from one solution to another ?

This solution would also be applied to a couple of other commonly
regenerated files in Gnome ebuilds, like gtk-icon-cache, etc.

-- 
Gilles Dartiguelongue e...@gentoo.org
Gentoo




Re: [gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update

2013-09-04 Thread Michał Górny
Dnia 2013-09-04, o godz. 20:57:41
Gilles Dartiguelongue e...@gentoo.org napisał(a):

 One last point to handle, how to migrate gdk-pixbuf.cache so that it is
 owned by the ebuild ?
 
 I've discussed this with Michał and it seems two options are possible.
 
 1. rm the file on the filesystem in pkg_preinst in gdk-pixbuf ebuild
 pros:
   - works immediately without fiddling with profiles (see 2)

Except when it doesn't ;).

 cons:
   - no idea what PMS says about it, Michał told me it shouldn't work yet
 my testing proves otherwise.

PMS doesn't cover collision-protect at all. It's purely portage
feature, and at the time I played with twisted portage still complained
before pkg_preinst().

 2. use COLLISION_IGNORE in profiles/base/make.conf
 pros:
   - does not leave the system without the cache file
 cons:
   - add a setting to base/make.conf for a long period of time to ensure
 most of our user have migrated (how long would it be btw, 6 months, 1
 year ?)
   - does not protect other packages from owning the package due to this
 very solution for the time the setting is left in base/make.conf

That's where you convince Zac to accept my patch that applies
COLLISION_IGNORE only to unowned files.

-- 
Best regards,
Michał Górny


signature.asc
Description: PGP signature


Re: [gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update

2013-09-04 Thread Zac Medico
On 09/04/2013 12:44 PM, Gilles Dartiguelongue wrote:
 Le mercredi 04 septembre 2013 à 15:23 -0400, Ian Stakenvicius a écrit :
 If you want to do that *and* maintain whatever is currently in that
 file, you can use the trick sys-apps/openrc used to do:  in
 pkg_preinst, copy the system file (if it exists) into ${D}, and then
 let that same copy be merged back into the system.  Openrc did it to
 get around CONFIG_PROTECT, but it had the unfortunate side effect of
 making the package own the file.  I don't know if removal will be
 affected by this though if the contents of the file change after the
 ebuild owning it was merged?
 
 That sounds like a good idea, I guess it does not cause a
 collision-protect error because the file is added to ${D} after
 comparison between ${D} and live file-system ? 

Right. The collision check happens _before_ pkg_preinst, so it's
possible to create a file in ${D} during pkg_preinst in order to fool
collision-protect.
-- 
Thanks,
Zac



Re: [gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update

2013-09-04 Thread Gilles Dartiguelongue
Le mercredi 04 septembre 2013 à 15:48 -0400, Ian Stakenvicius a écrit :
 On 04/09/13 03:44 PM, Gilles Dartiguelongue wrote:
  Le mercredi 04 septembre 2013 à 15:23 -0400, Ian Stakenvicius a
  écrit : [snip]
  
  By gdk-pixbuf.cache , you mean the 'loaders.cache' file that the 
  eclass is now continuously updating?  Which ebuild is going to
  'own' it?
  
  yes, gdk-pixbuf is going to own it since it is the main loader
  provider and the package that provides the tool to generate the
  cache.
  
  Also, is it owned by anything right now?  IIRC we don't try 
  particularly hard to support FEATURES=collision-protect in the
  tree, but rather FEATURES=protect-owned, and so if the file is
  currently sitting there unowned by any package, afaik you
  shouldn't get any collisions by installing over it.
  
  it is not owned by any package right now but touching the file in 
  src_install made collision-protect abort the install.
 
 You had FEATURES=collision-protect enabled  or the default
 FEATURES=protect-owned ?

the default, but since I only touched the file, maybe it's
FEATURES=config-protect-if-modified kicking in ?

-- 
Gilles Dartiguelongue e...@gentoo.org
Gentoo


signature.asc
Description: This is a digitally signed message part


Re: [gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update

2013-09-04 Thread Ian Stakenvicius
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

On 04/09/13 04:19 PM, Gilles Dartiguelongue wrote:
 Le mercredi 04 septembre 2013 à 15:48 -0400, Ian Stakenvicius a
 écrit :
 
 You had FEATURES=collision-protect enabled  or the default 
 FEATURES=protect-owned ?
 
 the default, but since I only touched the file, maybe it's 
 FEATURES=config-protect-if-modified kicking in ?
 

Is the file stored in a CONFIG_PROTECT area?  If that's the case you
have much bigger headaches to deal with, i expect.


-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.20 (GNU/Linux)

iF4EAREIAAYFAlInlkgACgkQ2ugaI38ACPBlzAD/dzO8Nnd3XHVWnUh2kIE4ynF2
adAUNJcMBdghsHoM4MgA/RFRig4N9fExncCI782eUPdMfVNwKM0oVxo7zIuDgGmy
=UaH3
-END PGP SIGNATURE-



Re: [gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update

2013-09-04 Thread Ian Stakenvicius
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

On 04/09/13 03:48 PM, Ian Stakenvicius wrote:

 No, it still does collide that first time if 
 FEATURES=collision-protect is enabled.  In fact, I do not
 believe there is (by design) any way for this ebuild to 'take
 ownership' of a file it doesn't already own without user
 intervention, if FEATURES=collision-protect is enabled.
 

that is, the COLLISION_IGNORE option in the profile is the only way to
do this.
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.20 (GNU/Linux)

iF4EAREIAAYFAlInjs4ACgkQ2ugaI38ACPD3GwEAhRAvZRTLrDgP2q8rr2gkAPPA
j4px+1xgBjsmDVa1JzoBAJsxHUPRnorS2Je76ulN9G1y5q89MoiB+PzzYFw1ibh/
=isxn
-END PGP SIGNATURE-



Re: [gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update

2013-09-01 Thread Gilles Dartiguelongue

Le samedi 31 août 2013 à 18:44 +0200, Gilles Dartiguelongue a écrit :
 Le samedi 31 août 2013 à 16:49 +0200, Michał Górny a écrit :
  Dnia 2013-08-31, o godz. 15:00:43
  Gilles Dartiguelongue e...@gentoo.org napisał(a):
  
   Le samedi 31 août 2013 à 13:40 +0200, Michał Górny a écrit :
 + cat ${tmp_file}  
 ${EROOT}usr/$(get_libdir)/gdk-pixbuf-2.0/2.10.0/loaders.cache

Why not mv or cp? Also you need '|| die' here since 'cat' can fail
writing.

Thanks for pacho's bugzillafu, we've got the original reports here:

https://bugs.gentoo.org/show_bug.cgi?id=413529
https://bugs.gentoo.org/show_bug.cgi?id=413485

It seems the cat usage was only to avoid handling file permission
issues.

The use of a temporary file itself it to avoid having a corrupted file
if the command fails.

As for immodules I plan to provide patches to fix it after we agree on
this one.

-- 
Gilles Dartiguelongue e...@gentoo.org
Gentoo

-- 
Gilles Dartiguelongue e...@gentoo.org
Gentoo


signature.asc
Description: This is a digitally signed message part


Re: [gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update

2013-09-01 Thread Michał Górny
Dnia 2013-09-01, o godz. 13:29:27
Gilles Dartiguelongue e...@gentoo.org napisał(a):

 
 Le samedi 31 août 2013 à 18:44 +0200, Gilles Dartiguelongue a écrit :
  Le samedi 31 août 2013 à 16:49 +0200, Michał Górny a écrit :
   Dnia 2013-08-31, o godz. 15:00:43
   Gilles Dartiguelongue e...@gentoo.org napisał(a):
   
Le samedi 31 août 2013 à 13:40 +0200, Michał Górny a écrit :
  +   cat ${tmp_file}  
  ${EROOT}usr/$(get_libdir)/gdk-pixbuf-2.0/2.10.0/loaders.cache
 
 Why not mv or cp? Also you need '|| die' here since 'cat' can fail
 writing.
 
 Thanks for pacho's bugzillafu, we've got the original reports here:
 
 https://bugs.gentoo.org/show_bug.cgi?id=413529
 https://bugs.gentoo.org/show_bug.cgi?id=413485
 
 It seems the cat usage was only to avoid handling file permission
 issues.

Then I guess using 'chmod' on the temporary file + 'mv' afterwards.

-- 
Best regards,
Michał Górny


signature.asc
Description: PGP signature


Re: [gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update

2013-09-01 Thread Gilles Dartiguelongue
Updated diffs + gdk-pixbuf handling.

Tested with success locally.

-- 
Gilles Dartiguelongue e...@gentoo.org
Gentoo
Index: gnome2.eclass
===
RCS file: /var/cvsroot/gentoo-x86/eclass/gnome2.eclass,v
retrieving revision 1.122
diff -u -B -r1.122 gnome2.eclass
--- gnome2.eclass	26 May 2013 14:08:21 -	1.122
+++ gnome2.eclass	1 Sep 2013 15:04:58 -
@@ -258,6 +258,7 @@
 	gnome2_icon_savelist
 	gnome2_schemas_savelist
 	gnome2_scrollkeeper_savelist
+	gnome2_gdk_pixbuf_savelist
 }
 
 # @FUNCTION: gnome2_pkg_postinst
@@ -271,6 +272,7 @@
 	gnome2_icon_cache_update
 	gnome2_schemas_update
 	gnome2_scrollkeeper_update
+	gnome2_gdk_pixbuf_update
 }
 
 # # FIXME Handle GConf schemas removal
Index: gnome2-utils.eclass
===
RCS file: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v
retrieving revision 1.31
diff -u -B -r1.31 gnome2-utils.eclass
--- gnome2-utils.eclass	27 Oct 2012 22:24:10 -	1.31
+++ gnome2-utils.eclass	1 Sep 2013 15:04:58 -
@@ -15,6 +15,8 @@
 #  * GConf schemas management
 #  * scrollkeeper (old Gnome help system) management
 
+inherit multilib
+
 case ${EAPI:-0} in
 	0|1|2|3|4|5) ;;
 	*) die EAPI=${EAPI} is not supported ;;
@@ -50,6 +52,12 @@
 # Path to glib-compile-schemas
 : ${GLIB_COMPILE_SCHEMAS:=/usr/bin/glib-compile-schemas}
 
+# @ECLASS-VARIABLE: GDK_PIXBUF_UPDATE_BIN
+# @INTERNAL
+# @DESCRIPTION:
+# Path to gdk-pixbuf-query-loaders
+: ${GDK_PIXBUF_UPDATE_BIN:=/usr/bin/gdk-pixbuf-query-loaders}
+
 # @ECLASS-VARIABLE: GNOME2_ECLASS_SCHEMAS
 # @INTERNAL
 # @DEFAULT_UNSET
@@ -74,6 +82,12 @@
 # @DESCRIPTION:
 # List of GSettings schemas provided by the package
 
+# @ECLASS-VARIABLE: GNOME2_ECLASS_GDK_PIXBUF_LOADERS
+# @INTERNAL
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# List of gdk-pixbuf loaders provided by the package
+
 DEPEND==sys-apps/sed-4
 
 
@@ -387,6 +401,46 @@
 	eend $?
 }
 
+# @FUNCTION: gnome2_gdk_pixbuf_savelist
+# @DESCRIPTION:
+# Find if there is any gdk-pixbuf loader to install and save the list in
+# GNOME2_ECLASS_GDK_PIXBUF_LOADERS variable.
+# This function should be called from pkg_preinst.
+gnome2_gdk_pixbuf_savelist() {
+	has ${EAPI:-0} 0 1 2  ! use prefix  ED=${D}
+	pushd ${ED} 1/dev/null
+	export GNOME2_ECLASS_GDK_PIXBUF_LOADERS=$(find usr/$(get_libdir)/gdk-pixbuf-2.0 -type f 2/dev/null)
+	popd 1/dev/null
+}
+
+# @FUNCTION: gnome2_gdk_pixbuf_update
+# @USAGE: gnome2_gdk_pixbuf_update
+# @DESCRIPTION:
+# Updates gdk-pixbuf loader cache if GNOME2_ECLASS_GDK_PIXBUF_LOADERS has some.
+# This function should be called from pkg_postinst and pkg_postrm.
+gnome2_gdk_pixbuf_update() {
+	has ${EAPI:-0} 0 1 2  ! use prefix  EROOT=${ROOT}
+	local updater=${EROOT}${GDK_PIXBUF_UPDATE_BIN}
+
+	if [[ ! -x ${updater} ]]; then
+		debug-print ${updater} is not executable
+		return
+	fi
+
+	if [[ -z ${GNOME2_ECLASS_GDK_PIXBUF_LOADERS} ]]; then
+		debug-print gdk-pixbuf loader cache does not need an update
+		return
+	fi
+
+	ebegin Updating gdk-pixbuf loader cache
+	local tmp_file=$(mktemp -t tmp.XX_gdkpixbuf)
+	${updater} 1 ${tmp_file} 
+	chmod 0644 ${tmp_file} 
+	mv -f ${tmp_file} ${EROOT}usr/$(get_libdir)/gdk-pixbuf-2.0/2.10.0/loaders.cache
+	eend $?
+}
+
+
 # @FUNCTION: gnome2_query_immodules_gtk2
 # @USAGE: gnome2_query_immodules_gtk2
 # @DESCRIPTION:
Index: gdk-pixbuf-2.28.2.ebuild
===
RCS file: /var/cvsroot/gentoo-x86/x11-libs/gdk-pixbuf/gdk-pixbuf-2.28.2.ebuild,v
retrieving revision 1.2
diff -u -B -r1.2 gdk-pixbuf-2.28.2.ebuild
--- gdk-pixbuf-2.28.2.ebuild	5 Aug 2013 09:48:12 -	1.2
+++ gdk-pixbuf-2.28.2.ebuild	1 Sep 2013 15:09:12 -
@@ -3,7 +3,8 @@
 # $Header: /var/cvsroot/gentoo-x86/x11-libs/gdk-pixbuf/gdk-pixbuf-2.28.2.ebuild,v 1.2 2013/08/05 09:48:12 ssuominen Exp $
 
 EAPI=5
-inherit gnome.org multilib libtool
+
+inherit gnome.org gnome2-utils multilib libtool
 
 DESCRIPTION=Image loading library for GTK+
 HOMEPAGE=http://www.gtk.org/;
@@ -64,19 +65,15 @@
 	prune_libtool_files --modules
 }
 
+pkg_preinst() {
+	gnome2_gdk_pixbuf_savelist
+}
+
 pkg_postinst() {
 	# causes segfault if set, see bug 375615
 	unset __GL_NO_DSO_FINALIZER
 
-	tmp_file=$(mktemp -t tmp_gdk_pixbuf_ebuild.XX)
-	# be atomic!
-	gdk-pixbuf-query-loaders  ${tmp_file}
-	if [ ${?} = 0 ]; then
-		cat ${tmp_file}  ${EROOT}usr/$(get_libdir)/gdk-pixbuf-2.0/2.10.0/loaders.cache
-	else
-		ewarn Cannot update loaders.cache, gdk-pixbuf-query-loaders failed to run
-	fi
-	rm ${tmp_file}
+	gnome2_gdk_pixbuf_update
 
 	# FIXME: use subslots to get rebuilds when really needed
 	# Every major version bump???
@@ -86,3 +83,9 @@
 		elog emerge -va1 \$(qfile -qC ${EPREFIX}/usr/lib/gtk-2.0/2.*/loaders)
 	fi
 }
+
+pkg_postrm() {
+	if [[ -z ${REPLACED_BY_VERSIONS} ]]; then
+		rm -f ${EROOT}usr/$(get_libdir)/${PN}-2.0/2.10.0/loaders.cache
+	fi
+}


[gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update

2013-08-31 Thread Gilles Dartiguelongue
As described here:

https://bugs.gentoo.org/show_bug.cgi?id=483128

This is a very lightweight patch to support the few packages that
provide gdk pixbuf loaders. The ones I know of are: gdk-pixbuf itself,
librsvg and libopenraw and emul-gtklibs but more could be missing simply
because they do not run the command.

Since this patch is quite trivial, I'd like to have it commited by
Sunday. Thanks.

I am attaching the patch here as well for convience.

-- 
Gilles Dartiguelongue e...@gentoo.org
Gentoo
Index: gnome2.eclass
===
RCS file: /var/cvsroot/gentoo-x86/eclass/gnome2.eclass,v
retrieving revision 1.122
diff -u -B -r1.122 gnome2.eclass
--- gnome2.eclass	26 May 2013 14:08:21 -	1.122
+++ gnome2.eclass	31 Aug 2013 10:56:58 -
@@ -258,6 +258,7 @@
 	gnome2_icon_savelist
 	gnome2_schemas_savelist
 	gnome2_scrollkeeper_savelist
+	gnome2_gdk_pixbuf_savelist
 }
 
 # @FUNCTION: gnome2_pkg_postinst
@@ -271,6 +272,7 @@
 	gnome2_icon_cache_update
 	gnome2_schemas_update
 	gnome2_scrollkeeper_update
+	gnome2_gdk_pixbuf_update
 }
 
 # # FIXME Handle GConf schemas removal
Index: gnome2-utils.eclass
===
RCS file: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v
retrieving revision 1.31
diff -u -B -r1.31 gnome2-utils.eclass
--- gnome2-utils.eclass	27 Oct 2012 22:24:10 -	1.31
+++ gnome2-utils.eclass	31 Aug 2013 10:56:58 -
@@ -50,6 +50,12 @@
 # Path to glib-compile-schemas
 : ${GLIB_COMPILE_SCHEMAS:=/usr/bin/glib-compile-schemas}
 
+# @ECLASS-VARIABLE: GDK_PIXBUF_UPDATE_BIN
+# @INTERNAL
+# @DESCRIPTION:
+# Path to gdk-pixbuf-query-loaders
+: ${GDK_PIXBUF_UPDATE_BIN:=/usr/bin/gdk-pixbuf-query-loaders}
+
 # @ECLASS-VARIABLE: GNOME2_ECLASS_SCHEMAS
 # @INTERNAL
 # @DEFAULT_UNSET
@@ -74,6 +80,12 @@
 # @DESCRIPTION:
 # List of GSettings schemas provided by the package
 
+# @ECLASS-VARIABLE: GNOME2_ECLASS_GDK_PIXBUF_LOADERS
+# @INTERNAL
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# List of gdk-pixbuf loaders provided by the package
+
 DEPEND==sys-apps/sed-4
 
 
@@ -387,6 +399,45 @@
 	eend $?
 }
 
+# @FUNCTION: gnome2_gdk_pixbuf_savelist
+# @DESCRIPTION:
+# Find if there is any gdk-pixbuf loader to install and save the list in
+# GNOME2_ECLASS_GDK_PIXBUF_LOADERS variable.
+# This function should be called from pkg_preinst.
+gnome2_gdk_pixbuf_savelist() {
+	has ${EAPI:-0} 0 1 2  ! use prefix  ED=${D}
+	pushd ${ED} /dev/null
+	export GNOME2_ECLASS_GDK_PIXBUF_LOADERS=$(find usr/$(get_libdir)/gdk-pixbuf-2.0 -type f 2/dev/null)
+	popd /dev/null
+}
+
+# @FUNCTION: gnome2_gdk_pixbuf_update
+# @USAGE: gnome2_gdk_pixbuf_update
+# @DESCRIPTION:
+# Updates gdk-pixbuf loader cache if GNOME2_ECLASS_GDK_PIXBUF_LOADERS has some.
+# This function should be called from pkg_postinst and pkg_postrm.
+gnome2_gdk_pixbuf_update() {
+	has ${EAPI:-0} 0 1 2  ! use prefix  EROOT=${ROOT}
+	local updater=${EROOT}${GDK_PIXBUF_UPDATE_BIN}
+
+	if [[ ! -x ${updater} ]]; then
+		debug-print ${updater} is not executable
+		return
+	fi
+
+	if [[ -z ${GNOME2_ECLASS_GDK_PIXBUF_LOADERS} ]]; then
+		debug-print gdk-pixbuf loader cache does not need an update
+		return
+	fi
+
+	ebegin Updating gdk-pixbuf loader cache
+	local tmp_file=$(mktemp -t tmp.XX_gdkpixbuf)
+	${updater} 1 ${tmp_file} 2/dev/null 
+	cat ${tmp_file}  ${EROOT}usr/$(get_libdir)/gdk-pixbuf-2.0/2.10.0/loaders.cache
+	eend $?
+}
+
+
 # @FUNCTION: gnome2_query_immodules_gtk2
 # @USAGE: gnome2_query_immodules_gtk2
 # @DESCRIPTION:


Re: [gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update

2013-08-31 Thread Michał Górny
Dnia 2013-08-31, o godz. 13:07:41
Gilles Dartiguelongue e...@gentoo.org napisał(a):

 +# @FUNCTION: gnome2_gdk_pixbuf_savelist
 +# @DESCRIPTION:
 +# Find if there is any gdk-pixbuf loader to install and save the list in
 +# GNOME2_ECLASS_GDK_PIXBUF_LOADERS variable.
 +# This function should be called from pkg_preinst.
 +gnome2_gdk_pixbuf_savelist() {
 + has ${EAPI:-0} 0 1 2  ! use prefix  ED=${D}
 + pushd ${ED} /dev/null

pushd ${ED} /dev/null || die

(don't hide errors)

 + export GNOME2_ECLASS_GDK_PIXBUF_LOADERS=$(find 
 usr/$(get_libdir)/gdk-pixbuf-2.0 -type f 2/dev/null)
 + popd /dev/null
 +}
 +
 +# @FUNCTION: gnome2_gdk_pixbuf_update
 +# @USAGE: gnome2_gdk_pixbuf_update
 +# @DESCRIPTION:
 +# Updates gdk-pixbuf loader cache if GNOME2_ECLASS_GDK_PIXBUF_LOADERS has 
 some.
 +# This function should be called from pkg_postinst and pkg_postrm.
 +gnome2_gdk_pixbuf_update() {
 + has ${EAPI:-0} 0 1 2  ! use prefix  EROOT=${ROOT}
 + local updater=${EROOT}${GDK_PIXBUF_UPDATE_BIN}
 +
 + if [[ ! -x ${updater} ]]; then
 + debug-print ${updater} is not executable
 + return
 + fi
 +
 + if [[ -z ${GNOME2_ECLASS_GDK_PIXBUF_LOADERS} ]]; then
 + debug-print gdk-pixbuf loader cache does not need an update
 + return
 + fi
 +
 + ebegin Updating gdk-pixbuf loader cache
 + local tmp_file=$(mktemp -t tmp.XX_gdkpixbuf)
 + ${updater} 1 ${tmp_file} 2/dev/null 

Why do you hide errors from user? '[FAIL]' with no explanation doesn't
seem really helpeful.

 + cat ${tmp_file}  
 ${EROOT}usr/$(get_libdir)/gdk-pixbuf-2.0/2.10.0/loaders.cache

Why not mv or cp? Also you need '|| die' here since 'cat' can fail
writing.

Is it safe to assume constant '2.10.0'?

 + eend $?
 +}
 +
 +
  # @FUNCTION: gnome2_query_immodules_gtk2
  # @USAGE: gnome2_query_immodules_gtk2
  # @DESCRIPTION:

Also, please make 'loaders.cache' owned by x11-libs/gdk-pixbuf.
And please ensure to remove it in pkg_postrm() when last version
of gdk-pixbuf is unmerged.

-- 
Best regards,
Michał Górny


signature.asc
Description: PGP signature


Re: [gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update

2013-08-31 Thread Gilles Dartiguelongue
Le samedi 31 août 2013 à 13:40 +0200, Michał Górny a écrit :
 Dnia 2013-08-31, o godz. 13:07:41
 Gilles Dartiguelongue e...@gentoo.org napisał(a):
 
  +# @FUNCTION: gnome2_gdk_pixbuf_savelist
  +# @DESCRIPTION:
  +# Find if there is any gdk-pixbuf loader to install and save the list in
  +# GNOME2_ECLASS_GDK_PIXBUF_LOADERS variable.
  +# This function should be called from pkg_preinst.
  +gnome2_gdk_pixbuf_savelist() {
  +   has ${EAPI:-0} 0 1 2  ! use prefix  ED=${D}
  +   pushd ${ED} /dev/null
 
 pushd ${ED} /dev/null || die
 
 (don't hide errors)

ok, I'll check all other usage in gnome eclasses.

  +   export GNOME2_ECLASS_GDK_PIXBUF_LOADERS=$(find 
  usr/$(get_libdir)/gdk-pixbuf-2.0 -type f 2/dev/null)
  +   popd /dev/null
  +}
  +
  +# @FUNCTION: gnome2_gdk_pixbuf_update
  +# @USAGE: gnome2_gdk_pixbuf_update
  +# @DESCRIPTION:
  +# Updates gdk-pixbuf loader cache if GNOME2_ECLASS_GDK_PIXBUF_LOADERS has 
  some.
  +# This function should be called from pkg_postinst and pkg_postrm.
  +gnome2_gdk_pixbuf_update() {
  +   has ${EAPI:-0} 0 1 2  ! use prefix  EROOT=${ROOT}
  +   local updater=${EROOT}${GDK_PIXBUF_UPDATE_BIN}
  +
  +   if [[ ! -x ${updater} ]]; then
  +   debug-print ${updater} is not executable
  +   return
  +   fi
  +
  +   if [[ -z ${GNOME2_ECLASS_GDK_PIXBUF_LOADERS} ]]; then
  +   debug-print gdk-pixbuf loader cache does not need an update
  +   return
  +   fi
  +
  +   ebegin Updating gdk-pixbuf loader cache
  +   local tmp_file=$(mktemp -t tmp.XX_gdkpixbuf)
  +   ${updater} 1 ${tmp_file} 2/dev/null 
 
 Why do you hide errors from user? '[FAIL]' with no explanation doesn't
 seem really helpeful.

True.

  +   cat ${tmp_file}  
  ${EROOT}usr/$(get_libdir)/gdk-pixbuf-2.0/2.10.0/loaders.cache
 
 Why not mv or cp? Also you need '|| die' here since 'cat' can fail
 writing.

I'd have to look back at the original bug report to get the exact reason
but it seems mv/cp was not atomic enough.

 Is it safe to assume constant '2.10.0'?

afaik yes, it's not changed in ages.

  +   eend $?
  +}
  +
  +
   # @FUNCTION: gnome2_query_immodules_gtk2
   # @USAGE: gnome2_query_immodules_gtk2
   # @DESCRIPTION:
 
 Also, please make 'loaders.cache' owned by x11-libs/gdk-pixbuf.

Yes, we need to work on that for all other caches as well.

 And please ensure to remove it in pkg_postrm() when last version
 of gdk-pixbuf is unmerged.

I am not clear on this last sentence. Could you reformulate it please ?

-- 
Gilles Dartiguelongue e...@gentoo.org
Gentoo


signature.asc
Description: This is a digitally signed message part


Re: [gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update

2013-08-31 Thread Alex Xu
On 31/08/13 09:00 AM, Gilles Dartiguelongue wrote:
  And please ensure to remove it in pkg_postrm() when last version
  of gdk-pixbuf is unmerged.
 I am not clear on this last sentence. Could you reformulate it please ?

Ensure that the loaders.cache file is removed correctly when all
versions of gdk-pixbuf have been removed from the system.



signature.asc
Description: OpenPGP digital signature


Re: [gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update

2013-08-31 Thread Michał Górny
Dnia 2013-08-31, o godz. 15:00:43
Gilles Dartiguelongue e...@gentoo.org napisał(a):

 Le samedi 31 août 2013 à 13:40 +0200, Michał Górny a écrit :
   + cat ${tmp_file}  
   ${EROOT}usr/$(get_libdir)/gdk-pixbuf-2.0/2.10.0/loaders.cache
  
  Why not mv or cp? Also you need '|| die' here since 'cat' can fail
  writing.
 
 I'd have to look back at the original bug report to get the exact reason
 but it seems mv/cp was not atomic enough.

Well, 'cat' is not atomic at all, so definitely not that :). 'mv' is
the only command that you can expect to at least try to be atomic.

It may had something to do with file metadata or symlinks.

  And please ensure to remove it in pkg_postrm() when last version
  of gdk-pixbuf is unmerged.
 
 I am not clear on this last sentence. Could you reformulate it please ?

In gdk-pixbuf, something like:

pkg_postrm() {
  # TODO: check if i used the correct variable :)
  [[ ${REPLACING_VERSIONS} ]] || rm -f ${EROOT}usr/.../loaders.cache
}

-- 
Best regards,
Michał Górny


signature.asc
Description: PGP signature


Re: [gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update

2013-08-31 Thread Gilles Dartiguelongue
Le samedi 31 août 2013 à 16:49 +0200, Michał Górny a écrit :
 Dnia 2013-08-31, o godz. 15:00:43
 Gilles Dartiguelongue e...@gentoo.org napisał(a):
 
  Le samedi 31 août 2013 à 13:40 +0200, Michał Górny a écrit :
+   cat ${tmp_file}  
${EROOT}usr/$(get_libdir)/gdk-pixbuf-2.0/2.10.0/loaders.cache
   
   Why not mv or cp? Also you need '|| die' here since 'cat' can fail
   writing.
  
  I'd have to look back at the original bug report to get the exact reason
  but it seems mv/cp was not atomic enough.
 
 Well, 'cat' is not atomic at all, so definitely not that :). 'mv' is
 the only command that you can expect to at least try to be atomic.
 
 It may had something to do with file metadata or symlinks.

I sort of remember there was a bug report but I can find no trace of it.
All I could find was the commit that introduced this logic, by lxnay:

http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/x11-libs/gdk-pixbuf/gdk-pixbuf-2.24.0.ebuild?hideattic=0revision=1.2view=markup

@lxnay, could you please comment on previous question ?

   And please ensure to remove it in pkg_postrm() when last version
   of gdk-pixbuf is unmerged.
  
  I am not clear on this last sentence. Could you reformulate it please ?
 
 In gdk-pixbuf, something like:
 
 pkg_postrm() {
   # TODO: check if i used the correct variable :)
   [[ ${REPLACING_VERSIONS} ]] || rm -f ${EROOT}usr/.../loaders.cache
 }
 

ok, will do.

-- 
Gilles Dartiguelongue e...@gentoo.org
Gentoo


signature.asc
Description: This is a digitally signed message part