<commit_before>#!/bin/bash -xe

mkdir -p ~/rpmbuild/SOURCES ~/rpmbuild/SPECS $3
yum install -y --nogpg python-pip

cd /data/$1
python setup.py sdist
TARBALL=$(ls dist)
VERSION=$(python setup.py --version)
mv dist/$TARBALL ~/rpmbuild/SOURCES/

# The project may have either it's own spec repo of use a subdirectory of the global one
cd /data/$1_spec || cd /data/global_spec/$2
cp * ~/rpmbuild/SOURCES/
cp *.spec ~/rpmbuild/SPECS/
cd ~/rpmbuild/SPECS/


# Add the mostcurrent repo, we may have dependencies in it
echo -e '[current]\nname=current\nbaseurl=file:///data/repos/current\nenabled=1\ngpgcheck=0' > /etc/yum.repos.d/current.repo

sed -i -e "s/VERSIONDIR/$VERSION/g" *.spec
VERSION=${VERSION/-/.}
sed -i -e "s/Version:.*/Version: $VERSION/g" *.spec
sed -i -e "s/Source0:.*/Source0: $TARBALL/g" *.spec<commit_msg>Only add the current repo if it exists<commit_after>#!/bin/bash -xe

mkdir -p ~/rpmbuild/SOURCES ~/rpmbuild/SPECS $3
yum install -y --nogpg python-pip

cd /data/$1
python setup.py sdist
TARBALL=$(ls dist)
VERSION=$(python setup.py --version)
mv dist/$TARBALL ~/rpmbuild/SOURCES/

# The project may have either it's own spec repo of use a subdirectory of the global one
cd /data/$1_spec || cd /data/global_spec/$2
cp * ~/rpmbuild/SOURCES/
cp *.spec ~/rpmbuild/SPECS/
cd ~/rpmbuild/SPECS/


# Add the mostcurrent repo, we may have dependencies in it
if [ -e /data/repos/current ] ; then
    echo -e '[current]\nname=current\nbaseurl=file:///data/repos/current\nenabled=1\ngpgcheck=0' > /etc/yum.repos.d/current.repo
fi

sed -i -e "s/VERSIONDIR/$VERSION/g" *.spec
VERSION=${VERSION/-/.}
sed -i -e "s/Version:.*/Version: $VERSION/g" *.spec
sed -i -e "s/Source0:.*/Source0: $TARBALL/g" *.spec
{'fraction_non_alphanumeric': 0.16950146627565982, 'fraction_numerical': 0.0093841642228739, 'mean_word_length': 3.635869565217391, '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': '4970628', 'n_tokens_mistral': 690, 'n_tokens_neox': 658, 'n_words': 181}