OSDN Git Service

Improve formatting of output for readability
[android-x86/device-common.git] / generate-blob-scripts.sh
index bbf5abb..e944f20 100755 (executable)
@@ -16,7 +16,7 @@
 
 # This script auto-generates the scripts that manage the handling of the
 # proprietary blobs necessary to build the Android Open-Source Project code
-# for passion and crespo targets
+# for a variety of hardware targets
 
 # It needs to be run from the root of a source tree that can repo sync,
 # runs builds with and without the vendor tree, and uses the difference
@@ -43,35 +43,40 @@ then
 fi
 shift
 
-DEVICES="crespo crespo4g stingray wingray tuna toro"
-
-ARCHIVEDIR=archive-$(date +%s)
-mkdir $ARCHIVEDIR
+DEVICES="crespo crespo4g stingray wingray tuna toro panda"
 
 repo sync
 repo sync
 repo sync
 
-. build/envsetup.sh
-for DEVICENAME in $DEVICES
-do
-  rm -rf out
-  lunch full_$DEVICENAME-user
-  make -j32
-  cat out/target/product/$DEVICENAME/installed-files.txt |
-    cut -b 15- |
-    sort -f > $ARCHIVEDIR/$DEVICENAME-with.txt
-done
-rm -rf vendor
-for DEVICENAME in $DEVICES
-do
-  rm -rf out
-  lunch full_$DEVICENAME-user
-  make -j32
-  cat out/target/product/$DEVICENAME/installed-files.txt |
-    cut -b 15- |
-    sort -f > $ARCHIVEDIR/$DEVICENAME-without.txt
-done
+ARCHIVEDIR=archive-$(date +%s)
+if test -d archive-ref
+then
+  cp -R archive-ref $ARCHIVEDIR
+else
+  mkdir $ARCHIVEDIR
+
+  . build/envsetup.sh
+  for DEVICENAME in $DEVICES
+  do
+    rm -rf out
+    lunch full_$DEVICENAME-user
+    make -j32
+    cat out/target/product/$DEVICENAME/installed-files.txt |
+      cut -b 15- |
+      sort -f > $ARCHIVEDIR/$DEVICENAME-with.txt
+  done
+  rm -rf vendor
+  for DEVICENAME in $DEVICES
+  do
+    rm -rf out
+    lunch full_$DEVICENAME-user
+    make -j32
+    cat out/target/product/$DEVICENAME/installed-files.txt |
+      cut -b 15- |
+      sort -f > $ARCHIVEDIR/$DEVICENAME-without.txt
+  done
+fi
 
 for DEVICENAME in $DEVICES
 do
@@ -103,10 +108,7 @@ do
     echo 'mkdir -p ../../../vendor/$MANUFACTURER/$DEVICE/proprietary'
 
     diff $ARCHIVEDIR/$DEVICENAME-without.txt $ARCHIVEDIR/$DEVICENAME-with.txt |
-      grep -v Nfc\.apk\$ |
-      grep -v Tag\.apk\$ |
-      grep -v libnfc\.so\$ |
-      grep -v libnfc_jni\.so\$ |
+      grep -v '\.odex$' |
       grep '>' |
       cut -b 3- |
       while read FULLPATH
@@ -147,10 +149,7 @@ do
 
     FOUND=false
     diff $ARCHIVEDIR/$DEVICENAME-without.txt $ARCHIVEDIR/$DEVICENAME-with.txt |
-      grep -v Nfc\.apk\$ |
-      grep -v Tag\.apk\$ |
-      grep -v libnfc\.so\$ |
-      grep -v libnfc_jni\.so\$ |
+      grep -v '\.odex$' |
       grep '>' |
       cut -b 3- |
       while read FULLPATH
@@ -173,10 +172,8 @@ do
 
     FOUND=false
     diff $ARCHIVEDIR/$DEVICENAME-without.txt $ARCHIVEDIR/$DEVICENAME-with.txt |
-      grep -v Nfc\.apk\$ |
-      grep -v Tag\.apk\$ |
-      grep -v libnfc\.so\$ |
-      grep -v libnfc_jni\.so\$ |
+      grep -v '\.odex$' |
+      grep -v '\.apk$' |
       grep '>' |
       cut -b 3- |
       while read FULLPATH
@@ -194,6 +191,90 @@ do
         echo -n \ \ \ \ vendor/__MANUFACTURER__/__DEVICE__/proprietary/$(basename $FULLPATH):$(echo $FULLPATH | cut -b 2-)
       done
     echo
+
+    FOUND=false
+    diff $ARCHIVEDIR/$DEVICENAME-without.txt $ARCHIVEDIR/$DEVICENAME-with.txt |
+      grep '\.apk$' |
+      grep '>' |
+      cut -b 3- |
+      while read FULLPATH
+      do
+        if test $FOUND = false
+        then
+          echo
+          echo -n '# All the apks necessary for '
+          echo $DEVICENAME
+          echo 'PRODUCT_PACKAGES += \\'
+        else
+          echo \ \\\\
+        fi
+        FOUND=true
+        echo -n \ \ \ \ 
+        echo -n $(basename $FULLPATH) | sed 's/\.apk//g'
+      done
+    echo
+
+    echo
+    echo 'EOF'
+
+    echo
+
+    echo -n '(cat << EOF) | sed s/__DEVICE__/$DEVICE/g | sed s/__MANUFACTURER__/$MANUFACTURER/g > ../../../vendor/$MANUFACTURER/$DEVICE/'
+    echo 'proprietary/Android.mk'
+
+    echo '# Copyright (C) 2011 The Android Open Source Project'
+    echo '#'
+    echo '# Licensed under the Apache License, Version 2.0 (the "License");'
+    echo '# you may not use this file except in compliance with the License.'
+    echo '# You may obtain a copy of the License at'
+    echo '#'
+    echo '#      http://www.apache.org/licenses/LICENSE-2.0'
+    echo '#'
+    echo '# Unless required by applicable law or agreed to in writing, software'
+    echo '# distributed under the License is distributed on an "AS IS" BASIS,'
+    echo '# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.'
+    echo '# See the License for the specific language governing permissions and'
+    echo '# limitations under the License.'
+    echo
+    echo -n '# This file is generated by device/__MANUFACTURER__/__DEVICE__/'
+    echo -n $FILESTYLE
+    echo '-files.sh - DO NOT EDIT'
+    echo
+    echo ifeq \(\\\$\(TARGET_DEVICE\),$DEVICENAME\)
+    echo LOCAL_PATH:=\\\$\(call my-dir\)
+
+    FOUND=false
+    diff $ARCHIVEDIR/$DEVICENAME-without.txt $ARCHIVEDIR/$DEVICENAME-with.txt |
+      grep '\.apk$' |
+      grep '>' |
+      cut -b 3- |
+      while read FULLPATH
+      do
+        if test $FOUND = false
+        then
+          echo
+          echo -n '# Module makefile rules for apks on '
+          echo $DEVICENAME
+        fi
+        FOUND=true
+        echo
+        echo -n '# '
+        echo $(basename $FULLPATH) | sed 's/\.apk//g'
+        echo
+        echo include \\\$\(CLEAR_VARS\)
+        echo
+        echo LOCAL_MODULE := $(basename $FULLPATH) | sed 's/\.apk//g'
+        echo LOCAL_SRC_FILES := \\\$\(LOCAL_MODULE\).apk
+        echo LOCAL_MODULE_CLASS := APPS
+        echo LOCAL_MODULE_TAGS := optional
+        echo LOCAL_CERTIFICATE := PRESIGNED
+        echo LOCAL_MODULE_SUFFIX := \\\$\(COMMON_ANDROID_PACKAGE_SUFFIX\)
+        echo include \\\$\(BUILD_PREBUILT\)
+      done
+    echo
+    echo endif
+    echo
+
     echo 'EOF'
     echo
     echo './setup-makefiles.sh'