File indexing completed on 2024-05-19 05:27:33

0001 #! /bin/sh
0002 
0003 # SPDX-FileCopyrightText: 2010 Kevin Ottens <ervin@kde.org>
0004 # SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 
0006 gitarchive()
0007 {
0008         project=$1
0009         tree=$2
0010         compression=$3
0011         extension=$4
0012 
0013         git archive --format=tar --prefix=$project-$tree/ $tree | $compression -c > $project-$tree.tar.$extension
0014 }
0015 
0016 buildarchive()
0017 {
0018         project=$1
0019         tree=$2
0020 
0021         tar zxf $project-$tree.tar.gz \
0022         && cd $project-$tree \
0023         && mkdir build \
0024         && cd build \
0025         && cmake -DKDE4_BUILD_TESTS=ON ../ \
0026         && make $MAKEOPTS \
0027         && cd ../..
0028 }
0029 
0030 runtests()
0031 {
0032         project=$1
0033         tree=$2
0034 
0035         cd $project-$tree/build \
0036         && make test \
0037         && cd ../..
0038 }
0039 
0040 # Looking for the .git directory to be sure we're
0041 # at the top level of the working directory
0042 
0043 while ! test -e ".git"; do
0044         cd ..
0045         if test "$PWD" = "/"; then
0046                 echo "We're not in a git working directory!"
0047                 exit 1
0048         fi
0049 done
0050 
0051 project=`basename $PWD`
0052 
0053 
0054 for tree in $*; do
0055         echo "Generating archives for $project $tree"
0056 
0057         gitarchive $project $tree "gzip" "gz"
0058         gitarchive $project $tree "bzip2" "bz2"
0059 
0060         echo "Building"
0061         buildarchive $project $tree "tar.gz" || exit 1
0062 
0063         echo "Testing"
0064         runtests $project $tree "tar.gz" || exit 1
0065 
0066         echo "Cleanup"
0067         rm -r ./$project-$tree
0068 done;