Merge remote branch 'origin/master'
authorJF Ding <jian-feng.ding@intel.com>
Mon, 5 Dec 2011 03:13:57 +0000 (11:13 +0800)
committerJF Ding <jian-feng.ding@intel.com>
Mon, 5 Dec 2011 03:13:57 +0000 (11:13 +0800)
1  2 
data/build.sh
data/packaging.sh

diff --cc data/build.sh
@@@ -45,30 -50,52 +50,52 @@@ f
  # tar the local changes
  tar jcf package.tar.bz2 `git ls-files`
  
 -# get user name/passwd from tizenpkg.conf
 -user=$(tizenpkg cfg user)
 -passwd=$(tizenpkg cfg passwd)
 -HUDSON_SERVER=$(tizenpkg cfg src_server)
 -passwdx=$(tizenpkg cfg passwdx)
 +# get user name/passwd from pkghelper.conf
 +user=$(pkghelper cfg user)
 +passwd=$(pkghelper cfg passwd)
 +HUDSON_SERVER=$(pkghelper cfg src_server)
 +passwdx=$(pkghelper cfg passwdx)
  echo "Submiting your changes to build server"
  
- 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" 
+ ret_string=$(curl -i -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")
+ echo $ret_string|grep '302' > /dev/null
+ if [ $? != 0 ]; then
+     echo $ret_string
+     die "Server Error, please check you tizenpkg configuration"
+ fi
+ sleep 2
  
- sleep 0.5
  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 :
@@@ -309,13 -315,17 +315,17 @@@ if [ -z "$tag" ];the
      tag=$(git describe $git_obj --abbrev=0 --tags)
  fi
  
 -user=$(tizenpkg cfg user)
 -passwd=$(tizenpkg cfg passwd)
 -HUDSON_SERVER=$(tizenpkg cfg src_server)
 +user=$(pkghelper cfg user)
 +passwd=$(pkghelper cfg passwd)
 +HUDSON_SERVER=$(pkghelper cfg src_server)
  
  git_url=`git config remote.origin.url`
- project=`basename $git_url`
+ echo $git_url|grep ^ssh  > /dev/null
+ if [ $? == 0 ]; then
+     project=`basename $git_url`
+ else
+     project=$(echo $git_url|cut -d ':' -f2)
+ fi
  
  info_msg "Packaging at major release ${tag}, the other commit(s) formating as patch(es)"
  srctar_md5sum=""