Skip to content

Commit eda8641

Browse files
committed
Add script wrapper for pypi_shadowmire.sh
Signed-off-by: Shengqi Chen <[email protected]>
1 parent ec2e661 commit eda8641

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

pypi_shadowmire.sh

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
SHADOWMIRE=${SHADOWMIRE:-"/home/scripts/shadowmire"}
6+
PYPI_MASTER="https://pypi.org"
7+
8+
TUNASYNC_UPSTREAM=${TUNASYNC_UPSTREAM_URL:-$PYPI_MASTER}
9+
TUNASYNC_UPSTREAM=${TUNASYNC_UPSTREAM%/}
10+
11+
CONF="/tmp/shadowmire.conf"
12+
INIT=${INIT:-"0"}
13+
SHADOWMIRE_UPSTREAM=${SHADOWMIRE_UPSTREAM:-"0"}
14+
15+
if [ ! -d "$TUNASYNC_WORKING_DIR" ]; then
16+
mkdir -p $TUNASYNC_WORKING_DIR
17+
INIT="1"
18+
fi
19+
20+
export REPO="${TUNASYNC_WORKING_DIR}"
21+
22+
echo "Syncing to $TUNASYNC_WORKING_DIR"
23+
24+
DOWNLOAD_MIRROR=""
25+
if [[ $TUNASYNC_UPSTREAM != $PYPI_MASTER ]]; then
26+
# see https://github.com/pypa/bandersnatch/pull/928 for more info
27+
DOWNLOAD_MIRROR="shadowmire_upstream = ${TUNASYNC_UPSTREAM}"
28+
fi
29+
30+
(
31+
cat << EOF
32+
[options]
33+
sync_packages = true
34+
${DOWNLOAD_MIRROR}
35+
exclude = [
36+
".+-nightly(-|$)",
37+
EOF
38+
39+
for i in $PYPI_EXCLUDE; do
40+
echo " \"$i\","
41+
done
42+
43+
cat << EOF
44+
]
45+
EOF
46+
47+
cat << EOF
48+
]
49+
prerelease_exclude = [
50+
"duckdb",
51+
"graphscope-client",
52+
"lalsuite",
53+
"gs-(apps|engine|include)",
54+
"bigdl-dllib(-spark2|-spark3)?",
55+
"ovito"
56+
]
57+
EOF
58+
) > $CONF
59+
60+
echo "Generated config file:"
61+
cat $CONF
62+
63+
exec $SHADOWMIRE --config $CONF sync

0 commit comments

Comments
 (0)