Subject: pkg/35223: MAILSUBDIR support for mail/imap-uw
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: dhowland@users.sourceforge.net <dhowland@users.sourceforge.net>
List: pkgsrc-bugs
Date: 12/09/2006 21:50:00
>Number:         35223
>Category:       pkg
>Synopsis:       MAILSUBDIR support for mail/imap-uw
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 09 21:50:00 +0000 2006
>Originator:     dhowland@users.sourceforge.net
>Release:        NetBSD 4.99.5 i386
>Organization:
>Environment:


System: NetBSD 4.99.5 (GENERIC) #1: Wed Dec  6 11:56:19 EST 2006
	root@micron:/usr/4.99/obj/sys/arch/i386/compile/GENERIC



>Description:


mail/imap-uw is the University of Washington's IMAP mail server.

The package supports changing the default mail subdirectory such that
the user's IMAP folder structure is stored in a subdirectory within their
home directory rather than in ~.  This reduces clutter for users with
many IMAP folders.  A common setting for this is "mail".  This does not
effect the user's inbox (spool), only the rest of the IMAP folder structure.

This tweek is documented in imap-uw's CONFIG documentation file.

A similar type of customization has been implemented in pkgsrc with
IMAP_UW_MAILSPOOLHOME.  See pkgsrc/mk/defaults/mk.conf.
(its also from imap-uw's CONFIG doc)

I propose adding a  new variable, IMAP_UW_MAILSUBDIR.  This would
default to not defined, making the package behave as normal.

I am including patches to make this change.  The modifications  are trivial.

Please consider implementing this.
Thank you.


>How-To-Repeat:


this is not a bug


>Fix:


The following patches will implement the feature.

cd /usr/pkgsrc/mk/defaults
diff -u mk.conf.orig mk.conf

--- mk.conf.orig        2006-12-09 15:47:00.000000000 -0500
+++ mk.conf     2006-12-09 16:30:52.000000000 -0500
@@ -932,6 +932,13 @@
 # Possible: Any valid filename, not defined
 # Default: not defined
 
+#IMAP_UW_MAILSUBDIR=mail
+# To relocate user's IMAP mail tree out of the home directory,
+# and into a subdirectory.  This reduces clutter for users that
+# have a large IMAP folder structure.
+# Possible: Any valid filename, not defined
+# Default: not defined
+
 IMDICTDIR?=    ${VARBASE}/dict
 # Specify the directory for input method's dictionary installation.
 # Possible: any valid location


cd /usr/pkgsrc/mail/imap-uw
diff -u Makefile.orig Makefile

--- Makefile.orig       2006-12-09 15:45:43.000000000 -0500
+++ Makefile    2006-12-09 16:34:25.000000000 -0500
@@ -80,6 +80,15 @@
                        -e 's|@MAILBOX@|myusername ()|'
 .endif
 
+SUBST_CLASSES+=                subdir
+SUBST_STAGE.subdir=    pre-configure
+SUBST_FILES.subdir=    src/osdep/unix/env_unix.c
+.if defined(IMAP_UW_MAILSUBDIR)
+SUBST_SED.subdir=      -e 's|@MAILSUBDIR@|"${IMAP_UW_MAILSUBDIR}"|'
+.else
+SUBST_SED.subdir=      -e 's|@MAILSUBDIR@|NIL|'
+.endif
+
 SUBST_CLASSES+=                man
 SUBST_STAGE.man=       post-build
 SUBST_FILES.man=       src/imapd/imapd.8 src/ipopd/ipopd.8


cd /usr/pkgsrc/mail/imap-uw
diff -u distinfo.orig distinfo

--- distinfo.orig       2006-12-09 15:44:52.000000000 -0500
+++ distinfo    2006-12-09 15:58:37.000000000 -0500
@@ -15,7 +15,7 @@
 SHA1 (patch-aj) = 607286c1fd5eb97a07ffb812387f6a005aaee9c5
 SHA1 (patch-ak) = c798b2aad17091526c667a552839cfe1ec0e23c9
 SHA1 (patch-al) = 2915edc654c185311e09cef571b443c4a9ff7e3c
-SHA1 (patch-am) = 0aea2cbe98da312740e678355b11fc964a822cda
+SHA1 (patch-am) = 9fe0d6b62dfdde6a4e1851bbd9203c83948730b3
 SHA1 (patch-ao) = 777b30793ea2e1f33be14e34d837f1f0cc5d0d67
 SHA1 (patch-ap) = ce224812b0744a699e5e07916ca04510bf62da25
 SHA1 (patch-aq) = 7cf038fcb8e072fa46604ac0ac8c02c0d6d3608e


cd /usr/pkgsrc/mail/imap-uw/patches
diff -u patch-am.orig patch-am

--- patch-am.orig       2006-12-09 15:46:24.000000000 -0500
+++ patch-am    2006-12-09 15:57:58.000000000 -0500
@@ -1,4 +1,4 @@
-$NetBSD: patch-am,v 1.5 2006/07/26 20:00:27 jlam Exp $
+$NetBSD$
 
 --- src/osdep/unix/env_unix.c.orig     2004-09-13 17:31:19.000000000 -0400
 +++ src/osdep/unix/env_unix.c
@@ -12,6 +12,15 @@
  
  
  /* c-client environment parameters */
  
+@@ -29,7 +32,7 @@ static char *myHomeDir = NIL;        /* home di
+ static char *myMailboxDir = NIL;/* mailbox directory name */
+ static char *myLocalHost = NIL;       /* local host name */
+ static char *myNewsrc = NIL;  /* newsrc file name */
+-static char *mailsubdir = NIL;        /* mail subdirectory name */
++static char *mailsubdir = @MAILSUBDIR@;       /* mail subdirectory name */
+ static char *sysInbox = NIL;  /* system inbox name */
+ static char *newsActive = NIL;        /* news active file */
+ static char *newsSpool = NIL; /* news spool */
 @@ -567,7 +570,15 @@ long server_login (char *user,char *pwd,
    else if (disablePlaintext) err = "disabled";
    else if (!(authuser && *authuser)) pw = valpwd (user,pwd,argc,argv);