[pkg-kolab] r1357 - kolab-cyrus-imapd/scripts

Mathieu Parent sathieu at alioth.debian.org
Sun Oct 4 15:08:55 UTC 2009


Author: sathieu
Date: 2009-10-04 15:08:55 +0000 (Sun, 04 Oct 2009)
New Revision: 1357

Added:
   kolab-cyrus-imapd/scripts/cyrus-to-kolab
Log:
New script to convert from cyrus-imapd-2.2 to kolab-cyrus


Added: kolab-cyrus-imapd/scripts/cyrus-to-kolab
===================================================================
--- kolab-cyrus-imapd/scripts/cyrus-to-kolab	                        (rev 0)
+++ kolab-cyrus-imapd/scripts/cyrus-to-kolab	2009-10-04 15:08:55 UTC (rev 1357)
@@ -0,0 +1,365 @@
+#!/bin/bash
+
+# Script to merge the differences between the Debian cyrus package and the
+# kolab-cyrus package into a newer cyrus package thus creating a newer
+# kolab-cyrus package.
+#
+# Usage: cyrus-to-kolab cyrus-dir kolab-trunk dest-dir
+#
+# dest-dir will be created
+
+# Written by Mathieu Parent <sathieu at debian.org>, 2009.
+#
+# This program is made available under the same license as the
+# kolab-cyrus-imapd package it applies to.
+
+set -e
+
+#==============================================================================
+# Config
+kolab_maintainer="Debian Kolab Maintainers <pkg-kolab-devel at lists.alioth.debian.org>"
+kolab_uploaders="Noèl Köthe <noel at debian.org>, Steffen Joeris <white at debian.org>, Peter Eisentraut <petere at debian.org>, Mathieu Parent <sathieu at debian.org>"
+kolab_patches='100-kolab-imapd.dpatch
+101-fix_Makefile.in.dpatch
+105-cyradm.sh.dpatch
+130-kolab-imapd-goodchars.dpatch
+140-kolab-ldap.dpatch
+150-kolab-auth_unix.dpatch
+160-kolab-imapd.folderchar.dpatch
+170-ldap-deprecated.dpatch'
+
+kolab_patches_disabled='45-kolab2-annotations.dpatch'
+#==============================================================================
+# Args and constructed variables
+me=$(basename $0)
+
+cyrus_dir=$1
+cyrus_dir_debian=$cyrus_dir/debian
+trunk_dir=$2
+trunk_dir_debian=$trunk_dir/debian
+dest_dir=$3
+dest_dir_debian=$dest_dir/debian
+
+if [ -e $dest_dir ]; then
+	error "directory $dest_dir already exists"
+fi
+
+#==============================================================================
+# Functions
+error() {
+	echo "$me: $1" 1>&2
+	exit 1
+}
+
+package_name() {
+	grep-dctrl -r -F Source -n -s Source .  $1/debian/control
+}
+
+package_rename() {
+	local old=$1
+	case $old in
+		cyrus-common-2.2)	new=kolab-cyrus-common;;
+		cyrus-imapd-2.2)	new=kolab-cyrus-imapd;;
+		cyrus-pop3d-2.2)	new=kolab-cyrus-pop3d;;
+		cyrus-admin-2.2)	new=kolab-cyrus-admin;;
+		cyrus-clients-2.2)	new=kolab-cyrus-clients;;
+		libcyrus-imap-perl22)	new=kolab-libcyrus-imap-perl;;
+
+		# removed packages:
+		cyrus-doc-2.2)		new=;;
+		cyrus-murder-2.2)	new=;;
+		cyrus-nntpd-2.2)	new=;;
+		cyrus-dev-2.2)		new=;;
+
+		*)			error "unknown package $old";;
+	esac
+	echo $new
+}
+remove_package() {
+	local controlfile=$1
+	local pkg=$2
+    awk "/^Package: $pkg/,/^ ?$/{next}1" $controlfile > /tmp/u
+    cp /tmp/u $controlfile
+    rm /tmp/u
+}
+
+rename_and_conflicts_package() {
+	local controlfile=$1
+	local old=$2
+	local new=$3
+	sed -i "s/$old/$new/" $controlfile
+    awk "/^Package: $new/,/^ ?$/{sub(/^Conflicts: .*/,\"&, $old\");print;next}1" $controlfile > /tmp/u
+    awk "/^Package: $new/,/^ ?$/{sub(/^Replaces: .*/,\"&, $old\");print;next}1" /tmp/u > $controlfile
+    awk "/^Package: $new/,/^ ?$/{sub(/^Provides: .*/,\"&, $old\");print;next}1" $controlfile > /tmp/u
+    cp /tmp/u $controlfile
+    rm /tmp/u
+}
+
+map_names() {
+    file0=$1
+    for pkg0 in $(cd $cyrus_dir && dh_listpackages); do
+    	new0=$(package_rename $pkg0)
+        if [ -z "$new0" ]; then
+	        new0=$pkg0
+        fi
+    	sed -i "s/$pkg0/$new0/" $file0
+    	#recover CVS ids:
+    	sed -i "s/\$Id: $new0/\$Id: $pkg0/" $file0
+    done
+}
+
+map_daemon() {
+    file0=$1
+    sed -i 's at cyrus2.2@kolab-cyrus at g' $file0
+	#recover CVS ids:
+	sed -i "s/\$Id: cyrus-common-2.2.kolab-cyrus.init/\$Id: cyrus-common-2.2.cyrus2.2.init/" $file0
+}
+
+remove_lines() {
+    file0=$1
+    line0=$2
+    tmp0=`grep -v "$line0" "$file0"`
+    cat <<EOF > $file0
+$tmp0
+EOF
+
+}
+
+#==============================================================================
+# Copy
+mkdir $dest_dir
+cp -a $cyrus_dir_debian $dest_dir_debian
+
+#==============================================================================
+# unwanted files
+rm $dest_dir_debian/{README.Debian.simpleinstall,README.exim,README.sendmail,TODO.Debian,UPGRADE.Debian,*.pam,cyrus*-common*.NEWS}
+
+#==============================================================================
+# debian/changelog
+
+latest_cyrus_version=$(cd $cyrus_dir && dpkg-parsechangelog | grep-dctrl -r -n -s Version .)
+latest_cyrus_version_upstream=$(echo $latest_cyrus_version | sed 's/-[0-9]*$//')
+
+latest_kolab_version=$(cd $trunk_dir && dpkg-parsechangelog | grep-dctrl -r -n -s Version .)
+latest_kolab_version_upstream=$(echo $latest_kolab_version | sed 's/-[0-9]*$//')
+latest_kolab_version_debian=$(echo $latest_kolab_version | sed 's/^.*-\([0-9]*\)$/\1/')
+
+#search last cyrus version in trunk
+i=0
+until [ $i == -1 ]; do
+    latest_kolab_cyrus_version=$(cd $trunk_dir && dpkg-parsechangelog --offset $i --count 1 | grep-dctrl -r -n -s Version .)
+    latest_kolab_cyrus_package=$(cd $trunk_dir && dpkg-parsechangelog --offset $i --count 1 | grep-dctrl -r -n -s Source .)
+    i=$((i+1))
+    if [ $latest_kolab_cyrus_package = "cyrus-imapd-2.2" ]; then
+        i=-1
+    fi
+done
+grep -B 10000 "cyrus-imapd-2.2 ($latest_kolab_cyrus_version)" "$cyrus_dir_debian/changelog" \
+ | head -n-1 \
+ > "$dest_dir_debian/changelog"
+cat "$trunk_dir_debian/changelog" >> "$dest_dir_debian/changelog"
+
+if [ $latest_kolab_version_upstream = $latest_cyrus_version_upstream ]; then
+    new_kolab_version="$latest_cyrus_version_upstream-$((latest_kolab_version_debian+1))"
+else
+    new_kolab_version="$latest_cyrus_version_upstream-1"
+fi
+
+# bug #549469 in devscripts (debchange) should be solved
+debchange --changelog "$dest_dir/debian/changelog" --package=kolab-cyrus-imapd --newversion="$new_kolab_version" --force-bad-version 'Synced against cyrus-imapd package'
+
+#==============================================================================
+# debian/control
+
+path=$dest_dir_debian/control
+file=control
+#Maintainer/Uploaders
+sed -i "s/Maintainer: .*/Maintainer: $kolab_maintainer/" $path
+sed -i "s/Uploaders: .*/Uploaders: $kolab_uploaders/" $path
+
+#Builddeps
+sed -i "s/^Build-Depends: .*/&, libldap2-dev/" $path
+
+#VCS
+sed -i 's|Vcs-Browser: https://mail.incase.de/viewcvs/trunk/?root=cyrus22|Vcs-Browser: http://svn.debian.org/wsvn/pkg-kolab/kolab-cyrus-imapd/trunk/|' $path
+sed -i 's|https://mail.incase.de/svn/cyrus22/trunk|svn://svn.debian.org/pkg-kolab/kolab-cyrus-imapd/trunk/|' $path
+
+#Renaming and removing
+for pkg in $(cd $cyrus_dir && dh_listpackages); do
+	new=$(package_rename $pkg)
+    if [ -z "$new" ]; then
+	    remove_package $path $pkg
+    else
+        rename_and_conflicts_package $path $pkg $new
+    fi
+done
+
+# removed packages:
+sed -i "s/, cyrus-murder-2.2, cyrus-nntpd-2.2, cyrus-doc-2.2//" $path
+
+#Description prefixed by "Kolab "
+sed -i "s/^Description: \(.*\)/Description: Kolab \\1/" $path
+
+#Various cleaning
+sed -i "s/ and NNTP//" $path
+sed -i 's/| cyrus-murder-2.2 | cyrus-nntpd-2.2//' $path
+sed -i 's|The cyrus22-imapd and/or cyrus22-pop3d packages|The kolab-cyrus-imapd and/or kolab-cyrus-pop3d packages|' $path
+
+
+#==============================================================================
+# debian/copyright
+
+path=$dest_dir_debian/copyright
+file=copyright
+cat <<HEADER > $dest_dir_debian/copyright
+This package is a fork of the cyrus package. The Debian Kolab Maintainers
+maintain a separate source package for use with Kolab.
+The Cyrus Maintainers know and accept this.
+This package contains of some additional patches from the Kolab upstream
+which are all licened under the same license as the cyrus upstream.
+
+The specific Kolab patches are:
+$kolab_patches
+
+All patches are made by Kolab Upstream.
+
+We also include the full copyright notice from the Debian Cyrus package as we
+used the original packaging (thanks to the Debian Cyrus Maintainers for their
+help).
+
+HEADER
+#do
+
+cat $cyrus_dir_debian/copyright >> $dest_dir_debian/copyright
+
+#==============================================================================
+# debian/README.Debian
+
+path=$dest_dir_debian/README.Debian
+file=README.Debian
+cat <<HEADER > $dest_dir_debian/README.Debian
+Kolab-Cyrus IMAP for Debian
+
+This is a special version of the Cyrus package to run in a Kolab system.
+Please note that this package is only for use with Kolab.  If you need
+Cyrus for other purposes please use the cyrus-imapd-2.2 package from the
+Debian Cyrus Team.  Our advice is to always install the kolabd package,
+which will install this one automatically, so there is normally no need
+to manually install this package.
+
+At this point we want to thank the Cyrus Team for their help.  We will
+keep in contact with them about changes and coordinate our Cyrus work
+with them.
+
+-- Steffen Joeris <steffen.joeris at skolelinux.de>  Tue, 24 Jan 2006 13:49:19 +0000
+
+
+Information about the original Cyrus package follows.  Be aware that the
+file names will be different in some cases.
+
+
+HEADER
+#do
+
+cat $cyrus_dir_debian/README.Debian >> $dest_dir_debian/README.Debian
+
+#==============================================================================
+# debian/patches
+for patch in $kolab_patches; do
+    cp $trunk_dir_debian/patches/$patch $dest_dir_debian/patches/$patch
+done
+cat <<EOF >> $dest_dir_debian/patches/00list
+$kolab_patches
+EOF
+
+for patch in $kolab_patches_disabled; do
+    cp $trunk_dir_debian/patches/$patch $dest_dir_debian/patches/$patch
+done
+
+#==============================================================================
+# debian/rules
+path=$dest_dir_debian/rules
+file=rules
+
+map_names $path
+sed -i 's/dh_installdocs -p kolab-cyrus-admin -p cyrus-doc-2.2/dh_installdocs -p kolab-cyrus-admin/'  $path
+sed -i 's/dh_installchangelogs -p cyrus-doc-2.2/#dh_installchangelogs -p cyrus-doc-2.2/'  $path
+sed -i 's/dh_installinit -p $(MAINPKG) --noscripts --name=cyrus2.2/dh_installinit -p $(MAINPKG) --noscripts --name=kolab-cyrus/'  $path
+sed -i 's/dh_installcron -a --name=cyrus22/dh_installcron -a --name=kolab-cyrus/' $path
+
+#==============================================================================
+# pkg.*
+for pkg in $(cd $cyrus_dir && dh_listpackages); do
+	new=$(package_rename $pkg)
+    if [ -z "$new" ]; then
+	    rm $dest_dir_debian/${pkg}.*
+    else
+        for path in $dest_dir_debian/$pkg.*
+        do
+            file=`basename $path`
+            newfile=`echo $file | sed "s/$pkg/$new/"`
+			case $newfile in *.default|*.init|*.cron.*)
+				newfile=$(echo $newfile | sed 's/\.cyrus2\.*2\./.kolab-cyrus./')
+			esac
+            mv $dest_dir_debian/$file $dest_dir_debian/$newfile
+            map_names $dest_dir_debian/$newfile
+            case $newfile in *.install|*.dirs)
+                remove_lines $dest_dir_debian/$newfile '^etc/pam.d'
+			esac
+            case $newfile in *.postinst|*.postrm|*.preinst|*.prerm|*.cron.daily|*.init)
+                map_daemon $dest_dir_debian/$newfile
+			esac
+			case $newfile in *.init)
+                sed -i 's at cyrus 2.2 at kolab-cyrus@g' $dest_dir_debian/$newfile
+			esac
+        done
+    fi
+done
+
+remove_lines $dest_dir_debian/kolab-cyrus-common.docs '^debian/UPGRADE.Debian'
+map_names $dest_dir_debian/source.lintian-overrides
+
+#==============================================================================
+# Copy and fix PO files
+
+for x in $dest_dir_debian/po/*.po; do
+	echo '# AUTOMATICALLY GENERATED -- send updates to '$(package_name $cyrus_dir)' package' >$x.tmp
+	msgcat --no-wrap $x | sed -r -e 's,/usr/share/doc/(cyrus[^/]+)/,/usr/share/doc/kolab-cyrus-common/,g' | msgcat - >> $x.tmp
+	mv $x.tmp $x
+done
+
+sed -r -i -e 's,/usr/share/doc/(cyrus[^/]+)/,/usr/share/doc/kolab-cyrus-common/,g' $dest_dir_debian/po/templates.pot
+map_names $dest_dir_debian/po/POTFILES.in
+
+#==============================================================================
+# Other files
+
+#svn-deblayout
+cp $trunk_dir_debian/svn-deblayout $dest_dir_debian
+
+#cyrus.conf
+sed -i 's/^\([ \t]*\)nntp\([ \t]\+\)/\1#nntp\2/' $dest_dir_debian/cyrus.conf
+sed -i 's/^\([ \t]*\)#lmtp\([ \t]\+\)cmd="lmtpd"\([ \t]\+\)listen="localhost:lmtp"/\1lmtp\2cmd="lmtpd -a"\3listen="localhost:2003"/' $dest_dir_debian/cyrus.conf
+
+#cyrus-makedirs
+sed -i 's@/etc/default/cyrus2.2@/etc/default/kolab-cyrus at g' $dest_dir_debian/cyrus-makedirs
+
+#cyrus-makedirs.8
+sed -i 's@/etc/default/cyrus2.2@/etc/default/kolab-cyrus@' $dest_dir_debian/cyrus-makedirs.8
+
+#executable.files
+map_names $dest_dir_debian/executable.files
+sed -i 's at cyrus2.2@kolab-cyrus@' $dest_dir_debian/executable.files
+
+#imapd.conf
+sed -i 's@^unixhierarchysep: no at unixhierarchysep: yes@' $dest_dir_debian/imapd.conf
+sed -i 's@^#admins: cyrus at admins: manager cyrus@' $dest_dir_debian/imapd.conf
+sed -i 's@^popminpoll: 1@# kolab note: this is disabled to get no errors at the client\n# in a groupware environment a client will connect more than\n# once in a minute\n#popminpoll: 1@' $dest_dir_debian/imapd.conf
+sed -i 's@^#sasl_mech_list: PLAIN at sasl_mech_list: PLAIN@' $dest_dir_debian/imapd.conf
+sed -i 's@^#virtdomains: userid@# Kolab uses ldap for virtual domains\nvirtdomains: ldap@' $dest_dir_debian/imapd.conf
+sed -i 's@^sasl_pwcheck_method: auxprop at sasl_pwcheck_method: saslauthd@' $dest_dir_debian/imapd.conf
+map_names $dest_dir_debian/imapd.conf
+
+
+
+


Property changes on: kolab-cyrus-imapd/scripts/cyrus-to-kolab
___________________________________________________________________
Added: svn:executable
   + *




More information about the pkg-kolab-devel mailing list