project-config/jenkins/scripts/wheel-copy.sh
Michael Krotscheck 9183bac7ff Normalize wheel folder structure
This patch normalizes the names of the package folders based on
PEP-503. It permits the discovery of wheels with names that
contain odd characters.

Example conversion:
  'MySQL_python' => 'mysql-python'
  'MarkupSafe' => 'markupsafe'

Change-Id: Idcb540cecc7b581a24f060f636a1df034b653996
2016-02-08 07:13:23 -08: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