Updating submodules
[hiphop-php.git] / third-party / upload-first-party-to-manifold.sh
blob2e22a4fd82e372cf0dfa35d8a18404c09046bc71
1 #!/bin/sh
2 # MUST BE USED BY AN FB EMPLOYEE ON A MANAGED MACHINE
4 set -e
5 VER="$1"
7 # Assume we're not running this in 2100 or later
8 if [ "${VER#20*}" = "$VER" ]; then
9 echo "Usage: $0 YYYY.MM.DD.xx"
10 exit
13 DOWNLOAD_DIR="$(mktemp -d)"
15 grep --only-matching -E "https://github.com/.+$VER.+\.gz" -- */CMakeLists.txt | \
16 while read -r LINE; do
17 URL="${LINE#*:}"
18 FILE="${URL##*/}"
19 # Do we have `vFOO.tar.gz`, or `project-vFOO.tar.gz`? We always need
20 # the latter
21 if [ "${FILE#v20}" != "$FILE" ]; then
22 # https://github.com/ORG/PROJECT/
23 PROJECT="$(echo "$URL" | cut -f5 -d/)"
24 FILE="$PROJECT-$FILE"
26 wget -O "$DOWNLOAD_DIR/$FILE" "$URL"
27 manifold put \
28 "$DOWNLOAD_DIR/$FILE" \
29 "hhvm_opensource_dependency_cache/flat/$FILE"
30 done
32 rm -rf "$DOWNLOAD_DIR"