<commit_before>DESCRIPTION = "Runs a shell in an environment as emitted by BitBake to execute tasks"
LICENSE = "GPL"
MAINTAINER = "<NAME> <<EMAIL>>"

inherit autotools pkgconfig

do_configure() {
	:
}

def devshell_emit_env(o, d, all=False, funcwhitelist=None):
    """Emits all items in the data store in a format such that it can be sourced by a shell."""

    import bb
    import bb.data

    env = bb.data.keys(d)

    for e in env:
        if bb.data.getVarFlag(e, "func", d):
            continue
        bb.data.emit_var(e, o, d, all) and o.write('\n')

    for e in env:
        if not bb.data.getVarFlag(e, "func", d):
            continue
        if not funcwhitelist:
            bb.data.emit_var(e, o, d) and o.write('\n')
            continue
        for i in funcwhitelist:
            if e.startswith(i):
                bb.data.emit_var(e, o, d) and o.write('\n')
                break

python do_compile() {
	import os
	import os.path

	workdir = bb.data.getVar('WORKDIR', d, 1)
	shellfile = os.path.join(workdir, bb.data.expand("${TARGET_PREFIX}${DISTRO}-${MACHINE}-devshell", d))
	
	f = open(shellfile, "w")

	# emit variables and shell functions
        devshell_emit_env(f, d, False, ["die", "oe", "autotools_do_configure"])

	f.close()
}

do_install() {
	:
}

do_stage() {
	:
}

do_package() {
	shellfile="${TARGET_PREFIX}${DISTRO}-${MACHINE}-devshell"

	cd ${WORKDIR}

	cp $shellfile tmpfile
	echo "#!/bin/bash --rcfile" > $shellfile
	sed -e "s:${S}:.:g" -e "s:exit 1:true:" tmpfile >> $shellfile
	echo "export PS1='[OE::${TARGET_PREFIX}${DISTRO}-${MACHINE}]:\w\$ '" >> $shellfile

	mkdir -p ${DEPLOY_DIR}/addons
	install -m 755 $shellfile ${DEPLOY_DIR}/addons
}<commit_msg>devshell: add some alias magic.<commit_after>DESCRIPTION = "Runs a shell in an environment as emitted by BitBake to execute tasks"
LICENSE = "GPL"
MAINTAINER = "<NAME> <<EMAIL>>"
PR = "r1"

inherit autotools pkgconfig

do_configure() {
	:
}

def devshell_emit_env(o, d, all=False, funcwhitelist=None):
    """Emits all items in the data store in a format such that it can be sourced by a shell."""

    import bb
    import bb.data

    env = bb.data.keys(d)

    for e in env:
        if bb.data.getVarFlag(e, "func", d):
            continue
        bb.data.emit_var(e, o, d, all) and o.write('\n')

    for e in env:
        if not bb.data.getVarFlag(e, "func", d):
            continue
        if not funcwhitelist:
            bb.data.emit_var(e, o, d) and o.write('\n')
            continue
        for i in funcwhitelist:
            if e.startswith(i):
                bb.data.emit_var(e, o, d) and o.write('\n')
                break

python do_compile() {
	import os
	import os.path

	workdir = bb.data.getVar('WORKDIR', d, 1)
	shellfile = os.path.join(workdir, bb.data.expand("${TARGET_PREFIX}${DISTRO}-${MACHINE}-devshell", d))
	
	f = open(shellfile, "w")

	# emit variables and shell functions
        devshell_emit_env(f, d, False, ["die", "oe", "autotools_do_configure"])

	f.close()
}

do_install() {
	:
}

do_stage() {
	:
}

do_package() {
	shellfile="${TARGET_PREFIX}${DISTRO}-${MACHINE}-devshell"

	cd ${WORKDIR}

	cp $shellfile tmpfile
	echo "#!/bin/bash --rcfile" > $shellfile
	sed -e "s:${S}:.:g" -e "s:exit 1:true:" tmpfile >> $shellfile
	
	echo "export PS1='[OE::${TARGET_PREFIX}${DISTRO}-${MACHINE}]:\w\$ '" >> $shellfile
	echo "alias ./configure=oe_runconf" >> $shellfile
	echo "alias make=oe_runmake" >> $shellfile

	mkdir -p ${DEPLOY_DIR}/addons
	install -m 755 $shellfile ${DEPLOY_DIR}/addons
}
{'fraction_non_alphanumeric': 0.15762567452428286, 'fraction_numerical': 0.003692132916785004, 'mean_word_length': 2.952861952861953, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 23, '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': '5257529', 'n_tokens_mistral': 1371, 'n_tokens_neox': 1289, 'n_words': 336}