[pkg-kolab] r520 - in kolab-cyrus-imapd: . scripts

Peter Eisentraut petere at alioth.debian.org
Wed Nov 8 12:02:03 CET 2006


Author: petere
Date: 2006-11-08 12:02:03 +0100 (Wed, 08 Nov 2006)
New Revision: 520

Added:
   kolab-cyrus-imapd/scripts/
   kolab-cyrus-imapd/scripts/kolab-cyrus-merge
Log:
Added kolab-cyrus-merge script

Added: kolab-cyrus-imapd/scripts/kolab-cyrus-merge
===================================================================
--- kolab-cyrus-imapd/scripts/kolab-cyrus-merge	2006-11-08 09:38:37 UTC (rev 519)
+++ kolab-cyrus-imapd/scripts/kolab-cyrus-merge	2006-11-08 11:02:03 UTC (rev 520)
@@ -0,0 +1,156 @@
+#!/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: kolab-cyrus-merge cyrus-old-dir kolab-old-dir cyrus-new-dir
+#
+# The kolab-new-dir will be created in the current directory.
+
+# Written by Peter Eisentraut <peter.eisentraut at credativ.de>, 2006.
+#
+# This program is made available under the same license as the
+# kolab-cyrus-imapd package it applies to.
+
+set -e
+set -u
+shopt -s dotglob failglob
+
+
+me=$(basename $0)
+
+
+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
+}
+
+
+MERGE='merge -L NEW -L OLD_CYRUS -L OLD_KOLAB'
+
+
+cyrus_old_dir=$1
+kolab_old_dir=$2
+cyrus_new_dir=$3
+
+cyrus_old=$(basename $cyrus_old_dir)
+kolab_old=$(basename $kolab_old_dir)
+cyrus_new=$(basename $cyrus_new_dir)
+
+cyrus_new_version=$(cd $cyrus_new_dir && dpkg-parsechangelog | grep-dctrl -r -n -s Version . | sed 's/-[0-9]*$//')
+kolab_new="kolab-cyrus-imapd-${cyrus_new_version}"
+kolab_new_dir=$kolab_new
+
+if [ -e $kolab_new_dir ]; then
+	error "directory $kolab_new_dir already exists"
+fi
+
+cp -a $cyrus_new_dir $kolab_new_dir
+
+
+##
+## Remove unwanted files
+##
+
+rm $kolab_new_dir/debian/{README.Debian.simpleinstall,README.exim,README.sendmail,TODO.Debian,UPGRADE.Debian,*.pam,cyrus*-common*.NEWS}
+
+
+##
+## Copy and merge general files
+##
+
+for file in \
+	changelog control copyright cyrus.conf cyrus-makedirs imapd.conf rules README.Debian \
+	cyrus-makedirs.8 executable.files source.lintian-overrides \
+	patches/00list patches/01-fix_Makefile.in.dpatch patches/45-kolab2-annotations.dpatch patches/61-64bit-quota.dpatch patches/65-sieveshell-enhancements.dpatch \
+	po/POTFILES.in
+do
+	$MERGE $kolab_new_dir/debian/$file $cyrus_old_dir/debian/$file $kolab_old_dir/debian/$file || [ $? -eq 1 ]
+done
+
+
+##
+## Copy and merge package-specific/debhelper files
+##
+
+for pkg in $(cd $cyrus_old_dir && dh_listpackages); do
+	new=$(package_rename $pkg)
+	if [ -z "$new" ]; then
+		rm $kolab_new_dir/debian/${pkg}.*
+	else
+		for file in $kolab_new_dir/debian/${pkg}.*; do
+			newcfile=$file
+			newkfile=$(echo $newcfile | sed "s,/$pkg,/$new,")
+			oldcfile=$newcfile
+			oldkfile=$newkfile
+
+			case $newkfile in *.cron.*)
+				oldcfile=$(echo $oldcfile | sed 's/\.cyrus22\././')
+				oldkfile=$(echo $oldkfile | sed 's/\.cyrus22\././')
+				;;
+			esac
+			case $newkfile in *.default|*.init|*.cron.*)
+				newkfile=$(echo $newkfile | sed 's/\.cyrus2\.*2\./.kolab-cyrus./')
+				oldkfile=$(echo $oldkfile | sed 's/\.cyrus2\.*2\./.kolab-cyrus./');;
+			esac
+			case $newkfile in *.install)
+				oldcfile=$(echo $oldcfile | sed 's/\.install$/.files/')
+				oldkfile=$(echo $oldkfile | sed 's/\.install$/.files/');;
+			esac
+			mv $file $newkfile
+
+			if [ ! -e $cyrus_old_dir/debian/$(basename $oldcfile) ]; then
+				continue
+			fi
+			$MERGE $newkfile $cyrus_old_dir/debian/$(basename $oldcfile) $kolab_old_dir/debian/$(basename $oldkfile) || [ $? -eq 1 ]
+		done
+	fi
+done
+
+
+##
+## Copy and fix PO files
+##
+
+for x in $kolab_new_dir/debian/po/*.po; do
+	echo '# AUTOMATICALLY GENERATED -- send updates to '$(package_name $cyrus_new_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
+
+
+##
+## Copy patches
+##
+
+for file in $kolab_old_dir/debian/patches/1[0-9][0-9]-*.dpatch; do
+	cp $file $kolab_new_dir/debian/patches/
+done


Property changes on: kolab-cyrus-imapd/scripts/kolab-cyrus-merge
___________________________________________________________________
Name: svn:executable
   + *




More information about the pkg-kolab-devel mailing list