Enhance sync script to facilitate patch submission 52/25552/1
authorRui Lv <ruix.lv@intel.com>
Wed, 6 Aug 2014 06:16:53 +0000 (02:16 -0400)
committerRui Lv <ruix.lv@intel.com>
Thu, 7 Aug 2014 02:51:35 +0000 (22:51 -0400)
Change-Id: I06a16bfe44cf62c7090fc8eba44a24d327f6d689
Signed-off-by: Rui Lv <ruix.lv@intel.com>
update_from_obs

index a1cbcaa697518b72a4ded19df49687b6a1bbc7e8..1f9b71df56e38c2aac65769ef675facab397d861 100755 (executable)
@@ -6,17 +6,31 @@ osc_cmd="osc -A https://api.tizen.org"
 
 targets=`$osc_cmd repos Tizen:Common|awk '{print $1}'|sort |uniq`
 
-echo "downloading build configs ..."
+# removing all git tracked files except for myself
+git ls-files|grep -v update_from_obs |xargs rm -f
+git add -u
+
+echo "synchronizing build configs ..."
 for target in $targets
 do
     $osc_cmd buildconfig $project $target >build-${target}.conf
+    git add build-${target}.conf
 done
 
-
 # get project meta file
-echo "downloading project meta file"
+echo "synchronizing project meta file"
 $osc_cmd meta prj $project >meta.xml
+git add meta.xml
 
 # set default build config
-rm -f build.conf
 ln -sf build-${default_target}.conf build.conf
+git add build.conf
+
+# commit changes to git tree
+git commit -m "Update from OBS at `date +\"%Y-%m-%d %H:%M:%S\"`"  >/dev/null
+if [ $? -eq 0 ]; then
+    echo "all local changes commit locally"
+    echo "please review it with 'git show' and submit it with 'git push'"
+else
+    echo "no change needs to be made"
+fi