<commit_before>#!/bin/bash
#   Copyright (C) 2013-2014 Computer Sciences Corporation
#
#   Licensed 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.


function build_rpm() {
    spec_file=$1
    rpmbuild --quiet --define="_topdir $PWD/rpmbuild" -bb rpmbuild/SPECS/$spec_file
}

echo "Creating RPM build directories"
mkdir -p rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}

echo "Copying sources to RPM sources directory"
cp rpm-tools/macros.ezbake rpmbuild/SOURCES/macros.ezbake

echo "Copying spec files to RPM build directory"
cp rpm-tools/ezbake-rpm-tools.spec rpmbuild/SPECS/ezbake-rpm-tools.spec

echo "Building RPMs"
build_rpm ezbake-rpm-tools.spec<commit_msg>Updated RPM build script<commit_after>#!/bin/bash
#   Copyright (C) 2013-2014 Computer Sciences Corporation
#
#   Licensed 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.

function build_rpm() {
    spec_file=$1
    ezbake_version=$2
    is_release_build=$3

    rpmbuild \
        --quiet \
        --define="_topdir $PWD/rpmbuild" \
        --define="ezbake_version $ezbake_version" \
        --define="ezbake_release_build $is_release_build" \
        -bb \
        rpmbuild/SPECS/$spec_file
}

echo "Getting Maven project version information"
mvn_proj_version=$(mvn -q \
                  --non-recursive \
                  org.codehaus.mojo:exec-maven-plugin:1.3.1:exec \
                  -Dexec.executable="echo" \
                  -Dexec.args='${project.version}')

ezbake_version=${mvn_proj_version%%-SNAPSHOT}
if [[ $mvn_proj_version = *-SNAPSHOT ]]; then
    is_release_build=0
else
    is_release_build=1
fi

echo "Creating RPM build directories"
mkdir -p rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}

echo "Copying sources to RPM sources directory"
cp rpm-tools/macros.ezbake rpmbuild/SOURCES/macros.ezbake

echo "Copying spec files to RPM build directory"
cp rpm-tools/ezbake-rpm-tools.spec rpmbuild/SPECS/ezbake-rpm-tools.spec

echo "Building RPMs"
build_rpm ezbake-rpm-tools.spec $ezbake_version $is_release_build
{'fraction_non_alphanumeric': 0.09401993355481728, 'fraction_numerical': 0.010963455149501661, 'mean_word_length': 3.5414781297134237, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2792617', 'n_tokens_mistral': 1014, 'n_tokens_neox': 953, 'n_words': 287}