Package: debhelper Version: 5.0.35 Severity: wishlist Tags: patch The following patch will add functionality to debhelper to easily create a .postinst and .postrm to handle the GTK icon cache. It uses /usr/bin/gtk-update-icon-cache (of libgtk2.0-bin, if available) to manage an mmap()able file, which makes icon look up faster and shortens the amount of used memory for GTK processes by ~300k. XFCE and GNOME will benefit of this.
The implementation of GTK's icon cache wants to have a changed mtime in the directory above of the one where icons were added. As this doesn't happen automatically, using dh_iconcache makes this easier for package maintainers. Have a nice day, Daniel
diff -ruN debhelper-5.0.35/autoscripts/postinst-iconcache debhelper-5.0.7ubuntu13/autoscripts/postinst-iconcache
--- debhelper-5.0.35/autoscripts/postinst-iconcache 1970-01-01 01:00:00.000000000 +0100
+++ debhelper-5.0.7ubuntu13/autoscripts/postinst-iconcache 2006-04-24 11:59:24.000000000 +0200
@@ -0,0 +1,8 @@
+touch -m #ICONDIR#
+if [ "$1" = configure ] && \
+ [ -x "`which gtk-update-icon-cache 2>/dev/null`" ] && \
+ [ -f /etc/gtk-2.0/gdk-pixbuf.loaders ] && \
+ [ "`find #ICONDIR# -mindepth 1 -maxdepth 1 -type d | wc -l`" -gt 0 ] && \
+ [ "`find #ICONDIR# -mindepth 1 -maxdepth 1 -type f -name index.theme | wc -l`" -eq 1 ]; then
+ gtk-update-icon-cache -q #ICONDIR#
+fi
iff -ruN debhelper-5.0.35/autoscripts/postrm-iconcache debhelper-5.0.7ubuntu13/autoscripts/postrm-iconcache
--- debhelper-5.0.35/autoscripts/postrm-iconcache 1970-01-01 01:00:00.000000000 +0100
+++ debhelper-5.0.7ubuntu13/autoscripts/postrm-iconcache 2006-05-03 03:17:05.000000000 +0200
@@ -0,0 +1,14 @@
+[ -d #ICONDIR# ] && touch -m #ICONDIR# || true
+if [ "$1" = "remove" ] && \
+ [ -x "`which gtk-update-icon-cache 2>/dev/null`" ] && \
+ [ -f /etc/gtk-2.0/gdk-pixbuf.loaders ]; then
+ if [ "`find #ICONDIR# -mindepth 1 -maxdepth 1 -type d | wc -l`" -gt 0 ] && \
+ [ "`find #ICONDIR# -mindepth 1 -maxdepth 1 -type f -name index.theme | wc -l`" -eq 1 ]; then
+ # we shouldn't bomb out, if gtk-update-icon-cache failes,
+ # it's not important enough
+ gtk-update-icon-cache -q #ICONDIR# || true;
+ else
+ # if the icon theme directory has no subdirs, we can remove the cache
+ rm -f #ICONDIR#/icon-theme.cache || true;
+ fi
+fi
diff -ruN debhelper-5.0.35/dh_iconcache debhelper-5.0.7ubuntu13/dh_iconcache
--- debhelper-5.0.35/dh_iconcache 1970-01-01 01:00:00.000000000 +0100
+++ debhelper-5.0.7ubuntu13/dh_iconcache 2006-05-04 11:20:50.000000000 +0200
@@ -0,0 +1,57 @@
+#!/usr/bin/perl -w
+
+=head1 NAME
+
+dh_iconcache - Updates the Icon Cache for icons in /usr/share/icons
+
+=cut
+
+use strict;
+use Debian::Debhelper::Dh_Lib;
+
+=head1 SYNOPSIS
+
+B<dh_iconcache> [S<I<debhelper options>>] [B<-p<package>>]
+
+=head1 DESCRIPTION
+
+dh_iconcache is a debhelper program that updates the GTK icon cache.
+This is necessary, if packages install icons into /usr/share/icons/B<package>.
+Currently this program does not handle installation of icons, though
+may do so at a later date. It takes care of adding maintainer script
+fragments to call F<gtk-update-icon-cache>.
+
+=cut
+
+init();
+
+foreach my $package (@{$dh{DOPACKAGES}}) {
+ my $tmp=tmpdir($package);
+
+ if (-d "$tmp/usr/share/icons/") {
+ my @icon_dirs = `find $tmp/usr/share/icons -mindepth 1 -maxdepth 1 -type d -printf '/usr/share/icons/%P\n'`;
+ if (@icon_dirs && ! $dh{NOSCRIPTS}) {
+ foreach my $dir (@icon_dirs) {
+ chomp($dir);
+ if ($dir ne '') {
+ autoscript($package,"postinst","postinst-iconcache","s:#ICONDIR#:$dir:g");
+ autoscript($package,"postrm","postrm-iconcache","s:#ICONDIR#:$dir:g");
+ }
+ }
+ # not used, because KDE people might not be happy with it
+ # addsubstvar($package, "misc:Depends", "libgtk2.0-bin");
+ }
+ }
+}
+
+=head1 SEE ALSO
+
+L<debhelper>
+
+This program is a part of debhelper.
+
+=head1 AUTHOR
+
+Daniel Holbach <[EMAIL PROTECTED]>
+
+=cut
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

