#!/bin/sh set -e old_version=$1 if [ $# -gt 1 ]; then echo "Usage: $0 [old upstream version]" >&2 exit 1; fi echo "Checking if we are in branches/upstream..." if ! svn info | grep -q '^URL: svn+ssh://svn.noreply.org/svn/pkg-cvs2cl/branches/upstream$'; then echo "Are we not in branches/upstream?" >&2 exit 1 fi if [ -z "$old_version" ]; then old_version=`cvs status cvs2cl.pl | grep 'Working revision:' | sed -e 's/.*Working revision:[ \t]*//'` fi if [ -z "$old_version" ]; then echo "Old version is empty. This should not be." exit 1; fi old_tag=upstream_version_`echo $old_version | sed -e 's/\./_/g'` echo "Checking if old tag for upstream version exists" if ! svn ls http://svn.noreply.org/svn/pkg-cvs2cl/tags/$old_tag >/dev/null 2>&1; then echo "Old tag $old_tag does not already exists [you can pass one manually]" >&2 exit 1 fi echo "Updating files from upstream cvs" cvs up COPYING TODO cvs2cl.pl index.html cvs2cl -w -S --utc --no-wrap version=`cvs status cvs2cl.pl | grep 'Working revision:' | sed -e 's/.*Working revision:[ \t]*//'` tag=upstream_version_`echo $version | sed -e 's/\./_/g'` dirname="cvs2cl-$version" dirnameUS="cvs2cl_$version" date=`822-date` if [ -z "$version" ]; then echo "New version is empty. This should not be." exit 1; fi echo "Checking if tag for upstream version exists" if svn ls http://svn.noreply.org/svn/pkg-cvs2cl/tags/$tag >/dev/null 2>&1; then echo "Tag $tag already exists" >&2 exit 1 fi echo "Commit new upstream version" svn ci -m 'Update from upstream' COPYING TODO cvs2cl.pl index.html CVS ChangeLog echo "Copying to tag" svn cp -m "Upstream version $version" \ svn+ssh://svn.noreply.org/svn/pkg-cvs2cl/branches/upstream \ svn+ssh://svn.noreply.org/svn/pkg-cvs2cl/tags/$tag cd .. echo "Checking out tag" svn co svn+ssh://svn.noreply.org/svn/pkg-cvs2cl/tags/$tag $tag cd $tag echo "Removing CVS Directory from tag" svn rm CVS svn ci -m 'Removing CVS Directory from tag' CVS cat > README.ORIGTARGZ << EOF This orig.tar.gz was build on $date from a cvs checkout of cvs -d :pserver:anonymous@cvs.red-bean.com:/usr/local/cvs login (password the key) cvs -d :pserver:anonymous@cvs.red-bean.com:/usr/local/cvs co cvs2cl since upstream does not provide a .tar.gz file for download. cvs2cl was at revision $version at that time. There are a lot more files in the CVS, but this tarball only includes cvs2cl.pl and 3 or 4 other files. The ChangeLog was created using cvs2cl itself. -- Peter Palfrader EOF echo "Adding README.ORIGTARGZ" svn add README.ORIGTARGZ svn ci -m 'Document where this comes from' README.ORIGTARGZ cd .. rm -rf $tag echo "Exporting tag $tag" svn export http://svn.noreply.org/svn/pkg-cvs2cl/tags/$tag $dirname tar czf $dirnameUS.orig.tar.gz $dirname cd trunk svn up echo "Removing old README.ORIGTARGZ from trunk" svn rm README.ORIGTARGZ svn ci -m 'Removing old README.ORIGTARGZ' svn up echo "Merging changes" if ! svn merge svn+ssh://svn.noreply.org/svn/pkg-cvs2cl/tags/$old_tag svn+ssh://svn.noreply.org/svn/pkg-cvs2cl/tags/$tag . ; then echo "Merging failed, You are on your own from now on." exit 1 fi echo "Now run (in trunk):" echo " svn ci -m 'Merge in changes from $version'" echo " dch --newversion '$version-1' 'New upstream version.'" echo " svn ci -m 'Update debian changelog for new upstream version $version'"