<commit_before>#!/bin/sh

# We're NOT in the docker container, so let's build it
if [ "$1" != "in_docker_container" ]
then
    echo "Not in docker container. Building container..."
    cd "$(dirname "$0")"
    BASEDIR="$(pwd)"

    # Build librespot-cross Docker container
    cd librespot
    docker build -t librespot-cross -f contrib/Dockerfile .

    echo "Running script..."
    docker run -it \
        -v "$BASEDIR":/pkgbuild \
        librespot-cross \
        /pkgbuild/build_raspotify.sh in_docker_container
else
    echo "Building in docker container"

    # Get versions to prepare build
    LIBRESPOT_GIT_REV="$(git --git-dir=/pkgbuild/librespot/.git rev-parse --short HEAD)"
    DEB_PKG_VER="$(grep '^Version:' /pkgbuild/raspotify/debian/control | sed 's/^Version: //')"
    if echo "$DEB_PKG_VER" | fgrep -vq "$LIBRESPOT_GIT_REV"
    then
        echo 'Librespot git revision not found in package version. Is this correct?'
        exit 1
    fi

    DEB_PKG_NAME="raspotify_${DEB_PKG_VER}_armhf.deb"

    # Cross compile
    cargo build --release --target arm-unknown-linux-gnueabihf --no-default-features --features alsa-backend
    cd /pkgbuild

    mkdir -p raspotify/usr/bin
    cp /build/arm-unknown-linux-gnueabihf/release/librespot raspotify/usr/bin

    # Strip substantially decreases size of binary<commit_msg>No need to have -it flag on docker<commit_after>#!/bin/sh

# We're NOT in the docker container, so let's build it
if [ "$1" != "in_docker_container" ]
then
    echo "Not in docker container. Building container..."
    cd "$(dirname "$0")"
    BASEDIR="$(pwd)"

    # Build librespot-cross Docker container
    cd librespot
    docker build -t librespot-cross -f contrib/Dockerfile .

    echo "Running script..."
    docker run \
        -v "$BASEDIR":/pkgbuild \
        librespot-cross \
        /pkgbuild/build_raspotify.sh in_docker_container
else
    echo "Building in docker container"

    # Get versions to prepare build
    LIBRESPOT_GIT_REV="$(git --git-dir=/pkgbuild/librespot/.git rev-parse --short HEAD)"
    DEB_PKG_VER="$(grep '^Version:' /pkgbuild/raspotify/debian/control | sed 's/^Version: //')"
    if echo "$DEB_PKG_VER" | fgrep -vq "$LIBRESPOT_GIT_REV"
    then
        echo 'Librespot git revision not found in package version. Is this correct?'
        exit 1
    fi

    DEB_PKG_NAME="raspotify_${DEB_PKG_VER}_armhf.deb"

    # Cross compile
    cargo build --release --target arm-unknown-linux-gnueabihf --no-default-features --features alsa-backend
    cd /pkgbuild

    mkdir -p raspotify/usr/bin
    cp /build/arm-unknown-linux-gnueabihf/release/librespot raspotify/usr/bin

    # Strip substantially decreases size of binary
{'fraction_non_alphanumeric': 0.11602826329490516, 'fraction_numerical': 0.002231312755671253, 'mean_word_length': 2.927007299270073, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, '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': '1829523', 'n_tokens_mistral': 954, 'n_tokens_neox': 894, 'n_words': 239}