curl -s -u$user:$passwd -Fname=package.tar.bz2 -Ffile0=@package.tar.bz2 -Fjson='{"parameter": [{"name": "package.tar.bz2", "file": "file0"},{"name":"pkg", "value":"'$prj_name'"},{"name":"parameters","value":"obsproject='$target_obsproject';passwdx='$passwdx'"}]}' -FSubmit=Build "$HUDSON_SERVER/job/build/build"
-sleep 1
+sleep 2
+
last_id=`curl -s -u$user:$passwd "$HUDSON_SERVER/job/build/lastBuild/buildNumber"`
+result_json=`curl -s -u$user:$passwd "$HUDSON_SERVER/job/build/$last_id/api/json"`
+last_prj=`echo $result_json|python -mjson.tool |grep "pkg" -A1|tail -1|cut -d'"' -f4`
+last_user=`echo $result_json|python -mjson.tool |grep "userName" |cut -d'"' -f4`
+ # In case the last commit is not made by the user, supposed the last job triggered by '$user' is the one.
+if [ "$last_prj" != "$prj_name" -o "$last_user" != "$user" ]; then
+ echo "Your request has been put in queue waiting to process"
+ while [ true ]
+ do
+ ret_id=$(curl -s -u$user:$passwd "$HUDSON_SERVER/job/build/lastBuild/buildNumber")
+ if [ "$last_id" != "$ret_id" ]; then
+ result_json=`curl -s -u$user:$passwd "$HUDSON_SERVER/job/build/$ret_id/api/json"`
+ last_prj=`echo $result_json|python -mjson.tool |grep "pkg" -A1|tail -1|cut -d'"' -f4`
+ last_user=`echo $result_json|python -mjson.tool |grep "userName" |cut -d'"' -f4`
+ if [ "$last_prj" == "$prj_name" -o "$last_user" != "$user" ]; then
+ last_id=$ret_id
+ echo ''
+ break
+ fi
+ last_id=$ret_id
+ else
+ echo -n .
+ sleep 1
+ fi
+ done
+fi
-# In case the last commit is not made by the user, supposed the last job triggered by '$user' is the one.
-while :
-do
- result_json=`curl -s -u$user:$passwd "$HUDSON_SERVER/job/build/$last_id/api/json"`
- username=`echo $result_json|python -mjson.tool |grep "userName" |cut -d'"' -f4`
- if [ x$username != x$user ]; then
- last_id=`expr $last_id - 1`
- else
- build_id=$last_id
- break
- fi
-done
+build_id=$last_id
offset=0
while :
project=$2
info_msg "Geting md5sum about package $project, at $tag"
string=`curl -s -i -u$user:$passwd -Fjson='{"parameter": [{"name": "tag", "value": "'$tag'"},{"name":"project", "value":"'$project'"}]}' -FSubmit=Build "$HUDSON_SERVER/job/srctar_md5sum/build"`
- sleep 0.5
+ sleep 2
last_id=`curl -s -u$user:$passwd "$HUDSON_SERVER/job/srctar_md5sum/lastBuild/buildNumber"`
result_json=`curl -s -u$user:$passwd "$HUDSON_SERVER/job/srctar_md5sum/$last_id/api/json"`