project-config/roles/copy-wheels/files/wheel-copy.sh
Ian Wienand f767e5230a copy-wheels: fix index build
wheel-copy.sh is the wrong place to do the index of the package
directory.  Move it to wheel-index.sh where we are walking the final
wheel directories.

Change-Id: I58329650962b4dbe24f79a1f4e4ea54e709233c1
2020-01-15 18:06:39 +11:00

34 lines
990 B
Bash
Executable File

#!/bin/bash -xe
# Working variables
WHEELHOUSE_DIR=$1
MIRROR_ROOT=$2
# Pre-filter any blacklisted package name patterns
find "$WHEELHOUSE_DIR/" '(' \
-name "pip-*-none-any.whl" -o \
-name "setuptools-*-none-any.whl" -o \
-name "virtualenv-*-none-any.whl" \
')' -exec rm "{}" \;
# 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