Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 101337 - setup /usr/lib/graphviz/config after graphviz-2.4 install
Summary: setup /usr/lib/graphviz/config after graphviz-2.4 install
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] KDE (show other bugs)
Hardware: x86 Linux
: High major (vote)
Assignee: Gentoo Graphics Project
URL:
Whiteboard:
Keywords:
: 101759 101834 102008 103031 103223 103974 105087 105109 106201 106249 (view as bug list)
Depends on:
Blocks: 99802
  Show dependency tree
 
Reported: 2005-08-04 08:18 UTC by Jean-Francois Ostiguy
Modified: 2005-09-17 13:43 UTC (History)
23 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
gvcachedir.patch (gvcachedir.patch,576 bytes, patch)
2005-08-21 16:47 UTC, Ed Catmur
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Francois Ostiguy 2005-08-04 08:18:32 UTC
emerge kdelibs-3.4.2 fails with access violations.


.... 

Making apidox in kmdi
make[2]: Entering directory
`/var/tmp/portage/kdelibs-3.4.2/work/kdelibs-3.4.2/kmdi/kmdi'
make[3]: Entering directory
`/var/tmp/portage/kdelibs-3.4.2/work/kdelibs-3.4.2/kmdi/kmdi'
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
/var/tmp/portage/kdelibs-3.4.2/work/kdelibs-3.4.2/kmdi/kmdi/dockcontainer.h:51
Warning: Found unknown command `\TODO'
/var/tmp/portage/kdelibs-3.4.2/work/kdelibs-3.4.2/kmdi/kmdi/dockcontainer.h:63
Warning: Found unknown command `\TODO'
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
/var/tmp/portage/kdelibs-3.4.2/work/kdelibs-3.4.2/kmdi/kmdi/mainwindow.h

Reproducible: Always
Steps to Reproduce:
1.emerge -Du =kdelibs-3.4.2
2.
3.

Actual Results:  
.... 

Making apidox in kmdi
make[2]: Entering directory
`/var/tmp/portage/kdelibs-3.4.2/work/kdelibs-3.4.2/kmdi/kmdi'
make[3]: Entering directory
`/var/tmp/portage/kdelibs-3.4.2/work/kdelibs-3.4.2/kmdi/kmdi'
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
/var/tmp/portage/kdelibs-3.4.2/work/kdelibs-3.4.2/kmdi/kmdi/dockcontainer.h:51
Warning: Found unknown command `\TODO'
/var/tmp/portage/kdelibs-3.4.2/work/kdelibs-3.4.2/kmdi/kmdi/dockcontainer.h:63
Warning: Found unknown command `\TODO'
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
ACCESS DENIED  open_wr:   /usr/lib/graphviz/config
Error: failed to open /usr/lib/graphviz/config for write.
/var/tmp/portage/kdelibs-3.4.2/work/kdelibs-3.4.2/kmdi/kmdi/mainwindo
Comment 1 Vahur Sinijärv 2005-08-05 10:29:42 UTC
After emerging graphviz you need to run 'dot -V' once. This will create
/usr/lib/graphviz/config file. This step must be included in graphviz ebuild,
otherwise all ebuilds which generate documentation using doxygen and dot will fail.
Comment 2 Alexander Wessel 2005-08-08 03:08:09 UTC
You need to run `dot -V` as root, otherwize you get 
 
Error: failed to open /usr/lib/graphviz/config for write. 
dot version 2.4 (Wed Aug  3 16:43:39 UTC 2005) 
 
Thought I'd mention it, since I just stumbled across... 
Comment 3 Gregorio Guidi (RETIRED) gentoo-dev 2005-08-08 05:23:36 UTC
Reassigning to graphviz maintainers. 
 
Comment 4 Sascha Silbe 2005-08-08 07:20:29 UTC
Same problem here when trying to compile gwenhywfar (needed for GnuCash with HBCI support) after upgrading to graphviz-2.4.
The given workaround (running 'dot -V' as root) works. I don't think it's the proper solution to just use it in the ebuild, though. /usr is not the right place for config files.
Comment 5 Jakub Moc (RETIRED) gentoo-dev 2005-08-09 03:11:36 UTC
*** Bug 101834 has been marked as a duplicate of this bug. ***
Comment 6 Jakub Moc (RETIRED) gentoo-dev 2005-08-09 06:03:30 UTC
*** Bug 101759 has been marked as a duplicate of this bug. ***
Comment 7 Jakub Moc (RETIRED) gentoo-dev 2005-08-11 00:43:57 UTC
*** Bug 102008 has been marked as a duplicate of this bug. ***
Comment 8 Gustavo Ribeiro Alves 2005-08-18 09:38:38 UTC
same problem. xerces-c 2.6.0
Comment 9 Jakub Moc (RETIRED) gentoo-dev 2005-08-19 02:16:59 UTC
*** Bug 103031 has been marked as a duplicate of this bug. ***
Comment 10 Carsten Lohrke (RETIRED) gentoo-dev 2005-08-21 07:37:08 UTC
*** Bug 103223 has been marked as a duplicate of this bug. ***
Comment 11 Marcelo Goes (RETIRED) gentoo-dev 2005-08-21 09:40:14 UTC
Okies, I went for the simple solution. I generated a config file and made the
graphviz-2.4-r1 ebuild install it in /etc/graphviz.conf.
/usr/lib/graphviz/config is a symlink to that file.

Can you comment if it fixes the problems you are having installing other packages?

Further, can alpha, hppa, ia64, mips, ppc-macos and sparc folks keyword it if it
works?
I couldn't find anything in Bugzilla or the ChangeLog explaining why keywords
were dropped.
Comment 12 Ed Catmur 2005-08-21 11:21:53 UTC
graphviz-2.4-r1.ebuild does not fix the bug, I think because the installed
/etc/graphviz.conf is not newer than /usr/bin/dot:

# ls --full-time /etc/graphviz.conf /usr/bin/dot
-rw-r--r--  1 root root  236 2005-08-21 19:16:39.000000000 +0100 /etc/graphviz.conf
-rwxr-xr-x  1 root root 9458 2005-08-21 19:16:39.000000000 +0100 /usr/bin/dot*
# su operator -c 'dot -V'
Error: failed to open /usr/lib/graphviz/config for write.
dot version 2.4 (Sun Aug 21 18:08:02 UTC 2005)
# touch /etc/graphviz.conf
# su operator -c 'dot -V'
dot version 2.4 (Sun Aug 21 18:08:02 UTC 2005)
# touch /etc/graphviz.conf -r /usr/bin/dot
# su operator -c 'dot -V'
Error: failed to open /usr/lib/graphviz/config for write.
dot version 2.4 (Sun Aug 21 18:08:02 UTC 2005)

I guess it should work to touch /etc/graphviz.conf in postinst().
Comment 13 Marcelo Goes (RETIRED) gentoo-dev 2005-08-21 11:48:26 UTC
Ed, can you test your idea using touch inside the ebuild?

--- graphviz-2.4-r1.ebuild      21 Aug 2005 16:31:24 -0000      1.1
+++ graphviz-2.4-r1.ebuild      21 Aug 2005 18:46:28 -0000
@@ -41,6 +41,7 @@
        # bug 101337
        insinto /etc
        newins ${FILESDIR}/${P}.conf ${PN}.conf
+       touch ${D}/etc/${PN}.conf
        dosym /etc/${PN}.conf /usr/lib/graphviz/config
 }
Comment 14 Ed Catmur 2005-08-21 12:14:13 UTC
That won't work; when portage merges a package it sets the mtime of all regular
files to the same time (see treewalk in portage.py). That's why the touch has to
be in postinst.

Also, I'm wrong about it being the mtime of /usr/bin/dot that /etc/graphviz.conf
is compared against; it's actually the mtime of the directory /usr/lib/graphviz:

[graphviz-2.4/lib/gvc/gvconfig.c 442 gvconfig()]
    if (rc == -1 || libdir_st.st_mtime > config_st.st_mtime) {
	config_rescan(gvc, config_path);
        ^
        this is what tries to write to /usr/lib/graphviz/config

Since /usr/lib/graphviz is modified after the merge proper starts, the only way
to give /etc/graphviz.conf a not earlier mtime is to touch it in postinst.

Note:
# touch /etc/graphviz.conf -r /usr/lib/graphviz
# su operator -c 'dot -V'
dot version 2.4 (Sun Aug 21 18:08:02 UTC 2005)
Comment 15 Marcelo Goes (RETIRED) gentoo-dev 2005-08-21 12:51:53 UTC
Well, just tested putting it in pkg_postinst() and got the same result.

--- graphviz-2.4-r1.ebuild      21 Aug 2005 16:31:24 -0000      1.1
+++ graphviz-2.4-r1.ebuild      21 Aug 2005 19:49:39 -0000
@@ -45,5 +45,6 @@
 }

 pkg_postinst() {
+       touch ${D}/etc/${PN}.conf
        einfo "Edit /etc/${PN}.conf to your liking before running."
 }

$ ls --full-time /etc/graphviz.conf /usr/bin/dot
-rw-r--r--  1 root root   236 2005-08-21 16:42:41.000000000 -0300 /etc/graphviz.conf
-rwxr-xr-x  1 root root 49748 2005-08-21 16:42:41.000000000 -0300 /usr/bin/dot

:-( Any ideas?
Comment 16 Ed Catmur 2005-08-21 15:51:22 UTC
I meant:

--- graphviz-2.4-r1.ebuild      21 Aug 2005 16:31:24 -0000      1.1
+++ graphviz-2.4-r1.ebuild      21 Aug 2005 19:49:39 -0000
@@ -45,5 +45,6 @@
 }

 pkg_postinst() {
+       touch /etc/${PN}.conf
        einfo "Edit /etc/${PN}.conf to your liking before running."
 }

i.e. touch the file on the live filesystem.

However, I'm no longer sure that's correct; it seems that rather than a
configuration file, /usr/lib/graphviz/config is a registry of graphviz render
plugins - see
http://www.graphviz.org/pub/graphviz/CURRENT/doxygen/html/gvconfig_8c-source.html
line 52 ff.

Thus for FHS compatibility (and RO root support) we should hack graphviz to site
the /usr/lib/graphviz/config file in /var, probably /var/cache/graphviz/config. 

Then in postinst graphviz (and anything other ebuild that provides graphviz
render plugins; I don't know of any in portage, but graphviz-cairo - see bug
99802 - will be one such) should force graphviz to update the plugin registry
(by removing the file and running dot -V). This could be done in an eclass, as
with gst-plugins_update_registry in gst-plugins.eclass.
Comment 17 Ed Catmur 2005-08-21 16:47:16 UTC
Created attachment 66511 [details, diff]
gvcachedir.patch

Make graphviz site its renderer registry at /var/cache/graphviz/config.

Something like:
--- graphviz-2.4-r1.ebuild	2005/08/21 23:25:48	1.1
+++ graphviz-2.4-r1.ebuild	2005/08/21 23:45:31
@@ -2,6 +2,8 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Header: /home/ed/scratch/graphviz-2.4/graphviz-2.4-r1.ebuild,v 1.1
2005/08/21 23:25:48 ed Exp ed $
 
+inherit eutils
+
 DESCRIPTION="Open Source Graph Visualization Software"
 HOMEPAGE="http://www.graphviz.org/"
 SRC_URI="http://www.graphviz.org/pub/graphviz/ARCHIVE/${P}.tar.gz"
@@ -23,6 +25,11 @@ RDEPEND=">=sys-libs/zlib-1.1.3
 DEPEND="${RDEPEND}
		dev-util/pkgconfig"
 
+src_unpack() {
+	unpack ${A}
+	cd ${S}; epatch ${FILESDIR}/${PN}-2.4-cachedir.patch
+}
+
 src_compile() {
	econf --with-mylibgd \
		  $(use_with dynagraph dynagraph) \
@@ -38,12 +45,29 @@ src_install() {
	dodoc doc/*.pdf doc/Dot.ref
	dohtml -r .
 
-	# bug 101337
-	insinto /etc
-	newins ${FILESDIR}/${P}.conf ${PN}.conf
-	dosym /etc/${PN}.conf /usr/lib/graphviz/config
+	keepdir /var/cache/graphviz
 }
 
 pkg_postinst() {
-	einfo "Edit /etc/${PN}.conf to your liking before running."
+	local GVCACHEDIR="/var/cache/graphviz"
+	ebegin "Regenerating $GVCACHEDIR/config"
+	if [[ ! -d /var/cache/graphviz ]]; then
+		eerror "directory $GVCACHEDIR missing!"
+		eend 1
+		return 1
+	fi
+	if [[ -e "$GVCACHEDIR/config" ]]; then
+		ebegin "Backing up old registry to $GVCACHEDIR/config.old"
+		mv "$GVCACHEDIR/config" "$GVCACHEDIR/config.old"
+		eend $?
+	fi
+	ebegin "Generating new registry"
+	dot -V >/dev/null
+	eend $?
+	if [[ ! -e "$GVCACHEDIR/config" && -e "$GVCACHEDIR/config.old" ]]; then

+		ebegin "Restoring old registry"
+		mv "$GVCACHEDIR/config.old" "$GVCACHEDIR/config"
+		eend $?
+	fi
+	[[ ! "$GVCACHEDIR/config" -ot /usr/lib/graphviz ]]; eend $?
 }

modulo introducing a new graphviz-plugin eclass.
Comment 18 Ed Catmur 2005-08-21 17:55:32 UTC
Sorry, some mistakes. This should be better:

--- graphviz-2.4-r1.ebuild	2005/08/21 23:25:48	1.1
+++ graphviz-2.4-r1.ebuild	2005/08/22 00:53:37
@@ -2,6 +2,8 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Header: /home/ed/scratch/graphviz-2.4/graphviz-2.4-r1.ebuild,v 1.1
2005/08/21 23:25:48 ed Exp ed $
 
+inherit eutils
+
 DESCRIPTION="Open Source Graph Visualization Software"
 HOMEPAGE="http://www.graphviz.org/"
 SRC_URI="http://www.graphviz.org/pub/graphviz/ARCHIVE/${P}.tar.gz"
@@ -23,6 +25,11 @@ RDEPEND=">=sys-libs/zlib-1.1.3
 DEPEND="${RDEPEND}
 		dev-util/pkgconfig"
 
+src_unpack() {
+	unpack ${A}
+	cd ${S}; epatch ${FILESDIR}/${PN}-2.4-cachedir.patch
+}
+
 src_compile() {
 	econf --with-mylibgd \
 		  $(use_with dynagraph dynagraph) \
@@ -38,12 +45,44 @@ src_install() {
 	dodoc doc/*.pdf doc/Dot.ref
 	dohtml -r .
 
-	# bug 101337
-	insinto /etc
-	newins ${FILESDIR}/${P}.conf ${PN}.conf
-	dosym /etc/${PN}.conf /usr/lib/graphviz/config
+	keepdir /var/cache/graphviz
+}
+
+graphviz-plugins_generate_plugins_cache() {
+	local GVLIBDIR="/usr/lib/graphviz"
+	local GVCACHEDIR="/var/cache/graphviz"
+	if [[ -d "$GVLIBDIR" ]]; then
+		ebegin "Regenerating $GVCACHEDIR/config"
+		if [[ ! -d "$GVCACHEDIR" ]]; then
+			eerror "directory $GVCACHEDIR missing!"
+			eend 1
+			return 1
+		fi
+		if [[ -e "$GVCACHEDIR/config" ]]; then
+			ebegin "Backing up old registry to $GVCACHEDIR/config.old"
+			mv "$GVCACHEDIR/config" "$GVCACHEDIR/config.old"
+			eend $?
+		fi
+		ebegin "Generating new registry"
+		dot -V >/dev/null
+		eend $?
+		if [[ ! -e "$GVCACHEDIR/config" && -e "$GVCACHEDIR/config.old" ]]; then
+			ebegin "Restoring old registry"
+			mv "$GVCACHEDIR/config.old" "$GVCACHEDIR/config"
+			eend $?
+		fi
+		[[ ! "$GVCACHEDIR/config" -ot "$GVLIBDIR" ]]; eend $?
+	else
+		ebegin "Removing $GVCACHEDIR"
+		rm "$GVCACHEDIR/"{config,config.old,.keep} && rmdir "$GVCACHEDIR"
+		eend $?
+	fi
 }
 
 pkg_postinst() {
-	einfo "Edit /etc/${PN}.conf to your liking before running."
+	graphviz-plugins_generate_plugins_cache
+}
+
+pkg_postrm() {
+	graphviz-plugins_generate_plugins_cache
 }
Comment 19 John Ellson 2005-08-21 19:34:03 UTC
FYI.

I hope to have a graphviz-2.6 release this week.

The config creation has been changed from a side effect of "dot -V" 
to the explicit effect of a new switch "dot -c".   Normal
invocations of dot no longer check timestamps of config or attempt
to recreate it when possibly non-root.

The current graphviz2.5 snapshots should be representative of graphviz-2.6
in this area.   
Comment 20 Jakub Moc (RETIRED) gentoo-dev 2005-08-27 17:00:38 UTC
*** Bug 103974 has been marked as a duplicate of this bug. ***
Comment 21 Steve Arnold archtester gentoo-dev 2005-09-06 19:30:08 UTC
*** Bug 105087 has been marked as a duplicate of this bug. ***
Comment 22 Jakub Moc (RETIRED) gentoo-dev 2005-09-11 14:49:05 UTC
*** Bug 105109 has been marked as a duplicate of this bug. ***
Comment 23 Steve Arnold archtester gentoo-dev 2005-09-15 00:20:52 UTC
graphviz 2.6 is now in portage, and it fixes this error with doxygen.  It should 
also fix it for you all; please test and re-open if you still have problems.
Comment 24 Carsten Lohrke (RETIRED) gentoo-dev 2005-09-16 13:47:48 UTC
*** Bug 106201 has been marked as a duplicate of this bug. ***
Comment 25 Jakub Moc (RETIRED) gentoo-dev 2005-09-17 02:54:34 UTC
*** Bug 106249 has been marked as a duplicate of this bug. ***