You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by le...@apache.org on 2009/05/21 15:18:03 UTC

svn commit: r777108 - /felix/sandbox/lenzi/upload-release.sh

Author: lenzi
Date: Thu May 21 13:18:03 2009
New Revision: 777108

URL: http://svn.apache.org/viewvc?rev=777108&view=rev
Log:
Simple script for uploading release files to the felix distribution directory


Added:
    felix/sandbox/lenzi/upload-release.sh   (with props)

Added: felix/sandbox/lenzi/upload-release.sh
URL: http://svn.apache.org/viewvc/felix/sandbox/lenzi/upload-release.sh?rev=777108&view=auto
==============================================================================
--- felix/sandbox/lenzi/upload-release.sh (added)
+++ felix/sandbox/lenzi/upload-release.sh Thu May 21 13:18:03 2009
@@ -0,0 +1,87 @@
+#!/bin/bash
+
+PROGRAM=$( basename $0 )
+CREDITS='Stefano "Kismet" Lenzi <le...@apache.org>'
+VERSION="0.1.0"
+
+function verbose() {
+	test "$VERBOSE" != "" && echo $1
+}
+
+function usage() {
+	echo "$PROGRAM [-hV] [[-g groupId] [-d destination] [-u username] [-s scppath] [-r <root of local staging>] artifactId version]"
+	echo "Devloped by $CREDITS"
+	echo "Version $VERSION"
+}
+
+
+# parse command line arguments
+while getopts hvVg:u:s:r: OPT; do
+    case "$OPT" in
+	h)	usage 
+		exit 0
+		;;
+	V)	echo $VERSION
+		exit 0
+		;;
+	v)	VERBOSE="YES"
+		;;
+	g)	GROUP=$OPTARG
+		;;
+	d)	DST=$OPTARG
+		;;
+	u)	USERNAME=$OPTARG
+		;;
+	s)	SCPEXE=$OPTARG
+		;;
+	r)	ROOT=$OPTARG
+		;;
+	*)	# getopts issues an error message
+		usage 
+		exit 1
+		;;
+    esac
+done
+
+shift `expr $OPTIND - 1`
+
+[ "$#" -lt "2" ] && \
+	verbose  "ArtifactId or Version missing" &&\
+	exit 0
+
+ARTIFACT="$1"
+VERSION="$2"
+
+[ "$GROUP" == "" ] && \
+	GROUP="org.apache.felix" && \
+	verbose "GroupId was not set, using default $GROUP"
+
+
+[ "$DST" == "" ] && \
+	DST="/x1/www/www.apache.org/dist/felix" && \
+	verbose "Remote direcoty where upload the file to was not set, using default $DST"
+
+[ "$USERNAME" == "" ] && \
+	USERNAME="$USER" && \
+	verbose "Username to use for ssh authentication  was not set, using default $USERNAME"
+
+[ "$SCPEXE" == "" ] && \
+	SCPEXE="$(which scp)" && \
+	verbose "Path to scp executable was not set, using default scp ($SCPEXE)"
+
+[ "$ROOT" == "" ] && \
+	ROOT="$(pwd)" && \
+	verbose "Path to root of local staging, using default current directory ($ROOT)"
+
+test -x $SCPEXE || ( echo "Unable to find a valid scp executable at $SCPEXE" && exit 1 )
+cd $ROOT || ( echo "Root of local staging not found at $ROOT" &&  exit 1 )
+
+RELEASEROOT=$(echo $GROUP | sed 's%\.%/%g' ) 
+RELEASEROOT="${RELEASEROOT}/${ARTIFACT}/${VERSION}"
+cd $RELEASEROOT || ( echo "Unable to find the directory containing the release file at $RELEASEROOT" && exit 1 )
+
+BASENAME="${ARTIFACT}-${VERSION}"
+FILES=$(file ${BASENAME}.jar ${BASENAME}.jar.{asc,md5} ${BASENAME}-project.{tar.gz,zip} ${BASENAME}-project.{tar.gz,zip}.{asc,md5} | wc -l)
+test $FILES -eq "9" || ( echo "Unable to find some of the file to upload" && exit 1 )
+
+${SCPEXE} ${BASENAME}.jar ${BASENAME}.jar.{asc,md5} ${BASENAME}-project.{tar.gz,zip} ${BASENAME}-project.{tar.gz,zip}.{asc,md5} ${USERNAME}@people.apache.org:${DST}

Propchange: felix/sandbox/lenzi/upload-release.sh
------------------------------------------------------------------------------
    svn:executable = *