#!/usr/bin/env bash # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # Script for creating and tagging a source distribution # ### UTILITIES # Print an error message and then exit. function error { echo "$0: FATAL: $1" exit 1 } ### SETUP # default settings project_name="NO_PROJECT" distserver="people.apache.org" excludes="" # detect some settings trunkurl=`svn info | grep 'URL:' | sed 's/URL: //'` [[ "x$trunkurl" == "x" ]] && error "cannot find working copy url" codebase=`echo $trunkurl | sed 's/trunk//'` tagsbase="${codebase}tags" revision=`svn info | grep 'Revision:' | sed 's/Revision: //'` [[ "x$revision" == "x" ]] && error "cannot find working copy revision" currdate=`date +%Y%m%d` [[ "x$currdate" == "x" ]] && error "cannot find current date" # load configuration source release-settings.sh # settings that are based on/overridable by configuration if [[ "x$releasename" == "x" ]]; then releasename="$project_name-r$revision-$currdate-incubating" fi if [[ "x$distserverpath" == "x" ]]; then distserverpath="~/public_html/releases/$project_name" fi ### SAFETY CHECKS # check the tag does not exist yet for tag in `svn ls "$tagsbase"`; do basetag=`echo "$tag" | sed 's/\///g'` if [[ "$releasename" == "$basetag" ]]; then echo "WARNING: tag $tagname already exists within" 'repository!' fi done ### Go! echo svn checkout -q -r "'$revision'" "'$trunkurl'" "'$releasename'" echo cd "'$releasename'" echo rm -rf $excludes echo cd .. echo java -jar tools/rat-0.4.1.jar "'$releasename'" echo tar cjf "'$releasename.tar.bz2'" "'$releasename'" echo md5 "'$releasename.tar.bz2'" '>' "'$releasename.tar.bz2.md5'" echo gpg --armor --output "'$releasename.tar.bz2.asc'" \ --detach-sig "'$releasename.tar.bz2'" echo svn copy -m "'Tagging release $releasename.'" \ "'$trunkurl'" "'$tagsbase/$releasename'" echo ssh "'$distserver'" mkdir -p "'$distserverpath'" echo scp "'$releasename.tar.bz2' '$releasename.tar.bz2.md5' '$releasename.tar.bz2.asc'" \ "'$distserver:$distserverpath'"