[Pkg-kde-commits] rev 1088 - scripts

Adeodato Simó dato-guest@costa.debian.org
Sun, 22 May 2005 10:16:02 +0000


Author: dato-guest
Date: 2005-05-22 10:16:01 +0000 (Sun, 22 May 2005)
New Revision: 1088

Added:
   scripts/pull-kde-branch
Log:
Commited script to automatize branch pulls from SVN.


Added: scripts/pull-kde-branch
===================================================================
--- scripts/pull-kde-branch	2005-05-22 07:14:20 UTC (rev 1087)
+++ scripts/pull-kde-branch	2005-05-22 10:16:01 UTC (rev 1088)
@@ -0,0 +1,70 @@
+#!/bin/bash
+
+# $Id$
+# Magic script to make branch pulls from KDE SVN. Invoke it from a
+# toplevel dir (i.e., debian/ exists) and let it figure out what to do.
+# (C) 2005, Adeodato Simó <asp16@alu.ua.es>
+# GPL'ed code follows.
+
+set -e
+
+KDE_SVN=svn://anonsvn.kde.org/home/kde
+
+dh_testdir
+
+# Find out module and version
+dpkg-parsechangelog | awk '
+
+    /^Source/   { printf("%s ", $2) }
+    /^Version/  {
+                  sub(/^[0-9]+:/, "", $2)
+                  sub(/-[^-]+$/,  "", $2)
+		  printf("%s ", $2)
+                  sub(/\.[0-9]+$/, "", $2)
+                  print $2
+                }
+
+    ' | { read MODULE VERSION MAJOR_VERSION
+
+# Determine the revision of the latest pull
+# (empty string if there has been none)
+shopt -s nullglob
+LATEST_PULL=$(
+               echo debian/patches/*_${MODULE}_branch_r*.diff |
+               tail -1 |
+               sed -re 's/.*_branch_r([0-9]+).*/\1/'
+             )
+
+if [ -z "$LATEST_PULL" ]; then
+    echo "This is the first pull for $MODULE $VERSION."
+    ARG1="$KDE_SVN/tags/KDE/$VERSION/$MODULE"
+    ARG2="$KDE_SVN/branches/KDE/$MAJOR_VERSION/$MODULE"
+else
+    echo "Patch until revision $LATEST_PULL exists."
+    ARG1="-r$LATEST_PULL:HEAD"
+    ARG2="$KDE_SVN/branches/KDE/$MAJOR_VERSION/$MODULE"
+fi
+
+# Get branch from the repo
+TMP_PATCH=$(mktemp debian/patches/branch.XXXXXX)
+trap "rm -f $TMP_PATCH" EXIT
+
+echo "Getting diff file from server..."
+svn diff "$ARG1" "$ARG2" | filterdiff -x 'debian/*' >${TMP_PATCH}
+
+# Find out the revision of this new pull, unless empty
+# Gross hack coming...
+if [ ! -s ${TMP_PATCH} ]; then
+    echo "Diff file was empty, no patch created."
+    exit
+else
+    NEW_REVISION=$(sed -rne '4s/.*revision ([0-9]+).*/\1/p' ${TMP_PATCH})
+fi
+
+# Move patch to its final destination
+DEST="debian/patches/01_${MODULE}_branch_r$NEW_REVISION.diff"
+mv ${TMP_PATCH} ${DEST}
+
+echo "Created patch ${DEST}."
+
+}


Property changes on: scripts/pull-kde-branch
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Id