project-config/roles/copy-wheels/files/wheel-copy.sh
Andreas Jaeger 3a806df6c6 Move wheel-build scripts out of jenkins/scripts
We only need the three wheel-X scripts from jenkins/scripts and need
them only for the playbook and its roles. Move the scripts in the
roles directory and copy them only if needed - using the scripts module.

Remove copying of complete jenkins/script for this playbook using the
role legacy-copy-project-config-scripts, it's not needed anymore.

Change-Id: I2e481fcf7ca148aac8a36ae99d8598ba26078a25
2018-02-13 21:12:45 +01:00

27 lines
764 B
Bash
Executable File

#!/bin/bash -xe
# Working variables
WHEELHOUSE_DIR=$1
MIRROR_ROOT=$2
# Build our mirror folder structure.
for f in $WHEELHOUSE_DIR/*; do
BASENAME=$(basename $f)
IFS='-' read -a parts <<< $BASENAME
# Normalize based on PEP503
PACKAGENAME=`echo "${parts[0]}" | perl -pe 's/[-_.]+/-/g' | \
tr '[:upper:]' '[:lower:]'`
DEST_DIR="${PACKAGENAME:0:1}/$PACKAGENAME"
# Create the mirror directories in AFS /s/split style. This
# depends on the existence of a mod_rewrite script which unmunges
# the path, and is required because AFS has a practical folder size
# limit.
if [ ! -f $MIRROR_ROOT/$DEST_DIR/$BASENAME ]; then
mkdir -p $MIRROR_ROOT/$DEST_DIR
cp $f $MIRROR_ROOT/$DEST_DIR/$BASENAME
fi
done