summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/bitbake38
-rwxr-xr-xscripts/contrib/bbvars.py186
-rwxr-xr-xscripts/poky-env-internal106
-rwxr-xr-xscripts/poky-extract-sdk5
-rwxr-xr-xscripts/poky-qemu25
-rwxr-xr-xscripts/poky-setup-builddir113
-rwxr-xr-xscripts/poky-setup-rpmrepo89
-rw-r--r--scripts/qemuimage-testlib127
-rwxr-xr-xscripts/qemuimage-tests/sanity/compiler52
-rwxr-xr-xscripts/qemuimage-tests/sanity/connman52
-rwxr-xr-xscripts/qemuimage-tests/sanity/dmesg2
-rwxr-xr-xscripts/qemuimage-tests/sanity/rpm_query52
-rwxr-xr-xscripts/qemuimage-tests/sanity/scp2
-rwxr-xr-xscripts/qemuimage-tests/sanity/shutdown8
-rwxr-xr-xscripts/qemuimage-tests/sanity/ssh2
-rwxr-xr-xscripts/qemuimage-tests/sanity/zypper_help52
-rwxr-xr-xscripts/qemuimage-tests/sanity/zypper_search52
-rw-r--r--scripts/qemuimage-tests/scenario/qemuarm/poky-image-lsb4
-rw-r--r--scripts/qemuimage-tests/scenario/qemuarm/poky-image-sato5
-rw-r--r--scripts/qemuimage-tests/scenario/qemuarm/poky-image-sdk6
-rw-r--r--scripts/qemuimage-tests/scenario/qemumips/poky-image-lsb4
-rw-r--r--scripts/qemuimage-tests/scenario/qemumips/poky-image-sato5
-rw-r--r--scripts/qemuimage-tests/scenario/qemumips/poky-image-sdk6
-rw-r--r--scripts/qemuimage-tests/scenario/qemuppc/poky-image-lsb4
-rw-r--r--scripts/qemuimage-tests/scenario/qemuppc/poky-image-sato5
-rw-r--r--scripts/qemuimage-tests/scenario/qemuppc/poky-image-sdk6
-rw-r--r--scripts/qemuimage-tests/scenario/qemux86-64/poky-image-lsb4
-rw-r--r--scripts/qemuimage-tests/scenario/qemux86-64/poky-image-sato5
-rw-r--r--scripts/qemuimage-tests/scenario/qemux86-64/poky-image-sdk6
-rw-r--r--scripts/qemuimage-tests/scenario/qemux86/poky-image-lsb4
-rw-r--r--scripts/qemuimage-tests/scenario/qemux86/poky-image-sato5
-rw-r--r--scripts/qemuimage-tests/scenario/qemux86/poky-image-sdk6
-rw-r--r--scripts/qemuimage-tests/tools/compiler_test.sh137
-rw-r--r--scripts/qemuimage-tests/tools/connman_test.sh55
-rw-r--r--scripts/qemuimage-tests/tools/rpm_test.sh45
-rw-r--r--scripts/qemuimage-tests/tools/zypper_test.sh45
-rwxr-xr-xscripts/rpm2cpio.sh53
-rwxr-xr-xscripts/send-pull-request99
38 files changed, 1305 insertions, 167 deletions
diff --git a/scripts/bitbake b/scripts/bitbake
index 2c03314e0..f40bd2826 100755
--- a/scripts/bitbake
+++ b/scripts/bitbake
@@ -1,9 +1,33 @@
#!/bin/sh
+NO_BUILD_OPTS="--version -h --help -p --parse-only -s --show-versions -e --environment"
+needpseudo="1"
+for opt in $@; do
+for key in $NO_BUILD_OPTS; do
+ if [ $opt = $key ]
+ then
+ needpseudo="0"
+ break
+ fi
+done
+[ $needpseudo = "0" ] && break
+done
+
+buildpseudo="1"
+if [ $needpseudo = "1" ] && [ -e "$BUILDDIR/pseudodone" ]; then
+ PSEUDOBINDIR=`cat $BUILDDIR/pseudodone`
+ if [ -e "$PSEUDOBINDIR/pseudo" ]; then
+ buildpseudo="0"
+ fi
+fi
+if [ $needpseudo = "0" ]; then
+ buildpseudo="0"
+fi
+
OLDPATH=$PATH
export PATH=`echo $PATH | sed s#[^:]*/scripts:##`
-if [ ! -e "$BUILDDIR/pseudodone" ]; then
- echo "Pseudo has not been built, building this first before the main build"
- bitbake pseudo-native
+if [ $buildpseudo = "1" ]; then
+ echo "Pseudo is not present but is required, building this first before the main build"
+ bitbake pseudo-native -c populate_sysroot
ret=$?
if [ "$ret" != "0" ]; then
exit 1
@@ -19,7 +43,11 @@ if [ ! -e "$BUILDDIR/pseudodone" ]; then
fi
BITBAKE=`which bitbake`
export PATH=$OLDPATH
-PSEUDOBINDIR=`cat $BUILDDIR/pseudodone`
-PSEUDO_BINDIR=$PSEUDOBINDIR PSEUDO_LIBDIR=$PSEUDOBINDIR/../lib/pseudo/lib PSEUDO_PREFIX=$PSEUDOBINDIR/../../ PSEUDO_DISABLED=1 $PSEUDOBINDIR/pseudo $BITBAKE $@
+if [ $needpseudo = "1" ]; then
+ PSEUDOBINDIR=`cat $BUILDDIR/pseudodone`
+ PSEUDO_BINDIR=$PSEUDOBINDIR PSEUDO_LIBDIR=$PSEUDOBINDIR/../lib/pseudo/lib PSEUDO_PREFIX=$PSEUDOBINDIR/../../ PSEUDO_DISABLED=1 $PSEUDOBINDIR/pseudo $BITBAKE $@
+else
+ $BITBAKE $@
+fi
ret=$?
exit $ret
diff --git a/scripts/contrib/bbvars.py b/scripts/contrib/bbvars.py
new file mode 100755
index 000000000..0896d6444
--- /dev/null
+++ b/scripts/contrib/bbvars.py
@@ -0,0 +1,186 @@
+#!/usr/bin/env python
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright (C) Darren Hart <dvhart@linux.intel.com>, 2010
+
+
+import sys
+import getopt
+import os
+import os.path
+import re
+
+def usage():
+ print 'Usage: %s -d FILENAME [-d FILENAME]* -m METADIR [-m MATADIR]*' % os.path.basename(sys.argv[0])
+ print ' -d FILENAME documentation file to search'
+ print ' -h, --help display this help and exit'
+ print ' -m METADIR meta directory to search for recipes'
+ print ' -t FILENAME documentation config file (for doc tags)'
+ print ' -T Only display variables with doc tags (requires -t)'
+
+def recipe_bbvars(recipe):
+ ''' Return a unique set of every bbvar encountered in the recipe '''
+ prog = re.compile("[A-Z_]+")
+ vset = set()
+ try:
+ r = open(recipe)
+ except IOError as (errno, strerror):
+ print 'WARNING: Failed to open recipe ', recipe
+ print strerror
+
+ for line in r:
+ # Strip any comments from the line
+ line = line.rsplit('#')[0]
+ vset = vset.union(set(prog.findall(line)))
+ r.close()
+
+ bbvars = {}
+ for v in vset:
+ bbvars[v] = 1
+
+ return bbvars
+
+def collect_bbvars(metadir):
+ ''' Walk the metadir and collect the bbvars from each recipe found '''
+ bbvars = {}
+ for root,dirs,files in os.walk(metadir):
+ for name in files:
+ if name.find(".bb") >= 0:
+ for key in recipe_bbvars(os.path.join(root,name)).iterkeys():
+ if bbvars.has_key(key):
+ bbvars[key] = bbvars[key] + 1
+ else:
+ bbvars[key] = 1
+ return bbvars
+
+def bbvar_is_documented(var, docfiles):
+ prog = re.compile(".*($|[^A-Z_])%s([^A-Z_]|$)" % (var))
+ for doc in docfiles:
+ try:
+ f = open(doc)
+ except IOError as (errno, strerror):
+ print 'WARNING: Failed to open doc ', doc
+ print strerror
+ for line in f:
+ if prog.match(line):
+ return True
+ f.close()
+ return False
+
+def bbvar_doctag(var, docconf):
+ prog = re.compile('^%s\[doc\] *= *"(.*)"' % (var))
+ if docconf == "":
+ return "?"
+
+ try:
+ f = open(docconf)
+ except IOError as (errno, strerror):
+ return strerror
+
+ for line in f:
+ m = prog.search(line)
+ if m:
+ return m.group(1)
+
+ f.close()
+ return ""
+
+def main():
+ docfiles = []
+ metadirs = []
+ bbvars = {}
+ undocumented = []
+ docconf = ""
+ onlydoctags = False
+
+ # Collect and validate input
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], "d:hm:t:T", ["help"])
+ except getopt.GetoptError, err:
+ print '%s' % str(err)
+ usage()
+ sys.exit(2)
+
+ for o, a in opts:
+ if o in ('-h', '--help'):
+ usage()
+ sys.exit(0)
+ elif o == '-d':
+ if os.path.isfile(a):
+ docfiles.append(a)
+ else:
+ print 'ERROR: documentation file %s is not a regular file' % (a)
+ sys.exit(3)
+ elif o == '-m':
+ if os.path.isdir(a):
+ metadirs.append(a)
+ else:
+ print 'ERROR: meta directory %s is not a directory' % (a)
+ sys.exit(4)
+ elif o == "-t":
+ if os.path.isfile(a):
+ docconf = a
+ elif o == "-T":
+ onlydoctags = True
+ else:
+ assert False, "unhandled option"
+
+ if len(docfiles) == 0:
+ print 'ERROR: no docfile specified'
+ usage()
+ sys.exit(5)
+
+ if len(metadirs) == 0:
+ print 'ERROR: no metadir specified'
+ usage()
+ sys.exit(6)
+
+ if onlydoctags and docconf == "":
+ print 'ERROR: no docconf specified'
+ usage()
+ sys.exit(7)
+
+ # Collect all the variable names from the recipes in the metadirs
+ for m in metadirs:
+ for key,cnt in collect_bbvars(m).iteritems():
+ if bbvars.has_key(key):
+ bbvars[key] = bbvars[key] + cnt
+ else:
+ bbvars[key] = cnt
+
+ # Check each var for documentation
+ varlen = 0
+ for v in bbvars.iterkeys():
+ if len(v) > varlen:
+ varlen = len(v)
+ if not bbvar_is_documented(v, docfiles):
+ undocumented.append(v)
+ undocumented.sort()
+ varlen = varlen + 1
+
+ # Report all undocumented variables
+ print 'Found %d undocumented bb variables (out of %d):' % (len(undocumented), len(bbvars))
+ header = '%s%s%s' % (str("VARIABLE").ljust(varlen), str("COUNT").ljust(6), str("DOCTAG").ljust(7))
+ print header
+ print str("").ljust(len(header), '=')
+ for v in undocumented:
+ doctag = bbvar_doctag(v, docconf)
+ if not onlydoctags or not doctag == "":
+ print '%s%s%s' % (v.ljust(varlen), str(bbvars[v]).ljust(6), doctag)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/scripts/poky-env-internal b/scripts/poky-env-internal
index 1557f9ddb..80b7a125d 100755
--- a/scripts/poky-env-internal
+++ b/scripts/poky-env-internal
@@ -18,9 +18,11 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-# scripts/ is a sub-directory of OEROOT, we use readlink to get the full path
-SCRIPTPATH=`readlink -f "$BASH_SOURCE"`
-OEROOT="`dirname $SCRIPTPATH`/../"
+# It is assumed OEROOT is already defined when this is called
+if [ -z "$OEROOT" ]; then
+ echo >&2 "Error: OEROOT is not defined!"
+ return
+fi
if [ "x$BDIR" = "x" ]; then
if [ "x$1" = "x" ]; then
@@ -29,116 +31,28 @@ if [ "x$BDIR" = "x" ]; then
BDIR=`readlink -f "$1"`
fi
fi
-if [[ "$BDIR" = /* ]] ; then
+if expr "$BDIR" : '/.*' > /dev/null ; then
BUILDDIR="$BDIR"
else
BUILDDIR="`pwd`/$BDIR"
fi
unset BDIR
-mkdir -p $BUILDDIR/conf
-if ! (test -w "$BUILDDIR"); then
- echo >&2 "Error: Cannot write to $BUILDDIR, perhaps try sourcing with a writable path? i.e. . poky-init-build-env ~/my-build"
- return
-fi
-
BITBAKEDIR="$OEROOT/bitbake$BBEXTRA/"
-PATH="${OEROOT}/scripts:$BITBAKEDIR/bin/:$PATH"
-
-# Remove any symlinks from paths
BITBAKEDIR=`readlink -f "$BITBAKEDIR"`
BUILDDIR=`readlink -f "$BUILDDIR"`
-OEROOT=`readlink -f "$OEROOT"`
-
-cd "$BUILDDIR"
-if ! (test -d "$BITBAKEDIR" && test -d "$BUILDDIR"); then
- echo >&2 "Error: Not all directories exist! Did you run this script in poky directory?"
+if ! (test -d "$BITBAKEDIR"); then
+ echo >&2 "Error: The bitbake directory ($BITBAKEDIR) does not exist! Did you source the script in the poky directory?"
return
fi
-#
-# $POKYCONF can point to a directory for the template local.conf & bblayers.conf
-#
-if [ "x" != "x$POKYCONF" ]; then
- if ! (test -d "$POKYCONF"); then
- # Allow POKYCONF=meta-xyz/conf as a shortcut
- if [ -d "$OEROOT/$POKYCONF" ]; then
- POKYCONF="$OEROOT/$POKYCONF"
- fi
- if ! (test -d "$POKYCONF"); then
- echo >&2 "Error: '$POKYCONF' must be a directory containing local.conf & bblayers.conf"
- return
- fi
- fi
- POKYLAYERCONF="$POKYCONF/bblayers.conf"
- POKYLOCALCONF="$POKYCONF/local.conf"
-fi
-
-if [ "x" = "x$POKYLOCALCONF" ]; then
- POKYLOCALCONF="$OEROOT/meta/conf/local.conf.sample"
-fi
-if ! (test -r "$BUILDDIR/conf/local.conf"); then
-cat <<EOM
-You had no conf/local.conf file. Poky has created this configuration file for
-you with some default values. You may wish to edit it to use a different MACHINE
-(target hardware) or enable parallel build options to take advantage of multiple
-cores for example. See the file for more information as common configuration
-options are commented.
-
-Also, for more information see the Poky handbook:
-http://pokylinux.org/doc/poky-handbook.html
-
-EOM
- cp -f $POKYLOCALCONF $BUILDDIR/conf/local.conf
-fi
-
-if [ "x" = "x$POKYLAYERCONF" ]; then
- POKYLAYERCONF="$OEROOT/meta/conf/bblayers.conf.sample"
-fi
-if ! (test -r "$BUILDDIR/conf/bblayers.conf"); then
-cat <<EOM
-You had no conf/bblayers.conf file. Poky has created this configuration file for
-you with some default values. To add additional metadata layers into your
-configuration please add entries to this file.
-
-For more information see the Poky handbook:
- http://pokylinux.org/doc/poky-handbook.html
-
-EOM
-
- # Put the abosolute path to the layers in bblayers.conf so we can run
- # bitbake without the init script after the first run
- sed "s|##POKYBASE##|$OEROOT|g" $POKYLAYERCONF > $BUILDDIR/conf/bblayers.conf
-fi
-
-# Prevent disturbing a new GIT clone in same console
-unset POKYLOCALCONF
-unset POKYLAYERCONF
+PATH="${OEROOT}/scripts:$BITBAKEDIR/bin/:$PATH"
unset BITBAKEDIR
-unset OEROOT
# Used by the poky-qemu script
export BUILDDIR
export PATH
-# Stop multi byte characters breaking the patcher stuff - This is for Redhat / Fedora people really
-export LANG=C
-export BB_ENV_EXTRAWHITE="MACHINE DISTRO POKYMODE POKYLIBC http_proxy ftp_proxy https_proxy all_proxy ALL_PROXY no_proxy SSH_AGENT_PID SSH_AUTH_SOCK BB_SRCREV_POLICY SDKMACHINE BB_NUMBER_THREADS GIT_PROXY_COMMAND PSEUDO_DISABLED"
-
-cat <<EOM
-
-### Shell environment set up for Poky builds. ###
-
-You can now run 'bitbake <target>'
-
-Common targets are:
- poky-image-minimal
- poky-image-sato
- meta-toolchain
- meta-toolchain-sdk
-
-You can also run generated qemu images with a command like 'poky-qemu qemux86'
-
-EOM
+export BB_ENV_EXTRAWHITE="MACHINE DISTRO POKYMODE POKYLIBC http_proxy ftp_proxy https_proxy all_proxy ALL_PROXY no_proxy SSH_AGENT_PID SSH_AUTH_SOCK BB_SRCREV_POLICY SDKMACHINE BB_NUMBER_THREADS GIT_PROXY_COMMAND PSEUDO_DISABLED"
diff --git a/scripts/poky-extract-sdk b/scripts/poky-extract-sdk
index 977adde1a..a36d79d31 100755
--- a/scripts/poky-extract-sdk
+++ b/scripts/poky-extract-sdk
@@ -47,6 +47,11 @@ if [ ! -e "$ROOTFS_TARBALL" ]; then
exit 1
fi
+# Convert SDK_ROOTFS_DIR to a full pathname
+if [[ ${SDK_ROOTFS_DIR:0:1} != "/" ]]; then
+ SDK_ROOTFS_DIR=$(pwd)/$SDK_ROOTFS_DIR
+fi
+
TAR_OPTS=""
if [[ "$ROOTFS_TARBALL" =~ tar\.bz2$ ]]; then
TAR_OPTS="-xjf"
diff --git a/scripts/poky-qemu b/scripts/poky-qemu
index 313248ff4..b19a89dda 100755
--- a/scripts/poky-qemu
+++ b/scripts/poky-qemu
@@ -29,7 +29,7 @@ usage() {
echo " Additional QEMU command-line options can be passed with:"
echo " nographic - disables video console"
echo " serial - enables a serial console on /dev/ttyS0"
- echo " kvm - enables kvm"
+ echo " kvm - enables KVM when running qemux86/qemux86-64, VT capable CPU required"
echo " \"<extra-qemu-options>\" - enables extra qemu options, excluding serial and kvm"
echo ""
echo "Examples:"
@@ -171,10 +171,29 @@ while [ $i -le $# ]; do
i=$((i + 1))
done
+POKY_KVM_WIKI="https://wiki.yoctoproject.org/wiki/How_to_enable_KVM_for_Poky_qemu"
# Detect KVM configuration
-if [[ "x$KVM_ENABLED" == "xyes" && ! -z "$KVM_CAPABLE" ]]; then
- if [[ "x$MACHINE" == "xqemux86" || "x$MACHINE" == "xqemux86-64" ]]; then
+if [[ "x$KVM_ENABLED" == "xyes" ]]; then
+ if [[ -z "$KVM_CAPABLE" ]]; then
+ echo "You are tring to enable KVM on cpu without VT support. Remove kvm from the command-line, or refer";
+ echo "$POKY_KVM_WIKI";
+ exit 1;
+ fi
+ if [[ "x$MACHINE" != "xqemux86" && "x$MACHINE" != "xqemux86-64" ]]; then
+ echo "KVM only support x86 & x86-64. Remove kvm from the command-line";
+ exit 1;
+ fi
+ if [ ! -e /dev/kvm ]; then
+ echo "Missing KVM device. Have you inserted kvm modules? Pls. refer";
+ echo "$POKY_KVM_WIKI";
+ exit 1;
+ fi
+ if 9<>/dev/kvm ; then
SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm"
+ else
+ echo "You have no rights on /dev/kvm. Pls. change the owndership as described at";
+ echo "$POKY_KVM_WIKI";
+ exit 1;
fi
fi
diff --git a/scripts/poky-setup-builddir b/scripts/poky-setup-builddir
new file mode 100755
index 000000000..7a1452f7c
--- /dev/null
+++ b/scripts/poky-setup-builddir
@@ -0,0 +1,113 @@
+#!/bin/sh
+
+# Poky Build Enviroment Setup Script
+#
+# Copyright (C) 2006-2007 OpenedHand Ltd.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+if [ -z "$BUILDDIR" ]; then
+ echo >&2 "Error: The build directory (BUILDDIR) must be set!"
+ exit 1
+fi
+
+mkdir -p $BUILDDIR/conf
+
+if ! (test -d "$BUILDDIR"); then
+ echo >&2 "Error: The builddir ($BUILDDIR) does not exist!"
+ exit 1
+fi
+
+if ! (test -w "$BUILDDIR"); then
+ echo >&2 "Error: Cannot write to $BUILDDIR, perhaps try sourcing with a writable path? i.e. . poky-init-build-env ~/my-build"
+ exit 1
+fi
+
+cd "$BUILDDIR"
+
+#
+# $POKYCONF can point to a directory for the template local.conf & bblayers.conf
+#
+if [ "x" != "x$POKYCONF" ]; then
+ if ! (test -d "$POKYCONF"); then
+ # Allow POKYCONF=meta-xyz/conf as a shortcut
+ if [ -d "$OEROOT/$POKYCONF" ]; then
+ POKYCONF="$OEROOT/$POKYCONF"
+ fi
+ if ! (test -d "$POKYCONF"); then
+ echo >&2 "Error: '$POKYCONF' must be a directory containing local.conf & bblayers.conf"
+ return
+ fi
+ fi
+ POKYLAYERCONF="$POKYCONF/bblayers.conf"
+ POKYLOCALCONF="$POKYCONF/local.conf"
+fi
+
+if [ "x" = "x$POKYLOCALCONF" ]; then
+ POKYLOCALCONF="$OEROOT/meta/conf/local.conf.sample"
+fi
+if ! (test -r "$BUILDDIR/conf/local.conf"); then
+cat <<EOM
+You had no conf/local.conf file. Poky has created this configuration file for
+you with some default values. You may wish to edit it to use a different MACHINE
+(target hardware) or enable parallel build options to take advantage of multiple
+cores for example. See the file for more information as common configuration
+options are commented.
+
+Also, for more information see the Poky handbook:
+http://pokylinux.org/doc/poky-handbook.html
+
+EOM
+ cp -f $POKYLOCALCONF $BUILDDIR/conf/local.conf
+fi
+
+if [ "x" = "x$POKYLAYERCONF" ]; then
+ POKYLAYERCONF="$OEROOT/meta/conf/bblayers.conf.sample"
+fi
+if ! (test -r "$BUILDDIR/conf/bblayers.conf"); then
+cat <<EOM
+You had no conf/bblayers.conf file. Poky has created this configuration file for
+you with some default values. To add additional metadata layers into your
+configuration please add entries to this file.
+
+For more information see the Poky handbook:
+ http://pokylinux.org/doc/poky-handbook.html
+
+EOM
+
+ # Put the abosolute path to the layers in bblayers.conf so we can run
+ # bitbake without the init script after the first run
+ sed "s|##POKYBASE##|$OEROOT|g" $POKYLAYERCONF > $BUILDDIR/conf/bblayers.conf
+fi
+
+# Prevent disturbing a new GIT clone in same console
+unset POKYLOCALCONF
+unset POKYLAYERCONF
+
+cat <<EOM
+
+### Shell environment set up for Poky builds. ###
+
+You can now run 'bitbake <target>'
+
+Common targets are:
+ poky-image-minimal
+ poky-image-sato
+ meta-toolchain
+ meta-toolchain-sdk
+
+You can also run generated qemu images with a command like 'poky-qemu qemux86'
+
+EOM
diff --git a/scripts/poky-setup-rpmrepo b/scripts/poky-setup-rpmrepo
new file mode 100755
index 000000000..42a9b6aed
--- /dev/null
+++ b/scripts/poky-setup-rpmrepo
@@ -0,0 +1,89 @@
+#!/bin/bash
+#
+# This utility setup the necessary metadata for an rpm repo
+#
+# Copyright (c) 2011 Intel Corp.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+function usage() {
+ echo "Usage: $0 <rpm-dir>"
+ echo " <rpm-dir>: default is $TPMDIR/deploy/rpm"
+}
+
+if [ $# -gt 1 ]; then
+ usage
+ exit 1
+fi
+
+setup_tmpdir() {
+ if [ -z "$TMPDIR" ]; then
+ if [ "x$BUILDDIR" = "x" -o ! -d "$BUILDDIR/tmp" ]; then
+ # BUILDDIR unset, try and get TMPDIR from bitbake
+ type -P bitbake &>/dev/null || {
+ echo "In order for this script to dynamically infer paths";
+ echo "to kernels or filesystem images, you either need";
+ echo "bitbake in your PATH or to source poky-init-build-env";
+ echo "before running this script" >&2;
+ exit 1; }
+
+ # We have bitbake in PATH, get TMPDIR from bitbake
+ TMPDIR=`bitbake -e | grep TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2`
+ else
+ TMPDIR=$BUILDDIR/tmp
+ fi
+ fi
+}
+
+setup_sysroot() {
+ # Toolchain installs set up $POKY_NATIVE_SYSROOT in their
+ # environment script. If that variable isn't set, we're
+ # either in an in-tree poky scenario or the environment
+ # script wasn't source'd.
+ if [ -z "$POKY_NATIVE_SYSROOT" ]; then
+ setup_tmpdir
+ BUILD_ARCH=`uname -m`
+ BUILD_OS=`uname | tr '[A-Z]' '[a-z]'`
+ BUILD_SYS="$BUILD_ARCH-$BUILD_OS"
+
+ POKY_NATIVE_SYSROOT=$TMPDIR/sysroots/$BUILD_SYS
+ fi
+}
+
+setup_tmpdir
+setup_sysroot
+
+
+if [ -n "$1" ]; then
+ RPM_DIR="$1"
+else
+ RPM_DIR="$TMPDIR/deploy/rpm"
+fi
+
+if [ ! -d "$RPM_DIR" ]; then
+ echo "Error: rpm dir $RPM_DIR doesn't exist"
+ exit 1
+fi
+
+CREATEREPO=$POKY_NATIVE_SYSROOT/usr/bin/createrepo
+if [ ! -e "$CREATEREPO" ]; then
+ echo "Error: can't find createrepo binary"
+ echo "please run bitbake createrepo-native first"
+ exit 1
+fi
+
+
+$CREATEREPO "$RPM_DIR"
+
+exit 0
diff --git a/scripts/qemuimage-testlib b/scripts/qemuimage-testlib
index c2c394d5e..823cbfa18 100644
--- a/scripts/qemuimage-testlib
+++ b/scripts/qemuimage-testlib
@@ -39,6 +39,19 @@ Test_Info()
echo -e "\tTest_Info: $*"
}
+# function to update target ip address
+# $1 is the process id of the process, which starts the qemu target
+# $2 is the ip address of the target
+Test_Update_IPSAVE()
+{
+ local pid=$1
+ local ip_addr=$2
+
+ if [ "$TEST_SERIALIZE" -eq 1 ]; then
+ echo "$pid $ip_addr" > $TARGET_IPSAVE
+ fi
+}
+
# function to copy files from host into target
# $1 is the ip address of target
# $2 is the files, which need to be copied into target
@@ -99,6 +112,11 @@ Test_SSH_UP()
local timeout=$2
local interval=0
+ # If TEST_SERIALIZE is set, use existing running qemu for testing
+ if [ ${TEST_SERIALIZE} -eq 1 -a -e ${TARGET_IPSAVE} ]; then
+ timeout=50
+ fi
+
while [ ${interval} -lt ${timeout} ]
do
Test_SSH ${ip_addr} "hostname"
@@ -106,13 +124,13 @@ Test_SSH_UP()
interval=`expr $interval + 10`
sleep 10
else
- Test_Info "We can ssh on ${ip_addr} now"
+ Test_Info "We can ssh on ${ip_addr} within ${interval} seconds"
return 0
fi
done
- Test_Info "We can not ssh on ${ip_addr} in ${timeout}"
+ Test_Info "We can not ssh on ${ip_addr} in ${timeout} seconds"
return 1
}
@@ -162,6 +180,8 @@ Test_Kill_Qemu()
local ret=0
local ppid=0
local i=0
+ local index=0
+ local total=0
declare local pid
# Check if $1 pid exists and is a qemu process
@@ -186,16 +206,39 @@ Test_Kill_Qemu()
ret=$?
done
- # Kill these children pids from the last one
- while [ $i -ne 0 ]
- do
- i=$((i-1))
- kill ${pid[$i]}
- sleep 2
- done
+ # When TEST_SERIALIZE is set, qemu process will not be
+ # killed until all the cases are finished
+ if [ ${TEST_SERIALIZE} -eq 1 -a -e ${TEST_STATUS} ]; then
+ index=`sed -n 2p ${TEST_STATUS} | awk '{print $3}'`
+ total=`sed -n 2p ${TEST_STATUS} | awk '{print $4}'`
+ if [ ${index} != ${total} ]; then
+ Test_Info "Do not kill the qemu process and use it for later testing"
+ Test_Update_IPSAVE $PID $TARGET_IPADDR
+ else
+ # If it is the last case, let's kill it
+ while [ $i -ne 0 ]
+ do
+ i=$((i-1))
+ kill ${pid[$i]}
+ sleep 2
+ done
+
+ # Kill the parent id
+ kill $PID
+ fi
- # Kill the parent id
- kill $PID
+ else
+ # Kill these children pids from the last one
+ while [ $i -ne 0 ]
+ do
+ i=$((i-1))
+ kill ${pid[$i]}
+ sleep 2
+ done
+
+ # Kill the parent id
+ kill $PID
+ fi
fi
return
@@ -204,12 +247,12 @@ Test_Kill_Qemu()
# function to check if there is any qemu process
Test_Check_Qemu_UP()
{
- local count=`ps -ef | grep -c qemu`
- if [ ${count} -lt 2 ]; then
+ local count=`ps -eo command | cut -d " " -f 1 | grep -c "\(^qemu\|.*/qemu\)"`
+ if [ ${count} -lt 1 ]; then
Test_Info "There is no Qemu process"
return 1
else
- Test_Info "There is at least Qemu process running"
+ Test_Info "There is at least one Qemu process running"
return 0
fi
}
@@ -365,27 +408,49 @@ Test_Create_Qemu()
elif [ "$QEMUARCH" = "qemumips" ]; then
KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k vmlinux -a ${QEMUARCH})
fi
+
+ # If there is no kernel image found, return failed directly
+ if [ $? -eq 1 ]; then
+ Test_Info "No kernel image file found under ${DEPLOY_DIR}/images for ${QEMUARCH}, pls. have a check"
+ return $ret
+ fi
ROOTFS_IMAGE=$(Test_Find_Image -l ${DEPLOY_DIR}/images -t ${QEMUTARGET} -a ${QEMUARCH})
+
+ # If there is no rootfs image found, return failed directly
+ if [ $? -eq 1 ]; then
+ Test_Info "No ${QEMUTARGET} rootfs image file found under ${DEPLOY_DIR}/images for ${QEMUARCH}, pls. have a check"
+ return $ret
+ fi
+
TEST_ROOTFS_IMAGE="${TEST_TMP}/${QEMUTARGET}-${QEMUARCH}-test.ext3"
CP=`which cp`
- if [ -e "$TEST_ROOTFS_IMAGE" ]; then
- rm -rf $TEST_ROOTFS_IMAGE
- fi
- $CP $ROOTFS_IMAGE $TEST_ROOTFS_IMAGE
-
- export MACHINE=$QEMUARCH
- # Create Qemu in localhost VNC Port 1
- xterm -display ${DISPLAY} -e "${RUNQEMU} ${KERNEL} ${TEST_ROOTFS_IMAGE}" &
+ # When TEST_SERIALIZE is set, we use the existing image under tmp folder
+ if [ ${TEST_SERIALIZE} -eq 1 -a -e "$TARGET_IPSAVE" ]; then
+ # If TARGET_IPSAVE exists, check PID of the qemu process from it
+ PID=`awk '{print $1}' $TARGET_IPSAVE`
+ timeout=50
+ else
+ rm -rf $TEST_ROOTFS_IMAGE
+ $CP $ROOTFS_IMAGE $TEST_ROOTFS_IMAGE
+ if [ $? -ne 0 ]; then
+ Test_Info "Image ${ROOTFS_IMAGE} copy to ${TEST_ROOTFS_IMAGE} failed, return fail"
+ return $ret
+ fi
- # Get the pid of the xterm processor, which will be used in Test_Kill_Qemu
- PID=$!
+ export MACHINE=$QEMUARCH
- sleep 5
+ # Create Qemu in localhost VNC Port 1
+ echo "Running xterm -display ${DISPLAY} -e 'BUILDDIR=${TOPDIR} ${RUNQEMU} ${KERNEL} ${TEST_ROOTFS_IMAGE}' &"
+ xterm -display ${DISPLAY} -e "BUILDDIR=${TOPDIR} ${RUNQEMU} ${KERNEL} ${TEST_ROOTFS_IMAGE}" &
- while [ ${up_time} -lt ${timeout} ]
+ # Get the pid of the xterm processor, which will be used in Test_Kill_Qemu
+ PID=$!
+ fi
+
+ while [ ${up_time} -lt 10 ]
do
Test_Check_Qemu_UP
if [ $? -ne 0 ]; then
@@ -402,13 +467,18 @@ Test_Create_Qemu()
if [ ${up_time} -lt ${timeout} ]; then
sleep 5
TARGET_IPADDR=`Test_Fetch_Target_IP $PID`
+ # If IP address is 0, means there is no qemu process found
+ if [ ${TARGET_IPADDR} == "0" ]; then
+ Test_Info "There is no qemu process or qemu ip address found, return failed"
+ return $ret
+ fi
fi
while [ ${up_time} -lt ${timeout} ]
do
Test_Check_IP_UP ${TARGET_IPADDR}
if [ $? -eq 0 ]; then
- Test_Info "Qemu Network is up, ping with ${TARGET_IPADDR} is OK"
+ Test_Info "Qemu Network is up, ping with ${TARGET_IPADDR} is OK within ${up_time} seconds"
ret=0
break
else
@@ -422,7 +492,8 @@ Test_Create_Qemu()
Test_Info "Qemu and its network is up"
return $ret
else
- Test_Info "Qemu or its network is not up in ${timeout}"
+ Test_Info "Qemu or its network is not up in ${timeout} seconds"
+ Test_Update_IPSAVE $PID $TARGET_IPADDR
return $ret
fi
}
diff --git a/scripts/qemuimage-tests/sanity/compiler b/scripts/qemuimage-tests/sanity/compiler
new file mode 100755
index 000000000..29dbfd9bb
--- /dev/null
+++ b/scripts/qemuimage-tests/sanity/compiler
@@ -0,0 +1,52 @@
+#!/bin/bash
+# Compiler Test Case for Sanity Test
+# The case boot up the Qemu target with `poky-qemu qemuxxx`.
+# Then check if gcc/g++/make command can work in target.
+#
+# Author: Jiajun Xu <jiajun.xu@intel.com>
+#
+# This file is licensed under the GNU General Public License,
+# Version 2.
+#
+
+. $POKYBASE/scripts/qemuimage-testlib
+
+TIMEOUT=400
+RET=1
+
+# Start qemu and check its network
+Test_Create_Qemu ${TIMEOUT}
+
+# If qemu network is up, check ssh service in qemu
+if [ $? -eq 0 ]; then
+ Test_Info "Begin to Test SSH Service in Qemu"
+ Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT}
+ RET=$?
+else
+ RET=1
+fi
+
+# Check if gcc/g++/make can work in target
+if [ $RET -eq 0 -a -f $TOOLS/compiler_test.sh ]; then
+ # Copy compiler_test.sh into target
+ Test_Target_Pre ${TARGET_IPADDR} $TOOLS/compiler_test.sh
+ if [ $? -eq 0 ]; then
+ # Run compiler_test.sh to check if gcc/g++/make can work in target
+ Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/compiler_test.sh"
+ RET=$?
+ else
+ RET=1
+ fi
+fi
+
+if [ ${RET} -eq 0 ]; then
+ Test_Info "Compiler Test PASS"
+ Test_Kill_Qemu
+ Test_Print_Result "compiler" 0
+ exit 0
+else
+ Test_Info "Compiler FAIL, Pls. check above error log"
+ Test_Kill_Qemu
+ Test_Print_Result "compiler" 1
+ exit 1
+fi
diff --git a/scripts/qemuimage-tests/sanity/connman b/scripts/qemuimage-tests/sanity/connman
new file mode 100755
index 000000000..fca6a2784
--- /dev/null
+++ b/scripts/qemuimage-tests/sanity/connman
@@ -0,0 +1,52 @@
+#!/bin/bash
+# Conmman Check Test Case for Sanity Test
+# The case boot up the Qemu target with `poky-qemu qemuxxx`.
+# Then check if connman can work in target.
+#
+# Author: Jiajun Xu <jiajun.xu@intel.com>
+#
+# This file is licensed under the GNU General Public License,
+# Version 2.
+#
+
+. $POKYBASE/scripts/qemuimage-testlib
+
+TIMEOUT=400
+RET=1
+
+# Start qemu and check its network
+Test_Create_Qemu ${TIMEOUT}
+
+# If qemu network is up, check ssh service in qemu
+if [ $? -eq 0 ]; then
+ Test_Info "Begin to Test SSH Service in Qemu"
+ Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT}
+ RET=$?
+else
+ RET=1
+fi
+
+# Check if connman can work in target
+if [ $RET -eq 0 -a -f $TOOLS/connman_test.sh ]; then
+ # Copy connman_test.sh into target
+ Test_Target_Pre ${TARGET_IPADDR} $TOOLS/connman_test.sh
+ if [ $? -eq 0 ]; then
+ # Run connman_test.sh to check if connman can work in target
+ Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/connman_test.sh"
+ RET=$?
+ else
+ RET=1
+ fi
+fi
+
+if [ ${RET} -eq 0 ]; then
+ Test_Info "Connman Test PASS"
+ Test_Kill_Qemu
+ Test_Print_Result "connman" 0
+ exit 0
+else
+ Test_Info "Connman Test FAIL, Pls. check above error log"
+ Test_Kill_Qemu
+ Test_Print_Result "connman" 1
+ exit 1
+fi
diff --git a/scripts/qemuimage-tests/sanity/dmesg b/scripts/qemuimage-tests/sanity/dmesg
index 36813dcd4..5ed31b735 100755
--- a/scripts/qemuimage-tests/sanity/dmesg
+++ b/scripts/qemuimage-tests/sanity/dmesg
@@ -11,7 +11,7 @@
. $POKYBASE/scripts/qemuimage-testlib
-TIMEOUT=360
+TIMEOUT=400
RET=1
# Start qemu and check its network
diff --git a/scripts/qemuimage-tests/sanity/rpm_query b/scripts/qemuimage-tests/sanity/rpm_query
new file mode 100755
index 000000000..08017ffbe
--- /dev/null
+++ b/scripts/qemuimage-tests/sanity/rpm_query
@@ -0,0 +1,52 @@
+#!/bin/bash
+# RPM Check Test Case for Sanity Test
+# The case boot up the Qemu target with `poky-qemu qemuxxx`.
+# Then check if rpm command can work in target.
+#
+# Author: Jiajun Xu <jiajun.xu@intel.com>
+#
+# This file is licensed under the GNU General Public License,
+# Version 2.
+#
+
+. $POKYBASE/scripts/qemuimage-testlib
+
+TIMEOUT=400
+RET=1
+
+# Start qemu and check its network
+Test_Create_Qemu ${TIMEOUT}
+
+# If qemu network is up, check ssh service in qemu
+if [ $? -eq 0 ]; then
+ Test_Info "Begin to Test SSH Service in Qemu"
+ Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT}
+ RET=$?
+else
+ RET=1
+fi
+
+# Check if rpm query can work in target
+if [ $RET -eq 0 -a -f $TOOLS/rpm_test.sh ]; then
+ # Copy rpm_test.sh into target
+ Test_Target_Pre ${TARGET_IPADDR} $TOOLS/rpm_test.sh
+ if [ $? -eq 0 ]; then
+ # Run rpm_test.sh to check if rpm query can work in target
+ Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/rpm_test.sh -qa"
+ RET=$?
+ else
+ RET=1
+ fi
+fi
+
+if [ ${RET} -eq 0 ]; then
+ Test_Info "rpm query Test PASS"
+ Test_Kill_Qemu
+ Test_Print_Result "rpm_query" 0
+ exit 0
+else
+ Test_Info "rpm query FAIL, Pls. check above error log"
+ Test_Kill_Qemu
+ Test_Print_Result "rpm_query" 1
+ exit 1
+fi
diff --git a/scripts/qemuimage-tests/sanity/scp b/scripts/qemuimage-tests/sanity/scp
index ce3489d66..c72cdc9d6 100755
--- a/scripts/qemuimage-tests/sanity/scp
+++ b/scripts/qemuimage-tests/sanity/scp
@@ -11,7 +11,7 @@
. $POKYBASE/scripts/qemuimage-testlib
-TIMEOUT=360
+TIMEOUT=400
RET=1
SPID=0
i=0
diff --git a/scripts/qemuimage-tests/sanity/shutdown b/scripts/qemuimage-tests/sanity/shutdown
index e36b4a983..bc08cf0fd 100755
--- a/scripts/qemuimage-tests/sanity/shutdown
+++ b/scripts/qemuimage-tests/sanity/shutdown
@@ -13,7 +13,8 @@
. $POKYBASE/scripts/qemuimage-testlib
-TIMEOUT=360
+TIMEOUT=400
+
RET=1
i=0
@@ -61,6 +62,11 @@ fi
if [ ${RET} -eq 0 ]; then
Test_Info "Shutdown Test PASS"
Test_Print_Result "shutdown" 0
+
+ # Remove TARGET_IPSAVE since no existing qemu running now
+ if [ -e ${TARGET_IPSAVE} ]; then
+ rm -rf ${TARGET_IPSAVE}
+ fi
exit 0
else
Test_Info "Shutdown Test FAIL"
diff --git a/scripts/qemuimage-tests/sanity/ssh b/scripts/qemuimage-tests/sanity/ssh
index 084530adf..2a0e93439 100755
--- a/scripts/qemuimage-tests/sanity/ssh
+++ b/scripts/qemuimage-tests/sanity/ssh
@@ -11,7 +11,7 @@
. $POKYBASE/scripts/qemuimage-testlib
-TIMEOUT=360
+TIMEOUT=400
RET=1
# Start qemu and check its network
diff --git a/scripts/qemuimage-tests/sanity/zypper_help b/scripts/qemuimage-tests/sanity/zypper_help
new file mode 100755
index 000000000..1ab6d2407
--- /dev/null
+++ b/scripts/qemuimage-tests/sanity/zypper_help
@@ -0,0 +1,52 @@
+#!/bin/bash
+# Zypper Check Test Case for Sanity Test
+# The case boot up the Qemu target with `poky-qemu qemuxxx`.
+# Then check if zypper command can work in target.
+#
+# Author: Jiajun Xu <jiajun.xu@intel.com>
+#
+# This file is licensed under the GNU General Public License,
+# Version 2.
+#
+
+. $POKYBASE/scripts/qemuimage-testlib
+
+TIMEOUT=400
+RET=1
+
+# Start qemu and check its network
+Test_Create_Qemu ${TIMEOUT}
+
+# If qemu network is up, check ssh service in qemu
+if [ $? -eq 0 ]; then
+ Test_Info "Begin to Test SSH Service in Qemu"
+ Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT}
+ RET=$?
+else
+ RET=1
+fi
+
+# Check if zypper help can work in target
+if [ $RET -eq 0 -a -f $TOOLS/zypper_test.sh ]; then
+ # Copy zypper_test.sh into target
+ Test_Target_Pre ${TARGET_IPADDR} $TOOLS/zypper_test.sh
+ if [ $? -eq 0 ]; then
+ # Run zypper_test.sh to check if zypper help can work in target
+ Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/zypper_test.sh help"
+ RET=$?
+ else
+ RET=1
+ fi
+fi
+
+if [ ${RET} -eq 0 ]; then
+ Test_Info "zypper help Test PASS"
+ Test_Kill_Qemu
+ Test_Print_Result "zypper_help" 0
+ exit 0
+else
+ Test_Info "zypper help FAIL, Pls. check above error log"
+ Test_Kill_Qemu
+ Test_Print_Result "zypper_help" 1
+ exit 1
+fi
diff --git a/scripts/qemuimage-tests/sanity/zypper_search b/scripts/qemuimage-tests/sanity/zypper_search
new file mode 100755
index 000000000..d6bcd27a3
--- /dev/null
+++ b/scripts/qemuimage-tests/sanity/zypper_search
@@ -0,0 +1,52 @@
+#!/bin/bash
+# Zypper Check Test Case for Sanity Test
+# The case boot up the Qemu target with `poky-qemu qemuxxx`.
+# Then check if zypper command can work in target.
+#
+# Author: Jiajun Xu <jiajun.xu@intel.com>
+#
+# This file is licensed under the GNU General Public License,
+# Version 2.
+#
+
+. $POKYBASE/scripts/qemuimage-testlib
+
+TIMEOUT=400
+RET=1
+
+# Start qemu and check its network
+Test_Create_Qemu ${TIMEOUT}
+
+# If qemu network is up, check ssh service in qemu
+if [ $? -eq 0 ]; then
+ Test_Info "Begin to Test SSH Service in Qemu"
+ Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT}
+ RET=$?
+else
+ RET=1
+fi
+
+# Check if zypper search can work in target
+if [ $RET -eq 0 -a -f $TOOLS/zypper_test.sh ]; then
+ # Copy zypper_test.sh into target
+ Test_Target_Pre ${TARGET_IPADDR} $TOOLS/zypper_test.sh
+ if [ $? -eq 0 ]; then
+ # Run zypper_test.sh to check if zypper search can work in target
+ Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/zypper_test.sh search avahi"
+ RET=$?
+ else
+ RET=1
+ fi
+fi
+
+if [ ${RET} -eq 0 ]; then
+ Test_Info "zypper search package avahi Test PASS"
+ Test_Kill_Qemu
+ Test_Print_Result "zypper_search" 0
+ exit 0
+else
+ Test_Info "zypper search package avahi FAIL, Pls. check above error log"
+ Test_Kill_Qemu
+ Test_Print_Result "zypper_search" 1
+ exit 1
+fi
diff --git a/scripts/qemuimage-tests/scenario/qemuarm/poky-image-lsb b/scripts/qemuimage-tests/scenario/qemuarm/poky-image-lsb
index b8e9847b4..4fa606876 100644
--- a/scripts/qemuimage-tests/scenario/qemuarm/poky-image-lsb
+++ b/scripts/qemuimage-tests/scenario/qemuarm/poky-image-lsb
@@ -1,5 +1,7 @@
-sanity boot
sanity ssh
sanity scp
sanity dmesg
+sanity zypper_help
+sanity zypper_search
+sanity rpm_query
sanity shutdown
diff --git a/scripts/qemuimage-tests/scenario/qemuarm/poky-image-sato b/scripts/qemuimage-tests/scenario/qemuarm/poky-image-sato
index b8e9847b4..7a6353e1a 100644
--- a/scripts/qemuimage-tests/scenario/qemuarm/poky-image-sato
+++ b/scripts/qemuimage-tests/scenario/qemuarm/poky-image-sato
@@ -1,5 +1,8 @@
-sanity boot
sanity ssh
sanity scp
sanity dmesg
+sanity zypper_help
+sanity zypper_search
+sanity rpm_query
+sanity connman
sanity shutdown
diff --git a/scripts/qemuimage-tests/scenario/qemuarm/poky-image-sdk b/scripts/qemuimage-tests/scenario/qemuarm/poky-image-sdk
index b8e9847b4..42b8e1902 100644
--- a/scripts/qemuimage-tests/scenario/qemuarm/poky-image-sdk
+++ b/scripts/qemuimage-tests/scenario/qemuarm/poky-image-sdk
@@ -1,5 +1,9 @@
-sanity boot
sanity ssh
sanity scp
sanity dmesg
+sanity zypper_help
+sanity zypper_search
+sanity rpm_query
+sanity compiler
+sanity connman
sanity shutdown
diff --git a/scripts/qemuimage-tests/scenario/qemumips/poky-image-lsb b/scripts/qemuimage-tests/scenario/qemumips/poky-image-lsb
index b8e9847b4..4fa606876 100644
--- a/scripts/qemuimage-tests/scenario/qemumips/poky-image-lsb
+++ b/scripts/qemuimage-tests/scenario/qemumips/poky-image-lsb
@@ -1,5 +1,7 @@
-sanity boot
sanity ssh
sanity scp
sanity dmesg
+sanity zypper_help
+sanity zypper_search
+sanity rpm_query
sanity shutdown
diff --git a/scripts/qemuimage-tests/scenario/qemumips/poky-image-sato b/scripts/qemuimage-tests/scenario/qemumips/poky-image-sato
index b8e9847b4..7a6353e1a 100644
--- a/scripts/qemuimage-tests/scenario/qemumips/poky-image-sato
+++ b/scripts/qemuimage-tests/scenario/qemumips/poky-image-sato
@@ -1,5 +1,8 @@
-sanity boot
sanity ssh
sanity scp
sanity dmesg
+sanity zypper_help
+sanity zypper_search
+sanity rpm_query
+sanity connman
sanity shutdown
diff --git a/scripts/qemuimage-tests/scenario/qemumips/poky-image-sdk b/scripts/qemuimage-tests/scenario/qemumips/poky-image-sdk
index b8e9847b4..42b8e1902 100644
--- a/scripts/qemuimage-tests/scenario/qemumips/poky-image-sdk
+++ b/scripts/qemuimage-tests/scenario/qemumips/poky-image-sdk
@@ -1,5 +1,9 @@
-sanity boot
sanity ssh
sanity scp
sanity dmesg
+sanity zypper_help
+sanity zypper_search
+sanity rpm_query
+sanity compiler
+sanity connman
sanity shutdown
diff --git a/scripts/qemuimage-tests/scenario/qemuppc/poky-image-lsb b/scripts/qemuimage-tests/scenario/qemuppc/poky-image-lsb
index b8e9847b4..4fa606876 100644
--- a/scripts/qemuimage-tests/scenario/qemuppc/poky-image-lsb
+++ b/scripts/qemuimage-tests/scenario/qemuppc/poky-image-lsb
@@ -1,5 +1,7 @@
-sanity boot
sanity ssh
sanity scp
sanity dmesg
+sanity zypper_help
+sanity zypper_search
+sanity rpm_query
sanity shutdown
diff --git a/scripts/qemuimage-tests/scenario/qemuppc/poky-image-sato b/scripts/qemuimage-tests/scenario/qemuppc/poky-image-sato
index b8e9847b4..7a6353e1a 100644
--- a/scripts/qemuimage-tests/scenario/qemuppc/poky-image-sato
+++ b/scripts/qemuimage-tests/scenario/qemuppc/poky-image-sato
@@ -1,5 +1,8 @@
-sanity boot
sanity ssh
sanity scp
sanity dmesg
+sanity zypper_help
+sanity zypper_search
+sanity rpm_query
+sanity connman
sanity shutdown
diff --git a/scripts/qemuimage-tests/scenario/qemuppc/poky-image-sdk b/scripts/qemuimage-tests/scenario/qemuppc/poky-image-sdk
index b8e9847b4..42b8e1902 100644
--- a/scripts/qemuimage-tests/scenario/qemuppc/poky-image-sdk
+++ b/scripts/qemuimage-tests/scenario/qemuppc/poky-image-sdk
@@ -1,5 +1,9 @@
-sanity boot
sanity ssh
sanity scp
sanity dmesg
+sanity zypper_help
+sanity zypper_search
+sanity rpm_query
+sanity compiler
+sanity connman
sanity shutdown
diff --git a/scripts/qemuimage-tests/scenario/qemux86-64/poky-image-lsb b/scripts/qemuimage-tests/scenario/qemux86-64/poky-image-lsb
index b8e9847b4..4fa606876 100644
--- a/scripts/qemuimage-tests/scenario/qemux86-64/poky-image-lsb
+++ b/scripts/qemuimage-tests/scenario/qemux86-64/poky-image-lsb
@@ -1,5 +1,7 @@
-sanity boot
sanity ssh
sanity scp
sanity dmesg
+sanity zypper_help
+sanity zypper_search
+sanity rpm_query
sanity shutdown
diff --git a/scripts/qemuimage-tests/scenario/qemux86-64/poky-image-sato b/scripts/qemuimage-tests/scenario/qemux86-64/poky-image-sato
index b8e9847b4..7a6353e1a 100644
--- a/scripts/qemuimage-tests/scenario/qemux86-64/poky-image-sato
+++ b/scripts/qemuimage-tests/scenario/qemux86-64/poky-image-sato
@@ -1,5 +1,8 @@
-sanity boot
sanity ssh
sanity scp
sanity dmesg
+sanity zypper_help
+sanity zypper_search
+sanity rpm_query
+sanity connman
sanity shutdown
diff --git a/scripts/qemuimage-tests/scenario/qemux86-64/poky-image-sdk b/scripts/qemuimage-tests/scenario/qemux86-64/poky-image-sdk
index b8e9847b4..42b8e1902 100644
--- a/scripts/qemuimage-tests/scenario/qemux86-64/poky-image-sdk
+++ b/scripts/qemuimage-tests/scenario/qemux86-64/poky-image-sdk
@@ -1,5 +1,9 @@
-sanity boot
sanity ssh
sanity scp
sanity dmesg
+sanity zypper_help
+sanity zypper_search
+sanity rpm_query
+sanity compiler
+sanity connman
sanity shutdown
diff --git a/scripts/qemuimage-tests/scenario/qemux86/poky-image-lsb b/scripts/qemuimage-tests/scenario/qemux86/poky-image-lsb
index b8e9847b4..4fa606876 100644
--- a/scripts/qemuimage-tests/scenario/qemux86/poky-image-lsb
+++ b/scripts/qemuimage-tests/scenario/qemux86/poky-image-lsb
@@ -1,5 +1,7 @@
-sanity boot
sanity ssh
sanity scp
sanity dmesg
+sanity zypper_help
+sanity zypper_search
+sanity rpm_query
sanity shutdown
diff --git a/scripts/qemuimage-tests/scenario/qemux86/poky-image-sato b/scripts/qemuimage-tests/scenario/qemux86/poky-image-sato
index b8e9847b4..7a6353e1a 100644
--- a/scripts/qemuimage-tests/scenario/qemux86/poky-image-sato
+++ b/scripts/qemuimage-tests/scenario/qemux86/poky-image-sato
@@ -1,5 +1,8 @@
-sanity boot
sanity ssh
sanity scp
sanity dmesg
+sanity zypper_help
+sanity zypper_search
+sanity rpm_query
+sanity connman
sanity shutdown
diff --git a/scripts/qemuimage-tests/scenario/qemux86/poky-image-sdk b/scripts/qemuimage-tests/scenario/qemux86/poky-image-sdk
index b8e9847b4..42b8e1902 100644
--- a/scripts/qemuimage-tests/scenario/qemux86/poky-image-sdk
+++ b/scripts/qemuimage-tests/scenario/qemux86/poky-image-sdk
@@ -1,5 +1,9 @@
-sanity boot
sanity ssh
sanity scp
sanity dmesg
+sanity zypper_help
+sanity zypper_search
+sanity rpm_query
+sanity compiler
+sanity connman
sanity shutdown
diff --git a/scripts/qemuimage-tests/tools/compiler_test.sh b/scripts/qemuimage-tests/tools/compiler_test.sh
new file mode 100644
index 000000000..9c30d6d78
--- /dev/null
+++ b/scripts/qemuimage-tests/tools/compiler_test.sh
@@ -0,0 +1,137 @@
+#!/bin/bash
+# compiler test script running in target
+#
+# Author: Jiajun Xu <jiajun.xu@intel.com>
+#
+# This file is licensed under the GNU General Public License,
+# Version 2.
+#
+
+# Prepare test folder for compiler test
+COMPILE_FOLDER="/opt/test/compile_test"
+TEST_FILE="$COMPILE_FOLDER/compile_test.c"
+EXECUTE_FILE="$COMPILE_FOLDER/compile_test"
+TEST_MAKEFILE="$COMPILE_FOLDER/makefile"
+TEST_LIST="gcc g++ make"
+
+if [ ! -d $COMPILE_FOLDER ]; then
+ mkdir -p $COMPILE_FOLDER
+fi
+
+Target_Info()
+{
+ echo -e "\tTARGET: $*"
+}
+
+Target_Err()
+{
+ echo -e "\tTARGET: ##### Error Log #####"
+ $@
+ echo -e "\tTARGET: ##### End #####"
+}
+
+# Function to generate a c test file for compiler testing
+Gen_File()
+{
+ temp=`mktemp`
+
+ # Generate c/c++ test file for compiler testing
+ echo "#include <stdio.h>" >> $temp
+ echo "#include <math.h>" >> $temp
+ echo "" >> $temp
+ echo "double" >> $temp
+ echo "convert(long long l)" >> $temp
+ echo "{" >> $temp
+ echo " return (double)l; // or double(l)" >> $temp
+ echo "}" >> $temp
+ echo "" >> $temp
+ echo "int" >> $temp
+ echo "main(int argc, char * argv[])" >> $temp
+ echo "{" >> $temp
+ echo " long long l = 10;" >> $temp
+ echo " double f;" >> $temp
+ echo "" >> $temp
+ echo " f = convert(l);" >> $temp
+ echo " printf(\"convert: %lld => %f\n\", l, f);" >> $temp
+ echo "" >> $temp
+ echo " f = 1234.67;" >> $temp
+ echo " printf(\"floorf(%f) = %f\n\", f, floorf(f));" >> $temp
+ echo " return 0;" >> $temp
+ echo "}" >> $temp
+ echo $temp
+}
+
+# Function to generate a makefile for compiler testing
+Gen_Makefile()
+{
+ temp=`mktemp`
+ basename=`basename $EXECUTE_FILE`
+
+ echo -e "$basename: $basename.o" >> $temp
+ echo -e "\tgcc -o $basename $basename.o -lm" >> $temp
+ echo -e "$basename.o: $basename.c" >> $temp
+ echo -e "\tgcc -c $basename.c" >> $temp
+
+ echo $temp
+}
+
+# Generate a c test file for compiler testing
+test_file=`Gen_File`
+
+MOVE=`which mv`
+$MOVE $test_file $TEST_FILE
+
+# Begin compiler test in target
+for cmd in $TEST_LIST
+do
+ which $cmd
+ if [ $? -ne 0 ]; then
+ Target_Info "No $cmd command found"
+ exit 1
+ fi
+
+ if [ "$cmd" == "make" ]; then
+ rm -rf $EXECUTE_FILE
+
+ # For makefile test, we need to generate a makefile and run with a c file
+ makefile=`Gen_Makefile`
+ $MOVE $makefile $TEST_MAKEFILE
+
+ cd `dirname $TEST_MAKEFILE`
+ make
+
+ if [ $? -ne 0 ]; then
+ Target_Info "$cmd running with error, Pls. check error in following"
+ Target_Err make
+ exit 1
+ fi
+ else
+ rm -rf $EXECUTE_FILE
+
+ # For gcc/g++, we compile a c test file and check the output
+ $cmd $TEST_FILE -o $EXECUTE_FILE -lm
+
+ if [ $? -ne 0 ]; then
+ Target_Info "$cmd running with error, Pls. check error in following"
+ Target_Err $cmd $TEST_FILE -o $EXECUTE_FILE -lm
+ exit 1
+ fi
+ fi
+
+ # Check if the binary file generated by $cmd can work without error
+ if [ -f $EXECUTE_FILE ]; then
+ $EXECUTE_FILE
+ if [ $? -ne 0 ]; then
+ Target_Info "$EXECUTE_FILE running with error, Pls. check error in following"
+ Target_Err $EXECUTE_FILE
+ exit 1
+ else
+ Target_Info "$cmd can work without problem in target"
+ fi
+ else
+ Target_Info "No executalbe file $EXECUTE_FILE found, Pls. check the error log"
+ exit 1
+ fi
+done
+
+exit 0
diff --git a/scripts/qemuimage-tests/tools/connman_test.sh b/scripts/qemuimage-tests/tools/connman_test.sh
new file mode 100644
index 000000000..d7e63e7db
--- /dev/null
+++ b/scripts/qemuimage-tests/tools/connman_test.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+# connman test script running in target
+#
+# Author: Jiajun Xu <jiajun.xu@intel.com>
+#
+# This file is licensed under the GNU General Public License,
+# Version 2.
+#
+
+Target_Info()
+{
+ echo -e "\tTARGET: $*"
+}
+
+Target_Err()
+{
+ echo -e "\tTARGET: connman has issue when running, Pls. check the error log"
+ echo -e "\tTARGET: ##### Error Log #####"
+ $1
+ echo -e "\tTARGET: ##### End #####"
+}
+
+# Check if connmand is in target
+if [ ! -f /usr/sbin/connmand ]; then
+ Target_Info "No connmand command found"
+ exit 1
+fi
+
+# Check if connmand is running in background
+count=`ps -eo cmd | cut -d " " -f 1 | grep -c connmand`
+
+if [ $count -ne 1 ]; then
+ Target_Info "connmand has issue when running in background, Pls, check the output of ps"
+ ps -ef cmd | grep connmand
+ exit 1
+fi
+
+# Check if there is always only one connmand running in background
+if [ connmand > /dev/null 2>&1 ]; then
+ Target_Info "connmand command run without problem"
+ count=`ps -eo cmd | cut -d " " -f 1 | grep -c connmand`
+ if [ $count -ne 1 ]; then
+ Target_Info "There are more than one connmand running in background, Pls, check the output of ps"
+ ps -ef cmd | grep connmand
+ exit 1
+ else
+ Target_Info "There is always one connmand running in background, test pass"
+ exit 0
+ fi
+else
+ Target_Err connmand
+ exit 1
+fi
+
+exit 0
diff --git a/scripts/qemuimage-tests/tools/rpm_test.sh b/scripts/qemuimage-tests/tools/rpm_test.sh
new file mode 100644
index 000000000..6e6f9112c
--- /dev/null
+++ b/scripts/qemuimage-tests/tools/rpm_test.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+# rpm test script running in target
+#
+# Author: Jiajun Xu <jiajun.xu@intel.com>
+#
+# This file is licensed under the GNU General Public License,
+# Version 2.
+#
+
+Target_Info()
+{
+ echo -e "\tTARGET: $*"
+}
+
+Target_Err()
+{
+ echo -e "\tTARGET: rpm command has issue when running, Pls. check the error log"
+ echo -e "\tTARGET: ##### Error Log #####"
+ $1
+ echo -e "\tTARGET: ##### End #####"
+}
+
+which rpm
+if [ $? -ne 0 ]; then
+ Target_Info "No rpm command found"
+ exit 1
+fi
+
+if [ rpm > /dev/null 2>&1 ]; then
+ Target_Info "rpm command run without problem"
+else
+ Target_Err rpm
+ exit 1
+fi
+
+# run rpm with specific command parsed to rpm_test.sh
+rpm $* > /dev/null 2>&1
+
+if [ $? -eq 0 ]; then
+ Target_Info "rpm $* work without problem"
+ exit 0
+else
+ Target_Err rpm $*
+ exit 1
+fi
diff --git a/scripts/qemuimage-tests/tools/zypper_test.sh b/scripts/qemuimage-tests/tools/zypper_test.sh
new file mode 100644
index 000000000..5e8e7aaac
--- /dev/null
+++ b/scripts/qemuimage-tests/tools/zypper_test.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+# zypper test script running in target
+#
+# Author: Jiajun Xu <jiajun.xu@intel.com>
+#
+# This file is licensed under the GNU General Public License,
+# Version 2.
+#
+
+Target_Info()
+{
+ echo -e "\tTARGET: $*"
+}
+
+Target_Err()
+{
+ echo -e "\tTARGET: zypper command has issue when running, Pls. check the error log"
+ echo -e "\tTARGET: ##### Error Log #####"
+ $1
+ echo -e "\tTARGET: ##### End #####"
+}
+
+which zypper
+if [ $? -ne 0 ]; then
+ Target_Info "No zypper command found"
+ exit 1
+fi
+
+if [ zypper > /dev/null 2>&1 ]; then
+ Target_Info "zypper command run without problem"
+else
+ Target_Err zypper
+ exit 1
+fi
+
+# run zypper with specific command parsed to zypper_test.sh
+zypper $* > /dev/null 2>&1
+
+if [ $? -eq 0 ]; then
+ Target_Info "zypper $* work without problem"
+ exit 0
+else
+ Target_Err zypper $*
+ exit 1
+fi
diff --git a/scripts/rpm2cpio.sh b/scripts/rpm2cpio.sh
new file mode 100755
index 000000000..426fd77bb
--- /dev/null
+++ b/scripts/rpm2cpio.sh
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+# This comes from the RPM5 5.4.0 distribution.
+
+pkg=$1
+if [ "$pkg" = "" -o ! -e "$pkg" ]; then
+ echo "no package supplied" 1>&2
+ exit 1
+fi
+
+leadsize=96
+o=`expr $leadsize + 8`
+set `od -j $o -N 8 -t u1 $pkg`
+il=`expr 256 \* \( 256 \* \( 256 \* $2 + $3 \) + $4 \) + $5`
+dl=`expr 256 \* \( 256 \* \( 256 \* $6 + $7 \) + $8 \) + $9`
+# echo "sig il: $il dl: $dl"
+
+sigsize=`expr 8 + 16 \* $il + $dl`
+o=`expr $o + $sigsize + \( 8 - \( $sigsize \% 8 \) \) \% 8 + 8`
+set `od -j $o -N 8 -t u1 $pkg`
+il=`expr 256 \* \( 256 \* \( 256 \* $2 + $3 \) + $4 \) + $5`
+dl=`expr 256 \* \( 256 \* \( 256 \* $6 + $7 \) + $8 \) + $9`
+# echo "hdr il: $il dl: $dl"
+
+hdrsize=`expr 8 + 16 \* $il + $dl`
+o=`expr $o + $hdrsize`
+EXTRACTOR="dd if=$pkg ibs=$o skip=1"
+
+COMPRESSION=`($EXTRACTOR |file -) 2>/dev/null`
+if echo $COMPRESSION |grep -q gzip; then
+ DECOMPRESSOR=gunzip
+elif echo $COMPRESSION |grep -q bzip2; then
+ DECOMPRESSOR=bunzip2
+elif echo $COMPRESSION |grep -q xz; then
+ DECOMPRESSOR=unxz
+elif echo $COMPRESSION |grep -q cpio; then
+ DECOMPRESSOR=cat
+else
+ # Most versions of file don't support LZMA, therefore we assume
+ # anything not detected is LZMA
+ DECOMPRESSOR=`which unlzma 2>/dev/null`
+ case "$DECOMPRESSOR" in
+ /* ) ;;
+ * ) DECOMPRESSOR=`which lzmash 2>/dev/null`
+ case "$DECOMPRESSOR" in
+ /* ) DECOMPRESSOR="lzmash -d -c" ;;
+ * ) DECOMPRESSOR=cat ;;
+ esac
+ ;;
+ esac
+fi
+
+$EXTRACTOR 2>/dev/null | $DECOMPRESSOR
diff --git a/scripts/send-pull-request b/scripts/send-pull-request
index 0576a5dd4..7f51a1b25 100755
--- a/scripts/send-pull-request
+++ b/scripts/send-pull-request
@@ -1,6 +1,16 @@
#!/bin/bash
AUTO=0
+# Check env for any default settings, command line options will override these.
+if [ -z "$PULL_MTA" ]; then
+ PULL_MTA="sendmail"
+fi
+
+# Prevent environment leakage to these vars.
+unset TO
+unset CC
+# allow the user to set FROM in the environment
+
usage()
{
cat <<EOM
@@ -8,6 +18,10 @@ Usage: $(basename $0) [-h] [-a] [[-t email]...] -p pull-dir
-t email Explicitly add email to the recipients
-a Automatically harvest recipients from "*-by: email" lines
in the patches in the pull-dir
+ -f Specify a FROM address, you can also use the FROM environment
+ variable. If you do not specify one, it will try to use the one
+ from your git config. This is ignored if -g is used.
+ -g Use git-send-email to send mail instead of sendmail
-p pull-dir Directory containing summary and patch files
EOM
}
@@ -35,11 +49,17 @@ harvest_recipients()
# Parse and verify arguments
-while getopts "ahp:t:" OPT; do
+while getopts "af:ghp:t:" OPT; do
case $OPT in
a)
AUTO=1
;;
+ f)
+ FROM="$OPTARG"
+ ;;
+ g)
+ PULL_MTA="git"
+ ;;
h)
usage
exit 0
@@ -95,13 +115,29 @@ if [ -z "$TO" ] && [ -z "$CC" ]; then
exit 1
fi
+case "$PULL_MTA" in
+ git)
+ FROM="$(git config sendemail.from)"
+ ;;
+ sendmail)
+ if [ -z "$FROM" ]; then
+ FROM="$(git config user.name) <$(git config user.email)>"
+ if [ -z "$FROM" ]; then
+ echo "ERROR: unable to determine a FROM address"
+ usage
+ exit 1
+ fi
+ fi
+ ;;
+esac
# Generate report for the user and require confirmation before sending
cat <<EOM
The following patches:
$(for PATCH in $PDIR/*.patch; do echo " $PATCH"; done)
-will be sent to the following recipients:
+will be sent with the following headers:
+ From: $FROM
To: $TO
CC: $CC
@@ -111,21 +147,52 @@ read cont
if [ "$cont" == "y" ] || [ "$cont" == "Y" ]; then
ERROR=0
- for PATCH in $PDIR/*patch; do
- # Insert To and CC headers via formail to keep them separate and
- # appending them to the sendmail command as -- $TO $CC has proven
- # to be an exercise in futility.
- #
- # Use tail to remove the email envelope from git or formail as
- # msmtp (sendmail) would choke on them.
- cat $PATCH | formail -I "To: $TO" -I "CC: $CC" | tail -n +2 | sendmail -t
- if [ $? -eq 1 ]; then
- ERROR=1
- fi
- done
+ case "$PULL_MTA" in
+ git)
+ export IFS=$','
+ GIT_TO=$(for R in $TO; do echo -n "--to='$R' "; done)
+ GIT_CC=$(for R in $CC; do echo -n "--cc='$R' "; done)
+ unset IFS
+ for PATCH in $PDIR/*patch; do
+ # We harvest the emails manually, so force git not to.
+ eval "git send-email $GIT_TO $GIT_CC --no-chain-reply-to --suppress-cc=all $PATCH"
+ if [ $? -eq 1 ]; then
+ ERROR=1
+ fi
+ done
+ ;;
+ sendmail)
+ for PATCH in $PDIR/*patch; do
+ # Insert To and CC headers via formail to keep them separate and
+ # appending them to the sendmail command as -- $TO $CC has
+ # proven to be an exercise in futility.
+ #
+ # Clear the From header, leaving it up to sendmail to insert an
+ # appropriate one. Insert the original sender (per git) into the
+ # body of the message.
+ #
+ # Use tail to remove the email envelope from git or formail as
+ # msmtp (sendmail) would choke on them.
+ #
+ # Modify the patch date for sequential delivery, but retain the
+ # original date as "Old-Date".
+ DATE=$(date +"%a, %d %b %Y %k:%M:%S %z")
+ GIT_FROM=$(cat $PATCH | formail -X "From:")
+ cat $PATCH | formail -I "To: $TO" -I "CC: $CC" -I "From: $FROM" -i "Date: $DATE" | sed "0,/^$/s/^$/\n$GIT_FROM\n/" | tail -n +2 | sendmail -t
+ if [ $? -eq 1 ]; then
+ ERROR=1
+ fi
+ done
+ ;;
+ *)
+ echo "ERROR: unknown MTA: $PULL_MTA"
+ usage
+ exit 1
+ ;;
+ esac
+
if [ $ERROR -eq 1 ]; then
- echo "ERROR: sendmail failed to send one or more messages. Check your"
- echo " sendmail log for details."
+ echo "ERROR: Failed to send one or more messages. Check your MTA log for details."
fi
else
echo "Send aborted."