git rm/add when remove/add new patches
authorHuaxu Wan <huaxu.wan@intel.com>
Mon, 5 Dec 2011 10:21:34 +0000 (18:21 +0800)
committerHuaxu Wan <huaxu.wan@intel.com>
Mon, 5 Dec 2011 10:21:34 +0000 (18:21 +0800)
data/packaging.sh

index f3ed08b..82b8475 100644 (file)
@@ -88,7 +88,7 @@ update_patches()
     # Find the patches to be kept
     for patch in $patch_list
     do
-        line=$(grep "Patch[0-9]*:.*$(basename $patch|sed 's/[0-9]*-//')" $spec)
+        line=$(grep "Patch[0-9]*:.*$(basename ${patch%.patch}|sed 's/[0-9]*-//')" $spec)
         if [ -n "$line" ]; then
             sed -i "s/$line/#PATCHKEPT#$line/" $spec
         else
@@ -98,7 +98,7 @@ update_patches()
 
     # Remove old patches
     toberemove_patch=$(grep "^Patch[0-9]*:" $spec |awk '{print $2}')
-    
+
     if [ -n "$toberemove_patch" ]; then
         echo "----------------------------------------"
         info_msg "The following patch(es) removed:"
@@ -118,7 +118,7 @@ update_patches()
                     ;;
                 * )
                     sed -i "/^Patch[0-9]*:.*$patch/ d" $spec
-                    rm $patch
+                    git rm $patch
                     info_msg "Patch $patch removed."
                     ;;
             esac
@@ -190,6 +190,7 @@ update_patches()
         do
             echo "    " $(basename $patch)
             mv $patch .
+            git add $patch
         done
         echo "----------------------------------------"
     fi # end of insert new add patch section
@@ -299,7 +300,6 @@ do
     shift
 done
 
-
 if [ -z "$git_obj" ]; then
     git_obj=$(git log --format="%h" -n 1)