add tagging capabilities and cli options
authorMarius Mauch <genone@gentoo.org>
Sat, 9 Feb 2008 15:39:49 +0000 (15:39 -0000)
committerMarius Mauch <genone@gentoo.org>
Sat, 9 Feb 2008 15:39:49 +0000 (15:39 -0000)
svn path=/main/trunk/; revision=9312

mkrelease.sh

index a92413f9262acaf9fdc6962ed75b30c1d86603f1..098c80d1ba687b087e471ae582d4d50f178911e1 100755 (executable)
@@ -3,13 +3,32 @@
 RELEASE_BUILDDIR=${RELEASE_BUILDDIR:-/var/tmp/portage-release}
 SOURCE_DIR=${RELEASE_BUILDDIR}/checkout
 BRANCH=${BRANCH:-trunk}
-REPOSITORY=svn+ssh://cvs.gentoo.org/var/svnroot/portage/main/${BRANCH}
+REPOSITORY=svn+ssh://cvs.gentoo.org/var/svnroot/portage/main
+SVN_LOCATION=${REPOSITORY}/${BRANCH}
 
 die() {
        echo $@
+       echo "Usage: $(basename $0) [-t|--tag] [-u|--upload <location>] <version>"
        exit 1
 }
 
+while [ "${1:1}" == "-" ]; then
+       case "$1" in
+               -t|--tag)
+                       CREATE_TAG=true
+                       shift
+                       ;;
+               -u|--upload)
+                       [ -z "$2" ] && die "missing argument to upload option"
+                       UPLOAD_LOCATION=${2}
+                       shift; shift
+                       ;;
+               *)
+                       die "unknown option: $1"
+                       ;;
+       esac
+fi
+
 [ -z "$1" ] && die "Need version argument"
 [ -n "${1/[0-9]*}" ] && die "Invalid version argument"
 
@@ -22,8 +41,8 @@ rm -rf "${RELEASE_DIR}" "${SOURCE_DIR}" || die "directory cleanup failed"
 mkdir -p "${RELEASE_DIR}" || die "directory creation failed"
 
 
-svn export "${REPOSITORY}" "${SOURCE_DIR}" || die "svn export failed"
-svn2cl -o "${SOURCE_DIR}/ChangeLog" "${REPOSITORY}" || die "ChangeLog creation failed"
+svn export "${SVN_LOCATION}" "${SOURCE_DIR}" > /dev/null || die "svn export failed"
+svn2cl -o "${SOURCE_DIR}/ChangeLog" "${SVN_LOCATION}" || die "ChangeLog creation failed"
 
 cp -a "${SOURCE_DIR}/"{bin,cnf,doc,man,pym,src} "${RELEASE_DIR}/" || die "directory copy failed"
 cp "${SOURCE_DIR}/"{ChangeLog,DEVELOPING,NEWS,RELEASE-NOTES,TEST-NOTES,TODO} "${RELEASE_DIR}/" || die "file copy failed"
@@ -38,3 +57,9 @@ if [ -n "${UPLOAD_LOCATION}" ]; then
 else
        echo "${RELEASE_TARBALL} created"
 fi
+
+if [ -n "${CREATE_TAG}" ]; then
+       echo "Tagging ${VERSION} in repository"
+       svn cp ${SVN_LOCATION} ${REPOSITORY}/tags/${VERSION} || die "tagging failed"
+fi
+