<commit_before>#!/bin/sh -e

if [ ! -e dist/ami/build_ami.sh ] || [ ! -e ../scylla-jmx/dist/redhat/build_rpm.sh ] || [ ! -e ../cassandra/dist/redhat/build_rpm.sh ]; then
    echo "run build_ami.sh in top of scylla dir"
    echo "please make sure scylla-jmx is checked out under the same directory as scylla"
    echo "please make sure cassandra with scylla tools branch checked out under the same directory as scylla"
    exit 1
fi

cd dist/ami

if [ ! -f variables.json ]; then
    echo "create variables.json before start building AMI"
    exit 1
fi

if [ ! -f files/scylla-server.rpm ] || [ ! -f files/scylla-server-debuginfo.rpm ]; then
    cd ../../
    dist/redhat/build_rpm.sh
    RPM=`ls build/rpms/scylla-server-*.x86_64.rpm|grep -v debuginfo`
    cp $RPM dist/ami/files/scylla-server.rpm
    cp build/rpms/scylla-server-debuginfo-*.x86_64.rpm dist/ami/files/scylla-server-debuginfo.rpm
    cd -
fi

if [ ! -f files/scylla-jmx.rpm ]; then
    CWD=`pwd`
    cd ../../../scylla-jmx
    dist/redhat/build_rpm.sh
    RPM=`ls build/rpms/scylla-jmx-*.noarch.rpm`
    cp $RPM $CWD/files/scylla-jmx.rpm
    cd -
fi

if [ ! -f files/scylla-tools.rpm ]; then
    CWD=`pwd`
    cd ../../../cassandra
    dist/redhat/build_rpm.sh
    RPM=`ls build/rpms/scylla-tools-*.noarch.rpm`
    cp $RPM $CWD/files/scylla-tools.rpm
    cd -
fi

if [ ! -d packer ]; then
    wget https://dl.bintray.com/mitchellh/packer/packer_0.8.6_linux_amd64.zip
    mkdir packer
    cd packer
    unzip -x ../packer_0.8.6_linux_amd64.zip
    cd -
fi

packer/packer build -var-file=variables.json scylla.json<commit_msg>ami: Copy the rpm we just built only<commit_after>#!/bin/sh -e

if [ ! -e dist/ami/build_ami.sh ] || [ ! -e ../scylla-jmx/dist/redhat/build_rpm.sh ] || [ ! -e ../cassandra/dist/redhat/build_rpm.sh ]; then
    echo "run build_ami.sh in top of scylla dir"
    echo "please make sure scylla-jmx is checked out under the same directory as scylla"
    echo "please make sure cassandra with scylla tools branch checked out under the same directory as scylla"
    exit 1
fi

cd dist/ami

if [ ! -f variables.json ]; then
    echo "create variables.json before start building AMI"
    exit 1
fi

if [ ! -f files/scylla-server.rpm ] || [ ! -f files/scylla-server-debuginfo.rpm ]; then
    cd ../../
    dist/redhat/build_rpm.sh
    SCYLLA_VERSION=$(cat build/SCYLLA-VERSION-FILE)
    SCYLLA_RELEASE=$(cat build/SCYLLA-RELEASE-FILE)
    RPM=`ls build/rpms/scylla-server-$SCYLLA_VERSION-$SCYLLA_RELEASE*.x86_64.rpm|grep -v debuginfo`
    cp $RPM dist/ami/files/scylla-server.rpm
    cp build/rpms/scylla-server-debuginfo-$SCYLLA_VERSION-$SCYLLA_RELEASE*.x86_64.rpm dist/ami/files/scylla-server-debuginfo.rpm
    cd -
fi

if [ ! -f files/scylla-jmx.rpm ]; then
    CWD=`pwd`
    cd ../../../scylla-jmx
    dist/redhat/build_rpm.sh
    SCYLLA_VERSION=$(cat build/SCYLLA-VERSION-FILE)
    SCYLLA_RELEASE=$(cat build/SCYLLA-RELEASE-FILE)
    RPM=`ls build/rpms/scylla-jmx-$SCYLLA_VERSION-$SCYLLA_RELEASE*.noarch.rpm`
    cp $RPM $CWD/files/scylla-jmx.rpm
    cd -
fi

if [ ! -f files/scylla-tools.rpm ]; then
    CWD=`pwd`
    cd ../../../cassandra
    dist/redhat/build_rpm.sh
    SCYLLA_VERSION=$(cat build/SCYLLA-VERSION-FILE)
    SCYLLA_RELEASE=$(cat build/SCYLLA-RELEASE-FILE)
    RPM=`ls build/rpms/scylla-tools-$SCYLLA_VERSION-$SCYLLA_RELEASE*.noarch.rpm`
    cp $RPM $CWD/files/scylla-tools.rpm
    cd -
fi

if [ ! -d packer ]; then
    wget https://dl.bintray.com/mitchellh/packer/packer_0.8.6_linux_amd64.zip
    mkdir packer
    cd packer
    unzip -x ../packer_0.8.6_linux_amd64.zip
    cd -
fi

packer/packer build -var-file=variables.json scylla.json
{'fraction_non_alphanumeric': 0.14262159934047816, 'fraction_numerical': 0.010992030777686177, 'mean_word_length': 2.7837837837837838, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '3702964', 'n_tokens_mistral': 1560, 'n_tokens_neox': 1466, 'n_words': 292}