<commit_before>#!/bin/bash

# Generate erldocs for Erlang/OTP's maint branch.

[[ $# -ne 1 ]] && echo "Usage: $0  ‹path to cloned repo›" && exit 1
idir="${1%%/}" # Remove trailing slash if exists
[[ ! -d "$idir"/.git ]] && echo "$idir is not a Git repo!" && exit 1
[[ ! -x "$idir"/otp_build ]] && echo "$idir is not the OTP repo!" && exit 1

erldocs='./erldocs'
[[ ! -x "$erldocs" ]] && [[ ! -L "$erldocs" ]] && \
    echo "$erldocs executable not found!" && exit 1

release="maint"
odir="docs-$release"

site_root='site.git'
site="$site_root/$release"
[[ ! -d "$site" ]] && echo "maint site not found" && exit 1
archive="$site_root/archives/${odir}.tar.bz2"


mkdir -p  "$odir"
rm    -rf "$odir"/*

CONFIGURE_OPTIONS=''
cd "$idir"
echo "Commencing pull & build of $release branch" \
    && rm -rf maint_rel/* \
    && git checkout maint \
    && make clean \
    && git remote update --prune \
    && ./otp_build autoconf  -a $CONFIGURE_OPTIONS \
    && ./otp_build configure -a $CONFIGURE_OPTIONS \
    && ./configure && make
cd -

includes="-I $idir"/erts/include
for dir in "$idir"/lib/*/include "$idir"/bootstrap/lib/*/include; do
    includes="$includes -I $dir"
done

"$erldocs"          \
    -o "$odir"      \
    $includes       \<commit_msg>maint.sh: Simpler git pull command. Support for shell-passed options.<commit_after>#!/bin/bash

# Generate erldocs for Erlang/OTP's maint branch.

[[ $# -ne 1 ]] && echo "Usage: $0  ‹path to cloned repo›" && exit 1
idir="${1%%/}" # Remove trailing slash if exists
[[ ! -d "$idir"/.git ]] && echo "$idir is not a Git repo!" && exit 1
[[ ! -x "$idir"/otp_build ]] && echo "$idir is not the OTP repo!" && exit 1

erldocs='./erldocs'
[[ ! -x "$erldocs" ]] && [[ ! -L "$erldocs" ]] && \
    echo "$erldocs executable not found!" && exit 1

release="maint"
odir="docs-$release"

site_root='site.git'
site="$site_root/$release"
[[ ! -d "$site" ]] && echo "maint site not found" && exit 1
archive="$site_root/archives/${odir}.tar.bz2"


mkdir -p  "$odir"
rm    -rf "$odir"/*

CONFIGURE_OPTIONS=${CONFIGURE_OPTIONS:-''}
cd "$idir"
echo "Commencing pull & build of $release branch" \
    && rm -rf maint_rel/* \
    && git checkout maint \
    && make clean \
    && git pull origin maint \
    && ./otp_build autoconf  -a $CONFIGURE_OPTIONS \
    && ./otp_build configure -a $CONFIGURE_OPTIONS \
    && ./configure && make
cd -

includes="-I $idir"/erts/include
for dir in "$idir"/lib/*/include "$idir"/bootstrap/lib/*/include; do
    includes="$includes -I $dir"
done

"$erldocs"          \
    -o "$odir"      \
    $includes       \
{'fraction_non_alphanumeric': 0.19860356865787432, 'fraction_numerical': 0.0069821567106283944, 'mean_word_length': 2.955521472392638, 'pattern_counts': {'":': 0, '<': 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': '1281294', 'n_tokens_mistral': 997, 'n_tokens_neox': 945, 'n_words': 262}