From: Jean-Baptiste Queru Date: Tue, 27 Dec 2011 22:34:24 +0000 (-0800) Subject: Improve self-extractor-generation scripts. X-Git-Url: http://git.osdn.net/view?p=android-x86%2Fdevice-common.git;a=commitdiff_plain;h=4b57212ce222342fec45154f5b711495877b2509 Improve self-extractor-generation scripts. Don't generate output if the build failed. Don't delete sources when using a reference archive. Change-Id: I66263b39dc91c74b8b4edaa11737449d093f7bf7 --- diff --git a/generate-blob-scripts.sh b/generate-blob-scripts.sh index e5449eb..902e72f 100755 --- a/generate-blob-scripts.sh +++ b/generate-blob-scripts.sh @@ -43,13 +43,9 @@ then fi shift -DEVICES="crespo crespo4g stingray wingray panda toro maguro" +DEVICES="maguro" export LC_ALL=C -repo sync -repo sync -repo sync - ARCHIVEDIR=archive-$(date +%s) if test -d archive-ref then @@ -81,226 +77,231 @@ fi for DEVICENAME in $DEVICES do - MANUFACTURERNAME=$( find device -type d | grep [^/]\*/[^/]\*/$DEVICENAME\$ | cut -f 2 -d / ) - for FILESTYLE in extract unzip - do - ( - echo '#!/bin/sh' - echo - echo '# Copyright (C) 2010 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 '# This file is generated by device/common/generate-blob-scripts.sh - DO NOT EDIT' - echo - echo DEVICE=$DEVICENAME - echo MANUFACTURER=$MANUFACTURERNAME - echo - echo 'mkdir -p ../../../vendor/$MANUFACTURER/$DEVICE/proprietary' + if test $(wc -l < $ARCHIVEDIR/$DEVICENAME-without.txt) != 0 -a $(wc -l < $ARCHIVEDIR/$DEVICENAME-with.txt) != 0 + then + MANUFACTURERNAME=$( find device -type d | grep [^/]\*/[^/]\*/$DEVICENAME\$ | cut -f 2 -d / ) + for FILESTYLE in extract unzip + do + ( + echo '#!/bin/sh' + echo + echo '# Copyright (C) 2010 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 '# This file is generated by device/common/generate-blob-scripts.sh - DO NOT EDIT' + echo + echo DEVICE=$DEVICENAME + echo MANUFACTURER=$MANUFACTURERNAME + echo + echo 'mkdir -p ../../../vendor/$MANUFACTURER/$DEVICE/proprietary' - diff $ARCHIVEDIR/$DEVICENAME-without.txt $ARCHIVEDIR/$DEVICENAME-with.txt | - grep -v '\.odex$' | - grep '>' | - cut -b 3- | - while read FULLPATH - do - if test $FILESTYLE = extract - then - echo adb pull $FULLPATH ../../../vendor/\$MANUFACTURER/\$DEVICE/proprietary/$(basename $FULLPATH) - else - echo unzip -j -o ../../../\${DEVICE}_update.zip $(echo $FULLPATH | cut -b 2-) -d ../../../vendor/\$MANUFACTURER/\$DEVICE/proprietary - fi - if test $(basename $FULLPATH) = akmd -o $(basename $FULLPATH) = mm-venc-omx-test -o $(basename $FULLPATH) = parse_radio_log -o $(basename $FULLPATH) = akmd8973 -o $(basename $FULLPATH) = gpsd -o $(basename $FULLPATH) = pvrsrvinit -o $(basename $FULLPATH) = fRom - then - echo chmod 755 ../../../vendor/\$MANUFACTURER/\$DEVICE/proprietary/$(basename $FULLPATH) - fi - done - echo + diff $ARCHIVEDIR/$DEVICENAME-without.txt $ARCHIVEDIR/$DEVICENAME-with.txt | + grep -v '\.odex$' | + grep '>' | + cut -b 3- | + while read FULLPATH + do + if test $FILESTYLE = extract + then + echo adb pull $FULLPATH ../../../vendor/\$MANUFACTURER/\$DEVICE/proprietary/$(basename $FULLPATH) + else + echo unzip -j -o ../../../\${DEVICE}_update.zip $(echo $FULLPATH | cut -b 2-) -d ../../../vendor/\$MANUFACTURER/\$DEVICE/proprietary + fi + if test $(basename $FULLPATH) = akmd -o $(basename $FULLPATH) = mm-venc-omx-test -o $(basename $FULLPATH) = parse_radio_log -o $(basename $FULLPATH) = akmd8973 -o $(basename $FULLPATH) = gpsd -o $(basename $FULLPATH) = pvrsrvinit -o $(basename $FULLPATH) = fRom + then + echo chmod 755 ../../../vendor/\$MANUFACTURER/\$DEVICE/proprietary/$(basename $FULLPATH) + fi + done + echo - echo -n '(cat << EOF) | sed s/__DEVICE__/$DEVICE/g | sed s/__MANUFACTURER__/$MANUFACTURER/g > ../../../vendor/$MANUFACTURER/$DEVICE/' - echo 'device-vendor-blobs.mk' + echo -n '(cat << EOF) | sed s/__DEVICE__/$DEVICE/g | sed s/__MANUFACTURER__/$MANUFACTURER/g > ../../../vendor/$MANUFACTURER/$DEVICE/' + echo 'device-vendor-blobs.mk' - echo '# Copyright (C) 2010 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 '# Copyright (C) 2010 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' - FOUND=false - diff $ARCHIVEDIR/$DEVICENAME-without.txt $ARCHIVEDIR/$DEVICENAME-with.txt | - grep -v '\.odex$' | - grep '>' | - cut -b 3- | - while read FULLPATH - do - if test $(basename $FULLPATH) = libgps.so -o $(basename $FULLPATH) = libcamera.so -o $(basename $FULLPATH) = libsecril-client.so - then + FOUND=false + diff $ARCHIVEDIR/$DEVICENAME-without.txt $ARCHIVEDIR/$DEVICENAME-with.txt | + grep -v '\.odex$' | + grep '>' | + cut -b 3- | + while read FULLPATH + do + if test $(basename $FULLPATH) = libgps.so -o $(basename $FULLPATH) = libcamera.so -o $(basename $FULLPATH) = libsecril-client.so + then + if test $FOUND = false + then + echo + echo '# Prebuilt libraries that are needed to build open-source libraries' + echo 'PRODUCT_COPY_FILES := \\' + else + echo \ \\\\ + fi + FOUND=true + echo -n \ \ \ \ vendor/__MANUFACTURER__/__DEVICE__/proprietary/$(basename $FULLPATH):obj/lib/$(basename $FULLPATH) + fi + done + echo + + FOUND=false + diff $ARCHIVEDIR/$DEVICENAME-without.txt $ARCHIVEDIR/$DEVICENAME-with.txt | + grep -v '\.odex$' | + grep -v '\.apk$' | + grep '>' | + cut -b 3- | + while read FULLPATH + do if test $FOUND = false then echo - echo '# Prebuilt libraries that are needed to build open-source libraries' - echo 'PRODUCT_COPY_FILES := \\' + echo -n '# All the blobs necessary for ' + echo $DEVICENAME + echo 'PRODUCT_COPY_FILES += \\' else echo \ \\\\ fi FOUND=true - echo -n \ \ \ \ vendor/__MANUFACTURER__/__DEVICE__/proprietary/$(basename $FULLPATH):obj/lib/$(basename $FULLPATH) - fi - done - echo - - FOUND=false - diff $ARCHIVEDIR/$DEVICENAME-without.txt $ARCHIVEDIR/$DEVICENAME-with.txt | - grep -v '\.odex$' | - grep -v '\.apk$' | - grep '>' | - cut -b 3- | - while read FULLPATH - do - if test $FOUND = false - then - echo - echo -n '# All the blobs necessary for ' - echo $DEVICENAME - echo 'PRODUCT_COPY_FILES += \\' - else - echo \ \\\\ - fi - FOUND=true - echo -n \ \ \ \ vendor/__MANUFACTURER__/__DEVICE__/proprietary/$(basename $FULLPATH):$(echo $FULLPATH | cut -b 2-) - done - echo + 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 + 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 'EOF' - echo + echo - echo -n '(cat << EOF) | sed s/__DEVICE__/$DEVICE/g | sed s/__MANUFACTURER__/$MANUFACTURER/g > ../../../vendor/$MANUFACTURER/$DEVICE/' - echo 'proprietary/Android.mk' + 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\) + 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 + 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 '# 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' + 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 - ) > $ARCHIVEDIR/$DEVICENAME-$FILESTYLE-files.sh - cp $ARCHIVEDIR/$DEVICENAME-$FILESTYLE-files.sh device/$MANUFACTURERNAME/$DEVICENAME/$FILESTYLE-files.sh - chmod a+x device/$MANUFACTURERNAME/$DEVICENAME/$FILESTYLE-files.sh - done + echo 'EOF' + echo + echo './setup-makefiles.sh' - ( - cd device/$MANUFACTURERNAME/$DEVICENAME - git add . - git commit -m "$(echo -e 'auto-generated blob-handling scripts\n\nBug: 4295425')" - if test "$1" != "" -a "$2" != "" - then - echo uploading to server $1 branch $2 - git push ssh://$1:29418/device/$MANUFACTURERNAME/$DEVICENAME.git HEAD:refs/for/$2/autoblobs - fi - ) + ) > $ARCHIVEDIR/$DEVICENAME-$FILESTYLE-files.sh + cp $ARCHIVEDIR/$DEVICENAME-$FILESTYLE-files.sh device/$MANUFACTURERNAME/$DEVICENAME/$FILESTYLE-files.sh + chmod a+x device/$MANUFACTURERNAME/$DEVICENAME/$FILESTYLE-files.sh + done + ( + cd device/$MANUFACTURERNAME/$DEVICENAME + git add . + git commit -m "$(echo -e 'auto-generated blob-handling scripts\n\nBug: 4295425')" + if test "$1" != "" -a "$2" != "" + then + echo uploading to server $1 branch $2 + git push ssh://$1:29418/device/$MANUFACTURERNAME/$DEVICENAME.git HEAD:refs/for/$2/autoblobs + fi + ) + fi done -echo * device/* | - tr \ \\n | - grep -v ^archive- | - grep -v ^device$ | - grep -v ^device/common$ | - xargs rm -rf +if ! test -d archive-ref +then + echo * device/* | + tr \ \\n | + grep -v ^archive- | + grep -v ^device$ | + grep -v ^device/common$ | + xargs rm -rf +fi