extract_files: Add support for specifying blob sections

Sometimes the need arises to update one specific subset of blobs
while holding others steady. Introduce a way to specify the "section"
of blobs to update (obviously requires the proprietary-files to be
properly split up first)

Requires additional changes in device tree extract_files.sh to support
passing the additional arguments

Change-Id: I98feab56f8bfade2818b1b5264e019440d4c57c5
diff --git a/extract_utils.sh b/extract_utils.sh
index d241cf5..76fa63b 100644
--- a/extract_utils.sh
+++ b/extract_utils.sh
@@ -555,6 +555,7 @@
 # parse_file_list:
 #
 # $1: input file
+# $2: blob section in file - optional
 #
 # Sets PRODUCT_PACKAGES and PRODUCT_COPY_FILES while parsing the input file
 #
@@ -567,6 +568,14 @@
         exit 1
     fi
 
+    if [ $# -eq 2 ]; then
+        LIST=$TMPDIR/files.txt
+        cat $1 | sed -n '/# '"$2"'/I,/^\s*$/p' > $LIST
+    else
+        LIST=$1
+    fi
+
+
     PRODUCT_PACKAGES_LIST=()
     PRODUCT_PACKAGES_HASHES=()
     PRODUCT_COPY_FILES_LIST=()
@@ -595,7 +604,7 @@
             PRODUCT_COPY_FILES_HASHES+=("$HASH")
         fi
 
-    done < <(egrep -v '(^#|^[[:space:]]*$)' "$1" | LC_ALL=C sort | uniq)
+    done < <(egrep -v '(^#|^[[:space:]]*$)' "$LIST" | LC_ALL=C sort | uniq)
 }
 
 #
@@ -779,6 +788,7 @@
 #
 # $1: file containing the list of items to extract
 # $2: path to extracted system folder, an ota zip file, or "adb" to extract from device
+# $3: section in list file to extract - optional
 #
 function extract() {
     if [ -z "$OUTDIR" ]; then
@@ -786,7 +796,7 @@
         exit 1
     fi
 
-    parse_file_list "$1"
+    parse_file_list "$1" "$3"
 
     # Allow failing, so we can try $DEST and/or $FILE
     set +e