--- /dev/null
+#!/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
# 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
--- /dev/null
+#!/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
#!/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=''
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
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
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
resources_SCRIPTS = *
-resourcesdir = /opt/tct-appwgt-wrt-tests/resources
+resourcesdir = $(prefix)/opt/tct-appwgt-wrt-tests/resources
EXTRA_DIST = $(resources_SCRIPTS) LICENSE.Flora
scripts_SCRIPTS = *
-scriptsdir = /opt/tct-appwgt-wrt-tests/scripts
+scriptsdir = $(prefix)/opt/tct-appwgt-wrt-tests/scripts
EXTRA_DIST = $(scripts_SCRIPTS)
-%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')
# 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
--- /dev/null
+#!/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
#!/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=''
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
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
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
-%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')
# 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
--- /dev/null
+#!/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
#!/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=''
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
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
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
scripts_SCRIPTS = *
-scriptsdir = /opt/tct-ext02-wrt-tests/scripts
+scriptsdir = $(prefix)/opt/tct-ext02-wrt-tests/scripts
EXTRA_DIST = $(scripts_SCRIPTS)
support_SCRIPTS = *
-supportdir = /opt/tct-ext02-wrt-tests/support
+supportdir = $(prefix)/opt/tct-ext02-wrt-tests/support
EXTRA_DIST = $(support_SCRIPTS)
-%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')
SUBDIRS = support
w3c_SCRIPTS = *
-w3cdir = /opt/tct-ext02-wrt-tests/w3c
+w3cdir = $(prefix)/opt/tct-ext02-wrt-tests/w3c
EXTRA_DIST = $(w3c_SCRIPTS)
w3csupport_SCRIPTS = *
-w3csupportdir = /opt/tct-ext02-wrt-tests/w3c/support
+w3csupportdir = $(prefix)/opt/tct-ext02-wrt-tests/w3c/support
EXTRA_DIST = $(w3csupport_SCRIPTS)
# 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
--- /dev/null
+#!/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
#!/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=''
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
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
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
dist_resources_DATA = *.wgt
-resourcesdir= /opt/tct-pm-wrt-tests/
+resourcesdir= $(prefix)/opt/tct-pm-wrt-tests/
scripts_SCRIPTS = *
-scriptsdir = /opt/tct-pm-wrt-tests/scripts
+scriptsdir = $(prefix)/opt/tct-pm-wrt-tests/scripts
EXTRA_DIST = $(scripts_SCRIPTS)
-%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')
# 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
--- /dev/null
+#!/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
#!/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=''
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
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
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
-%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')
# 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
--- /dev/null
+#!/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
#!/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=''
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
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
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
scripts_SCRIPTS = *
-scriptsdir = /opt/tct-rt02-wrt-tests/scripts
+scriptsdir = $(prefix)/opt/tct-rt02-wrt-tests/scripts
EXTRA_DIST = $(scripts_SCRIPTS)
-%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')
# 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
--- /dev/null
+#!/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
#!/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=''
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
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
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
-%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')
# 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
--- /dev/null
+#!/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
#!/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=''
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
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
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
spscripts_SCRIPTS = *.sh
-spscriptsdir = /opt/tct-sp02-wrt-tests/scripts
+spscriptsdir = $(prefix)/opt/tct-sp02-wrt-tests/scripts
EXTRA_DIST = $(spscripts_SCRIPTS)
-%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')
# 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
--- /dev/null
+#!/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
#!/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=''
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
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
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
scripts_SCRIPTS = *
-scriptsdir = /opt/tct-stab-wrt-tests/scripts
+scriptsdir = $(prefix)/opt/tct-stab-wrt-tests/scripts
EXTRA_DIST = $(scripts_SCRIPTS)
-%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')
# 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
--- /dev/null
+#!/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
#!/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=''
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
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
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
-%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')