summaryrefslogtreecommitdiffstats
path: root/scripts/compose_pki_test_package
blob: 075495489b96fda39039313cf3bd5d5e127b23e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
# BEGIN COPYRIGHT BLOCK
# (C) 2010 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK

check_for_dependencies()
{
    NOT_FOUND="FALSE"
    for i in "expect" "beakerlib" "beaker-client" "rhts-devel"
    do
        rpm -qa $i
        if [ $? -ne 0 ] ; then
            echo "$i package required."
            NOT_FOUND="TRUE"
        fi
    done
    if [ $NOT_FOUND = "TRUE" ] ; then
        echo "Cannot compose test rpm without installing the dependencies."
        exit -1
    fi
}

check_for_dependencies

if [ $# -lt 2 ];
then
  echo "Usage: $0 User-ID_for_personalization Job_xml_config_file [--runtests]"
  exit -1
fi

RUN_TESTS='N'

if [ $# -gt 2 ];
then
    if [ $3 = "--runtests" ]
    then
        RUN_TESTS='Y'
    fi
fi

### Directory with all the compose scripts
COMPOSE_DIR=`dirname $0 | cd ; pwd`

PKI_SOURCE_DIR=`cd $COMPOSE_DIR/..; pwd`

###   Build the task rpm outside the PKI git source tree.
###   The rhts-build-package command checks if the code is is a git repository,
###   if yes, it will compare tags of the current branch and the master branch.
###   If they do not match then the rpm is not built.

WORK_DIR=`cd $COMPOSE_DIR/../..;pwd`

BUILD_DIR="$WORK_DIR/package.tests"

rm -rf $BUILD_DIR

mkdir $BUILD_DIR

cd $BUILD_DIR

cp -r "$PKI_SOURCE_DIR/tests" .

cd tests/dogtag

### Passing the keyword for personalizing and an option
### to maintain a seperate folder for each beaker job (Optional)
./make-package.sh $1 $2

mv *.rpm ../../

mv *.xml ../../

### Running the tasks

cd $COMPOSE_DIR

if [ $RUN_TESTS = "Y" ] ; then
     ./run_tests
fi