Add pack and install scripts for zip
authorjiehua.xiong <jiehuax.xiong@intel.com>
Tue, 17 Sep 2013 08:41:12 +0000 (16:41 +0800)
committerjiehua.xiong <jiehuax.xiong@intel.com>
Fri, 11 Oct 2013 06:37:29 +0000 (14:37 +0800)
Change-Id: I752cff85b6aba06b5820640c84c4a4ab73e8badf

52 files changed:
packall.sh [new file with mode: 0755]
tct-appwgt-wrt-tests/Makefile.am
tct-appwgt-wrt-tests/inst.sh.wgt [new file with mode: 0755]
tct-appwgt-wrt-tests/pack.sh
tct-appwgt-wrt-tests/resources/Makefile.am
tct-appwgt-wrt-tests/scripts/Makefile.am
tct-appwgt-wrt-tests/tct-appwgt-wrt-tests.spec
tct-ext01-wrt-tests/Makefile.am
tct-ext01-wrt-tests/inst.sh.wgt [new file with mode: 0755]
tct-ext01-wrt-tests/pack.sh
tct-ext01-wrt-tests/tct-ext01-wrt-tests.spec
tct-ext02-wrt-tests/Makefile.am
tct-ext02-wrt-tests/inst.sh.wgt [new file with mode: 0755]
tct-ext02-wrt-tests/pack.sh
tct-ext02-wrt-tests/scripts/Makefile.am
tct-ext02-wrt-tests/support/Makefile.am
tct-ext02-wrt-tests/tct-ext02-wrt-tests.spec
tct-ext02-wrt-tests/w3c/Makefile.am
tct-ext02-wrt-tests/w3c/support/Makefile.am
tct-pm-wrt-tests/Makefile.am
tct-pm-wrt-tests/inst.sh.wgt [new file with mode: 0755]
tct-pm-wrt-tests/pack.sh
tct-pm-wrt-tests/resources/Makefile.am
tct-pm-wrt-tests/scripts/Makefile.am
tct-pm-wrt-tests/tct-pm-wrt-tests.spec
tct-rt01-wrt-tests/Makefile.am
tct-rt01-wrt-tests/inst.sh.wgt [new file with mode: 0755]
tct-rt01-wrt-tests/pack.sh
tct-rt01-wrt-tests/tct-rt01-wrt-tests.spec
tct-rt02-wrt-tests/Makefile.am
tct-rt02-wrt-tests/inst.sh.wgt [new file with mode: 0755]
tct-rt02-wrt-tests/pack.sh
tct-rt02-wrt-tests/scripts/Makefile.am
tct-rt02-wrt-tests/tct-rt02-wrt-tests.spec
tct-sp01-wrt-tests/Makefile.am
tct-sp01-wrt-tests/inst.sh.wgt [new file with mode: 0755]
tct-sp01-wrt-tests/pack.sh
tct-sp01-wrt-tests/tct-sp01-wrt-tests.spec
tct-sp02-wrt-tests/Makefile.am
tct-sp02-wrt-tests/inst.sh.wgt [new file with mode: 0755]
tct-sp02-wrt-tests/pack.sh
tct-sp02-wrt-tests/scripts/Makefile.am
tct-sp02-wrt-tests/tct-sp02-wrt-tests.spec
tct-stab-wrt-tests/Makefile.am
tct-stab-wrt-tests/inst.sh.wgt [new file with mode: 0755]
tct-stab-wrt-tests/pack.sh
tct-stab-wrt-tests/scripts/Makefile.am
tct-stab-wrt-tests/tct-stab-wrt-tests.spec
tct-ui01-wrt-tests/Makefile.am
tct-ui01-wrt-tests/inst.sh.wgt [new file with mode: 0755]
tct-ui01-wrt-tests/pack.sh
tct-ui01-wrt-tests/tct-ui01-wrt-tests.spec

diff --git a/packall.sh b/packall.sh
new file mode 100755 (executable)
index 0000000..729fdfa
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+SUITE="tct-appwgt-wrt-tests
+tct-ext01-wrt-tests
+tct-ext02-wrt-tests
+tct-pm-wrt-tests
+tct-rt01-wrt-tests
+tct-rt02-wrt-tests
+tct-sp01-wrt-tests
+tct-sp02-wrt-tests
+tct-stab-wrt-tests
+tct-ui01-wrt-tests"
+
+for suite in $SUITE;do
+    cd $suite
+    ./pack.sh
+    cd -
+done
index 384a794975e3e639f20b023b91d9f0429ccfbbe7..4937e3c3daf88b52041bb41a82f9b7bc4b3cc9d0 100644 (file)
@@ -28,7 +28,5 @@
 #               Fan, Yugang <yugang.fan@intel.com>
 #
 SUBDIRS =  scripts resources
-testdefdir = $(datadir)/tct-appwgt-wrt-tests
-dist_testdef_DATA = tests.xml
-docdir = /opt/tct-appwgt-wrt-tests
-dist_doc_DATA = Changelog README *.wgt COPYING
+docdir = $(prefix)/opt/tct-appwgt-wrt-tests
+dist_doc_DATA = Changelog README *.wgt COPYING tests.xml
diff --git a/tct-appwgt-wrt-tests/inst.sh.wgt b/tct-appwgt-wrt-tests/inst.sh.wgt
new file mode 100755 (executable)
index 0000000..4661715
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+wgt_installer="pkgcmd"
+NAME=$(basename $(cd $(dirname $0);pwd))
+
+#parse params
+USAGE="Usage: ./inst.sh [-i] [-u]
+  -i install wgt and config environment 
+  -u uninstall wgt and remove source file
+[-i] option was set as default."
+
+function installpkg(){
+    echo "No need to install $NAME.wgt ..."
+}
+
+function uninstallpkg(){
+### remove source file ###
+if [ -d /opt/usr/media/tct/opt/$NAME ];then
+    rm -rf /opt/usr/media/tct/opt/$NAME
+else
+    echo "Remove source file fail,please check if the source file exist: /opt/usr/media/tct/opt/$NAME ..."
+fi
+}
+
+case "$1" in
+    -h|--help) echo "$USAGE"
+               exit ;;
+    ""|-i) installpkg;;
+    -u) uninstallpkg;;
+    *) echo "Unknown option: $1"
+       echo "$USAGE"
+       exit ;;
+esac
index fc85c462131ef2d3f24568f3afe5f8af9989aa3b..4d66654d337f6e6742386a6556de9642e50677d6 100755 (executable)
@@ -1,44 +1,72 @@
 #!/bin/bash
-##
-# Copyright (c) 2012 Intel Corporation.
-#
-# Redistribution and use in source and binary forms, with or without modification,
-# are permitted provided that the following conditions are met:
-#
-# * Redistributions of works must retain the original copyright notice, this list
-#   of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the original copyright notice,
-#   this list of conditions and the following disclaimer in the documentation
-#   and/or other materials provided with the distribution.
-# * Neither the name of Intel Corporation nor the names of its contributors
-#   may be used to endorse or promote products derived from this work without
-#   specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT,
-# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# Authors:
-#               Fan, Yugang <yugang.fan@intel.com>
-#
-
-USAGE="Usage: ./pack.sh"
+source $(dirname $0)/$(basename $(pwd)).spec
+
+#parse params
+usage="Usage: ./pack.sh [-t <package type: wgt | apk | crx | xpk>]
+[-t wgt] option was set as default."
 
 if [[ $1 == "-h" || $1 == "--help" ]]; then
-    echo $USAGE
+    echo $usage
+    exit 1
+fi
+
+type="wgt"
+while getopts t: o
+do
+    case "$o" in
+    t) type=$OPTARG;;
+    *) echo $usage
+       exit 1;;
+    esac
+done
+
+if [[ $type == "wgt" || $type == "apk" || $type == "crx" || $type == "xpk" ]];then
+    echo "Create package with $type and raw source"
+else 
+    echo "Sorry,$type is not support... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+    echo "$usage"
+    exit 1
+fi
+
+if [[ -z $name || -z $version || -z $appname ]];then
+    echo "Package name or version not specified in spec"
+    exit 1
+fi
+
+SRC_ROOT=${PWD}
+BUILD_ROOT=/tmp/${name}_pack
+BUILD_DEST=/tmp/${name}
+
+# clean
+function clean_workspace(){
+echo "cleaning workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+rm -rf $BUILD_ROOT $BUILD_DEST
+}
+
+clean_workspace
+mkdir -p $BUILD_ROOT $BUILD_DEST
+
+# copy source code
+rm -rf *.rpm *.tar.bz2 *.tar.gz *.zip
+cp -arf $SRC_ROOT/* $BUILD_ROOT/
+
+# copy signing tool
+echo "copy signing tool... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cp -arf $SRC_ROOT/../tools/signing $BUILD_ROOT/signing
+if [ $? -ne 0 ];then
+    echo "No signing tool found in $SRC_ROOT/../tools.... >>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
     exit 1
 fi
 
+## function for create wgt apk xpk ##
+
+function create_wgt(){
+# create wgt
+cd $BUILD_ROOT
 pack_fail='FALSE'
 suite_dir=${PWD}
-all_dirs=`ls -l --time-style="long-iso" $suite_dir | grep '^d' | awk '{print $8}'`
+all_dirs=`ls -l --time-style="long-iso" $suite_dir | grep '^d' | awk '{print $8}'|grep -v signing`
 black_dirs=''
 signing_white_dirs=''
 
@@ -74,13 +102,6 @@ function check_signing_whitedir()
   return 0
 }
 
-# parse spec required name
-NAME=`grep "Name:" *.spec | awk '{print $2}'`
-if [ -z "$NAME" ];then
-        echo "Name not specified in spec file"
-        exit 1
-fi
-
 echo "-->> Creating widgets >>--"
 for app in $all_dirs; do
     check_blackdir $app
@@ -108,11 +129,9 @@ for app in $all_dirs; do
                cd $suite_dir
                continue
             fi
-           if [ -d "../../signing" ]; then
+           if [ -d "$BUILD_ROOT/signing" ]; then
                 echo "Start sign wgt ..."
-                cd ../../signing
-                ./sign-widget.sh --config default.conf ../$NAME/$app.wgt
-                cd -
+                $BUILD_ROOT/signing/sign-widget.sh --dist platform $BUILD_ROOT/$app.wgt
             else
                 echo "Not found signing folder."
                 rm -rf $suite_dir/*.wgt
@@ -130,88 +149,96 @@ if [ $pack_fail != 'FALSE' ]; then
     exit 1
 fi
 
-#######################################################################################################
-# parse spec required version
-VERSION=`grep "Version:" ${NAME}.spec | awk '{print $2}'`
-if [ -z "$VERSION" ];then
-        echo "Version not specified in spec file"
-        exit 1
+# build
+echo "build from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cd  $BUILD_ROOT
+./autogen && ./configure --prefix=/ && make && make install DESTDIR=$BUILD_DEST
+if [ $? -ne 0 ];then
+    echo "build fail,please check Makefile.am and cofigure.ac... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
+    exit 1
 fi
+find $BUILD_DEST -name "Makefile*" -delete
+}
 
-SRC_ROOT=${PWD}
-RPM_ROOT=/tmp/${NAME}_pack
-#tar.gz2
-ARCHIVE_TYPE=tar.gz
-#cjvf
-ARCHIVE_OPTION=czvf
-
-# check precondition
-check_precondition()
-{
-    which $1 > /dev/null 2>&1
-    if [ $? -ne 0 ]; then
-        echo "Error: no tool: $1"
-        exit 1
-    fi
+function create_apk(){
+echo "Sorry,apk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
 }
-check_precondition rpmbuild
-check_precondition gcc
-check_precondition make
 
+function create_xpk(){
+echo "Sorry,xpk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
 
-# clean
-echo "cleaning rpm workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf $RPM_ROOT
-
-# create workspace
-echo "create rpm workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-mkdir -p $RPM_ROOT/RPMS $RPM_ROOT/SRPMS $RPM_ROOT/SPECS $RPM_ROOT/SOURCES $RPM_ROOT/BUILD $RPM_ROOT/src_tmp/$NAME-$VERSION
-
-# prepare
-echo "prepare workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf *.rpm *.tar.bz2 *.tar.gz
-cp -a $SRC_ROOT/* $RPM_ROOT/src_tmp/$NAME-$VERSION
-# create Makefile in top src folder
-#cp $SRC_ROOT/top_Makefile $RPM_ROOT/src_tmp/$NAME-$VERSION/Makefile
-cp $PWD/${NAME}.spec $RPM_ROOT/SPECS
-cd $RPM_ROOT/src_tmp
-tar $ARCHIVE_OPTION $RPM_ROOT/SOURCES/$NAME-$VERSION.$ARCHIVE_TYPE $NAME-$VERSION
-cd -
+function create_crx(){
+echo "Sorry,crx is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
 
-# build
-echo "build from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-cd  $RPM_ROOT/SPECS
-rpmbuild -ba ${NAME}.spec --clean --define "_topdir $RPM_ROOT" --target=noarch
-cd -
-
-echo "copy from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-echo "get packages......"
-find $RPM_ROOT -name "$NAME*.rpm" | grep -v debuginfo | xargs -n1 -I {} mv {} $PWD -f
-
-if [[ $platform != "" && $platform != "default" ]]; then
-        cd $PWD
-        for file in `ls *.rpm`; do
-                new_name=`echo $file | sed "s/\.rpm/\.$platform\.rpm/g"`
-                mv $file $new_name
-        done
-        cd -
+## zip function ##
+function zip_for_wgt(){
+cd $BUILD_DEST
+# cp inst.sh script #
+rm -rf $BUILD_DEST/opt/$name/inst.sh.wgt
+cp -af $BUILD_ROOT/inst.sh.wgt $BUILD_DEST/opt/$name/inst.sh
+
+zip -Drq $BUILD_DEST/$name-$version.zip opt/
+if [ $? -ne 0 ];then
+    echo "Create zip package fail... >>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
+    exit 1
 fi
+}
 
-echo "get $NAME-$VERSION.$ARCHIVE_TYPE......"
-mv $RPM_ROOT/SOURCES/$NAME-$VERSION.$ARCHIVE_TYPE $PWD -f
+function zip_for_apk(){
+echo "Sorry,apk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+function zip_for_xpk(){
+echo "Sorry,xpk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+function zip_for_crx(){
+echo "Sorry,crx is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+## create wgt crx apk xpk and zip package ##
+case $type in
+    wgt) create_wgt
+         zip_for_wgt;;
+    apk) create_apk
+         zip_for_apk;;
+    xpk) create_xpk
+         zip_for_xpk;;
+    crx) create_crx
+         zip_for_crx;;
+esac
 
-# clean
-echo "cleaning workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf $RPM_ROOT
-rm -rf *.wgt
+
+# copy zip file
+echo "copy package from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cp -f $BUILD_DEST/$name-$version.zip $SRC_ROOT/$name-$version.zip
+
+# clean workspace
+clean_workspace
 
 # validate
 echo "checking result... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-if [ -z "`ls | grep "\.rpm"`" ] || [ -z "`ls | grep "\.$ARCHIVE_TYPE"`" ];then
-        echo "------------------------------ FAILED to build $NAME packages --------------------------"
-        exit 1
+cd $SRC_ROOT
+if [ -z "`ls | grep "\.zip"`" ];then
+    echo "------------------------------ FAILED to build $name packages --------------------------"
+    exit 1
 fi
 
-echo "------------------------------ Done to build $NAME packages --------------------------"
-ls *.rpm *.$ARCHIVE_TYPE 2>/dev/null
-##############################################################################
+echo "------------------------------ Done to build $name packages --------------------------"
+ls *.zip 2>/dev/null
index ae2e09c2c51f52c6fdf95ea9f75f7fca9ceaff08..d8ca579cfc7077e3aa503570304ff7a6ad60c07f 100644 (file)
@@ -1,3 +1,3 @@
 resources_SCRIPTS = *
-resourcesdir = /opt/tct-appwgt-wrt-tests/resources
+resourcesdir = $(prefix)/opt/tct-appwgt-wrt-tests/resources
 EXTRA_DIST = $(resources_SCRIPTS) LICENSE.Flora
index e647ca77ff7239fdffdae3f15fb17887c0859c9b..37d66536f484075b0a25cfd7e52125fcc01295f8 100644 (file)
@@ -1,3 +1,3 @@
 scripts_SCRIPTS = *
-scriptsdir = /opt/tct-appwgt-wrt-tests/scripts
+scriptsdir = $(prefix)/opt/tct-appwgt-wrt-tests/scripts
 EXTRA_DIST = $(scripts_SCRIPTS)
index 3d66f90cec1fceaea8a66bf446ba1be6bcb5b24a..55f000fcbc495d47fb834d73325ca70f15d15135 100644 (file)
@@ -1,34 +1,3 @@
-%define _unpackaged_files_terminate_build 0
-
-Summary: WRT web appwidget tests
-Name: tct-appwgt-wrt-tests
-Version: 1.5.2
-Release: 1
-License: BSD
-Group: System/Libraries
-Source: %name-%version.tar.gz
-
-%description
-This is WRT web appwidget test suite package
-
-
-%prep
-%setup -q
-
-%build
-./autogen
-./configure --prefix=/usr
-make
-
-%install
-rm -rf $RPM_BUILD_ROOT
-make install DESTDIR=$RPM_BUILD_ROOT
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-/opt/%name
-/usr/share/%name
-
-%changelog
+name=$(basename $(pwd))
+version="1.5.2"
+appname=$(echo $name|sed 's/-/_/g')
index caa0e3da187806454d6207691960b511f1aa5bb3..0a55f1a4665ec582e4df2ed4d9d8cd920ace5619 100644 (file)
@@ -27,7 +27,5 @@
 # Authors:
 #               Fan, Yugang <yugang.fan@intel.com>
 #
-testdefdir = $(datadir)/tct-ext01-wrt-tests
-dist_testdef_DATA = tests.xml 
-docdir = /opt/tct-ext01-wrt-tests
-dist_doc_DATA = Changelog README *.wgt COPYING
+docdir = $(prefix)/opt/tct-ext01-wrt-tests
+dist_doc_DATA = Changelog README *.wgt COPYING tests.xml
diff --git a/tct-ext01-wrt-tests/inst.sh.wgt b/tct-ext01-wrt-tests/inst.sh.wgt
new file mode 100755 (executable)
index 0000000..4661715
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+wgt_installer="pkgcmd"
+NAME=$(basename $(cd $(dirname $0);pwd))
+
+#parse params
+USAGE="Usage: ./inst.sh [-i] [-u]
+  -i install wgt and config environment 
+  -u uninstall wgt and remove source file
+[-i] option was set as default."
+
+function installpkg(){
+    echo "No need to install $NAME.wgt ..."
+}
+
+function uninstallpkg(){
+### remove source file ###
+if [ -d /opt/usr/media/tct/opt/$NAME ];then
+    rm -rf /opt/usr/media/tct/opt/$NAME
+else
+    echo "Remove source file fail,please check if the source file exist: /opt/usr/media/tct/opt/$NAME ..."
+fi
+}
+
+case "$1" in
+    -h|--help) echo "$USAGE"
+               exit ;;
+    ""|-i) installpkg;;
+    -u) uninstallpkg;;
+    *) echo "Unknown option: $1"
+       echo "$USAGE"
+       exit ;;
+esac
index fc85c462131ef2d3f24568f3afe5f8af9989aa3b..4d66654d337f6e6742386a6556de9642e50677d6 100755 (executable)
@@ -1,44 +1,72 @@
 #!/bin/bash
-##
-# Copyright (c) 2012 Intel Corporation.
-#
-# Redistribution and use in source and binary forms, with or without modification,
-# are permitted provided that the following conditions are met:
-#
-# * Redistributions of works must retain the original copyright notice, this list
-#   of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the original copyright notice,
-#   this list of conditions and the following disclaimer in the documentation
-#   and/or other materials provided with the distribution.
-# * Neither the name of Intel Corporation nor the names of its contributors
-#   may be used to endorse or promote products derived from this work without
-#   specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT,
-# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# Authors:
-#               Fan, Yugang <yugang.fan@intel.com>
-#
-
-USAGE="Usage: ./pack.sh"
+source $(dirname $0)/$(basename $(pwd)).spec
+
+#parse params
+usage="Usage: ./pack.sh [-t <package type: wgt | apk | crx | xpk>]
+[-t wgt] option was set as default."
 
 if [[ $1 == "-h" || $1 == "--help" ]]; then
-    echo $USAGE
+    echo $usage
+    exit 1
+fi
+
+type="wgt"
+while getopts t: o
+do
+    case "$o" in
+    t) type=$OPTARG;;
+    *) echo $usage
+       exit 1;;
+    esac
+done
+
+if [[ $type == "wgt" || $type == "apk" || $type == "crx" || $type == "xpk" ]];then
+    echo "Create package with $type and raw source"
+else 
+    echo "Sorry,$type is not support... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+    echo "$usage"
+    exit 1
+fi
+
+if [[ -z $name || -z $version || -z $appname ]];then
+    echo "Package name or version not specified in spec"
+    exit 1
+fi
+
+SRC_ROOT=${PWD}
+BUILD_ROOT=/tmp/${name}_pack
+BUILD_DEST=/tmp/${name}
+
+# clean
+function clean_workspace(){
+echo "cleaning workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+rm -rf $BUILD_ROOT $BUILD_DEST
+}
+
+clean_workspace
+mkdir -p $BUILD_ROOT $BUILD_DEST
+
+# copy source code
+rm -rf *.rpm *.tar.bz2 *.tar.gz *.zip
+cp -arf $SRC_ROOT/* $BUILD_ROOT/
+
+# copy signing tool
+echo "copy signing tool... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cp -arf $SRC_ROOT/../tools/signing $BUILD_ROOT/signing
+if [ $? -ne 0 ];then
+    echo "No signing tool found in $SRC_ROOT/../tools.... >>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
     exit 1
 fi
 
+## function for create wgt apk xpk ##
+
+function create_wgt(){
+# create wgt
+cd $BUILD_ROOT
 pack_fail='FALSE'
 suite_dir=${PWD}
-all_dirs=`ls -l --time-style="long-iso" $suite_dir | grep '^d' | awk '{print $8}'`
+all_dirs=`ls -l --time-style="long-iso" $suite_dir | grep '^d' | awk '{print $8}'|grep -v signing`
 black_dirs=''
 signing_white_dirs=''
 
@@ -74,13 +102,6 @@ function check_signing_whitedir()
   return 0
 }
 
-# parse spec required name
-NAME=`grep "Name:" *.spec | awk '{print $2}'`
-if [ -z "$NAME" ];then
-        echo "Name not specified in spec file"
-        exit 1
-fi
-
 echo "-->> Creating widgets >>--"
 for app in $all_dirs; do
     check_blackdir $app
@@ -108,11 +129,9 @@ for app in $all_dirs; do
                cd $suite_dir
                continue
             fi
-           if [ -d "../../signing" ]; then
+           if [ -d "$BUILD_ROOT/signing" ]; then
                 echo "Start sign wgt ..."
-                cd ../../signing
-                ./sign-widget.sh --config default.conf ../$NAME/$app.wgt
-                cd -
+                $BUILD_ROOT/signing/sign-widget.sh --dist platform $BUILD_ROOT/$app.wgt
             else
                 echo "Not found signing folder."
                 rm -rf $suite_dir/*.wgt
@@ -130,88 +149,96 @@ if [ $pack_fail != 'FALSE' ]; then
     exit 1
 fi
 
-#######################################################################################################
-# parse spec required version
-VERSION=`grep "Version:" ${NAME}.spec | awk '{print $2}'`
-if [ -z "$VERSION" ];then
-        echo "Version not specified in spec file"
-        exit 1
+# build
+echo "build from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cd  $BUILD_ROOT
+./autogen && ./configure --prefix=/ && make && make install DESTDIR=$BUILD_DEST
+if [ $? -ne 0 ];then
+    echo "build fail,please check Makefile.am and cofigure.ac... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
+    exit 1
 fi
+find $BUILD_DEST -name "Makefile*" -delete
+}
 
-SRC_ROOT=${PWD}
-RPM_ROOT=/tmp/${NAME}_pack
-#tar.gz2
-ARCHIVE_TYPE=tar.gz
-#cjvf
-ARCHIVE_OPTION=czvf
-
-# check precondition
-check_precondition()
-{
-    which $1 > /dev/null 2>&1
-    if [ $? -ne 0 ]; then
-        echo "Error: no tool: $1"
-        exit 1
-    fi
+function create_apk(){
+echo "Sorry,apk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
 }
-check_precondition rpmbuild
-check_precondition gcc
-check_precondition make
 
+function create_xpk(){
+echo "Sorry,xpk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
 
-# clean
-echo "cleaning rpm workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf $RPM_ROOT
-
-# create workspace
-echo "create rpm workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-mkdir -p $RPM_ROOT/RPMS $RPM_ROOT/SRPMS $RPM_ROOT/SPECS $RPM_ROOT/SOURCES $RPM_ROOT/BUILD $RPM_ROOT/src_tmp/$NAME-$VERSION
-
-# prepare
-echo "prepare workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf *.rpm *.tar.bz2 *.tar.gz
-cp -a $SRC_ROOT/* $RPM_ROOT/src_tmp/$NAME-$VERSION
-# create Makefile in top src folder
-#cp $SRC_ROOT/top_Makefile $RPM_ROOT/src_tmp/$NAME-$VERSION/Makefile
-cp $PWD/${NAME}.spec $RPM_ROOT/SPECS
-cd $RPM_ROOT/src_tmp
-tar $ARCHIVE_OPTION $RPM_ROOT/SOURCES/$NAME-$VERSION.$ARCHIVE_TYPE $NAME-$VERSION
-cd -
+function create_crx(){
+echo "Sorry,crx is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
 
-# build
-echo "build from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-cd  $RPM_ROOT/SPECS
-rpmbuild -ba ${NAME}.spec --clean --define "_topdir $RPM_ROOT" --target=noarch
-cd -
-
-echo "copy from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-echo "get packages......"
-find $RPM_ROOT -name "$NAME*.rpm" | grep -v debuginfo | xargs -n1 -I {} mv {} $PWD -f
-
-if [[ $platform != "" && $platform != "default" ]]; then
-        cd $PWD
-        for file in `ls *.rpm`; do
-                new_name=`echo $file | sed "s/\.rpm/\.$platform\.rpm/g"`
-                mv $file $new_name
-        done
-        cd -
+## zip function ##
+function zip_for_wgt(){
+cd $BUILD_DEST
+# cp inst.sh script #
+rm -rf $BUILD_DEST/opt/$name/inst.sh.wgt
+cp -af $BUILD_ROOT/inst.sh.wgt $BUILD_DEST/opt/$name/inst.sh
+
+zip -Drq $BUILD_DEST/$name-$version.zip opt/
+if [ $? -ne 0 ];then
+    echo "Create zip package fail... >>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
+    exit 1
 fi
+}
 
-echo "get $NAME-$VERSION.$ARCHIVE_TYPE......"
-mv $RPM_ROOT/SOURCES/$NAME-$VERSION.$ARCHIVE_TYPE $PWD -f
+function zip_for_apk(){
+echo "Sorry,apk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+function zip_for_xpk(){
+echo "Sorry,xpk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+function zip_for_crx(){
+echo "Sorry,crx is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+## create wgt crx apk xpk and zip package ##
+case $type in
+    wgt) create_wgt
+         zip_for_wgt;;
+    apk) create_apk
+         zip_for_apk;;
+    xpk) create_xpk
+         zip_for_xpk;;
+    crx) create_crx
+         zip_for_crx;;
+esac
 
-# clean
-echo "cleaning workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf $RPM_ROOT
-rm -rf *.wgt
+
+# copy zip file
+echo "copy package from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cp -f $BUILD_DEST/$name-$version.zip $SRC_ROOT/$name-$version.zip
+
+# clean workspace
+clean_workspace
 
 # validate
 echo "checking result... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-if [ -z "`ls | grep "\.rpm"`" ] || [ -z "`ls | grep "\.$ARCHIVE_TYPE"`" ];then
-        echo "------------------------------ FAILED to build $NAME packages --------------------------"
-        exit 1
+cd $SRC_ROOT
+if [ -z "`ls | grep "\.zip"`" ];then
+    echo "------------------------------ FAILED to build $name packages --------------------------"
+    exit 1
 fi
 
-echo "------------------------------ Done to build $NAME packages --------------------------"
-ls *.rpm *.$ARCHIVE_TYPE 2>/dev/null
-##############################################################################
+echo "------------------------------ Done to build $name packages --------------------------"
+ls *.zip 2>/dev/null
index caa8a9ff105c29117626407398196a3b59777af9..55f000fcbc495d47fb834d73325ca70f15d15135 100644 (file)
@@ -1,34 +1,3 @@
-%define _unpackaged_files_terminate_build 0
-
-Summary: WRT config extension tests
-Name: tct-ext01-wrt-tests
-Version: 1.5.2
-Release: 1
-License: BSD
-Group: System/Libraries
-Source: %name-%version.tar.gz
-
-%description
-This is WRT config extension test suite package
-
-
-%prep
-%setup -q
-
-%build
-./autogen
-./configure --prefix=/usr
-make
-
-%install
-rm -rf $RPM_BUILD_ROOT
-make install DESTDIR=$RPM_BUILD_ROOT
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-/opt/%name
-/usr/share/%name
-
-%changelog
+name=$(basename $(pwd))
+version="1.5.2"
+appname=$(echo $name|sed 's/-/_/g')
index 2b7adab6d672fd2106ee1445429af905fdf6d04f..1d0b80bd39513fe3687d1a37e220236deae67c53 100644 (file)
@@ -28,7 +28,5 @@
 #               Fan, Yugang <yugang.fan@intel.com>
 #
 SUBDIRS =  support w3c scripts
-testdefdir = $(datadir)/tct-ext02-wrt-tests
-dist_testdef_DATA = tests.xml 
-docdir = /opt/tct-ext02-wrt-tests
-dist_doc_DATA = Changelog README *.wgt COPYING
+docdir = $(prefix)/opt/tct-ext02-wrt-tests
+dist_doc_DATA = Changelog README *.wgt COPYING tests.xml
diff --git a/tct-ext02-wrt-tests/inst.sh.wgt b/tct-ext02-wrt-tests/inst.sh.wgt
new file mode 100755 (executable)
index 0000000..4661715
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+wgt_installer="pkgcmd"
+NAME=$(basename $(cd $(dirname $0);pwd))
+
+#parse params
+USAGE="Usage: ./inst.sh [-i] [-u]
+  -i install wgt and config environment 
+  -u uninstall wgt and remove source file
+[-i] option was set as default."
+
+function installpkg(){
+    echo "No need to install $NAME.wgt ..."
+}
+
+function uninstallpkg(){
+### remove source file ###
+if [ -d /opt/usr/media/tct/opt/$NAME ];then
+    rm -rf /opt/usr/media/tct/opt/$NAME
+else
+    echo "Remove source file fail,please check if the source file exist: /opt/usr/media/tct/opt/$NAME ..."
+fi
+}
+
+case "$1" in
+    -h|--help) echo "$USAGE"
+               exit ;;
+    ""|-i) installpkg;;
+    -u) uninstallpkg;;
+    *) echo "Unknown option: $1"
+       echo "$USAGE"
+       exit ;;
+esac
index fc85c462131ef2d3f24568f3afe5f8af9989aa3b..4d66654d337f6e6742386a6556de9642e50677d6 100755 (executable)
@@ -1,44 +1,72 @@
 #!/bin/bash
-##
-# Copyright (c) 2012 Intel Corporation.
-#
-# Redistribution and use in source and binary forms, with or without modification,
-# are permitted provided that the following conditions are met:
-#
-# * Redistributions of works must retain the original copyright notice, this list
-#   of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the original copyright notice,
-#   this list of conditions and the following disclaimer in the documentation
-#   and/or other materials provided with the distribution.
-# * Neither the name of Intel Corporation nor the names of its contributors
-#   may be used to endorse or promote products derived from this work without
-#   specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT,
-# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# Authors:
-#               Fan, Yugang <yugang.fan@intel.com>
-#
-
-USAGE="Usage: ./pack.sh"
+source $(dirname $0)/$(basename $(pwd)).spec
+
+#parse params
+usage="Usage: ./pack.sh [-t <package type: wgt | apk | crx | xpk>]
+[-t wgt] option was set as default."
 
 if [[ $1 == "-h" || $1 == "--help" ]]; then
-    echo $USAGE
+    echo $usage
+    exit 1
+fi
+
+type="wgt"
+while getopts t: o
+do
+    case "$o" in
+    t) type=$OPTARG;;
+    *) echo $usage
+       exit 1;;
+    esac
+done
+
+if [[ $type == "wgt" || $type == "apk" || $type == "crx" || $type == "xpk" ]];then
+    echo "Create package with $type and raw source"
+else 
+    echo "Sorry,$type is not support... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+    echo "$usage"
+    exit 1
+fi
+
+if [[ -z $name || -z $version || -z $appname ]];then
+    echo "Package name or version not specified in spec"
+    exit 1
+fi
+
+SRC_ROOT=${PWD}
+BUILD_ROOT=/tmp/${name}_pack
+BUILD_DEST=/tmp/${name}
+
+# clean
+function clean_workspace(){
+echo "cleaning workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+rm -rf $BUILD_ROOT $BUILD_DEST
+}
+
+clean_workspace
+mkdir -p $BUILD_ROOT $BUILD_DEST
+
+# copy source code
+rm -rf *.rpm *.tar.bz2 *.tar.gz *.zip
+cp -arf $SRC_ROOT/* $BUILD_ROOT/
+
+# copy signing tool
+echo "copy signing tool... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cp -arf $SRC_ROOT/../tools/signing $BUILD_ROOT/signing
+if [ $? -ne 0 ];then
+    echo "No signing tool found in $SRC_ROOT/../tools.... >>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
     exit 1
 fi
 
+## function for create wgt apk xpk ##
+
+function create_wgt(){
+# create wgt
+cd $BUILD_ROOT
 pack_fail='FALSE'
 suite_dir=${PWD}
-all_dirs=`ls -l --time-style="long-iso" $suite_dir | grep '^d' | awk '{print $8}'`
+all_dirs=`ls -l --time-style="long-iso" $suite_dir | grep '^d' | awk '{print $8}'|grep -v signing`
 black_dirs=''
 signing_white_dirs=''
 
@@ -74,13 +102,6 @@ function check_signing_whitedir()
   return 0
 }
 
-# parse spec required name
-NAME=`grep "Name:" *.spec | awk '{print $2}'`
-if [ -z "$NAME" ];then
-        echo "Name not specified in spec file"
-        exit 1
-fi
-
 echo "-->> Creating widgets >>--"
 for app in $all_dirs; do
     check_blackdir $app
@@ -108,11 +129,9 @@ for app in $all_dirs; do
                cd $suite_dir
                continue
             fi
-           if [ -d "../../signing" ]; then
+           if [ -d "$BUILD_ROOT/signing" ]; then
                 echo "Start sign wgt ..."
-                cd ../../signing
-                ./sign-widget.sh --config default.conf ../$NAME/$app.wgt
-                cd -
+                $BUILD_ROOT/signing/sign-widget.sh --dist platform $BUILD_ROOT/$app.wgt
             else
                 echo "Not found signing folder."
                 rm -rf $suite_dir/*.wgt
@@ -130,88 +149,96 @@ if [ $pack_fail != 'FALSE' ]; then
     exit 1
 fi
 
-#######################################################################################################
-# parse spec required version
-VERSION=`grep "Version:" ${NAME}.spec | awk '{print $2}'`
-if [ -z "$VERSION" ];then
-        echo "Version not specified in spec file"
-        exit 1
+# build
+echo "build from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cd  $BUILD_ROOT
+./autogen && ./configure --prefix=/ && make && make install DESTDIR=$BUILD_DEST
+if [ $? -ne 0 ];then
+    echo "build fail,please check Makefile.am and cofigure.ac... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
+    exit 1
 fi
+find $BUILD_DEST -name "Makefile*" -delete
+}
 
-SRC_ROOT=${PWD}
-RPM_ROOT=/tmp/${NAME}_pack
-#tar.gz2
-ARCHIVE_TYPE=tar.gz
-#cjvf
-ARCHIVE_OPTION=czvf
-
-# check precondition
-check_precondition()
-{
-    which $1 > /dev/null 2>&1
-    if [ $? -ne 0 ]; then
-        echo "Error: no tool: $1"
-        exit 1
-    fi
+function create_apk(){
+echo "Sorry,apk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
 }
-check_precondition rpmbuild
-check_precondition gcc
-check_precondition make
 
+function create_xpk(){
+echo "Sorry,xpk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
 
-# clean
-echo "cleaning rpm workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf $RPM_ROOT
-
-# create workspace
-echo "create rpm workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-mkdir -p $RPM_ROOT/RPMS $RPM_ROOT/SRPMS $RPM_ROOT/SPECS $RPM_ROOT/SOURCES $RPM_ROOT/BUILD $RPM_ROOT/src_tmp/$NAME-$VERSION
-
-# prepare
-echo "prepare workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf *.rpm *.tar.bz2 *.tar.gz
-cp -a $SRC_ROOT/* $RPM_ROOT/src_tmp/$NAME-$VERSION
-# create Makefile in top src folder
-#cp $SRC_ROOT/top_Makefile $RPM_ROOT/src_tmp/$NAME-$VERSION/Makefile
-cp $PWD/${NAME}.spec $RPM_ROOT/SPECS
-cd $RPM_ROOT/src_tmp
-tar $ARCHIVE_OPTION $RPM_ROOT/SOURCES/$NAME-$VERSION.$ARCHIVE_TYPE $NAME-$VERSION
-cd -
+function create_crx(){
+echo "Sorry,crx is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
 
-# build
-echo "build from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-cd  $RPM_ROOT/SPECS
-rpmbuild -ba ${NAME}.spec --clean --define "_topdir $RPM_ROOT" --target=noarch
-cd -
-
-echo "copy from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-echo "get packages......"
-find $RPM_ROOT -name "$NAME*.rpm" | grep -v debuginfo | xargs -n1 -I {} mv {} $PWD -f
-
-if [[ $platform != "" && $platform != "default" ]]; then
-        cd $PWD
-        for file in `ls *.rpm`; do
-                new_name=`echo $file | sed "s/\.rpm/\.$platform\.rpm/g"`
-                mv $file $new_name
-        done
-        cd -
+## zip function ##
+function zip_for_wgt(){
+cd $BUILD_DEST
+# cp inst.sh script #
+rm -rf $BUILD_DEST/opt/$name/inst.sh.wgt
+cp -af $BUILD_ROOT/inst.sh.wgt $BUILD_DEST/opt/$name/inst.sh
+
+zip -Drq $BUILD_DEST/$name-$version.zip opt/
+if [ $? -ne 0 ];then
+    echo "Create zip package fail... >>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
+    exit 1
 fi
+}
 
-echo "get $NAME-$VERSION.$ARCHIVE_TYPE......"
-mv $RPM_ROOT/SOURCES/$NAME-$VERSION.$ARCHIVE_TYPE $PWD -f
+function zip_for_apk(){
+echo "Sorry,apk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+function zip_for_xpk(){
+echo "Sorry,xpk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+function zip_for_crx(){
+echo "Sorry,crx is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+## create wgt crx apk xpk and zip package ##
+case $type in
+    wgt) create_wgt
+         zip_for_wgt;;
+    apk) create_apk
+         zip_for_apk;;
+    xpk) create_xpk
+         zip_for_xpk;;
+    crx) create_crx
+         zip_for_crx;;
+esac
 
-# clean
-echo "cleaning workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf $RPM_ROOT
-rm -rf *.wgt
+
+# copy zip file
+echo "copy package from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cp -f $BUILD_DEST/$name-$version.zip $SRC_ROOT/$name-$version.zip
+
+# clean workspace
+clean_workspace
 
 # validate
 echo "checking result... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-if [ -z "`ls | grep "\.rpm"`" ] || [ -z "`ls | grep "\.$ARCHIVE_TYPE"`" ];then
-        echo "------------------------------ FAILED to build $NAME packages --------------------------"
-        exit 1
+cd $SRC_ROOT
+if [ -z "`ls | grep "\.zip"`" ];then
+    echo "------------------------------ FAILED to build $name packages --------------------------"
+    exit 1
 fi
 
-echo "------------------------------ Done to build $NAME packages --------------------------"
-ls *.rpm *.$ARCHIVE_TYPE 2>/dev/null
-##############################################################################
+echo "------------------------------ Done to build $name packages --------------------------"
+ls *.zip 2>/dev/null
index fff303b6096d546e88d34b2778ffc6829dbc675f..87838ace671afc93d52346d4b3771b8a322a358c 100644 (file)
@@ -30,5 +30,5 @@
 
 
 scripts_SCRIPTS = *
-scriptsdir = /opt/tct-ext02-wrt-tests/scripts
+scriptsdir = $(prefix)/opt/tct-ext02-wrt-tests/scripts
 EXTRA_DIST = $(scripts_SCRIPTS)
index ec7f57383206f086de274589e885315513da5e2d..e4fcc0e43fa6fb42d807bc64790080b0c86327f7 100644 (file)
@@ -1,3 +1,3 @@
 support_SCRIPTS = *
-supportdir = /opt/tct-ext02-wrt-tests/support
+supportdir = $(prefix)/opt/tct-ext02-wrt-tests/support
 EXTRA_DIST = $(support_SCRIPTS)
index 01ff27768ed0ad156adc8a0fae004d9a79c0f5b1..55f000fcbc495d47fb834d73325ca70f15d15135 100644 (file)
@@ -1,34 +1,3 @@
-%define _unpackaged_files_terminate_build 0
-
-Summary: WRT config extension tests
-Name: tct-ext02-wrt-tests
-Version: 1.5.2
-Release: 1
-License: BSD
-Group: System/Libraries
-Source: %name-%version.tar.gz
-
-%description
-This is WRT config extension test suite package
-
-
-%prep
-%setup -q
-
-%build
-./autogen
-./configure --prefix=/usr
-make
-
-%install
-rm -rf $RPM_BUILD_ROOT
-make install DESTDIR=$RPM_BUILD_ROOT
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-/opt/%name
-/usr/share/%name
-
-%changelog
+name=$(basename $(pwd))
+version="1.5.2"
+appname=$(echo $name|sed 's/-/_/g')
index 4c05c5bc4266f355c9d5c670e52a852260885018..8518957210a1ea6f88ac532acba6cd6115316f7d 100644 (file)
@@ -1,4 +1,4 @@
 SUBDIRS = support
 w3c_SCRIPTS = *
-w3cdir = /opt/tct-ext02-wrt-tests/w3c
+w3cdir = $(prefix)/opt/tct-ext02-wrt-tests/w3c
 EXTRA_DIST = $(w3c_SCRIPTS)
index 786e43da0fbc8c1e960b8a2823eef291e5d98ac8..fa22e3246e0c79e1ee89d7260f0a19e54d5b3941 100644 (file)
@@ -1,3 +1,3 @@
 w3csupport_SCRIPTS = *
-w3csupportdir = /opt/tct-ext02-wrt-tests/w3c/support
+w3csupportdir = $(prefix)/opt/tct-ext02-wrt-tests/w3c/support
 EXTRA_DIST = $(w3csupport_SCRIPTS)
index 6a988c984faf246713df644adb667769a3084211..a89d5dd2168954241bc5487fa9931f04678c9abb 100644 (file)
@@ -28,7 +28,5 @@
 #               Fan, Yugang <yugang.fan@intel.com>
 #
 SUBDIRS =  scripts resources
-testdefdir = $(datadir)/tct-pm-wrt-tests
-dist_testdef_DATA = tests.xml 
-docdir = /opt/tct-pm-wrt-tests
-dist_doc_DATA = Changelog README *.wgt COPYING
+docdir = $(prefix)/opt/tct-pm-wrt-tests
+dist_doc_DATA = Changelog README *.wgt COPYING tests.xml
diff --git a/tct-pm-wrt-tests/inst.sh.wgt b/tct-pm-wrt-tests/inst.sh.wgt
new file mode 100755 (executable)
index 0000000..4661715
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+wgt_installer="pkgcmd"
+NAME=$(basename $(cd $(dirname $0);pwd))
+
+#parse params
+USAGE="Usage: ./inst.sh [-i] [-u]
+  -i install wgt and config environment 
+  -u uninstall wgt and remove source file
+[-i] option was set as default."
+
+function installpkg(){
+    echo "No need to install $NAME.wgt ..."
+}
+
+function uninstallpkg(){
+### remove source file ###
+if [ -d /opt/usr/media/tct/opt/$NAME ];then
+    rm -rf /opt/usr/media/tct/opt/$NAME
+else
+    echo "Remove source file fail,please check if the source file exist: /opt/usr/media/tct/opt/$NAME ..."
+fi
+}
+
+case "$1" in
+    -h|--help) echo "$USAGE"
+               exit ;;
+    ""|-i) installpkg;;
+    -u) uninstallpkg;;
+    *) echo "Unknown option: $1"
+       echo "$USAGE"
+       exit ;;
+esac
index fc85c462131ef2d3f24568f3afe5f8af9989aa3b..4d66654d337f6e6742386a6556de9642e50677d6 100755 (executable)
@@ -1,44 +1,72 @@
 #!/bin/bash
-##
-# Copyright (c) 2012 Intel Corporation.
-#
-# Redistribution and use in source and binary forms, with or without modification,
-# are permitted provided that the following conditions are met:
-#
-# * Redistributions of works must retain the original copyright notice, this list
-#   of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the original copyright notice,
-#   this list of conditions and the following disclaimer in the documentation
-#   and/or other materials provided with the distribution.
-# * Neither the name of Intel Corporation nor the names of its contributors
-#   may be used to endorse or promote products derived from this work without
-#   specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT,
-# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# Authors:
-#               Fan, Yugang <yugang.fan@intel.com>
-#
-
-USAGE="Usage: ./pack.sh"
+source $(dirname $0)/$(basename $(pwd)).spec
+
+#parse params
+usage="Usage: ./pack.sh [-t <package type: wgt | apk | crx | xpk>]
+[-t wgt] option was set as default."
 
 if [[ $1 == "-h" || $1 == "--help" ]]; then
-    echo $USAGE
+    echo $usage
+    exit 1
+fi
+
+type="wgt"
+while getopts t: o
+do
+    case "$o" in
+    t) type=$OPTARG;;
+    *) echo $usage
+       exit 1;;
+    esac
+done
+
+if [[ $type == "wgt" || $type == "apk" || $type == "crx" || $type == "xpk" ]];then
+    echo "Create package with $type and raw source"
+else 
+    echo "Sorry,$type is not support... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+    echo "$usage"
+    exit 1
+fi
+
+if [[ -z $name || -z $version || -z $appname ]];then
+    echo "Package name or version not specified in spec"
+    exit 1
+fi
+
+SRC_ROOT=${PWD}
+BUILD_ROOT=/tmp/${name}_pack
+BUILD_DEST=/tmp/${name}
+
+# clean
+function clean_workspace(){
+echo "cleaning workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+rm -rf $BUILD_ROOT $BUILD_DEST
+}
+
+clean_workspace
+mkdir -p $BUILD_ROOT $BUILD_DEST
+
+# copy source code
+rm -rf *.rpm *.tar.bz2 *.tar.gz *.zip
+cp -arf $SRC_ROOT/* $BUILD_ROOT/
+
+# copy signing tool
+echo "copy signing tool... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cp -arf $SRC_ROOT/../tools/signing $BUILD_ROOT/signing
+if [ $? -ne 0 ];then
+    echo "No signing tool found in $SRC_ROOT/../tools.... >>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
     exit 1
 fi
 
+## function for create wgt apk xpk ##
+
+function create_wgt(){
+# create wgt
+cd $BUILD_ROOT
 pack_fail='FALSE'
 suite_dir=${PWD}
-all_dirs=`ls -l --time-style="long-iso" $suite_dir | grep '^d' | awk '{print $8}'`
+all_dirs=`ls -l --time-style="long-iso" $suite_dir | grep '^d' | awk '{print $8}'|grep -v signing`
 black_dirs=''
 signing_white_dirs=''
 
@@ -74,13 +102,6 @@ function check_signing_whitedir()
   return 0
 }
 
-# parse spec required name
-NAME=`grep "Name:" *.spec | awk '{print $2}'`
-if [ -z "$NAME" ];then
-        echo "Name not specified in spec file"
-        exit 1
-fi
-
 echo "-->> Creating widgets >>--"
 for app in $all_dirs; do
     check_blackdir $app
@@ -108,11 +129,9 @@ for app in $all_dirs; do
                cd $suite_dir
                continue
             fi
-           if [ -d "../../signing" ]; then
+           if [ -d "$BUILD_ROOT/signing" ]; then
                 echo "Start sign wgt ..."
-                cd ../../signing
-                ./sign-widget.sh --config default.conf ../$NAME/$app.wgt
-                cd -
+                $BUILD_ROOT/signing/sign-widget.sh --dist platform $BUILD_ROOT/$app.wgt
             else
                 echo "Not found signing folder."
                 rm -rf $suite_dir/*.wgt
@@ -130,88 +149,96 @@ if [ $pack_fail != 'FALSE' ]; then
     exit 1
 fi
 
-#######################################################################################################
-# parse spec required version
-VERSION=`grep "Version:" ${NAME}.spec | awk '{print $2}'`
-if [ -z "$VERSION" ];then
-        echo "Version not specified in spec file"
-        exit 1
+# build
+echo "build from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cd  $BUILD_ROOT
+./autogen && ./configure --prefix=/ && make && make install DESTDIR=$BUILD_DEST
+if [ $? -ne 0 ];then
+    echo "build fail,please check Makefile.am and cofigure.ac... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
+    exit 1
 fi
+find $BUILD_DEST -name "Makefile*" -delete
+}
 
-SRC_ROOT=${PWD}
-RPM_ROOT=/tmp/${NAME}_pack
-#tar.gz2
-ARCHIVE_TYPE=tar.gz
-#cjvf
-ARCHIVE_OPTION=czvf
-
-# check precondition
-check_precondition()
-{
-    which $1 > /dev/null 2>&1
-    if [ $? -ne 0 ]; then
-        echo "Error: no tool: $1"
-        exit 1
-    fi
+function create_apk(){
+echo "Sorry,apk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
 }
-check_precondition rpmbuild
-check_precondition gcc
-check_precondition make
 
+function create_xpk(){
+echo "Sorry,xpk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
 
-# clean
-echo "cleaning rpm workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf $RPM_ROOT
-
-# create workspace
-echo "create rpm workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-mkdir -p $RPM_ROOT/RPMS $RPM_ROOT/SRPMS $RPM_ROOT/SPECS $RPM_ROOT/SOURCES $RPM_ROOT/BUILD $RPM_ROOT/src_tmp/$NAME-$VERSION
-
-# prepare
-echo "prepare workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf *.rpm *.tar.bz2 *.tar.gz
-cp -a $SRC_ROOT/* $RPM_ROOT/src_tmp/$NAME-$VERSION
-# create Makefile in top src folder
-#cp $SRC_ROOT/top_Makefile $RPM_ROOT/src_tmp/$NAME-$VERSION/Makefile
-cp $PWD/${NAME}.spec $RPM_ROOT/SPECS
-cd $RPM_ROOT/src_tmp
-tar $ARCHIVE_OPTION $RPM_ROOT/SOURCES/$NAME-$VERSION.$ARCHIVE_TYPE $NAME-$VERSION
-cd -
+function create_crx(){
+echo "Sorry,crx is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
 
-# build
-echo "build from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-cd  $RPM_ROOT/SPECS
-rpmbuild -ba ${NAME}.spec --clean --define "_topdir $RPM_ROOT" --target=noarch
-cd -
-
-echo "copy from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-echo "get packages......"
-find $RPM_ROOT -name "$NAME*.rpm" | grep -v debuginfo | xargs -n1 -I {} mv {} $PWD -f
-
-if [[ $platform != "" && $platform != "default" ]]; then
-        cd $PWD
-        for file in `ls *.rpm`; do
-                new_name=`echo $file | sed "s/\.rpm/\.$platform\.rpm/g"`
-                mv $file $new_name
-        done
-        cd -
+## zip function ##
+function zip_for_wgt(){
+cd $BUILD_DEST
+# cp inst.sh script #
+rm -rf $BUILD_DEST/opt/$name/inst.sh.wgt
+cp -af $BUILD_ROOT/inst.sh.wgt $BUILD_DEST/opt/$name/inst.sh
+
+zip -Drq $BUILD_DEST/$name-$version.zip opt/
+if [ $? -ne 0 ];then
+    echo "Create zip package fail... >>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
+    exit 1
 fi
+}
 
-echo "get $NAME-$VERSION.$ARCHIVE_TYPE......"
-mv $RPM_ROOT/SOURCES/$NAME-$VERSION.$ARCHIVE_TYPE $PWD -f
+function zip_for_apk(){
+echo "Sorry,apk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+function zip_for_xpk(){
+echo "Sorry,xpk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+function zip_for_crx(){
+echo "Sorry,crx is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+## create wgt crx apk xpk and zip package ##
+case $type in
+    wgt) create_wgt
+         zip_for_wgt;;
+    apk) create_apk
+         zip_for_apk;;
+    xpk) create_xpk
+         zip_for_xpk;;
+    crx) create_crx
+         zip_for_crx;;
+esac
 
-# clean
-echo "cleaning workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf $RPM_ROOT
-rm -rf *.wgt
+
+# copy zip file
+echo "copy package from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cp -f $BUILD_DEST/$name-$version.zip $SRC_ROOT/$name-$version.zip
+
+# clean workspace
+clean_workspace
 
 # validate
 echo "checking result... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-if [ -z "`ls | grep "\.rpm"`" ] || [ -z "`ls | grep "\.$ARCHIVE_TYPE"`" ];then
-        echo "------------------------------ FAILED to build $NAME packages --------------------------"
-        exit 1
+cd $SRC_ROOT
+if [ -z "`ls | grep "\.zip"`" ];then
+    echo "------------------------------ FAILED to build $name packages --------------------------"
+    exit 1
 fi
 
-echo "------------------------------ Done to build $NAME packages --------------------------"
-ls *.rpm *.$ARCHIVE_TYPE 2>/dev/null
-##############################################################################
+echo "------------------------------ Done to build $name packages --------------------------"
+ls *.zip 2>/dev/null
index 7c61c2ae37517948560f44381d87e51a4449f8fd..5c2de10602ab4c11471c3b72f4c383897ff9f570 100644 (file)
@@ -1,2 +1,2 @@
 dist_resources_DATA = *.wgt
-resourcesdir= /opt/tct-pm-wrt-tests/
+resourcesdir= $(prefix)/opt/tct-pm-wrt-tests/
index f8475e9a22c767f459780a13bc989db6f162a8c7..becebb40e037ad18cee39449a8f7896e7145cb39 100644 (file)
@@ -30,5 +30,5 @@
 
 
 scripts_SCRIPTS = *
-scriptsdir = /opt/tct-pm-wrt-tests/scripts
+scriptsdir = $(prefix)/opt/tct-pm-wrt-tests/scripts
 EXTRA_DIST = $(scripts_SCRIPTS)
index 94126a06bb2b083856b51402931751136b911460..55f000fcbc495d47fb834d73325ca70f15d15135 100644 (file)
@@ -1,34 +1,3 @@
-%define _unpackaged_files_terminate_build 0
-
-Summary: WRT package management tests
-Name: tct-pm-wrt-tests
-Version: 1.5.2
-Release: 1
-License: BSD
-Group: System/Libraries
-Source: %name-%version.tar.gz
-
-%description
-This is WRT package management test suite package
-
-
-%prep
-%setup -q
-
-%build
-./autogen
-./configure --prefix=/usr
-make
-
-%install
-rm -rf $RPM_BUILD_ROOT
-make install DESTDIR=$RPM_BUILD_ROOT
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-/opt/%name
-/usr/share/%name
-
-%changelog
+name=$(basename $(pwd))
+version="1.5.2"
+appname=$(echo $name|sed 's/-/_/g')
index 28404dd73eeb51fba1e49432dfd9489c783231a9..29b0b8ff2ca57a8ab9f842c7edc09f52384ffe07 100644 (file)
@@ -27,7 +27,5 @@
 # Authors:
 #               Fan, Yugang <yugang.fan@intel.com>
 #
-testdefdir = $(datadir)/tct-rt01-wrt-tests
-dist_testdef_DATA = tests.xml 
-docdir = /opt/tct-rt01-wrt-tests
-dist_doc_DATA = Changelog README *.wgt COPYING
+docdir = $(prefix)/opt/tct-rt01-wrt-tests
+dist_doc_DATA = Changelog README *.wgt COPYING tests.xml
diff --git a/tct-rt01-wrt-tests/inst.sh.wgt b/tct-rt01-wrt-tests/inst.sh.wgt
new file mode 100755 (executable)
index 0000000..4661715
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+wgt_installer="pkgcmd"
+NAME=$(basename $(cd $(dirname $0);pwd))
+
+#parse params
+USAGE="Usage: ./inst.sh [-i] [-u]
+  -i install wgt and config environment 
+  -u uninstall wgt and remove source file
+[-i] option was set as default."
+
+function installpkg(){
+    echo "No need to install $NAME.wgt ..."
+}
+
+function uninstallpkg(){
+### remove source file ###
+if [ -d /opt/usr/media/tct/opt/$NAME ];then
+    rm -rf /opt/usr/media/tct/opt/$NAME
+else
+    echo "Remove source file fail,please check if the source file exist: /opt/usr/media/tct/opt/$NAME ..."
+fi
+}
+
+case "$1" in
+    -h|--help) echo "$USAGE"
+               exit ;;
+    ""|-i) installpkg;;
+    -u) uninstallpkg;;
+    *) echo "Unknown option: $1"
+       echo "$USAGE"
+       exit ;;
+esac
index fc85c462131ef2d3f24568f3afe5f8af9989aa3b..4d66654d337f6e6742386a6556de9642e50677d6 100755 (executable)
@@ -1,44 +1,72 @@
 #!/bin/bash
-##
-# Copyright (c) 2012 Intel Corporation.
-#
-# Redistribution and use in source and binary forms, with or without modification,
-# are permitted provided that the following conditions are met:
-#
-# * Redistributions of works must retain the original copyright notice, this list
-#   of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the original copyright notice,
-#   this list of conditions and the following disclaimer in the documentation
-#   and/or other materials provided with the distribution.
-# * Neither the name of Intel Corporation nor the names of its contributors
-#   may be used to endorse or promote products derived from this work without
-#   specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT,
-# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# Authors:
-#               Fan, Yugang <yugang.fan@intel.com>
-#
-
-USAGE="Usage: ./pack.sh"
+source $(dirname $0)/$(basename $(pwd)).spec
+
+#parse params
+usage="Usage: ./pack.sh [-t <package type: wgt | apk | crx | xpk>]
+[-t wgt] option was set as default."
 
 if [[ $1 == "-h" || $1 == "--help" ]]; then
-    echo $USAGE
+    echo $usage
+    exit 1
+fi
+
+type="wgt"
+while getopts t: o
+do
+    case "$o" in
+    t) type=$OPTARG;;
+    *) echo $usage
+       exit 1;;
+    esac
+done
+
+if [[ $type == "wgt" || $type == "apk" || $type == "crx" || $type == "xpk" ]];then
+    echo "Create package with $type and raw source"
+else 
+    echo "Sorry,$type is not support... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+    echo "$usage"
+    exit 1
+fi
+
+if [[ -z $name || -z $version || -z $appname ]];then
+    echo "Package name or version not specified in spec"
+    exit 1
+fi
+
+SRC_ROOT=${PWD}
+BUILD_ROOT=/tmp/${name}_pack
+BUILD_DEST=/tmp/${name}
+
+# clean
+function clean_workspace(){
+echo "cleaning workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+rm -rf $BUILD_ROOT $BUILD_DEST
+}
+
+clean_workspace
+mkdir -p $BUILD_ROOT $BUILD_DEST
+
+# copy source code
+rm -rf *.rpm *.tar.bz2 *.tar.gz *.zip
+cp -arf $SRC_ROOT/* $BUILD_ROOT/
+
+# copy signing tool
+echo "copy signing tool... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cp -arf $SRC_ROOT/../tools/signing $BUILD_ROOT/signing
+if [ $? -ne 0 ];then
+    echo "No signing tool found in $SRC_ROOT/../tools.... >>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
     exit 1
 fi
 
+## function for create wgt apk xpk ##
+
+function create_wgt(){
+# create wgt
+cd $BUILD_ROOT
 pack_fail='FALSE'
 suite_dir=${PWD}
-all_dirs=`ls -l --time-style="long-iso" $suite_dir | grep '^d' | awk '{print $8}'`
+all_dirs=`ls -l --time-style="long-iso" $suite_dir | grep '^d' | awk '{print $8}'|grep -v signing`
 black_dirs=''
 signing_white_dirs=''
 
@@ -74,13 +102,6 @@ function check_signing_whitedir()
   return 0
 }
 
-# parse spec required name
-NAME=`grep "Name:" *.spec | awk '{print $2}'`
-if [ -z "$NAME" ];then
-        echo "Name not specified in spec file"
-        exit 1
-fi
-
 echo "-->> Creating widgets >>--"
 for app in $all_dirs; do
     check_blackdir $app
@@ -108,11 +129,9 @@ for app in $all_dirs; do
                cd $suite_dir
                continue
             fi
-           if [ -d "../../signing" ]; then
+           if [ -d "$BUILD_ROOT/signing" ]; then
                 echo "Start sign wgt ..."
-                cd ../../signing
-                ./sign-widget.sh --config default.conf ../$NAME/$app.wgt
-                cd -
+                $BUILD_ROOT/signing/sign-widget.sh --dist platform $BUILD_ROOT/$app.wgt
             else
                 echo "Not found signing folder."
                 rm -rf $suite_dir/*.wgt
@@ -130,88 +149,96 @@ if [ $pack_fail != 'FALSE' ]; then
     exit 1
 fi
 
-#######################################################################################################
-# parse spec required version
-VERSION=`grep "Version:" ${NAME}.spec | awk '{print $2}'`
-if [ -z "$VERSION" ];then
-        echo "Version not specified in spec file"
-        exit 1
+# build
+echo "build from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cd  $BUILD_ROOT
+./autogen && ./configure --prefix=/ && make && make install DESTDIR=$BUILD_DEST
+if [ $? -ne 0 ];then
+    echo "build fail,please check Makefile.am and cofigure.ac... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
+    exit 1
 fi
+find $BUILD_DEST -name "Makefile*" -delete
+}
 
-SRC_ROOT=${PWD}
-RPM_ROOT=/tmp/${NAME}_pack
-#tar.gz2
-ARCHIVE_TYPE=tar.gz
-#cjvf
-ARCHIVE_OPTION=czvf
-
-# check precondition
-check_precondition()
-{
-    which $1 > /dev/null 2>&1
-    if [ $? -ne 0 ]; then
-        echo "Error: no tool: $1"
-        exit 1
-    fi
+function create_apk(){
+echo "Sorry,apk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
 }
-check_precondition rpmbuild
-check_precondition gcc
-check_precondition make
 
+function create_xpk(){
+echo "Sorry,xpk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
 
-# clean
-echo "cleaning rpm workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf $RPM_ROOT
-
-# create workspace
-echo "create rpm workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-mkdir -p $RPM_ROOT/RPMS $RPM_ROOT/SRPMS $RPM_ROOT/SPECS $RPM_ROOT/SOURCES $RPM_ROOT/BUILD $RPM_ROOT/src_tmp/$NAME-$VERSION
-
-# prepare
-echo "prepare workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf *.rpm *.tar.bz2 *.tar.gz
-cp -a $SRC_ROOT/* $RPM_ROOT/src_tmp/$NAME-$VERSION
-# create Makefile in top src folder
-#cp $SRC_ROOT/top_Makefile $RPM_ROOT/src_tmp/$NAME-$VERSION/Makefile
-cp $PWD/${NAME}.spec $RPM_ROOT/SPECS
-cd $RPM_ROOT/src_tmp
-tar $ARCHIVE_OPTION $RPM_ROOT/SOURCES/$NAME-$VERSION.$ARCHIVE_TYPE $NAME-$VERSION
-cd -
+function create_crx(){
+echo "Sorry,crx is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
 
-# build
-echo "build from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-cd  $RPM_ROOT/SPECS
-rpmbuild -ba ${NAME}.spec --clean --define "_topdir $RPM_ROOT" --target=noarch
-cd -
-
-echo "copy from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-echo "get packages......"
-find $RPM_ROOT -name "$NAME*.rpm" | grep -v debuginfo | xargs -n1 -I {} mv {} $PWD -f
-
-if [[ $platform != "" && $platform != "default" ]]; then
-        cd $PWD
-        for file in `ls *.rpm`; do
-                new_name=`echo $file | sed "s/\.rpm/\.$platform\.rpm/g"`
-                mv $file $new_name
-        done
-        cd -
+## zip function ##
+function zip_for_wgt(){
+cd $BUILD_DEST
+# cp inst.sh script #
+rm -rf $BUILD_DEST/opt/$name/inst.sh.wgt
+cp -af $BUILD_ROOT/inst.sh.wgt $BUILD_DEST/opt/$name/inst.sh
+
+zip -Drq $BUILD_DEST/$name-$version.zip opt/
+if [ $? -ne 0 ];then
+    echo "Create zip package fail... >>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
+    exit 1
 fi
+}
 
-echo "get $NAME-$VERSION.$ARCHIVE_TYPE......"
-mv $RPM_ROOT/SOURCES/$NAME-$VERSION.$ARCHIVE_TYPE $PWD -f
+function zip_for_apk(){
+echo "Sorry,apk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+function zip_for_xpk(){
+echo "Sorry,xpk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+function zip_for_crx(){
+echo "Sorry,crx is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+## create wgt crx apk xpk and zip package ##
+case $type in
+    wgt) create_wgt
+         zip_for_wgt;;
+    apk) create_apk
+         zip_for_apk;;
+    xpk) create_xpk
+         zip_for_xpk;;
+    crx) create_crx
+         zip_for_crx;;
+esac
 
-# clean
-echo "cleaning workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf $RPM_ROOT
-rm -rf *.wgt
+
+# copy zip file
+echo "copy package from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cp -f $BUILD_DEST/$name-$version.zip $SRC_ROOT/$name-$version.zip
+
+# clean workspace
+clean_workspace
 
 # validate
 echo "checking result... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-if [ -z "`ls | grep "\.rpm"`" ] || [ -z "`ls | grep "\.$ARCHIVE_TYPE"`" ];then
-        echo "------------------------------ FAILED to build $NAME packages --------------------------"
-        exit 1
+cd $SRC_ROOT
+if [ -z "`ls | grep "\.zip"`" ];then
+    echo "------------------------------ FAILED to build $name packages --------------------------"
+    exit 1
 fi
 
-echo "------------------------------ Done to build $NAME packages --------------------------"
-ls *.rpm *.$ARCHIVE_TYPE 2>/dev/null
-##############################################################################
+echo "------------------------------ Done to build $name packages --------------------------"
+ls *.zip 2>/dev/null
index 7d27ff42c199e2d5c40c7e1115e53d6398dfdf74..55f000fcbc495d47fb834d73325ca70f15d15135 100644 (file)
@@ -1,34 +1,3 @@
-%define _unpackaged_files_terminate_build 0
-
-Summary: WRT runtime tests
-Name: tct-rt01-wrt-tests
-Version: 1.5.2
-Release: 1
-License: BSD
-Group: System/Libraries
-Source: %name-%version.tar.gz
-
-%description
-This is WRT runtime test suite package
-
-
-%prep
-%setup -q
-
-%build
-./autogen
-./configure --prefix=/usr
-make
-
-%install
-rm -rf $RPM_BUILD_ROOT
-make install DESTDIR=$RPM_BUILD_ROOT
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-/opt/%name
-/usr/share/%name
-
-%changelog
+name=$(basename $(pwd))
+version="1.5.2"
+appname=$(echo $name|sed 's/-/_/g')
index 33d93439db5c9a040f13f0a21f431160fb20c256..1432c679ae2f543aedd83e34479b9224467f6905 100644 (file)
@@ -28,7 +28,5 @@
 #               Fan, Yugang <yugang.fan@intel.com>
 #
 SUBDIRS =  scripts
-testdefdir = $(datadir)/tct-rt02-wrt-tests
-dist_testdef_DATA = tests.xml 
-docdir = /opt/tct-rt02-wrt-tests
-dist_doc_DATA = Changelog README *.wgt COPYING
+docdir = $(prefix)/opt/tct-rt02-wrt-tests
+dist_doc_DATA = Changelog README *.wgt COPYING tests.xml
diff --git a/tct-rt02-wrt-tests/inst.sh.wgt b/tct-rt02-wrt-tests/inst.sh.wgt
new file mode 100755 (executable)
index 0000000..4661715
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+wgt_installer="pkgcmd"
+NAME=$(basename $(cd $(dirname $0);pwd))
+
+#parse params
+USAGE="Usage: ./inst.sh [-i] [-u]
+  -i install wgt and config environment 
+  -u uninstall wgt and remove source file
+[-i] option was set as default."
+
+function installpkg(){
+    echo "No need to install $NAME.wgt ..."
+}
+
+function uninstallpkg(){
+### remove source file ###
+if [ -d /opt/usr/media/tct/opt/$NAME ];then
+    rm -rf /opt/usr/media/tct/opt/$NAME
+else
+    echo "Remove source file fail,please check if the source file exist: /opt/usr/media/tct/opt/$NAME ..."
+fi
+}
+
+case "$1" in
+    -h|--help) echo "$USAGE"
+               exit ;;
+    ""|-i) installpkg;;
+    -u) uninstallpkg;;
+    *) echo "Unknown option: $1"
+       echo "$USAGE"
+       exit ;;
+esac
index fc85c462131ef2d3f24568f3afe5f8af9989aa3b..4d66654d337f6e6742386a6556de9642e50677d6 100755 (executable)
@@ -1,44 +1,72 @@
 #!/bin/bash
-##
-# Copyright (c) 2012 Intel Corporation.
-#
-# Redistribution and use in source and binary forms, with or without modification,
-# are permitted provided that the following conditions are met:
-#
-# * Redistributions of works must retain the original copyright notice, this list
-#   of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the original copyright notice,
-#   this list of conditions and the following disclaimer in the documentation
-#   and/or other materials provided with the distribution.
-# * Neither the name of Intel Corporation nor the names of its contributors
-#   may be used to endorse or promote products derived from this work without
-#   specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT,
-# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# Authors:
-#               Fan, Yugang <yugang.fan@intel.com>
-#
-
-USAGE="Usage: ./pack.sh"
+source $(dirname $0)/$(basename $(pwd)).spec
+
+#parse params
+usage="Usage: ./pack.sh [-t <package type: wgt | apk | crx | xpk>]
+[-t wgt] option was set as default."
 
 if [[ $1 == "-h" || $1 == "--help" ]]; then
-    echo $USAGE
+    echo $usage
+    exit 1
+fi
+
+type="wgt"
+while getopts t: o
+do
+    case "$o" in
+    t) type=$OPTARG;;
+    *) echo $usage
+       exit 1;;
+    esac
+done
+
+if [[ $type == "wgt" || $type == "apk" || $type == "crx" || $type == "xpk" ]];then
+    echo "Create package with $type and raw source"
+else 
+    echo "Sorry,$type is not support... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+    echo "$usage"
+    exit 1
+fi
+
+if [[ -z $name || -z $version || -z $appname ]];then
+    echo "Package name or version not specified in spec"
+    exit 1
+fi
+
+SRC_ROOT=${PWD}
+BUILD_ROOT=/tmp/${name}_pack
+BUILD_DEST=/tmp/${name}
+
+# clean
+function clean_workspace(){
+echo "cleaning workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+rm -rf $BUILD_ROOT $BUILD_DEST
+}
+
+clean_workspace
+mkdir -p $BUILD_ROOT $BUILD_DEST
+
+# copy source code
+rm -rf *.rpm *.tar.bz2 *.tar.gz *.zip
+cp -arf $SRC_ROOT/* $BUILD_ROOT/
+
+# copy signing tool
+echo "copy signing tool... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cp -arf $SRC_ROOT/../tools/signing $BUILD_ROOT/signing
+if [ $? -ne 0 ];then
+    echo "No signing tool found in $SRC_ROOT/../tools.... >>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
     exit 1
 fi
 
+## function for create wgt apk xpk ##
+
+function create_wgt(){
+# create wgt
+cd $BUILD_ROOT
 pack_fail='FALSE'
 suite_dir=${PWD}
-all_dirs=`ls -l --time-style="long-iso" $suite_dir | grep '^d' | awk '{print $8}'`
+all_dirs=`ls -l --time-style="long-iso" $suite_dir | grep '^d' | awk '{print $8}'|grep -v signing`
 black_dirs=''
 signing_white_dirs=''
 
@@ -74,13 +102,6 @@ function check_signing_whitedir()
   return 0
 }
 
-# parse spec required name
-NAME=`grep "Name:" *.spec | awk '{print $2}'`
-if [ -z "$NAME" ];then
-        echo "Name not specified in spec file"
-        exit 1
-fi
-
 echo "-->> Creating widgets >>--"
 for app in $all_dirs; do
     check_blackdir $app
@@ -108,11 +129,9 @@ for app in $all_dirs; do
                cd $suite_dir
                continue
             fi
-           if [ -d "../../signing" ]; then
+           if [ -d "$BUILD_ROOT/signing" ]; then
                 echo "Start sign wgt ..."
-                cd ../../signing
-                ./sign-widget.sh --config default.conf ../$NAME/$app.wgt
-                cd -
+                $BUILD_ROOT/signing/sign-widget.sh --dist platform $BUILD_ROOT/$app.wgt
             else
                 echo "Not found signing folder."
                 rm -rf $suite_dir/*.wgt
@@ -130,88 +149,96 @@ if [ $pack_fail != 'FALSE' ]; then
     exit 1
 fi
 
-#######################################################################################################
-# parse spec required version
-VERSION=`grep "Version:" ${NAME}.spec | awk '{print $2}'`
-if [ -z "$VERSION" ];then
-        echo "Version not specified in spec file"
-        exit 1
+# build
+echo "build from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cd  $BUILD_ROOT
+./autogen && ./configure --prefix=/ && make && make install DESTDIR=$BUILD_DEST
+if [ $? -ne 0 ];then
+    echo "build fail,please check Makefile.am and cofigure.ac... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
+    exit 1
 fi
+find $BUILD_DEST -name "Makefile*" -delete
+}
 
-SRC_ROOT=${PWD}
-RPM_ROOT=/tmp/${NAME}_pack
-#tar.gz2
-ARCHIVE_TYPE=tar.gz
-#cjvf
-ARCHIVE_OPTION=czvf
-
-# check precondition
-check_precondition()
-{
-    which $1 > /dev/null 2>&1
-    if [ $? -ne 0 ]; then
-        echo "Error: no tool: $1"
-        exit 1
-    fi
+function create_apk(){
+echo "Sorry,apk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
 }
-check_precondition rpmbuild
-check_precondition gcc
-check_precondition make
 
+function create_xpk(){
+echo "Sorry,xpk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
 
-# clean
-echo "cleaning rpm workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf $RPM_ROOT
-
-# create workspace
-echo "create rpm workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-mkdir -p $RPM_ROOT/RPMS $RPM_ROOT/SRPMS $RPM_ROOT/SPECS $RPM_ROOT/SOURCES $RPM_ROOT/BUILD $RPM_ROOT/src_tmp/$NAME-$VERSION
-
-# prepare
-echo "prepare workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf *.rpm *.tar.bz2 *.tar.gz
-cp -a $SRC_ROOT/* $RPM_ROOT/src_tmp/$NAME-$VERSION
-# create Makefile in top src folder
-#cp $SRC_ROOT/top_Makefile $RPM_ROOT/src_tmp/$NAME-$VERSION/Makefile
-cp $PWD/${NAME}.spec $RPM_ROOT/SPECS
-cd $RPM_ROOT/src_tmp
-tar $ARCHIVE_OPTION $RPM_ROOT/SOURCES/$NAME-$VERSION.$ARCHIVE_TYPE $NAME-$VERSION
-cd -
+function create_crx(){
+echo "Sorry,crx is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
 
-# build
-echo "build from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-cd  $RPM_ROOT/SPECS
-rpmbuild -ba ${NAME}.spec --clean --define "_topdir $RPM_ROOT" --target=noarch
-cd -
-
-echo "copy from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-echo "get packages......"
-find $RPM_ROOT -name "$NAME*.rpm" | grep -v debuginfo | xargs -n1 -I {} mv {} $PWD -f
-
-if [[ $platform != "" && $platform != "default" ]]; then
-        cd $PWD
-        for file in `ls *.rpm`; do
-                new_name=`echo $file | sed "s/\.rpm/\.$platform\.rpm/g"`
-                mv $file $new_name
-        done
-        cd -
+## zip function ##
+function zip_for_wgt(){
+cd $BUILD_DEST
+# cp inst.sh script #
+rm -rf $BUILD_DEST/opt/$name/inst.sh.wgt
+cp -af $BUILD_ROOT/inst.sh.wgt $BUILD_DEST/opt/$name/inst.sh
+
+zip -Drq $BUILD_DEST/$name-$version.zip opt/
+if [ $? -ne 0 ];then
+    echo "Create zip package fail... >>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
+    exit 1
 fi
+}
 
-echo "get $NAME-$VERSION.$ARCHIVE_TYPE......"
-mv $RPM_ROOT/SOURCES/$NAME-$VERSION.$ARCHIVE_TYPE $PWD -f
+function zip_for_apk(){
+echo "Sorry,apk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+function zip_for_xpk(){
+echo "Sorry,xpk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+function zip_for_crx(){
+echo "Sorry,crx is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+## create wgt crx apk xpk and zip package ##
+case $type in
+    wgt) create_wgt
+         zip_for_wgt;;
+    apk) create_apk
+         zip_for_apk;;
+    xpk) create_xpk
+         zip_for_xpk;;
+    crx) create_crx
+         zip_for_crx;;
+esac
 
-# clean
-echo "cleaning workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf $RPM_ROOT
-rm -rf *.wgt
+
+# copy zip file
+echo "copy package from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cp -f $BUILD_DEST/$name-$version.zip $SRC_ROOT/$name-$version.zip
+
+# clean workspace
+clean_workspace
 
 # validate
 echo "checking result... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-if [ -z "`ls | grep "\.rpm"`" ] || [ -z "`ls | grep "\.$ARCHIVE_TYPE"`" ];then
-        echo "------------------------------ FAILED to build $NAME packages --------------------------"
-        exit 1
+cd $SRC_ROOT
+if [ -z "`ls | grep "\.zip"`" ];then
+    echo "------------------------------ FAILED to build $name packages --------------------------"
+    exit 1
 fi
 
-echo "------------------------------ Done to build $NAME packages --------------------------"
-ls *.rpm *.$ARCHIVE_TYPE 2>/dev/null
-##############################################################################
+echo "------------------------------ Done to build $name packages --------------------------"
+ls *.zip 2>/dev/null
index 1dd5f81346ac75241686707d20dd48776881a514..d812e026c8a929a3e226da0ae5ed436cbbebb752 100644 (file)
@@ -30,5 +30,5 @@
 
 
 scripts_SCRIPTS = *
-scriptsdir = /opt/tct-rt02-wrt-tests/scripts
+scriptsdir = $(prefix)/opt/tct-rt02-wrt-tests/scripts
 EXTRA_DIST = $(scripts_SCRIPTS)
index 0363196912a4a1791550856f76b5bde03ea34905..55f000fcbc495d47fb834d73325ca70f15d15135 100644 (file)
@@ -1,34 +1,3 @@
-%define _unpackaged_files_terminate_build 0
-
-Summary: WRT runtime tests
-Name: tct-rt02-wrt-tests
-Version: 1.5.2
-Release: 1
-License: BSD
-Group: System/Libraries
-Source: %name-%version.tar.gz
-
-%description
-This is WRT runtime test suite package
-
-
-%prep
-%setup -q
-
-%build
-./autogen
-./configure --prefix=/usr
-make
-
-%install
-rm -rf $RPM_BUILD_ROOT
-make install DESTDIR=$RPM_BUILD_ROOT
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-/opt/%name
-/usr/share/%name
-
-%changelog
+name=$(basename $(pwd))
+version="1.5.2"
+appname=$(echo $name|sed 's/-/_/g')
index 149d5fc0d4ed47c13d53076b2f8c30a3480f2080..a5385e5883de47e6bce4d1f1b27b4e9549bed3e9 100644 (file)
@@ -27,7 +27,5 @@
 # Authors:
 #               Fan, Yugang <yugang.fan@intel.com>
 #
-testdefdir = $(datadir)/tct-sp01-wrt-tests
-dist_testdef_DATA = tests.xml
-docdir = /opt/tct-sp01-wrt-tests
-dist_doc_DATA = Changelog README *.wgt COPYING
+docdir = $(prefix)/opt/tct-sp01-wrt-tests
+dist_doc_DATA = Changelog README *.wgt COPYING tests.xml
diff --git a/tct-sp01-wrt-tests/inst.sh.wgt b/tct-sp01-wrt-tests/inst.sh.wgt
new file mode 100755 (executable)
index 0000000..4661715
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+wgt_installer="pkgcmd"
+NAME=$(basename $(cd $(dirname $0);pwd))
+
+#parse params
+USAGE="Usage: ./inst.sh [-i] [-u]
+  -i install wgt and config environment 
+  -u uninstall wgt and remove source file
+[-i] option was set as default."
+
+function installpkg(){
+    echo "No need to install $NAME.wgt ..."
+}
+
+function uninstallpkg(){
+### remove source file ###
+if [ -d /opt/usr/media/tct/opt/$NAME ];then
+    rm -rf /opt/usr/media/tct/opt/$NAME
+else
+    echo "Remove source file fail,please check if the source file exist: /opt/usr/media/tct/opt/$NAME ..."
+fi
+}
+
+case "$1" in
+    -h|--help) echo "$USAGE"
+               exit ;;
+    ""|-i) installpkg;;
+    -u) uninstallpkg;;
+    *) echo "Unknown option: $1"
+       echo "$USAGE"
+       exit ;;
+esac
index fc85c462131ef2d3f24568f3afe5f8af9989aa3b..4d66654d337f6e6742386a6556de9642e50677d6 100755 (executable)
@@ -1,44 +1,72 @@
 #!/bin/bash
-##
-# Copyright (c) 2012 Intel Corporation.
-#
-# Redistribution and use in source and binary forms, with or without modification,
-# are permitted provided that the following conditions are met:
-#
-# * Redistributions of works must retain the original copyright notice, this list
-#   of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the original copyright notice,
-#   this list of conditions and the following disclaimer in the documentation
-#   and/or other materials provided with the distribution.
-# * Neither the name of Intel Corporation nor the names of its contributors
-#   may be used to endorse or promote products derived from this work without
-#   specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT,
-# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# Authors:
-#               Fan, Yugang <yugang.fan@intel.com>
-#
-
-USAGE="Usage: ./pack.sh"
+source $(dirname $0)/$(basename $(pwd)).spec
+
+#parse params
+usage="Usage: ./pack.sh [-t <package type: wgt | apk | crx | xpk>]
+[-t wgt] option was set as default."
 
 if [[ $1 == "-h" || $1 == "--help" ]]; then
-    echo $USAGE
+    echo $usage
+    exit 1
+fi
+
+type="wgt"
+while getopts t: o
+do
+    case "$o" in
+    t) type=$OPTARG;;
+    *) echo $usage
+       exit 1;;
+    esac
+done
+
+if [[ $type == "wgt" || $type == "apk" || $type == "crx" || $type == "xpk" ]];then
+    echo "Create package with $type and raw source"
+else 
+    echo "Sorry,$type is not support... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+    echo "$usage"
+    exit 1
+fi
+
+if [[ -z $name || -z $version || -z $appname ]];then
+    echo "Package name or version not specified in spec"
+    exit 1
+fi
+
+SRC_ROOT=${PWD}
+BUILD_ROOT=/tmp/${name}_pack
+BUILD_DEST=/tmp/${name}
+
+# clean
+function clean_workspace(){
+echo "cleaning workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+rm -rf $BUILD_ROOT $BUILD_DEST
+}
+
+clean_workspace
+mkdir -p $BUILD_ROOT $BUILD_DEST
+
+# copy source code
+rm -rf *.rpm *.tar.bz2 *.tar.gz *.zip
+cp -arf $SRC_ROOT/* $BUILD_ROOT/
+
+# copy signing tool
+echo "copy signing tool... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cp -arf $SRC_ROOT/../tools/signing $BUILD_ROOT/signing
+if [ $? -ne 0 ];then
+    echo "No signing tool found in $SRC_ROOT/../tools.... >>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
     exit 1
 fi
 
+## function for create wgt apk xpk ##
+
+function create_wgt(){
+# create wgt
+cd $BUILD_ROOT
 pack_fail='FALSE'
 suite_dir=${PWD}
-all_dirs=`ls -l --time-style="long-iso" $suite_dir | grep '^d' | awk '{print $8}'`
+all_dirs=`ls -l --time-style="long-iso" $suite_dir | grep '^d' | awk '{print $8}'|grep -v signing`
 black_dirs=''
 signing_white_dirs=''
 
@@ -74,13 +102,6 @@ function check_signing_whitedir()
   return 0
 }
 
-# parse spec required name
-NAME=`grep "Name:" *.spec | awk '{print $2}'`
-if [ -z "$NAME" ];then
-        echo "Name not specified in spec file"
-        exit 1
-fi
-
 echo "-->> Creating widgets >>--"
 for app in $all_dirs; do
     check_blackdir $app
@@ -108,11 +129,9 @@ for app in $all_dirs; do
                cd $suite_dir
                continue
             fi
-           if [ -d "../../signing" ]; then
+           if [ -d "$BUILD_ROOT/signing" ]; then
                 echo "Start sign wgt ..."
-                cd ../../signing
-                ./sign-widget.sh --config default.conf ../$NAME/$app.wgt
-                cd -
+                $BUILD_ROOT/signing/sign-widget.sh --dist platform $BUILD_ROOT/$app.wgt
             else
                 echo "Not found signing folder."
                 rm -rf $suite_dir/*.wgt
@@ -130,88 +149,96 @@ if [ $pack_fail != 'FALSE' ]; then
     exit 1
 fi
 
-#######################################################################################################
-# parse spec required version
-VERSION=`grep "Version:" ${NAME}.spec | awk '{print $2}'`
-if [ -z "$VERSION" ];then
-        echo "Version not specified in spec file"
-        exit 1
+# build
+echo "build from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cd  $BUILD_ROOT
+./autogen && ./configure --prefix=/ && make && make install DESTDIR=$BUILD_DEST
+if [ $? -ne 0 ];then
+    echo "build fail,please check Makefile.am and cofigure.ac... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
+    exit 1
 fi
+find $BUILD_DEST -name "Makefile*" -delete
+}
 
-SRC_ROOT=${PWD}
-RPM_ROOT=/tmp/${NAME}_pack
-#tar.gz2
-ARCHIVE_TYPE=tar.gz
-#cjvf
-ARCHIVE_OPTION=czvf
-
-# check precondition
-check_precondition()
-{
-    which $1 > /dev/null 2>&1
-    if [ $? -ne 0 ]; then
-        echo "Error: no tool: $1"
-        exit 1
-    fi
+function create_apk(){
+echo "Sorry,apk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
 }
-check_precondition rpmbuild
-check_precondition gcc
-check_precondition make
 
+function create_xpk(){
+echo "Sorry,xpk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
 
-# clean
-echo "cleaning rpm workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf $RPM_ROOT
-
-# create workspace
-echo "create rpm workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-mkdir -p $RPM_ROOT/RPMS $RPM_ROOT/SRPMS $RPM_ROOT/SPECS $RPM_ROOT/SOURCES $RPM_ROOT/BUILD $RPM_ROOT/src_tmp/$NAME-$VERSION
-
-# prepare
-echo "prepare workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf *.rpm *.tar.bz2 *.tar.gz
-cp -a $SRC_ROOT/* $RPM_ROOT/src_tmp/$NAME-$VERSION
-# create Makefile in top src folder
-#cp $SRC_ROOT/top_Makefile $RPM_ROOT/src_tmp/$NAME-$VERSION/Makefile
-cp $PWD/${NAME}.spec $RPM_ROOT/SPECS
-cd $RPM_ROOT/src_tmp
-tar $ARCHIVE_OPTION $RPM_ROOT/SOURCES/$NAME-$VERSION.$ARCHIVE_TYPE $NAME-$VERSION
-cd -
+function create_crx(){
+echo "Sorry,crx is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
 
-# build
-echo "build from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-cd  $RPM_ROOT/SPECS
-rpmbuild -ba ${NAME}.spec --clean --define "_topdir $RPM_ROOT" --target=noarch
-cd -
-
-echo "copy from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-echo "get packages......"
-find $RPM_ROOT -name "$NAME*.rpm" | grep -v debuginfo | xargs -n1 -I {} mv {} $PWD -f
-
-if [[ $platform != "" && $platform != "default" ]]; then
-        cd $PWD
-        for file in `ls *.rpm`; do
-                new_name=`echo $file | sed "s/\.rpm/\.$platform\.rpm/g"`
-                mv $file $new_name
-        done
-        cd -
+## zip function ##
+function zip_for_wgt(){
+cd $BUILD_DEST
+# cp inst.sh script #
+rm -rf $BUILD_DEST/opt/$name/inst.sh.wgt
+cp -af $BUILD_ROOT/inst.sh.wgt $BUILD_DEST/opt/$name/inst.sh
+
+zip -Drq $BUILD_DEST/$name-$version.zip opt/
+if [ $? -ne 0 ];then
+    echo "Create zip package fail... >>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
+    exit 1
 fi
+}
 
-echo "get $NAME-$VERSION.$ARCHIVE_TYPE......"
-mv $RPM_ROOT/SOURCES/$NAME-$VERSION.$ARCHIVE_TYPE $PWD -f
+function zip_for_apk(){
+echo "Sorry,apk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+function zip_for_xpk(){
+echo "Sorry,xpk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+function zip_for_crx(){
+echo "Sorry,crx is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+## create wgt crx apk xpk and zip package ##
+case $type in
+    wgt) create_wgt
+         zip_for_wgt;;
+    apk) create_apk
+         zip_for_apk;;
+    xpk) create_xpk
+         zip_for_xpk;;
+    crx) create_crx
+         zip_for_crx;;
+esac
 
-# clean
-echo "cleaning workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf $RPM_ROOT
-rm -rf *.wgt
+
+# copy zip file
+echo "copy package from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cp -f $BUILD_DEST/$name-$version.zip $SRC_ROOT/$name-$version.zip
+
+# clean workspace
+clean_workspace
 
 # validate
 echo "checking result... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-if [ -z "`ls | grep "\.rpm"`" ] || [ -z "`ls | grep "\.$ARCHIVE_TYPE"`" ];then
-        echo "------------------------------ FAILED to build $NAME packages --------------------------"
-        exit 1
+cd $SRC_ROOT
+if [ -z "`ls | grep "\.zip"`" ];then
+    echo "------------------------------ FAILED to build $name packages --------------------------"
+    exit 1
 fi
 
-echo "------------------------------ Done to build $NAME packages --------------------------"
-ls *.rpm *.$ARCHIVE_TYPE 2>/dev/null
-##############################################################################
+echo "------------------------------ Done to build $name packages --------------------------"
+ls *.zip 2>/dev/null
index 8e667752b203b6761bea65ed10c79250251340e5..55f000fcbc495d47fb834d73325ca70f15d15135 100644 (file)
@@ -1,34 +1,3 @@
-%define _unpackaged_files_terminate_build 0
-
-Summary: WRT Security Privacy tests
-Name: tct-sp01-wrt-tests
-Version: 1.5.2
-Release: 1
-License: BSD
-Group: System/Libraries
-Source: %name-%version.tar.gz
-
-%description
-This is WRT Security Privacy test suite package
-
-
-%prep
-%setup -q
-
-%build
-./autogen
-./configure --prefix=/usr
-make
-
-%install
-rm -rf $RPM_BUILD_ROOT
-make install DESTDIR=$RPM_BUILD_ROOT
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-/opt/%name
-/usr/share/%name
-
-%changelog
+name=$(basename $(pwd))
+version="1.5.2"
+appname=$(echo $name|sed 's/-/_/g')
index 553a2a7981c6d727df53c6a4a8531a173e793088..80ee439a8be7450d82db0768a6283a44b17b3a18 100644 (file)
@@ -28,7 +28,5 @@
 #               Fan, Yugang <yugang.fan@intel.com>
 #
 SUBDIRS =  scripts
-testdefdir = $(datadir)/tct-sp02-wrt-tests
-dist_testdef_DATA = tests.xml
-docdir = /opt/tct-sp02-wrt-tests
-dist_doc_DATA = Changelog README *.wgt COPYING
+docdir = $(prefix)/opt/tct-sp02-wrt-tests
+dist_doc_DATA = Changelog README *.wgt COPYING tests.xml
diff --git a/tct-sp02-wrt-tests/inst.sh.wgt b/tct-sp02-wrt-tests/inst.sh.wgt
new file mode 100755 (executable)
index 0000000..4661715
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+wgt_installer="pkgcmd"
+NAME=$(basename $(cd $(dirname $0);pwd))
+
+#parse params
+USAGE="Usage: ./inst.sh [-i] [-u]
+  -i install wgt and config environment 
+  -u uninstall wgt and remove source file
+[-i] option was set as default."
+
+function installpkg(){
+    echo "No need to install $NAME.wgt ..."
+}
+
+function uninstallpkg(){
+### remove source file ###
+if [ -d /opt/usr/media/tct/opt/$NAME ];then
+    rm -rf /opt/usr/media/tct/opt/$NAME
+else
+    echo "Remove source file fail,please check if the source file exist: /opt/usr/media/tct/opt/$NAME ..."
+fi
+}
+
+case "$1" in
+    -h|--help) echo "$USAGE"
+               exit ;;
+    ""|-i) installpkg;;
+    -u) uninstallpkg;;
+    *) echo "Unknown option: $1"
+       echo "$USAGE"
+       exit ;;
+esac
index fc85c462131ef2d3f24568f3afe5f8af9989aa3b..4d66654d337f6e6742386a6556de9642e50677d6 100755 (executable)
@@ -1,44 +1,72 @@
 #!/bin/bash
-##
-# Copyright (c) 2012 Intel Corporation.
-#
-# Redistribution and use in source and binary forms, with or without modification,
-# are permitted provided that the following conditions are met:
-#
-# * Redistributions of works must retain the original copyright notice, this list
-#   of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the original copyright notice,
-#   this list of conditions and the following disclaimer in the documentation
-#   and/or other materials provided with the distribution.
-# * Neither the name of Intel Corporation nor the names of its contributors
-#   may be used to endorse or promote products derived from this work without
-#   specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT,
-# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# Authors:
-#               Fan, Yugang <yugang.fan@intel.com>
-#
-
-USAGE="Usage: ./pack.sh"
+source $(dirname $0)/$(basename $(pwd)).spec
+
+#parse params
+usage="Usage: ./pack.sh [-t <package type: wgt | apk | crx | xpk>]
+[-t wgt] option was set as default."
 
 if [[ $1 == "-h" || $1 == "--help" ]]; then
-    echo $USAGE
+    echo $usage
+    exit 1
+fi
+
+type="wgt"
+while getopts t: o
+do
+    case "$o" in
+    t) type=$OPTARG;;
+    *) echo $usage
+       exit 1;;
+    esac
+done
+
+if [[ $type == "wgt" || $type == "apk" || $type == "crx" || $type == "xpk" ]];then
+    echo "Create package with $type and raw source"
+else 
+    echo "Sorry,$type is not support... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+    echo "$usage"
+    exit 1
+fi
+
+if [[ -z $name || -z $version || -z $appname ]];then
+    echo "Package name or version not specified in spec"
+    exit 1
+fi
+
+SRC_ROOT=${PWD}
+BUILD_ROOT=/tmp/${name}_pack
+BUILD_DEST=/tmp/${name}
+
+# clean
+function clean_workspace(){
+echo "cleaning workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+rm -rf $BUILD_ROOT $BUILD_DEST
+}
+
+clean_workspace
+mkdir -p $BUILD_ROOT $BUILD_DEST
+
+# copy source code
+rm -rf *.rpm *.tar.bz2 *.tar.gz *.zip
+cp -arf $SRC_ROOT/* $BUILD_ROOT/
+
+# copy signing tool
+echo "copy signing tool... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cp -arf $SRC_ROOT/../tools/signing $BUILD_ROOT/signing
+if [ $? -ne 0 ];then
+    echo "No signing tool found in $SRC_ROOT/../tools.... >>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
     exit 1
 fi
 
+## function for create wgt apk xpk ##
+
+function create_wgt(){
+# create wgt
+cd $BUILD_ROOT
 pack_fail='FALSE'
 suite_dir=${PWD}
-all_dirs=`ls -l --time-style="long-iso" $suite_dir | grep '^d' | awk '{print $8}'`
+all_dirs=`ls -l --time-style="long-iso" $suite_dir | grep '^d' | awk '{print $8}'|grep -v signing`
 black_dirs=''
 signing_white_dirs=''
 
@@ -74,13 +102,6 @@ function check_signing_whitedir()
   return 0
 }
 
-# parse spec required name
-NAME=`grep "Name:" *.spec | awk '{print $2}'`
-if [ -z "$NAME" ];then
-        echo "Name not specified in spec file"
-        exit 1
-fi
-
 echo "-->> Creating widgets >>--"
 for app in $all_dirs; do
     check_blackdir $app
@@ -108,11 +129,9 @@ for app in $all_dirs; do
                cd $suite_dir
                continue
             fi
-           if [ -d "../../signing" ]; then
+           if [ -d "$BUILD_ROOT/signing" ]; then
                 echo "Start sign wgt ..."
-                cd ../../signing
-                ./sign-widget.sh --config default.conf ../$NAME/$app.wgt
-                cd -
+                $BUILD_ROOT/signing/sign-widget.sh --dist platform $BUILD_ROOT/$app.wgt
             else
                 echo "Not found signing folder."
                 rm -rf $suite_dir/*.wgt
@@ -130,88 +149,96 @@ if [ $pack_fail != 'FALSE' ]; then
     exit 1
 fi
 
-#######################################################################################################
-# parse spec required version
-VERSION=`grep "Version:" ${NAME}.spec | awk '{print $2}'`
-if [ -z "$VERSION" ];then
-        echo "Version not specified in spec file"
-        exit 1
+# build
+echo "build from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cd  $BUILD_ROOT
+./autogen && ./configure --prefix=/ && make && make install DESTDIR=$BUILD_DEST
+if [ $? -ne 0 ];then
+    echo "build fail,please check Makefile.am and cofigure.ac... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
+    exit 1
 fi
+find $BUILD_DEST -name "Makefile*" -delete
+}
 
-SRC_ROOT=${PWD}
-RPM_ROOT=/tmp/${NAME}_pack
-#tar.gz2
-ARCHIVE_TYPE=tar.gz
-#cjvf
-ARCHIVE_OPTION=czvf
-
-# check precondition
-check_precondition()
-{
-    which $1 > /dev/null 2>&1
-    if [ $? -ne 0 ]; then
-        echo "Error: no tool: $1"
-        exit 1
-    fi
+function create_apk(){
+echo "Sorry,apk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
 }
-check_precondition rpmbuild
-check_precondition gcc
-check_precondition make
 
+function create_xpk(){
+echo "Sorry,xpk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
 
-# clean
-echo "cleaning rpm workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf $RPM_ROOT
-
-# create workspace
-echo "create rpm workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-mkdir -p $RPM_ROOT/RPMS $RPM_ROOT/SRPMS $RPM_ROOT/SPECS $RPM_ROOT/SOURCES $RPM_ROOT/BUILD $RPM_ROOT/src_tmp/$NAME-$VERSION
-
-# prepare
-echo "prepare workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf *.rpm *.tar.bz2 *.tar.gz
-cp -a $SRC_ROOT/* $RPM_ROOT/src_tmp/$NAME-$VERSION
-# create Makefile in top src folder
-#cp $SRC_ROOT/top_Makefile $RPM_ROOT/src_tmp/$NAME-$VERSION/Makefile
-cp $PWD/${NAME}.spec $RPM_ROOT/SPECS
-cd $RPM_ROOT/src_tmp
-tar $ARCHIVE_OPTION $RPM_ROOT/SOURCES/$NAME-$VERSION.$ARCHIVE_TYPE $NAME-$VERSION
-cd -
+function create_crx(){
+echo "Sorry,crx is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
 
-# build
-echo "build from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-cd  $RPM_ROOT/SPECS
-rpmbuild -ba ${NAME}.spec --clean --define "_topdir $RPM_ROOT" --target=noarch
-cd -
-
-echo "copy from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-echo "get packages......"
-find $RPM_ROOT -name "$NAME*.rpm" | grep -v debuginfo | xargs -n1 -I {} mv {} $PWD -f
-
-if [[ $platform != "" && $platform != "default" ]]; then
-        cd $PWD
-        for file in `ls *.rpm`; do
-                new_name=`echo $file | sed "s/\.rpm/\.$platform\.rpm/g"`
-                mv $file $new_name
-        done
-        cd -
+## zip function ##
+function zip_for_wgt(){
+cd $BUILD_DEST
+# cp inst.sh script #
+rm -rf $BUILD_DEST/opt/$name/inst.sh.wgt
+cp -af $BUILD_ROOT/inst.sh.wgt $BUILD_DEST/opt/$name/inst.sh
+
+zip -Drq $BUILD_DEST/$name-$version.zip opt/
+if [ $? -ne 0 ];then
+    echo "Create zip package fail... >>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
+    exit 1
 fi
+}
 
-echo "get $NAME-$VERSION.$ARCHIVE_TYPE......"
-mv $RPM_ROOT/SOURCES/$NAME-$VERSION.$ARCHIVE_TYPE $PWD -f
+function zip_for_apk(){
+echo "Sorry,apk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+function zip_for_xpk(){
+echo "Sorry,xpk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+function zip_for_crx(){
+echo "Sorry,crx is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+## create wgt crx apk xpk and zip package ##
+case $type in
+    wgt) create_wgt
+         zip_for_wgt;;
+    apk) create_apk
+         zip_for_apk;;
+    xpk) create_xpk
+         zip_for_xpk;;
+    crx) create_crx
+         zip_for_crx;;
+esac
 
-# clean
-echo "cleaning workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf $RPM_ROOT
-rm -rf *.wgt
+
+# copy zip file
+echo "copy package from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cp -f $BUILD_DEST/$name-$version.zip $SRC_ROOT/$name-$version.zip
+
+# clean workspace
+clean_workspace
 
 # validate
 echo "checking result... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-if [ -z "`ls | grep "\.rpm"`" ] || [ -z "`ls | grep "\.$ARCHIVE_TYPE"`" ];then
-        echo "------------------------------ FAILED to build $NAME packages --------------------------"
-        exit 1
+cd $SRC_ROOT
+if [ -z "`ls | grep "\.zip"`" ];then
+    echo "------------------------------ FAILED to build $name packages --------------------------"
+    exit 1
 fi
 
-echo "------------------------------ Done to build $NAME packages --------------------------"
-ls *.rpm *.$ARCHIVE_TYPE 2>/dev/null
-##############################################################################
+echo "------------------------------ Done to build $name packages --------------------------"
+ls *.zip 2>/dev/null
index 23f9e7278fbb4f8a3935762828d666bc1d724da7..647f72d1f4145ec384455ee5a65e08d826efedb8 100644 (file)
@@ -1,4 +1,4 @@
 
 spscripts_SCRIPTS = *.sh
-spscriptsdir = /opt/tct-sp02-wrt-tests/scripts
+spscriptsdir = $(prefix)/opt/tct-sp02-wrt-tests/scripts
 EXTRA_DIST = $(spscripts_SCRIPTS)
index e1efb7595a3ef8bab430d4a69a667588476ccc95..55f000fcbc495d47fb834d73325ca70f15d15135 100644 (file)
@@ -1,34 +1,3 @@
-%define _unpackaged_files_terminate_build 0
-
-Summary: WRT Security Privacy tests
-Name: tct-sp02-wrt-tests
-Version: 1.5.2
-Release: 1
-License: BSD
-Group: System/Libraries
-Source: %name-%version.tar.gz
-
-%description
-This is WRT Security Privacy test suite package
-
-
-%prep
-%setup -q
-
-%build
-./autogen
-./configure --prefix=/usr
-make
-
-%install
-rm -rf $RPM_BUILD_ROOT
-make install DESTDIR=$RPM_BUILD_ROOT
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-/opt/%name
-/usr/share/%name
-
-%changelog
+name=$(basename $(pwd))
+version="1.5.2"
+appname=$(echo $name|sed 's/-/_/g')
index d51128f200275d4f61686d8ef9b76451b5121800..7a08c78d83aa4b2b59caccfa85a78d6d1f7f00ed 100644 (file)
@@ -28,7 +28,5 @@
 #               Fan, Yugang <yugang.fan@intel.com>
 #
 SUBDIRS = scripts
-testdefdir = $(datadir)/tct-stab-wrt-tests
-dist_testdef_DATA = tests.xml 
-docdir = /opt/tct-stab-wrt-tests
-dist_doc_DATA = Changelog README *.wgt COPYING
+docdir = $(prefix)/opt/tct-stab-wrt-tests
+dist_doc_DATA = Changelog README *.wgt COPYING tests.xml
diff --git a/tct-stab-wrt-tests/inst.sh.wgt b/tct-stab-wrt-tests/inst.sh.wgt
new file mode 100755 (executable)
index 0000000..4661715
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+wgt_installer="pkgcmd"
+NAME=$(basename $(cd $(dirname $0);pwd))
+
+#parse params
+USAGE="Usage: ./inst.sh [-i] [-u]
+  -i install wgt and config environment 
+  -u uninstall wgt and remove source file
+[-i] option was set as default."
+
+function installpkg(){
+    echo "No need to install $NAME.wgt ..."
+}
+
+function uninstallpkg(){
+### remove source file ###
+if [ -d /opt/usr/media/tct/opt/$NAME ];then
+    rm -rf /opt/usr/media/tct/opt/$NAME
+else
+    echo "Remove source file fail,please check if the source file exist: /opt/usr/media/tct/opt/$NAME ..."
+fi
+}
+
+case "$1" in
+    -h|--help) echo "$USAGE"
+               exit ;;
+    ""|-i) installpkg;;
+    -u) uninstallpkg;;
+    *) echo "Unknown option: $1"
+       echo "$USAGE"
+       exit ;;
+esac
index fc85c462131ef2d3f24568f3afe5f8af9989aa3b..4d66654d337f6e6742386a6556de9642e50677d6 100755 (executable)
@@ -1,44 +1,72 @@
 #!/bin/bash
-##
-# Copyright (c) 2012 Intel Corporation.
-#
-# Redistribution and use in source and binary forms, with or without modification,
-# are permitted provided that the following conditions are met:
-#
-# * Redistributions of works must retain the original copyright notice, this list
-#   of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the original copyright notice,
-#   this list of conditions and the following disclaimer in the documentation
-#   and/or other materials provided with the distribution.
-# * Neither the name of Intel Corporation nor the names of its contributors
-#   may be used to endorse or promote products derived from this work without
-#   specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT,
-# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# Authors:
-#               Fan, Yugang <yugang.fan@intel.com>
-#
-
-USAGE="Usage: ./pack.sh"
+source $(dirname $0)/$(basename $(pwd)).spec
+
+#parse params
+usage="Usage: ./pack.sh [-t <package type: wgt | apk | crx | xpk>]
+[-t wgt] option was set as default."
 
 if [[ $1 == "-h" || $1 == "--help" ]]; then
-    echo $USAGE
+    echo $usage
+    exit 1
+fi
+
+type="wgt"
+while getopts t: o
+do
+    case "$o" in
+    t) type=$OPTARG;;
+    *) echo $usage
+       exit 1;;
+    esac
+done
+
+if [[ $type == "wgt" || $type == "apk" || $type == "crx" || $type == "xpk" ]];then
+    echo "Create package with $type and raw source"
+else 
+    echo "Sorry,$type is not support... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+    echo "$usage"
+    exit 1
+fi
+
+if [[ -z $name || -z $version || -z $appname ]];then
+    echo "Package name or version not specified in spec"
+    exit 1
+fi
+
+SRC_ROOT=${PWD}
+BUILD_ROOT=/tmp/${name}_pack
+BUILD_DEST=/tmp/${name}
+
+# clean
+function clean_workspace(){
+echo "cleaning workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+rm -rf $BUILD_ROOT $BUILD_DEST
+}
+
+clean_workspace
+mkdir -p $BUILD_ROOT $BUILD_DEST
+
+# copy source code
+rm -rf *.rpm *.tar.bz2 *.tar.gz *.zip
+cp -arf $SRC_ROOT/* $BUILD_ROOT/
+
+# copy signing tool
+echo "copy signing tool... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cp -arf $SRC_ROOT/../tools/signing $BUILD_ROOT/signing
+if [ $? -ne 0 ];then
+    echo "No signing tool found in $SRC_ROOT/../tools.... >>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
     exit 1
 fi
 
+## function for create wgt apk xpk ##
+
+function create_wgt(){
+# create wgt
+cd $BUILD_ROOT
 pack_fail='FALSE'
 suite_dir=${PWD}
-all_dirs=`ls -l --time-style="long-iso" $suite_dir | grep '^d' | awk '{print $8}'`
+all_dirs=`ls -l --time-style="long-iso" $suite_dir | grep '^d' | awk '{print $8}'|grep -v signing`
 black_dirs=''
 signing_white_dirs=''
 
@@ -74,13 +102,6 @@ function check_signing_whitedir()
   return 0
 }
 
-# parse spec required name
-NAME=`grep "Name:" *.spec | awk '{print $2}'`
-if [ -z "$NAME" ];then
-        echo "Name not specified in spec file"
-        exit 1
-fi
-
 echo "-->> Creating widgets >>--"
 for app in $all_dirs; do
     check_blackdir $app
@@ -108,11 +129,9 @@ for app in $all_dirs; do
                cd $suite_dir
                continue
             fi
-           if [ -d "../../signing" ]; then
+           if [ -d "$BUILD_ROOT/signing" ]; then
                 echo "Start sign wgt ..."
-                cd ../../signing
-                ./sign-widget.sh --config default.conf ../$NAME/$app.wgt
-                cd -
+                $BUILD_ROOT/signing/sign-widget.sh --dist platform $BUILD_ROOT/$app.wgt
             else
                 echo "Not found signing folder."
                 rm -rf $suite_dir/*.wgt
@@ -130,88 +149,96 @@ if [ $pack_fail != 'FALSE' ]; then
     exit 1
 fi
 
-#######################################################################################################
-# parse spec required version
-VERSION=`grep "Version:" ${NAME}.spec | awk '{print $2}'`
-if [ -z "$VERSION" ];then
-        echo "Version not specified in spec file"
-        exit 1
+# build
+echo "build from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cd  $BUILD_ROOT
+./autogen && ./configure --prefix=/ && make && make install DESTDIR=$BUILD_DEST
+if [ $? -ne 0 ];then
+    echo "build fail,please check Makefile.am and cofigure.ac... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
+    exit 1
 fi
+find $BUILD_DEST -name "Makefile*" -delete
+}
 
-SRC_ROOT=${PWD}
-RPM_ROOT=/tmp/${NAME}_pack
-#tar.gz2
-ARCHIVE_TYPE=tar.gz
-#cjvf
-ARCHIVE_OPTION=czvf
-
-# check precondition
-check_precondition()
-{
-    which $1 > /dev/null 2>&1
-    if [ $? -ne 0 ]; then
-        echo "Error: no tool: $1"
-        exit 1
-    fi
+function create_apk(){
+echo "Sorry,apk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
 }
-check_precondition rpmbuild
-check_precondition gcc
-check_precondition make
 
+function create_xpk(){
+echo "Sorry,xpk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
 
-# clean
-echo "cleaning rpm workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf $RPM_ROOT
-
-# create workspace
-echo "create rpm workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-mkdir -p $RPM_ROOT/RPMS $RPM_ROOT/SRPMS $RPM_ROOT/SPECS $RPM_ROOT/SOURCES $RPM_ROOT/BUILD $RPM_ROOT/src_tmp/$NAME-$VERSION
-
-# prepare
-echo "prepare workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf *.rpm *.tar.bz2 *.tar.gz
-cp -a $SRC_ROOT/* $RPM_ROOT/src_tmp/$NAME-$VERSION
-# create Makefile in top src folder
-#cp $SRC_ROOT/top_Makefile $RPM_ROOT/src_tmp/$NAME-$VERSION/Makefile
-cp $PWD/${NAME}.spec $RPM_ROOT/SPECS
-cd $RPM_ROOT/src_tmp
-tar $ARCHIVE_OPTION $RPM_ROOT/SOURCES/$NAME-$VERSION.$ARCHIVE_TYPE $NAME-$VERSION
-cd -
+function create_crx(){
+echo "Sorry,crx is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
 
-# build
-echo "build from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-cd  $RPM_ROOT/SPECS
-rpmbuild -ba ${NAME}.spec --clean --define "_topdir $RPM_ROOT" --target=noarch
-cd -
-
-echo "copy from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-echo "get packages......"
-find $RPM_ROOT -name "$NAME*.rpm" | grep -v debuginfo | xargs -n1 -I {} mv {} $PWD -f
-
-if [[ $platform != "" && $platform != "default" ]]; then
-        cd $PWD
-        for file in `ls *.rpm`; do
-                new_name=`echo $file | sed "s/\.rpm/\.$platform\.rpm/g"`
-                mv $file $new_name
-        done
-        cd -
+## zip function ##
+function zip_for_wgt(){
+cd $BUILD_DEST
+# cp inst.sh script #
+rm -rf $BUILD_DEST/opt/$name/inst.sh.wgt
+cp -af $BUILD_ROOT/inst.sh.wgt $BUILD_DEST/opt/$name/inst.sh
+
+zip -Drq $BUILD_DEST/$name-$version.zip opt/
+if [ $? -ne 0 ];then
+    echo "Create zip package fail... >>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
+    exit 1
 fi
+}
 
-echo "get $NAME-$VERSION.$ARCHIVE_TYPE......"
-mv $RPM_ROOT/SOURCES/$NAME-$VERSION.$ARCHIVE_TYPE $PWD -f
+function zip_for_apk(){
+echo "Sorry,apk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+function zip_for_xpk(){
+echo "Sorry,xpk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+function zip_for_crx(){
+echo "Sorry,crx is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+## create wgt crx apk xpk and zip package ##
+case $type in
+    wgt) create_wgt
+         zip_for_wgt;;
+    apk) create_apk
+         zip_for_apk;;
+    xpk) create_xpk
+         zip_for_xpk;;
+    crx) create_crx
+         zip_for_crx;;
+esac
 
-# clean
-echo "cleaning workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf $RPM_ROOT
-rm -rf *.wgt
+
+# copy zip file
+echo "copy package from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cp -f $BUILD_DEST/$name-$version.zip $SRC_ROOT/$name-$version.zip
+
+# clean workspace
+clean_workspace
 
 # validate
 echo "checking result... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-if [ -z "`ls | grep "\.rpm"`" ] || [ -z "`ls | grep "\.$ARCHIVE_TYPE"`" ];then
-        echo "------------------------------ FAILED to build $NAME packages --------------------------"
-        exit 1
+cd $SRC_ROOT
+if [ -z "`ls | grep "\.zip"`" ];then
+    echo "------------------------------ FAILED to build $name packages --------------------------"
+    exit 1
 fi
 
-echo "------------------------------ Done to build $NAME packages --------------------------"
-ls *.rpm *.$ARCHIVE_TYPE 2>/dev/null
-##############################################################################
+echo "------------------------------ Done to build $name packages --------------------------"
+ls *.zip 2>/dev/null
index 03b403ccd01c01e831c62cc82059a6bcc50914b0..a00ddd2ec99df023e1fbb459311dc23204aa7a42 100644 (file)
@@ -30,5 +30,5 @@
 
 
 scripts_SCRIPTS = *
-scriptsdir = /opt/tct-stab-wrt-tests/scripts
+scriptsdir = $(prefix)/opt/tct-stab-wrt-tests/scripts
 EXTRA_DIST = $(scripts_SCRIPTS)
index 46c50908950ab4ed803a459ea4d1c00d1d323e26..55f000fcbc495d47fb834d73325ca70f15d15135 100644 (file)
@@ -1,34 +1,3 @@
-%define _unpackaged_files_terminate_build 0
-
-Summary: WRT stability tests
-Name: tct-stab-wrt-tests
-Version: 1.5.2
-Release: 1
-License: BSD
-Group: System/Libraries
-Source: %name-%version.tar.gz
-
-%description
-This is WRT stability test suite package
-
-
-%prep
-%setup -q
-
-%build
-./autogen
-./configure --prefix=/usr
-make
-
-%install
-rm -rf $RPM_BUILD_ROOT
-make install DESTDIR=$RPM_BUILD_ROOT
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-/opt/%name
-/usr/share/%name
-
-%changelog
+name=$(basename $(pwd))
+version="1.5.2"
+appname=$(echo $name|sed 's/-/_/g')
index 0e02ed184395385173bbcb765443d6adf3076625..780cafb44744d5911e83a21bac247dc7ca613d42 100644 (file)
@@ -27,7 +27,5 @@
 # Authors:
 #               Fan, Yugang <yugang.fan@intel.com>
 #
-testdefdir = $(datadir)/tct-ui01-wrt-tests
-dist_testdef_DATA = tests.xml
-docdir = /opt/tct-ui01-wrt-tests
-dist_doc_DATA = Changelog README *.wgt COPYING
+docdir = $(prefix)/opt/tct-ui01-wrt-tests
+dist_doc_DATA = Changelog README *.wgt COPYING tests.xml
diff --git a/tct-ui01-wrt-tests/inst.sh.wgt b/tct-ui01-wrt-tests/inst.sh.wgt
new file mode 100755 (executable)
index 0000000..4661715
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+wgt_installer="pkgcmd"
+NAME=$(basename $(cd $(dirname $0);pwd))
+
+#parse params
+USAGE="Usage: ./inst.sh [-i] [-u]
+  -i install wgt and config environment 
+  -u uninstall wgt and remove source file
+[-i] option was set as default."
+
+function installpkg(){
+    echo "No need to install $NAME.wgt ..."
+}
+
+function uninstallpkg(){
+### remove source file ###
+if [ -d /opt/usr/media/tct/opt/$NAME ];then
+    rm -rf /opt/usr/media/tct/opt/$NAME
+else
+    echo "Remove source file fail,please check if the source file exist: /opt/usr/media/tct/opt/$NAME ..."
+fi
+}
+
+case "$1" in
+    -h|--help) echo "$USAGE"
+               exit ;;
+    ""|-i) installpkg;;
+    -u) uninstallpkg;;
+    *) echo "Unknown option: $1"
+       echo "$USAGE"
+       exit ;;
+esac
index fc85c462131ef2d3f24568f3afe5f8af9989aa3b..4d66654d337f6e6742386a6556de9642e50677d6 100755 (executable)
@@ -1,44 +1,72 @@
 #!/bin/bash
-##
-# Copyright (c) 2012 Intel Corporation.
-#
-# Redistribution and use in source and binary forms, with or without modification,
-# are permitted provided that the following conditions are met:
-#
-# * Redistributions of works must retain the original copyright notice, this list
-#   of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the original copyright notice,
-#   this list of conditions and the following disclaimer in the documentation
-#   and/or other materials provided with the distribution.
-# * Neither the name of Intel Corporation nor the names of its contributors
-#   may be used to endorse or promote products derived from this work without
-#   specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT,
-# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# Authors:
-#               Fan, Yugang <yugang.fan@intel.com>
-#
-
-USAGE="Usage: ./pack.sh"
+source $(dirname $0)/$(basename $(pwd)).spec
+
+#parse params
+usage="Usage: ./pack.sh [-t <package type: wgt | apk | crx | xpk>]
+[-t wgt] option was set as default."
 
 if [[ $1 == "-h" || $1 == "--help" ]]; then
-    echo $USAGE
+    echo $usage
+    exit 1
+fi
+
+type="wgt"
+while getopts t: o
+do
+    case "$o" in
+    t) type=$OPTARG;;
+    *) echo $usage
+       exit 1;;
+    esac
+done
+
+if [[ $type == "wgt" || $type == "apk" || $type == "crx" || $type == "xpk" ]];then
+    echo "Create package with $type and raw source"
+else 
+    echo "Sorry,$type is not support... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+    echo "$usage"
+    exit 1
+fi
+
+if [[ -z $name || -z $version || -z $appname ]];then
+    echo "Package name or version not specified in spec"
+    exit 1
+fi
+
+SRC_ROOT=${PWD}
+BUILD_ROOT=/tmp/${name}_pack
+BUILD_DEST=/tmp/${name}
+
+# clean
+function clean_workspace(){
+echo "cleaning workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+rm -rf $BUILD_ROOT $BUILD_DEST
+}
+
+clean_workspace
+mkdir -p $BUILD_ROOT $BUILD_DEST
+
+# copy source code
+rm -rf *.rpm *.tar.bz2 *.tar.gz *.zip
+cp -arf $SRC_ROOT/* $BUILD_ROOT/
+
+# copy signing tool
+echo "copy signing tool... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cp -arf $SRC_ROOT/../tools/signing $BUILD_ROOT/signing
+if [ $? -ne 0 ];then
+    echo "No signing tool found in $SRC_ROOT/../tools.... >>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
     exit 1
 fi
 
+## function for create wgt apk xpk ##
+
+function create_wgt(){
+# create wgt
+cd $BUILD_ROOT
 pack_fail='FALSE'
 suite_dir=${PWD}
-all_dirs=`ls -l --time-style="long-iso" $suite_dir | grep '^d' | awk '{print $8}'`
+all_dirs=`ls -l --time-style="long-iso" $suite_dir | grep '^d' | awk '{print $8}'|grep -v signing`
 black_dirs=''
 signing_white_dirs=''
 
@@ -74,13 +102,6 @@ function check_signing_whitedir()
   return 0
 }
 
-# parse spec required name
-NAME=`grep "Name:" *.spec | awk '{print $2}'`
-if [ -z "$NAME" ];then
-        echo "Name not specified in spec file"
-        exit 1
-fi
-
 echo "-->> Creating widgets >>--"
 for app in $all_dirs; do
     check_blackdir $app
@@ -108,11 +129,9 @@ for app in $all_dirs; do
                cd $suite_dir
                continue
             fi
-           if [ -d "../../signing" ]; then
+           if [ -d "$BUILD_ROOT/signing" ]; then
                 echo "Start sign wgt ..."
-                cd ../../signing
-                ./sign-widget.sh --config default.conf ../$NAME/$app.wgt
-                cd -
+                $BUILD_ROOT/signing/sign-widget.sh --dist platform $BUILD_ROOT/$app.wgt
             else
                 echo "Not found signing folder."
                 rm -rf $suite_dir/*.wgt
@@ -130,88 +149,96 @@ if [ $pack_fail != 'FALSE' ]; then
     exit 1
 fi
 
-#######################################################################################################
-# parse spec required version
-VERSION=`grep "Version:" ${NAME}.spec | awk '{print $2}'`
-if [ -z "$VERSION" ];then
-        echo "Version not specified in spec file"
-        exit 1
+# build
+echo "build from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cd  $BUILD_ROOT
+./autogen && ./configure --prefix=/ && make && make install DESTDIR=$BUILD_DEST
+if [ $? -ne 0 ];then
+    echo "build fail,please check Makefile.am and cofigure.ac... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
+    exit 1
 fi
+find $BUILD_DEST -name "Makefile*" -delete
+}
 
-SRC_ROOT=${PWD}
-RPM_ROOT=/tmp/${NAME}_pack
-#tar.gz2
-ARCHIVE_TYPE=tar.gz
-#cjvf
-ARCHIVE_OPTION=czvf
-
-# check precondition
-check_precondition()
-{
-    which $1 > /dev/null 2>&1
-    if [ $? -ne 0 ]; then
-        echo "Error: no tool: $1"
-        exit 1
-    fi
+function create_apk(){
+echo "Sorry,apk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
 }
-check_precondition rpmbuild
-check_precondition gcc
-check_precondition make
 
+function create_xpk(){
+echo "Sorry,xpk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
 
-# clean
-echo "cleaning rpm workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf $RPM_ROOT
-
-# create workspace
-echo "create rpm workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-mkdir -p $RPM_ROOT/RPMS $RPM_ROOT/SRPMS $RPM_ROOT/SPECS $RPM_ROOT/SOURCES $RPM_ROOT/BUILD $RPM_ROOT/src_tmp/$NAME-$VERSION
-
-# prepare
-echo "prepare workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf *.rpm *.tar.bz2 *.tar.gz
-cp -a $SRC_ROOT/* $RPM_ROOT/src_tmp/$NAME-$VERSION
-# create Makefile in top src folder
-#cp $SRC_ROOT/top_Makefile $RPM_ROOT/src_tmp/$NAME-$VERSION/Makefile
-cp $PWD/${NAME}.spec $RPM_ROOT/SPECS
-cd $RPM_ROOT/src_tmp
-tar $ARCHIVE_OPTION $RPM_ROOT/SOURCES/$NAME-$VERSION.$ARCHIVE_TYPE $NAME-$VERSION
-cd -
+function create_crx(){
+echo "Sorry,crx is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
 
-# build
-echo "build from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-cd  $RPM_ROOT/SPECS
-rpmbuild -ba ${NAME}.spec --clean --define "_topdir $RPM_ROOT" --target=noarch
-cd -
-
-echo "copy from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-echo "get packages......"
-find $RPM_ROOT -name "$NAME*.rpm" | grep -v debuginfo | xargs -n1 -I {} mv {} $PWD -f
-
-if [[ $platform != "" && $platform != "default" ]]; then
-        cd $PWD
-        for file in `ls *.rpm`; do
-                new_name=`echo $file | sed "s/\.rpm/\.$platform\.rpm/g"`
-                mv $file $new_name
-        done
-        cd -
+## zip function ##
+function zip_for_wgt(){
+cd $BUILD_DEST
+# cp inst.sh script #
+rm -rf $BUILD_DEST/opt/$name/inst.sh.wgt
+cp -af $BUILD_ROOT/inst.sh.wgt $BUILD_DEST/opt/$name/inst.sh
+
+zip -Drq $BUILD_DEST/$name-$version.zip opt/
+if [ $? -ne 0 ];then
+    echo "Create zip package fail... >>>>>>>>>>>>>>>>>>>>>>>>>"
+    clean_workspace
+    exit 1
 fi
+}
 
-echo "get $NAME-$VERSION.$ARCHIVE_TYPE......"
-mv $RPM_ROOT/SOURCES/$NAME-$VERSION.$ARCHIVE_TYPE $PWD -f
+function zip_for_apk(){
+echo "Sorry,apk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+function zip_for_xpk(){
+echo "Sorry,xpk is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+function zip_for_crx(){
+echo "Sorry,crx is not support yet... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+clean_workspace
+exit 1
+}
+
+## create wgt crx apk xpk and zip package ##
+case $type in
+    wgt) create_wgt
+         zip_for_wgt;;
+    apk) create_apk
+         zip_for_apk;;
+    xpk) create_xpk
+         zip_for_xpk;;
+    crx) create_crx
+         zip_for_crx;;
+esac
 
-# clean
-echo "cleaning workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-rm -rf $RPM_ROOT
-rm -rf *.wgt
+
+# copy zip file
+echo "copy package from workspace... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+cp -f $BUILD_DEST/$name-$version.zip $SRC_ROOT/$name-$version.zip
+
+# clean workspace
+clean_workspace
 
 # validate
 echo "checking result... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-if [ -z "`ls | grep "\.rpm"`" ] || [ -z "`ls | grep "\.$ARCHIVE_TYPE"`" ];then
-        echo "------------------------------ FAILED to build $NAME packages --------------------------"
-        exit 1
+cd $SRC_ROOT
+if [ -z "`ls | grep "\.zip"`" ];then
+    echo "------------------------------ FAILED to build $name packages --------------------------"
+    exit 1
 fi
 
-echo "------------------------------ Done to build $NAME packages --------------------------"
-ls *.rpm *.$ARCHIVE_TYPE 2>/dev/null
-##############################################################################
+echo "------------------------------ Done to build $name packages --------------------------"
+ls *.zip 2>/dev/null
index 8ba36aaa96abbc5b8f4e43dde6fa343bc4bcb774..55f000fcbc495d47fb834d73325ca70f15d15135 100644 (file)
@@ -1,34 +1,3 @@
-%define _unpackaged_files_terminate_build 0
-
-Summary: WRT runtime ui tests
-Name: tct-ui01-wrt-tests
-Version: 1.5.2
-Release: 1
-License: BSD
-Group: System/Libraries
-Source: %name-%version.tar.gz
-
-%description
-This is WRT runtime ui test suite package
-
-
-%prep
-%setup -q
-
-%build
-./autogen
-./configure --prefix=/usr
-make
-
-%install
-rm -rf $RPM_BUILD_ROOT
-make install DESTDIR=$RPM_BUILD_ROOT
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-/opt/%name
-/usr/share/%name
-
-%changelog
+name=$(basename $(pwd))
+version="1.5.2"
+appname=$(echo $name|sed 's/-/_/g')