ports/57754: [PATCH] devel/subversion: repository creation, svnserve umask wrapper

Roman Neuhauser neuhauser at bellavista.cz
Wed Oct 8 16:30:23 UTC 2003


>Number:         57754
>Category:       ports
>Synopsis:       [PATCH] devel/subversion: repository creation, svnserve umask wrapper
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 08 09:30:20 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Roman Neuhauser
>Release:        FreeBSD 4.8-STABLE i386
>Organization:
>Environment:
System: FreeBSD freepuppy.bellavista.cz 4.8-STABLE FreeBSD 4.8-STABLE #3: Tue Aug 26 12:34:53 CEST 2003 roman at freepuppy.bellavista.cz:/usr/obj/usr/src/sys/FREEPUPPY2_5 i386


	
>Description:
	The attached patch provides two new features for the devel/subversion port:

    * WITH_SVNSERVE_WRAPPER: svnserve is wrapped by a shell script that sets umask 002.
      this is intended for repositories accessed through svn+ssh.

    * WITH_REPOSITORY_CREATION: repository is created for the user, permissions and
      ownerships are tweaked so that commiters don't lock up the repository by
      creating logs with wrong permissions.

>How-To-Repeat:
	
>Fix:

	

--- devel-subversion-wrapper+repocreate.patch begins here ---
diff -ruN devel/subversion-orig/Makefile devel/subversion/Makefile
--- devel/subversion-orig/Makefile	Wed Oct  1 12:53:56 2003
+++ devel/subversion/Makefile	Wed Oct  8 18:04:41 2003
@@ -30,6 +30,8 @@
 		--with-swig=no
 
 
+SVNREPOS?=	/home/svn/repos
+
 MAN1=	svn.1 svnadmin.1
 MANCOMPRESSED=	no
 
@@ -40,9 +42,11 @@
 CONFIGURE_ARGS+= \
 		--with-apxs=${APXS}
 PLIST_SUB+=	MOD_DAV_SVN=""
+SVNGROUP?=	www
 .else
 PLIST_SUB+=	MOD_DAV_SVN="@comment "
 PKGDEINSTALL=	NONEXISTENT
+SVNGROUP?=	svn
 .endif
 
 .if defined(WITH_APACHE2_APR)
@@ -57,6 +61,13 @@
 		--with-apr-util=${LOCALBASE}
 .endif
 
+.if defined(WITH_SVNSERVE_WRAPPER)
+PLIST_SUB+=	SVNSERVE_WRAPPER=""
+EXTRA_PATCHES=	${PATCHDIR}/build-outputs.mk.patch
+.else
+PLIST_SUB+=	SVNSERVE_WRAPPER="@comment "
+.endif
+
 pre-extract:
 .if !defined (BATCH)
 	@dialog --title "-- URGENT UPGRADE INFORMATION --" --clear --yesno \
@@ -80,6 +91,28 @@
 	@${ECHO_MSG} "by defining WITH_APACHE2_APR."
 .endif
 	@${ECHO_MSG}
+.if defined(WITH_SVNSERVE_WRAPPER)
+	@${ECHO_MSG} "svnserve wrapper enabled."
+.else
+	@${ECHO_MSG} "You can install the svnserve wrapper (sets umask 002)"
+	@${ECHO_MSG} "by defining WITH_SVNSERVE_WRAPPER."
+.endif
+	@${ECHO_MSG}
+.if defined(WITH_REPOSITORY_CREATION)
+	@${ECHO_MSG} "I will create (or use, if it exists) \"${SVNGROUP}\" group."
+	@${ECHO_MSG} "Make sure that all commiters are its members."
+.else
+	@${ECHO_MSG} "You can have the repository created for you by defining"
+	@${ECHO_MSG} "WITH_REPOSITORY_CREATION."
+	@${ECHO_MSG} ""
+	@${ECHO_MSG} "Make sure that:"
+	@${ECHO_MSG} "* all your svn users are members of a common group"
+	@${ECHO_MSG} "* this group is the group id of the db/ and locks/"
+	@${ECHO_MSG} "  subdirectories of your repository"
+	@${ECHO_MSG} "* the above subdirectories are writable by this group"
+	@${ECHO_MSG} ""
+.endif
+	@${ECHO_MSG}
 
 post-extract:
 	@${REINPLACE_CMD} 's/ldb/ldb4/g' ${WRKSRC}/configure
@@ -98,6 +131,38 @@
 	${MKDIR} ${DOCSDIR}
 	for f in BUGS CHANGES COMMITTERS COPYING HACKING INSTALL README; do \
 		${INSTALL_DATA} ${WRKSRC}/$$f ${DOCSDIR}; \
+	done
+.endif
+.if defined(WITH_SVNSERVE_WRAPPER)
+	@${INSTALL_SCRIPT} ${FILESDIR}/svnserve.wrapper ${PREFIX}/bin/svnserve
+.endif
+.if defined(WITH_REPOSITORY_CREATION) && !exists(${SVNREPOS})
+. if defined(WITH_SVNSERVE_WRAPPER)
+	@if /usr/sbin/pw groupshow "${SVNGROUP}" >/dev/null 2>&1; then \
+	    echo "You already have a group \"${SVNGROUP}\", so I will use it."; \
+	else \
+	    if /usr/sbin/pw groupadd ${SVNGROUP} -h -; \
+	    then \
+	        echo "Added group \"${SVNGROUP}\"."; \
+	    else \
+	        echo "Adding group \"${SVNGROUP}\" failed..."; \
+	        echo "Please create it, and try again."; \
+	        ${FALSE}; \
+	    fi; \
+	fi
+. endif
+	@${MKDIR} ${SVNREPOS}
+	@${PREFIX}/bin/svnadmin create ${SVNREPOS}
+	${CHGRP} ${SVNGROUP} ${SVNREPOS}/db ${SVNREPOS}/locks/db.lock
+	${CHMOD} g+w ${SVNREPOS}/db ${SVNREPOS}/locks/db.lock
+	for i in ${SVNREPOS}/db/* ; do \
+	    i=$${i##*/}; \
+	    case $$i in \
+	    DB_CONFIG) ;; \
+	    *) ${CHGRP} ${SVNGROUP} ${SVNREPOS}/db/$$i; \
+	       ${CHMOD} g+w ${SVNREPOS}/db/$$i; \
+	       ;; \
+	    esac; \
 	done
 .endif
 
diff -ruN devel/subversion-orig/files/build-outputs.mk.patch devel/subversion/files/build-outputs.mk.patch
--- devel/subversion-orig/files/build-outputs.mk.patch	Thu Jan  1 01:00:00 1970
+++ devel/subversion/files/build-outputs.mk.patch	Wed Oct  8 16:03:44 2003
@@ -0,0 +1,11 @@
+--- build-outputs.mk.orig	Wed Oct  8 16:01:40 2003
++++ build-outputs.mk	Wed Oct  8 16:02:00 2003
+@@ -447,7 +447,7 @@
+ 	cd subversion/svnadmin ; $(INSTALL_FS_BIN) svnadmin$(EXEEXT) $(DESTDIR)$(fs_bindir)/svnadmin$(EXEEXT)
+ 	cd subversion/svndumpfilter ; $(INSTALL_FS_BIN) svndumpfilter$(EXEEXT) $(DESTDIR)$(fs_bindir)/svndumpfilter$(EXEEXT)
+ 	cd subversion/svnlook ; $(INSTALL_FS_BIN) svnlook$(EXEEXT) $(DESTDIR)$(fs_bindir)/svnlook$(EXEEXT)
+-	cd subversion/svnserve ; $(INSTALL_FS_BIN) svnserve$(EXEEXT) $(DESTDIR)$(fs_bindir)/svnserve$(EXEEXT)
++	cd subversion/svnserve ; $(INSTALL_FS_BIN) svnserve$(EXEEXT) $(DESTDIR)$(fs_bindir)/svnserve.real$(EXEEXT)
+ 
+ install-fs-lib: subversion/libsvn_fs/libsvn_fs-1.la subversion/libsvn_repos/libsvn_repos-1.la subversion/libsvn_ra_local/libsvn_ra_local-1.la
+ 	$(MKDIR) $(DESTDIR)$(fs_libdir)
diff -ruN devel/subversion-orig/files/svnserve.wrapper devel/subversion/files/svnserve.wrapper
--- devel/subversion-orig/files/svnserve.wrapper	Thu Jan  1 01:00:00 1970
+++ devel/subversion/files/svnserve.wrapper	Wed Oct  8 16:05:40 2003
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+SVNSERVE=$(dirname $(realpath $0))/svnserve.real
+
+umask 002
+$SVNSERVE "$@"
+
diff -ruN devel/subversion-orig/pkg-plist devel/subversion/pkg-plist
--- devel/subversion-orig/pkg-plist	Wed Oct  1 12:53:56 2003
+++ devel/subversion/pkg-plist	Wed Oct  8 15:57:46 2003
@@ -3,6 +3,7 @@
 bin/svndumpfilter
 bin/svnlook
 bin/svnserve
+%%SVNSERVE_WRAPPER%%bin/svnserve.real
 bin/svnversion
 include/subversion-1/mod_dav_svn.h
 include/subversion-1/svn-revision.txt
--- devel-subversion-wrapper+repocreate.patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list