<commit_before>'''
Created on Mar 17, 2013

__author__ = "Elizabeth 'pidge' Flanagan"
__copyright__ = "Copyright 2012-2013, Intel Corp."
__credits__ = ["<NAME>"]
__license__ = "GPL"
__version__ = "2.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
'''

from buildbot.steps.shell import ShellCommand
from twisted.python import log
import os, datetime 
from autobuilder.config import *

class CreateIntelBSPPackage(ShellCommand):
    haltOnFailure = False 
    flunkOnFailure = True 
    name = "Creating BSP Packages" 
    def __init__(self, factory, argdict=None, **kwargs):
        self.factory = factory
        self.machine = ""
        self.slavedir=os.path.join(os.path.join(YOCTO_ABBASE, "yocto-slave"))
        for k, v in argdict.iteritems():
            if type(v) is bool:
                setattr(self, k, str(v))
            else:
                setattr(self, k, v)
        self.description = "Creating BSP packages for " + self.machine + " tarball"
        self.timeout = 100000
        kwargs['timeout']=self.timeout
        ShellCommand.__init__(self, **kwargs)

    def start(self):
        DEST=self.getProperty("DEST")
        buildername=self.getProperty("buildername")
        if self.getProperty("custom_release_me_" + buildername):
            revision=self.getProperty("custom_release_name_" + buildername)
        else:
            revision=self.getProperty("got_revision_poky")
        self.basedir=os.path.join(self.slavedir, buildername)
        bsptardir = os.path.join(self.basedir, "meta-intel")
        cmd = "rm -rf " + bsptardir + "; cd " + bsptardir + "/..;"
        cmd = cmd + "git clone " + self.getProperty("repourl_meta-intel") + " meta-intel;" 
        cmd = cmd + "cd " + bsptardir + "; git checkout " + self.getProperty("got_revision_meta-intel")+";"
        # issue with buildbot choking on a find exec. figure this out later.
        cmd = cmd + "cd " + bsptardir + "; for x in `find . -name .git\*`; do rm -rf $x; done;" 
        cmd = cmd + "for x in `ls|egrep -v '(common|tlk|conf|README|MAINT|meta-" + self.machine.replace("-noemgd", "").replace("-lsb", "") + ")'`; do rm -rf $x; done;"
        cmd = cmd + "mkdir " + bsptardir + "/meta-" + self.machine.replace("-noemgd", "").replace("-lsb", "") + "/binary;" 
        cmd = cmd + "cp " + DEST + "/" + self.machine + "/core-image-sato-" + self.machine + ".hddimage " + bsptardir + "/meta-" + self.machine.replace("-noemgd", "").replace("-lsb", "") + "/binary;"
        cmd = cmd + "cp " + DEST + "/" + self.machine + "/core-image-minimal-" + self.machine + ".hddimage " + bsptardir + "/meta-" + self.machine.replace("-noemgd", "").replace("-lsb", "") + "/binary;"
        cmd = cmd + "echo '' >> " + bsptardir + "/README.tlk;"
        cmd = cmd + "echo 'The following text is autogenerated during the autobuilder build process.' >> " + bsptardir + "/README.tlk;"
        cmd = cmd + "echo 'It is not a part of the repositories used to create this BSP package.' >> " + bsptardir + "/README.tlk;"
        cmd = cmd + "echo '------------------------------------------------------------------------' >> " + bsptardir + "/README.tlk;"
        cmd = cmd + "echo 'Please note that the provided images were built using the meta-tlk layer' >> " + bsptardir + "/README.tlk;"
        cmd = cmd + "echo '(time limited kernel). Build instructions to build non-tlk images are' >> " + bsptardir + "/README.tlk;"
        cmd = cmd + "echo 'provided in ./meta-" + self.machine.replace("-noemgd", "").replace("-lsb", "") + "/README' >> " + bsptardir + "/README.tlk;"
        cmd = cmd + "echo '' >> README.tlk; cd ..;"
        cmd = cmd + "cd " + bsptardir + "/..; tar cjvf " + self.machine + ".tar.bz2 meta-intel;"
        cmd = cmd + "mkdir -p " + DEST + "/machine/" + self.machine +";"
        cmd = cmd + "cp -R " + self.machine + ".tar.bz2 " + DEST + "/machine/" + self.machine +";" 

        self.command=cmd
        ShellCommand.start(self)<commit_msg>CreateIntelBSPPackage.py: fix dest<commit_after>'''
Created on Mar 17, 2013

__author__ = "Elizabeth 'pidge' Flanagan"
__copyright__ = "Copyright 2012-2013, Intel Corp."
__credits__ = ["<NAME>"]
__license__ = "GPL"
__version__ = "2.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
'''

from buildbot.steps.shell import ShellCommand
from twisted.python import log
import os, datetime 
from autobuilder.config import *

class CreateIntelBSPPackage(ShellCommand):
    haltOnFailure = False 
    flunkOnFailure = True 
    name = "Creating BSP Packages" 
    def __init__(self, factory, argdict=None, **kwargs):
        self.factory = factory
        self.machine = ""
        self.slavedir=os.path.join(os.path.join(YOCTO_ABBASE, "yocto-slave"))
        for k, v in argdict.iteritems():
            if type(v) is bool:
                setattr(self, k, str(v))
            else:
                setattr(self, k, v)
        self.description = "Creating BSP packages for " + self.machine + " tarball"
        self.timeout = 100000
        kwargs['timeout']=self.timeout
        ShellCommand.__init__(self, **kwargs)

    def start(self):
        DEST=self.getProperty("DEST")
        buildername=self.getProperty("buildername")
        if self.getProperty("custom_release_me_" + buildername):
            revision=self.getProperty("custom_release_name_" + buildername)
        else:
            revision=self.getProperty("got_revision_poky")
        self.basedir=os.path.join(self.slavedir, buildername)
        bsptardir = os.path.join(self.basedir, "meta-intel")
        cmd = "rm -rf " + bsptardir + "; cd " + bsptardir + "/..;"
        cmd = cmd + "git clone " + self.getProperty("repourl_meta-intel") + " meta-intel;" 
        cmd = cmd + "cd " + bsptardir + "; git checkout " + self.getProperty("got_revision_meta-intel")+";"
        # issue with buildbot choking on a find exec. figure this out later.
        cmd = cmd + "cd " + bsptardir + "; for x in `find . -name .git\*`; do rm -rf $x; done;" 
        cmd = cmd + "for x in `ls|egrep -v '(common|tlk|conf|README|MAINT|meta-" + self.machine.replace("-noemgd", "").replace("-lsb", "") + ")'`; do rm -rf $x; done;"
        cmd = cmd + "mkdir " + bsptardir + "/meta-" + self.machine.replace("-noemgd", "").replace("-lsb", "") + "/binary;" 
        cmd = cmd + "cp " + DEST + "/" + self.machine + "/core-image-sato-" + self.machine + ".hddimage " + bsptardir + "/meta-" + self.machine.replace("-noemgd", "").replace("-lsb", "") + "/binary;"
        cmd = cmd + "cp " + DEST + "/" + self.machine + "/core-image-minimal-" + self.machine + ".hddimage " + bsptardir + "/meta-" + self.machine.replace("-noemgd", "").replace("-lsb", "") + "/binary;"
        cmd = cmd + "echo '' >> " + bsptardir + "/README.tlk;"
        cmd = cmd + "echo 'The following text is autogenerated during the autobuilder build process.' >> " + bsptardir + "/README.tlk;"
        cmd = cmd + "echo 'It is not a part of the repositories used to create this BSP package.' >> " + bsptardir + "/README.tlk;"
        cmd = cmd + "echo '------------------------------------------------------------------------' >> " + bsptardir + "/README.tlk;"
        cmd = cmd + "echo 'Please note that the provided images were built using the meta-tlk layer' >> " + bsptardir + "/README.tlk;"
        cmd = cmd + "echo '(time limited kernel). Build instructions to build non-tlk images are' >> " + bsptardir + "/README.tlk;"
        cmd = cmd + "echo 'provided in ./meta-" + self.machine.replace("-noemgd", "").replace("-lsb", "") + "/README' >> " + bsptardir + "/README.tlk;"
        cmd = cmd + "echo '' >> README.tlk; cd ..;"
        cmd = cmd + "cd " + bsptardir + "/..; tar cjvf " + self.machine + ".tar.bz2 meta-intel;"
        cmd = cmd + "mkdir -p " + DEST + "/machines/" + self.machine +";"
        cmd = cmd + "cp -R " + self.machine + ".tar.bz2 " + DEST + "/machine/" + self.machine +";" 

        self.command=cmd
        ShellCommand.start(self)
{'fraction_non_alphanumeric': 0.1882591093117409, 'fraction_numerical': 0.006072874493927126, 'mean_word_length': 2.532171581769437, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 41, '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': '4232609', 'n_tokens_mistral': 2671, 'n_tokens_neox': 2566, 'n_words': 635}