Skip to content
Snippets Groups Projects
Commit 9e222ca4 authored by Raphaël Gomès's avatar Raphaël Gomès
Browse files

Add script to help generate a tarball of unknown files for a given repository

parent cb06a253
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
set -euo pipefail
if [ $# -lt 2 ]; then
echo 'usage: create-tarball-of-unknowns REPOSITORY_NAME MAX [REPOS_DIR]'
echo ''
echo 'examples:'
echo ' create-tarball-of-unknowns mercurial-2018-08-01-b2561d4a 600'
echo ' create-tarball-of-unknowns mercurial-2018-08-01-b2561d4a 30%'
echo ' create-tarball-of-unknowns mercurial-2018-08-01-b2561d4a 100% /data/scmperf-repos'
exit 64
fi
initial_wd="$(pwd)"
root="$(realpath $(dirname $0) | tr -d '\n')"
echo "${root}"
repo="$1"
shift
max="$1"
shift
repos_dir="${1:-repos}"
venv_path=/tmp/build-reference-${repo}-$RANDOM-venv
rm -rf $venv_path
output_list_path="${venv_path}/${repo}"
function finish {
cd "${initial_wd}"
rm -rf "$venv_path"
}
trap finish EXIT
echo "Creating temporary virtualenv"
virtualenv -q "$venv_path"
PYTHONWARNINGS="ignore:DEPRECATION" ${venv_path}/bin/pip --disable-pip-version-check --quiet install --requirement "${root}"/../requirements.txt
export HGRCPATH=
set +u
source ${venv_path}/bin/activate
set -u
echo "Creating tarball for ${repo}"
cd "${repos_dir}/${repo}-reference/"
"${root}"/generate_unknown_files --max="${max}" -o="${output_list_path}"
tar cf "${repos_dir}/${repo}-unknown.tar" -T "${output_list_path}" --remove-files
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment