Skip to content

Commit

Permalink
Merge pull request #1297 from jsuereth/fix/binary-push
Browse files Browse the repository at this point in the history
Fixes binary repo push for new typesafe repo layouts.
  • Loading branch information
jsuereth committed Sep 13, 2012
2 parents 4c11a65 + be9bab1 commit d99d387
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
22 changes: 14 additions & 8 deletions tools/binary-repo-lib.sh
Expand Up @@ -3,7 +3,8 @@
# Library to push and pull binary artifacts from a remote repository using CURL. # Library to push and pull binary artifacts from a remote repository using CURL.




remote_urlbase="http://typesafe.artifactoryonline.com/typesafe/scala-sha-bootstrap/org/scala-lang/bootstrap" remote_urlget="http://repo.typesafe.com/typesafe/scala-sha-bootstrap/org/scala-lang/bootstrap"
remote_urlpush="http://typesafe.artifactoryonline.com/typesafe/scala-sha-bootstrap/org/scala-lang/bootstrap"
libraryJar="$(pwd)/lib/scala-library.jar" libraryJar="$(pwd)/lib/scala-library.jar"
desired_ext=".desired.sha1" desired_ext=".desired.sha1"
push_jar="$(pwd)/tools/push.jar" push_jar="$(pwd)/tools/push.jar"
Expand Down Expand Up @@ -34,8 +35,8 @@ curlUpload() {
local data=$2 local data=$2
local user=$3 local user=$3
local password=$4 local password=$4
local url="${remote_urlbase}/${remote_location}" local url="${remote_urlpush}/${remote_location}"
java -jar $push_jar "$data" "$remote_location" "$user" "$password" java -jar $push_jar "$data" "$url" "$user" "$password"
if (( $? != 0 )); then if (( $? != 0 )); then
echo "Error uploading $data to $url" echo "Error uploading $data to $url"
echo "$url" echo "$url"
Expand Down Expand Up @@ -77,7 +78,7 @@ pushJarFile() {
local jar_sha1=$(shasum -p $jar_name) local jar_sha1=$(shasum -p $jar_name)
local version=${jar_sha1% ?$jar_name} local version=${jar_sha1% ?$jar_name}
local remote_uri=${version}${jar#$basedir} local remote_uri=${version}${jar#$basedir}
echo " Pushing to ${remote_urlbase}/${remote_uri} ..." echo " Pushing to ${remote_urlpush}/${remote_uri} ..."
echo " $curl" echo " $curl"
curlUpload $remote_uri $jar_name $user $pw curlUpload $remote_uri $jar_name $user $pw
echo " Making new sha1 file ...." echo " Making new sha1 file ...."
Expand Down Expand Up @@ -113,7 +114,7 @@ pushJarFiles() {
local user=$2 local user=$2
local password=$3 local password=$3
# TODO - ignore target/ and build/ # TODO - ignore target/ and build/
local jarFiles="$(find ${basedir}/lib -name "*.jar") $(find ${basedir}/test/files -name "*.jar")" local jarFiles="$(find ${basedir}/lib -name "*.jar") $(find ${basedir}/test/files -name "*.jar") $(find ${basedir}/tools -name "*.jar")"
local changed="no" local changed="no"
for jar in $jarFiles; do for jar in $jarFiles; do
local valid=$(isJarFileValid $jar) local valid=$(isJarFileValid $jar)
Expand Down Expand Up @@ -142,9 +143,14 @@ pullJarFileToCache() {
if [[ ! -d $cdir ]]; then if [[ ! -d $cdir ]]; then
mkdir -p $cdir mkdir -p $cdir
fi fi
# TODO - Check SHA of local cache is accurate. if [[ ! -f "$cache_loc" ]]; then
if [[ ! -f $cache_loc ]]; then # Note: After we follow up with JFrog, we should check the more stable raw file server first
curlDownload $cache_loc ${remote_urlbase}/${uri} # before hitting the more flaky artifactory.
curlDownload $cache_loc ${remote_urlpush}/${uri}
if test "$(checkJarSha "$cache_loc" "$sha")" != "OK"; then
echo "Trouble downloading $uri. Please try pull-binary-libs again when your internet connection is stable."
exit 2
fi
fi fi
echo "$cache_loc" echo "$cache_loc"
} }
Expand Down
2 changes: 1 addition & 1 deletion tools/push.jar.desired.sha1
@@ -1 +1 @@
de5d3eb21a732e4bce44c283ccfbd1ed94bfeaed ?push.jar a1883f4304d5aa65e1f6ee6aad5900c62dd81079 ?push.jar

0 comments on commit d99d387

Please sign in to comment.