[Pkg-ocaml-maint-commits] [SCM] dh-ocaml packaging branch, master, updated. debian/0.4.1-21-g8a886dd

Mehdi Dogguy dogguy at pps.jussieu.fr
Wed May 20 12:02:02 UTC 2009


The following commit has been merged in the master branch:
commit a2d31ce0becd52a41f342364e09dff67d3000868
Author: Mehdi Dogguy <dogguy at pps.jussieu.fr>
Date:   Wed May 20 14:00:19 2009 +0200

    Add git helper scripts

diff --git a/tools/dom-git-checkout b/tools/dom-git-checkout
new file mode 100755
index 0000000..d8b22e8
--- /dev/null
+++ b/tools/dom-git-checkout
@@ -0,0 +1,24 @@
+#!/bin/bash
+set -e
+
+REMOTE_BRANCHES="upstream pristine-tar"
+
+PACKAGE="$1"
+if [ -z "$PACKAGE" ] ; then
+  echo "Usage: dom-git-checkout PKGNAME"
+  exit 1
+fi
+
+REPODIR="/git/pkg-ocaml-maint/packages/$PACKAGE.git"
+
+echo "I: cloning remote repository"
+git clone "git+ssh://git.debian.org/$REPODIR"
+
+echo "I: setting up remote tracking"
+(cd $PACKAGE
+ for branch in $REMOTE_BRANCHES ; do
+   git branch --track $branch remotes/origin/$branch
+ done)
+
+echo "I: all done, enjoy."
+
diff --git a/tools/dom-mrconfig b/tools/dom-mrconfig
new file mode 100755
index 0000000..d788fe5
--- /dev/null
+++ b/tools/dom-mrconfig
@@ -0,0 +1,111 @@
+#!/bin/bash
+set -e
+
+function msg() {
+    echo "I: $1"
+}
+
+function output() {
+    echo "$1" >> $OUTPUT
+}
+
+if [ "$1" = "-h" ] ; then
+    cat <<EOF
+Usage: dom-mrconfig [ -h ] [ CONFIG_FILE ]
+EOF
+    exit 0
+fi
+
+msg "Setting up output file"
+OUTPUT="$1"
+if [ -z "$OUTPUT" ] ; then
+    OUTPUT="mrconfig"
+fi
+
+msg "Retreiving package list"
+
+# Packages hosted in Git
+GIT_REPODIR="/git/pkg-ocaml-maint/packages/"
+GIT_PKGS=`ssh alioth.debian.org ls -1 $GIT_REPODIR | sed 's/.git$//'`
+
+# Packages hosted in Svn
+SVN_REPODIR="svn+ssh://svn.debian.org/svn/pkg-ocaml-maint/trunk"
+SVN_PKGS=`svn ls $SVN_REPODIR/packages | grep -v git-repo | sed 's/\///'`
+
+# Packages not migrated to Git
+## lablgtk has been migrated to Git and its new git repository name is lablgtk2
+SVN_REMAINING_PKGS=`echo "${SVN_PKGS}" | grep -F "${GIT_PKGS}" -x -v | grep -x -v lablgtk`
+
+msg "Generating mrconfig file in $OUTPUT"
+
+# Backup the output file if it exists
+if [ -f $OUTPUT ]; then
+    mv $OUTPUT ${OUTPUT}\~
+fi
+
+# Setting up mr lib
+output "[DEFAULT]
+lib=
+      msg () {
+        echo \"I: \$1\"
+      }
+      git_checkout () {
+        git clone git+ssh://git.debian.org$GIT_REPODIR\$1.git &&
+        cd \$1 &&
+        { git branch --track upstream remotes/origin/upstream || true; } &&
+        { git branch --track pristine-tar remotes/origin/pristine-tar || true; }
+      }
+      svn_checkout () {
+        svn co $SVN_REPODIR/\$1
+      }
+      update_check () {
+        if [ -d .git ]; then
+          git pull
+        else
+          svn update
+          if [ -f \"trunk/README\" ] && [[ \"\`cat trunk/README\`\" =~ \"This package has moved\" ]]; then       
+            cd ..
+            msg \"Deleting old svn repository: packages/\$1\"
+            rm -rf \$1
+            msg \"Checkout new git repository\"
+            git_checkout \$1
+          fi
+        fi
+      }
+"
+
+# Sections for Git repositories
+for i in $GIT_PKGS; do
+    output "[packages/$i]
+checkout = git_checkout $i
+update = update_check $i
+"
+done
+
+# Sections for Svn repositories
+for i in $SVN_REMAINING_PKGS; do
+    output "[packages/$i]
+checkout = svn_checkout packages/$i
+update = update_check $i
+"
+done
+
+msg "Setting up sections for projects and tools"
+
+# Adding other useful repositories
+for i in  projects tools; do
+  output "[$i]
+checkout = svn_checkout $i
+"
+done
+
+# Warn if changes have been made
+if [ -f ${OUTPUT}\~ ] && diff -u ${OUTPUT}\~ ${OUTPUT}; then
+    rm ${OUTPUT}\~
+    msg "no changes"
+else
+    msg "$OUTPUT changed!"
+fi
+
+# Finish
+msg "all done, enjoy: mr -c $OUTPUT [checkout,update,...]"
diff --git a/tools/dom-new-git-repo b/tools/dom-new-git-repo
new file mode 100755
index 0000000..889d2e9
--- /dev/null
+++ b/tools/dom-new-git-repo
@@ -0,0 +1,97 @@
+#!/bin/bash
+set -e
+
+NOTIFY_EMAIL="pkg-ocaml-maint-commits at lists.alioth.debian.org"
+CIA_PROJECT="debian-ocaml-maint"
+
+PACKAGE="$1"
+TARBALL="$2"
+if [ -z "$PACKAGE" ] ; then
+  echo "Usage: dom-new-git-repo PKGNAME [ UPSTREAM_TARBALL ]"
+  exit 1
+fi
+if [ -z "$TARBALL" ] ; then
+  INJECT_TARBALL="no"
+else
+  INJECT_TARBALL="yes"
+fi
+
+ALIOTH="alioth.debian.org"
+REPODIR="/git/pkg-ocaml-maint/packages/$PACKAGE.git"
+
+
+initialize_alioth_repos () {
+echo "I: initialize (empty) remote repository on alioth.d.o"
+# see http://wiki.debian.org/Alioth/Git
+cat <<EOCMD | ssh $ALIOTH
+umask 002
+set -e
+
+# create repo and add some metadata
+mkdir "$REPODIR"
+cd "$REPODIR"
+git --bare init --shared
+echo "$PACKAGE packaging" > description
+EOCMD
+}
+
+
+setup_notifications () {
+echo "I: set up commit notification (mail and CIA)"
+cat <<EOCMD | ssh $ALIOTH
+umask 002
+
+cd "$REPODIR"
+chmod a+x hooks/post-update
+git config --add hooks.mailinglist "$NOTIFY_EMAIL"
+git config --add hooks.bcc "${PACKAGE}_cvs at packages.qa.debian.org"
+git config --add hooks.cia-project "$CIA_PROJECT"
+git config --add hooks.cia-use-rpc 1
+echo "#!/bin/sh" > hooks/post-receive
+echo "exec /usr/local/bin/git-commit-notice" >> hooks/post-receive
+chmod 775 hooks/post-receive
+EOCMD
+}
+
+
+git_push () {
+   echo "I: pushing first changes to alioth.d.o"
+   git remote add origin "git+ssh://git.debian.org/$REPODIR"
+   git push --all
+   git push --tags
+}
+
+initialize_alioth_repos
+
+if [ "$INJECT_TARBALL" = "yes" ] ; then
+  setup_notifications
+  echo "I: check in upstream tarball and setup branch layout"
+  tmpdir=`mktemp -dt new-git-tmp.XXXXXXXXXX`
+  trap "rm -rf $tmpdir" EXIT
+  if [ "${TARBALL:0:1}" != "/" ] ; then
+    TARBALL="`pwd`/$TARBALL"
+  fi
+  (cd $tmpdir
+   git init
+   # see #475554
+   #git commit --allow-empty -m 'commit root'
+   #git branch upstream
+   git-import-orig --pristine-tar --no-dch "$TARBALL"
+   git_push)
+elif git show-ref --quiet 2>/dev/null ; then
+  echo "I: we are in a git repos"
+  git_push
+  setup_notifications
+else
+  setup_notifications
+fi
+
+
+echo "I: all done. You can now checkout your new git repo with:"
+echo
+echo "   git clone git+ssh://git.debian.org/$REPODIR"
+echo
+echo "I: or, for extra goodies (recommended):"
+echo
+echo "   dom-git-checkout $PACKAGE"
+echo

-- 
dh-ocaml packaging



More information about the Pkg-ocaml-maint-commits mailing list