Subject: Why no hashify on Gentoo?
From: Remigiusz Modrzejewski <lrem@sphere.pl>
Date: Thu, 17 Jul 2008 20:47:49 +0200
Thu, 17 Jul 2008 20:47:49 +0200
Hi,

I'm quite shocked that vhashify, or unification at all, does not work with 
Gentoo. It's quite a basic feature and not that hard to fix the issue too.
The attached patch is a stub that just makes things work for me. I've been 
thinking about some fancy grepping of /var/db/pkg/*/*/CONTENTS or maybe using
info from /var/lib/portage/config... But does that really matter, since 
automatic breaking of those hard links works?

Kind regards,
Remigiusz 'lRem' Modrzejewski


diff -ru /usr/lib/util-vserver/functions util-vserver/functions
--- /usr/lib/util-vserver/functions	2008-07-17 17:13:23.553840373 +0200
+++ util-vserver/functions	2008-07-17 17:14:21.874720132 +0200
@@ -768,6 +768,8 @@
 	style=debian
     elif test -e "$_pgs_vdir"/etc/SuSE-release; then
 	style=suse
+    elif test -e "$_pgs_vdir"/etc/gentoo-release; then
+	style=gentoo
     else
 	echo $"Can not determine packagemanagement style" >&2
 	return 1
diff -ru /usr/lib/util-vserver/vpkg util-vserver/vpkg
--- /usr/lib/util-vserver/vpkg	2008-07-17 17:13:24.433853647 +0200
+++ util-vserver/vpkg	2008-07-17 17:24:41.794071482 +0200
@@ -132,6 +132,23 @@
 	    cmd=( "$_VSERVER" --silent "$vserver" exec "${cmd[@]}" )
 	fi
 	;;
+    (gentoo)
+	case "$tag" in
+	    (get-conffiles)
+		cmd=( sh -c "true" )
+		;;
+	    (install)
+		cmd=( emerge "$@" )
+		;;
+	esac
+
+	if test -n "$is_external"; then
+	    echo $"'external' packagemanagement is not supported for Gentoo" >&2
+	    exit 1
+	else
+	    cmd=( "$_VSERVER" --silent "$vserver" exec "${cmd[@]}" )
+	fi
+	;;
     (*)
 	echo $"Packagemanagement is not supported for '$style' style" >&2
 	exit 2