summaryrefslogtreecommitdiffstats
path: root/sssd-nightly.sh
blob: 7c81e8e0412fc4abf63f50828c43bd059c5a1f5f (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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
function finish { #(exit code)
    recipients="sgallagh@redhat.com jgalipea@redhat.com"

    if [ $1 -eq 0 ]; then
        successful="successfully"
    else
        successful="unsuccessfully"
    fi

    echo "Build completed $successful" | /bin/mailx -a $LOGFILE -s "SSSD automated build report for $datestamp" $recipients
    exit $1
}

mkdir -p /local/sgallagh/logs
cd /local/sgallagh
nextversion=$1
if [ x$nextversion == x ]; then
    nextversion=0.0.1
fi
datestamp=`date +%Y%m%d%H`
today=`date +%Y%m%d`
git_repo=$2
if [ x$git_repo == x ]; then
    git_repo=git://git.fedorahosted.org/sssd.git
fi
LOGFILE=/local/sgallagh/logs/nightly-$datestamp.log

echo "===== BUILD STARTED AT `date` =====" > $LOGFILE

echo "===== Cleaning old RPMS =====" > $LOGFILE
rm -f `find /local/sgallagh/repos/f11 -type f -daystart -ctime +6|grep sssd-` || finish 98
rm -f `find /local/sgallagh/repos/rhel5 -type f -daystart -ctime +6|grep sssd-` || finish 99

echo "===== CHECKING OUT CODE =====" >> $LOGFILE
rm -Rf sssd-$datestamp #Remove an incomplete previous run
git clone $git_repo sssd-$datestamp >> $LOGFILE 2>&1
cd sssd-$datestamp

commit_id=`git log -1 --pretty=format:%h`
prereleaseversion=".${datestamp}git${commit_id}"
echo $nextversion > VERSION
echo $prereleaseversion >> VERSION
rpmversion=$nextversion-0$prereleaseversion

mv contrib/sssd.spec.in contrib/sssd.spec.in.orig && \
sed -e "s/make %/make CFLAGS=\"-ggdb3 -O0\" %/" < contrib/sssd.spec.in.orig > contrib/sssd.spec.in

echo "===== CONFIGURING CODE =====" >> $LOGFILE
autoreconf -i -f >> $LOGFILE 2>&1  || finish 1
./configure >> $LOGFILE 2>&1 || finish 2
make srpms >> $LOGFILE 2>&1 || finish 3
cd rpmbuild/SRPMS

echo "===== BUILDING FEDORA 11 i586 =====" >> $LOGFILE
mock -r fedora-11-i386 sssd-$rpmversion.fc11.src.rpm >> $LOGFILE 2>&1 || finish 4
echo "===== BUILDING FEDORA 11 x86_64 =====" >> $LOGFILE
mock -r fedora-11-x86_64 sssd-$rpmversion.fc11.src.rpm >> $LOGFILE 2>&1 || finish 5

echo "===== CREATING FEDORA 11 i586 YUM REPOSITORY ====" >> $LOGFILE
mkdir -p /local/sgallagh/repos/f11/SRPMS
mkdir -p /local/sgallagh/repos/f11/i386/DEBUGINFO
mkdir -p /local/sgallagh/repos/f11/i386/RPMS
cp /var/lib/mock/fedora-11-i386/result/sssd-$rpmversion.fc11.src.rpm /local/sgallagh/repos/f11/SRPMS
cp /var/lib/mock/fedora-11-i386/result/sssd-debuginfo-$rpmversion.fc11.i586.rpm /local/sgallagh/repos/f11/i386/DEBUGINFO
cp /var/lib/mock/fedora-11-i386/result/sssd-$rpmversion.fc11.i586.rpm /local/sgallagh/repos/f11/i386/RPMS

createrepo /local/sgallagh/repos/f11/SRPMS
if [ $? -eq 0 ]; then
    echo "Fedora 11 SRPM Repo updated" >> $LOGFILE
else
    echo "Fedora 11 SRPM Repo not updated" >> $LOGFILE
fi


createrepo /local/sgallagh/repos/f11/i386/DEBUGINFO
if [ $? -eq 0 ]; then
    echo "Fedora 11 i386 DEBUGINFO Repo updated" >> $LOGFILE
else
    echo "Fedora 11 i386 DEBUGINFO Repo not updated" >> $LOGFILE
fi

createrepo /local/sgallagh/repos/f11/i386/RPMS
if [ $? -eq 0 ]; then
    echo "Fedora 11 i386 RPM Repo updated" >> $LOGFILE
else
    echo "Fedora 11 i386 RPM Repo not updated" >> $LOGFILE
fi

echo "===== CREATING FEDORA 11 x86_64 YUM REPOSITORY ====" >> $LOGFILE
mkdir -p /local/sgallagh/repos/f11/x86_64/DEBUGINFO
mkdir -p /local/sgallagh/repos/f11/x86_64/RPMS
cp /var/lib/mock/fedora-11-x86_64/result/sssd-debuginfo-$rpmversion.fc11.x86_64.rpm /local/sgallagh/repos/f11/x86_64/DEBUGINFO
cp /var/lib/mock/fedora-11-x86_64/result/sssd-$rpmversion.fc11.x86_64.rpm /local/sgallagh/repos/f11/x86_64/RPMS

createrepo /local/sgallagh/repos/f11/x86_64/DEBUGINFO
if [ $? -eq 0 ]; then
    echo "Fedora 11 x86_64 DEBUGINFO Repo updated" >> $LOGFILE
else
    echo "Fedora 11 x86_64 DEBUGINFO Repo not updated" >> $LOGFILE
fi

createrepo /local/sgallagh/repos/f11/x86_64/RPMS
if [ $? -eq 0 ]; then
    echo "Fedora 11 x86_64 RPM Repo updated" >> $LOGFILE
else
    echo "Fedora 11 x86_64 RPM Repo not updated" >> $LOGFILE
fi

echo "===== BUILDING RHEL 5 i386 =====" >> $LOGFILE
cd /local/sgallagh/sssd-$datestamp/rpmbuild/SRPMS
mv sssd-$rpmversion.fc11.src.rpm \
   sssd-$rpmversion.el5.src.rpm
mock -r epel-5-i386 sssd-$rpmversion.el5.src.rpm >> $LOGFILE 2>&1 || finish 6

echo "===== BUILDING RHEL 5 x86_64 =====" >> $LOGFILE
mock -r epel-5-x86_64 sssd-$rpmversion.el5.src.rpm >> $LOGFILE 2>&1 || finish 7


echo "===== CREATING RHEL 5 i586 YUM REPOSITORY ====" >> $LOGFILE
mkdir -p /local/sgallagh/repos/rhel5/SRPMS
mkdir -p /local/sgallagh/repos/rhel5/i386/DEBUGINFO
mkdir -p /local/sgallagh/repos/rhel5/i386/RPMS
cp /var/lib/mock/epel-5-i386/result/sssd-$rpmversion.el5.src.rpm /local/sgallagh/repos/rhel5/SRPMS
cp /var/lib/mock/epel-5-i386/result/sssd-debuginfo-$rpmversion.el5.i386.rpm /local/sgallagh/repos/rhel5/i386/DEBUGINFO
cp /var/lib/mock/epel-5-i386/result/sssd-$rpmversion.el5.i386.rpm /local/sgallagh/repos/rhel5/i386/RPMS

createrepo -s sha1 /local/sgallagh/repos/rhel5/SRPMS
if [ $? -eq 0 ]; then
    echo "RHEL5 SRPM Repo updated" >> $LOGFILE
else
    echo "RHEL5 SRPM Repo not updated" >> $LOGFILE
fi

createrepo -s sha1 /local/sgallagh/repos/rhel5/i386/DEBUGINFO
if [ $? -eq 0 ]; then
    echo "RHEL5 i386 DEBUGINFO Repo updated" >> $LOGFILE
else
    echo "RHEL5 i386 DEBUGINFO Repo not updated" >> $LOGFILE
fi

createrepo -s sha1 /local/sgallagh/repos/rhel5/i386/RPMS
if [ $? -eq 0 ]; then
    echo "RHEL5 i386 RPM Repo updated" >> $LOGFILE
else
    echo "RHEL5 i386 RPM Repo not updated" >> $LOGFILE
fi

echo "===== CREATING RHEL 5 x86_86 YUM REPOSITORY ====" >> $LOGFILE
mkdir -p /local/sgallagh/repos/rhel5/x86_64/DEBUGINFO
mkdir -p /local/sgallagh/repos/rhel5/x86_64/RPMS
cp /var/lib/mock/epel-5-x86_64/result/sssd-debuginfo-$rpmversion.el5.x86_64.rpm /local/sgallagh/repos/rhel5/x86_64/DEBUGINFO
cp /var/lib/mock/epel-5-x86_64/result/sssd-$rpmversion.el5.x86_64.rpm /local/sgallagh/repos/rhel5/x86_64/RPMS

createrepo -s sha1 /local/sgallagh/repos/rhel5/x86_64/DEBUGINFO
if [ $? -eq 0 ]; then
    echo "RHEL5 x86_64 DEBUGINFO Repo updated" >> $LOGFILE
else
    echo "RHEL5 x86_64 DEBUGINFO Repo not updated" >> $LOGFILE
fi

createrepo -s sha1 /local/sgallagh/repos/rhel5/x86_64/RPMS
if [ $? -eq 0 ]; then
    echo "RHEL5 x86_64 RPM Repo updated" >> $LOGFILE
else
    echo "RHEL5 x86_64 RPM Repo not updated" >> $LOGFILE
fi

echo "===== Removing Source Tree =====" >> $LOGFILE
cd /local/sgallagh && rm -Rf sssd-$datestamp

echo "===== BUILD CONCLUDED AT `date` =====" >> $LOGFILE

finish 0