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

set -eu

if [[ $# -lt 1 ]]; then
  echo "usage: $(basename $0) MOZ-CENTRAL" >&2
  exit 1
fi

baseDir="$(dirname "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )")"
mozCentral="$1"
dest="${mozCentral}/browser/extensions/shield-recipe-client"

rm -rf "${dest}"/*

while read -r line || [[ -n "${line}" ]]; do
  mkdir -p "$(dirname "${dest}/${line}")"
  cp -r "${baseDir}/${line}" "$(dirname "${dest}/${line}")"
done < "${baseDir}/build-includes.txt"

# This produces versions like "45", "45.5.abcdef", and "45.5.abcdef.dirty"
version=$(git -C "${baseDir}" describe --dirty | sed -e 's/^v//' -e 's/-/./g')
sed -i -e "s/@NORMANDY_VERSION@/${version}/" "${dest}/install.rdf.in"<commit_msg>update-mozilla-central.sh: Error out if sync destination is missing<commit_after>#!/usr/bin/env bash

set -eu

if [[ $# -lt 1 ]]; then
  echo "usage: $(basename $0) MOZ-CENTRAL" >&2
  exit 1
fi

baseDir="$(dirname "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )")"
mozCentral="$1"
dest="${mozCentral}/browser/extensions/shield-recipe-client"

if [[ ! -d "$dest" ]]; then
    echo "Sync destination $dest does not exist" >&2
    exit 1
fi

rm -rf "${dest}"/*

while read -r line || [[ -n "${line}" ]]; do
  mkdir -p "$(dirname "${dest}/${line}")"
  cp -r "${baseDir}/${line}" "$(dirname "${dest}/${line}")"
done < "${baseDir}/build-includes.txt"

# This produces versions like "45", "45.5.abcdef", and "45.5.abcdef.dirty"
version=$(git -C "${baseDir}" describe --dirty | sed -e 's/^v//' -e 's/-/./g')
sed -i -e "s/@NORMANDY_VERSION@/${version}/" "${dest}/install.rdf.in"
{'fraction_non_alphanumeric': 0.2616060225846926, 'fraction_numerical': 0.018820577164366373, 'mean_word_length': 3.8776758409785934, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '2973677', 'n_tokens_mistral': 646, 'n_tokens_neox': 606, 'n_words': 157}