<commit_before>#!/usr/bin/env python

import os, sys, shutil, datetime
from fabric.api import run, cd, local, get, settings, lcd, put
from fabric_ssh_config import getSSHInfoForHost

username='test'
builddir = "/tmp/" + username + "Kits/buildtemp"
version = "UNKNOWN"
defaultlicensedays = 45 #default trial license length

################################################
# CHECKOUT CODE INTO A TEMP DIR
################################################

def checkoutCode(voltdbGit, proGit, rbmqExportGit):
    global buildir
    # clean out the existing dir
    run("rm -rf " + builddir)
    # make the build dir again
    run("mkdir -p " + builddir)
    # change to it
    with cd(builddir):
        # do the checkouts
        run("git clone <EMAIL>:VoltDB/voltdb.git")
        run("cd voltdb; git checkout %s" % voltdbGit)
        run("git clone <EMAIL>:VoltDB/pro.git")
        run("cd pro; git checkout %s" % proGit)
        run("git clone <EMAIL>:VoltDB/export-rabbitmq.git")
        run("cd export-rabbitmq; git checkout %s" % rbmqExportGit)
        return run("cat voltdb/version.txt").strip()

################################################
# MAKE A RELEASE DIR
################################################

def makeReleaseDir(releaseDir):
    # handle the case where a release dir exists for this version
    if os.path.exists(releaseDir):
        shutil.rmtree(releaseDir)
    # create a release dir
    os.makedirs(releaseDir)
    print "Created dir: " + releaseDir


################################################
# SEE IF HAS ZIP TARGET
###############################################
def versionHasZipTarget():
    with settings(warn_only=True):
        with cd(os.path.join(builddir,'pro')):
                return run("ant -p -f mmt.xml | grep dist.pro.zip")

################################################
# BUILD THE COMMUNITY VERSION
################################################

def buildCommunity():
    with cd(builddir + "/voltdb"):
        run("pwd")
        run("git status")
        run("git describe --dirty")
        run("ant -Djmemcheck=NO_MEMCHECK clean default dist")

################################################
# BUILD THE ENTERPRISE VERSION
################################################

def buildPro():
    with cd(builddir + "/pro"):
        run("pwd")
        run("git status")
        run("git describe --dirty")
        run("VOLTCORE=../voltdb ant -f mmt.xml -Djmemcheck=NO_MEMCHECK -Dallowreplication=true -Dlicensedays=%d clean dist.pro" % defaultlicensedays)

################################################
# BUILD THE RABBITMQ EXPORT CONNECTOR
################################################

def buildRabbitMQExport(version):
    with cd(builddir + "/export-rabbitmq"):
        run("pwd")
        run("git status")
        run("git describe --dirty", warn_only=True)
        run("VOLTDIST=../pro/obj/pro/voltdb-ent-%s ant" % version)
    # Repackage the pro tarball and zip file with the RabbitMQ connector Jar
    with cd("%s/pro/obj/pro" % builddir):
        run("pwd")
        run("gunzip voltdb-ent-%s.tar.gz" % version)
        run("tar uvf voltdb-ent-%s.tar voltdb-ent-%s/lib/extension/voltdb-rabbitmq.jar" % (version, version))
        run("gzip voltdb-ent-%s.tar" % version)
        run("zip -r voltdb-ent-%s.zip voltdb-ent-%s" % (version, version))

################################################
# MAKE AN ENTERPRISE TRIAL LICENSE
################################################
<commit_msg>Only build RabbitMQ export connector if version >=4.5 in the kit build script.<commit_after>#!/usr/bin/env python

import os, sys, shutil, datetime
from fabric.api import run, cd, local, get, settings, lcd, put
from fabric_ssh_config import getSSHInfoForHost

username='test'
builddir = "/tmp/" + username + "Kits/buildtemp"
version = "UNKNOWN"
defaultlicensedays = 45 #default trial license length

################################################
# CHECKOUT CODE INTO A TEMP DIR
################################################

def checkoutCode(voltdbGit, proGit, rbmqExportGit):
    global buildir
    # clean out the existing dir
    run("rm -rf " + builddir)
    # make the build dir again
    run("mkdir -p " + builddir)
    # change to it
    with cd(builddir):
        # do the checkouts
        run("git clone <EMAIL>:VoltDB/voltdb.git")
        run("cd voltdb; git checkout %s" % voltdbGit)
        run("git clone <EMAIL>:VoltDB/pro.git")
        run("cd pro; git checkout %s" % proGit)
        run("git clone <EMAIL>:VoltDB/export-rabbitmq.git")
        run("cd export-rabbitmq; git checkout %s" % rbmqExportGit)
        return run("cat voltdb/version.txt").strip()

################################################
# MAKE A RELEASE DIR
################################################

def makeReleaseDir(releaseDir):
    # handle the case where a release dir exists for this version
    if os.path.exists(releaseDir):
        shutil.rmtree(releaseDir)
    # create a release dir
    os.makedirs(releaseDir)
    print "Created dir: " + releaseDir


################################################
# SEE IF HAS ZIP TARGET
###############################################
def versionHasZipTarget():
    with settings(warn_only=True):
        with cd(os.path.join(builddir,'pro')):
                return run("ant -p -f mmt.xml | grep dist.pro.zip")

################################################
# BUILD THE COMMUNITY VERSION
################################################

def buildCommunity():
    with cd(builddir + "/voltdb"):
        run("pwd")
        run("git status")
        run("git describe --dirty")
        run("ant -Djmemcheck=NO_MEMCHECK clean default dist")

################################################
# BUILD THE ENTERPRISE VERSION
################################################

def buildPro():
    with cd(builddir + "/pro"):
        run("pwd")
        run("git status")
        run("git describe --dirty")
        run("VOLTCORE=../voltdb ant -f mmt.xml -Djmemcheck=NO_MEMCHECK -Dallowreplication=true -Dlicensedays=%d clean dist.pro" % defaultlicensedays)

################################################
# BUILD THE RABBITMQ EXPORT CONNECTOR
################################################

def buildRabbitMQExport(version):
    # Only compile the RabbitMQ connector if version is >= 4.5
    parts = version.split(".")
    skip = True
    try:
        if len(parts) >= 2 and \
           int(parts[0]) >= 4 and \
           int(parts[1][0]) >= 5:
            skip = False
    except Exception as e:
        pass

    if skip:
        return

    with cd(builddir + "/export-rabbitmq"):
        run("pwd")
        run("git status")
        run("git describe --dirty", warn_only=True)
        run("VOLTDIST=../pro/obj/pro/voltdb-ent-%s ant" % version)
    # Repackage the pro tarball and zip file with the RabbitMQ connector Jar
    with cd("%s/pro/obj/pro" % builddir):
        run("pwd")
        run("gunzip voltdb-ent-%s.tar.gz" % version)
        run("tar uvf voltdb-ent-%s.tar voltdb-ent-%s/lib/extension/voltdb-rabbitmq.jar" % (version, version))
        if versionHasZipTarget():
            run("gzip voltdb-ent-%s.tar" % version)
            run("zip -r voltdb-ent-%s.zip voltdb-ent-%s" % (version, version))

################################################
# MAKE AN ENTERPRISE TRIAL LICENSE
################################################

{'fraction_non_alphanumeric': 0.28521031207598374, 'fraction_numerical': 0.0018995929443690637, 'mean_word_length': 3.6622390891840606, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '3284327', 'n_tokens_mistral': 2181, 'n_tokens_neox': 2069, 'n_words': 549}