The following reply was made to PR pkg/36260; it has been noted by GNATS.
From: Robert Elz <kre%munnari.OZ.AU@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: tech-pkg%NetBSD.org@localhost
Subject: Re: pkg/36260: x11/xfce4-session PLIST problem
Date: Fri, 28 Nov 2008 20:29:06 +0700
| The PLIST for x11/xfce4-session includes a file which
| gets included in the system config directory (which is
| end system alterable - and which I prefer to alter) but
| references it using its full pathname as if PKG_SYSCONFBASE
| was not set.
| >Fix:
| Somehow make PLIST understand files whose location is not
| fixed (or if that one wasn't supposed tobe in PKG_SYSCONFBASE
| then don't put it there!)
After 18 months of waiting for someone to look at this PR, I decided
I really should do it for myself...
And of course, it turns out that pkgsrc is already perfectly able to
deal with files that are supposed to go under PKG_SYSCONFBASE, that
is, in PKG_SYSCONFDIR, but it just wasn't being used (fully) by this
package.
Given that it was being used for another config file, I suspect the
reason might possibly be that pkgsrc doesn't really want to know
about packages that want to use more than a single PKG_SYSCONFSUBDIR,
this one does, it puts files in two distinct sub-directories of
PKG_SYSCONFBASE. Why, I have no idea, I know nothing about xfce4-session
and certainly don't want to go messing about inside it - I don't even
use the thing, so I can't even test it - I just like to build binary
packages in case one day I suffer a sudden urge...
Anyway, the patch below allows me to build a binary package which seems
to "work" - where by "work" I mean that the compilation works,
installation works, making the binary package (with PKG_DEVELOPER=yes
so all the tests get run) works, pkg_delete works, pkg_add works on
the binary package, then pkg_delete works again.
Whether what was installed actually runs correctly I have no idea at all,
it would be good if an xfce4 user (if there are any) would try this
patch to xfce4-session, install the modified version, and see if it
functions (nothing should have changed, the only likely problem might
be an inability to find one f its configuration files).
It would be even better if this could be done by someone who has a
non-default PKG_SYSCONFBASE in their mk.conf, as well as by someone who
just uses the default (/usr/pkg/etc). The problem I am attempting to
fix was only observed in the former of those cases, but fixing it
obviously must not break the latter.
The patch alters 3 files, for the PLIST, the files that used to be
expected to be in pkg/etc are now found in pkg/share/examples, and the
pkg/etc subdirectory it used to be in is no longer @dirrm'd as it no
longer gets created by anything (this just causes a warning at
pkg_delete time, which is generally harmless, but still...)
Second, there's a new patch-ab (in patches/*) that fixes the place
in xfce4-session where one of the config files was being copied
directly to PKG_SYSCONFBASE ($(sysconfdir)) and instead causes it to
get installed in the examples directory. I see no Attic for
xfce4-session, so I'm assuming that patch-ab is a safe enough
patch name to use (hasn't previously been used to patch some other
file) - but feel free to rename it to whatever is appropriate.
Those two are pretty trivial, and I doubt there are likely to be many
serious problems or issues.
The third patch is to the Makefile, which is where it gets a little
messy (because of the two PKG_SYSCONFSUBDIRs we'd really like to have.)
There is one change here that's purely "correctness" - pkgsrc.txt
says "thou shalt not use PKG_SYSCONFBASE in pkgsrc", but this
package did - because of the two subdirs, it needed to be told
SYSCONFBASE to the package Makefiles could generate the correct
paths. It used PKG_SYSCONFDIR for everything else, but that handled
only one of the two config files - the other one is the one I detected
problems with.
To comply with the rules, and to make it a little cleaner to deal
with two PKG_SYSCONFSUBDIRs, I just deleted PKG_SYSCONFSUBDIR completely,
so PKG_SYSCONFDIR is now the same as PKG_SYSCONFBASE, and we can use
PKG_SYSCONFDIR (which is permitted) rather than PKG_SYSCONFBASE
which is not. The sub-directories are then just hard coded in the
various pathnames. That's half defeating the pkgsrc machinery, but
I don't know a better way - if anyone else does,
Last, this used directories with "xdg" in their pathnames. I have
absolutelu no idea whether that means it should be (via the pkgsrc
mechanism) using the misc/xdg-dirs package or not - it didn't before,
and still doesn't now... The xdg directories it uses don't seem to
overlap the ones that misc/xdg-dirs deals with, so perhaps not, but,
again, someone who understands should take a look.
I have tested this (using pkg_comp and a NetBSD 4.0 environment, with
modular-xorg from pkgsrc, though all that stuff would just affect
compiling & linking the sources (which was never the issue), and perhaps
how it runs (which I never have tested, before or now) so shouldn't
really matter. Aside from the @unexec $(RMDIR) which I left in
the PLISt (though as best I can tell, this package might never
create that directory - but with default PJG_SYSCONFBASE, maybe)
everything now seems (as far as pkg building goes) about as good
as I need it to be.
I would really appreciate it if someone who knows how this ought to be
done (you don't need to know anything about xfce4, I certainly don't)
can take a look and tell me how I should have done it instead.
It would also be good if someone could test the real thing, not just
the package building mechanism.
If everything seems to be OK, could someone please update x11/xfce4-session
with the patch below, or something that has the same effect.
Aside from the patch, the distinfo file will need regenerating (to include
the checksum for the new patch), and you may want to consider if a revbump
is needed (it most probably is.)
kre
--- Makefile.ORIG 2008-08-06 19:44:09.000000000 +0700
+++ Makefile 2008-11-28 18:40:17.000000000 +0700
@@ -8,17 +8,23 @@
CATEGORIES= x11
COMMENT= Xfce session manager
-PKG_SYSCONFSUBDIR= xdg/xfce4-session
EGDIR= ${XFCE4_EGBASE}/session
CONF_FILES= ${EGDIR:Q}/xfce4-session.rc \
- ${PKG_SYSCONFDIR:Q}/xfce4-session.rc
+ ${PKG_SYSCONFDIR:Q}/xdg/xfce4-session/xfce4-session.rc
-CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFBASE:Q}
+CONF_FILES+= ${PREFIX}/share/xdg/autostart/xfce4-tips-autostart.desktop \
+ ${PKG_SYSCONFDIR:Q}/xdg/autostart/xfce4-tips-autostart.desktop
+
+CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR:Q}
CONFIGURE_ARGS+= ICEAUTH=${TOOLS_PATH.iceauth:Q}
-REQD_DIRS+= ${XFCE4_EGBASE} ${EGDIR}
+REQD_DIRS+= ${XFCE4_EGBASE} ${EGDIR} ${PREFIX}/share/xdg/autostart
BUILD_DEFS+= PKG_SYSCONFBASE
+OWN_DIRS+= ${PKG_SYSCONFDIR}/xdg
+OWN_DIRS+= ${PKG_SYSCONFDIR}/xdg/xfce4-session
+OWN_DIRS+= ${PKG_SYSCONFDIR}/xdg/autostart
+
USE_TOOLS+= iceauth:run
USE_DIRS+= xdg-1.4
--- PLIST.ORIG 2008-11-27 15:09:05.000000000 +0700
+++ PLIST 2008-11-28 20:07:33.000000000 +0700
@@ -3,7 +3,6 @@
bin/xfce4-session
bin/xfce4-session-logout
bin/xfce4-tips
-etc/xdg/autostart/xfce4-tips-autostart.desktop
include/xfce4/xfce4-session-4.2/libxfsm/xfsm-splash-engine.h
include/xfce4/xfce4-session-4.2/libxfsm/xfsm-splash-rc.h
lib/libxfsm-4.2.la
@@ -84,6 +83,7 @@
share/locale/zh_TW/LC_MESSAGES/xfce4-session.mo
share/themes/Default/balou/logo.png
share/themes/Default/balou/themerc
+share/xdg/autostart/xfce4-tips-autostart.desktop
share/xfce4/doc/C/images/xfsm-advanced.png
share/xfce4/doc/C/images/xfsm-general.png
share/xfce4/doc/C/images/xfsm-splash.png
@@ -97,10 +97,9 @@
@dirrm share/xfce4/tips
@dirrm share/themes/Default/balou
@dirrm share/examples/xfce4/session
+@dirrm share/xdg/autostart
@dirrm lib/xfce4/splash/engines
@dirrm lib/xfce4/splash
@dirrm include/xfce4/xfce4-session-4.2/libxfsm
@dirrm include/xfce4/xfce4-session-4.2
-@dirrm etc/xdg/xfce4-session
-@dirrm etc/xdg/autostart
@unexec ${RMDIR} %D/etc/xdg 2>/dev/null || ${TRUE}
--- patches/patch-ab.ORIG 2008-11-28 18:40:40.000000000 +0700
+++ patches/patch-ab 2008-11-28 17:17:47.000000000 +0700
@@ -0,0 +1,11 @@
+--- xfce4-tips/Makefile.in.ORIG 2008-11-28 10:08:28.000000000 +0000
++++ xfce4-tips/Makefile.in 2008-11-28 10:16:47.000000000 +0000
+@@ -298,7 +298,7 @@
+ xfce4_tips_LDADD = \
+ @LIBXFCEGUI4_LIBS@
+
+-desktopdir = $(sysconfdir)/xdg/autostart
++desktopdir = $(datadir)/xdg/autostart
+ desktop_in_files = xfce4-tips-autostart.desktop.in
+ desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
+ EXTRA_DIST = \