<commit_before><commit_msg>PROTON-47 - Added script to generate C and Java tarballs.<commit_after>#!/bin/bash
#
# release.sh - Creates release tarballs from the upstream source
# repository.
#

ME=$(basename ${0})
CURRDIR=$PWD
die()
{
    printf "ERROR: %s\n", "$*"
    exit 1
}

URL="http://svn.apache.org/repos/asf/qpid/proton"
BRANCH="trunk"
VERSION=""

usage()
{
    echo "Usage: ${ME} -v VERSION [-u URL] [-b BRANCH] [-c]"
    echo "-v VERSION  Specifies the release version; i.e., 0.18"
    echo "-u URL      The base URL for the repository (def. ${URL})"
    echo "-b BRANCH   The branch to check out (def. ${BRANCH})"
    echo ""
    exit 0
}


while getopts "hu:b:v:" OPTION; do
    case $OPTION in
        h) usage;;

        v) VERSION=$OPTARG;;

        u) URL=$OPTARG;;

        b) BRANCH=$OPTARG;;

        \?) usage;;
    esac
done

if [[ -z "${VERSION}" ]]; then
    die "You need to specify a version."
fi

##
## Create the C Tarball
##
rootname="qpid-proton-c-${VERSION}"
WORKDIR=$(mktemp -d)
mkdir -p "${WORKDIR}"
(
    cd ${WORKDIR}
    svn export ${URL}/${BRANCH} ${WORKDIR}/${rootname} >/dev/null

    ##
    ## Remove content not for the C tarball
    ##
    rm -f  ${rootname}/.gitignore
    rm -f  ${rootname}/config.sh
    rm -rf ${rootname}/bin
    rm -rf ${rootname}/examples/broker
    rm -rf ${rootname}/examples/mailbox
    rm -rf ${rootname}/proton-j
    rm -rf ${rootname}/design

    echo "Generating Archive: ${CURRDIR}/${rootname}.tar.gz"
    tar zcf ${CURRDIR}/${rootname}.tar.gz ${rootname}
)

##
## Create the Java Tarball
##
rootname="qpid-proton-java-${VERSION}"
WORKDIR=$(mktemp -d)
mkdir -p "${WORKDIR}"
(
    cd ${WORKDIR}
    svn export ${URL}/${BRANCH} ${WORKDIR}/${rootname} >/dev/null

    ##
    ## Remove content not for the Java tarball
    ##
    rm -f  ${rootname}/.gitignore
    rm -f  ${rootname}/config.sh
    rm -rf ${rootname}/bin
    rm -rf ${rootname}/examples
    rm -rf ${rootname}/proton-c
    rm -rf ${rootname}/design

    echo "Generating Archive: ${CURRDIR}/${rootname}.tar.gz"
    tar zcf ${CURRDIR}/${rootname}.tar.gz ${rootname}
)

{'fraction_non_alphanumeric': 0.18181818181818182, 'fraction_numerical': 0.0038077106139933364, 'mean_word_length': 2.7805755395683454, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4770405', 'n_tokens_mistral': 799, 'n_tokens_neox': 771, 'n_words': 208}