source: devel/pb/t/pbtest @ 1580

Last change on this file since 1580 was 1580, checked in by bruno, 7 years ago

Adding pbcl for afio

  • Property svn:executable set to *
File size: 9.4 KB
Line 
1#!/bin/bash
2#
3# Project Builder test suite
4#
5# $Id$
6#
7# Copyright B. Cornec 2007-2012
8# Provided under the GPL v2
9
10# First create a dummy account for testing
11# In order for this script to run well, you hould have sudo access
12
13# You may have multiple distros here
14TESTVEDIST="fedora-16-x86_64 mageia-1-i386 debian-6.0-x86_64 ubuntu-11.04-i386"
15# Only one VM is tested for now.
16TESTVMDIST="fedora-16-i386"
17TESTVMISO="/users/bruno/iso/Fedora-16-i386-DVD.iso"
18
19sudo rm -rf ~pbtest/* ~pbtest/.??*
20sudo userdel pbtest
21sudo groupdel pbtest
22sudo useradd pbtest
23sudo grep -q pbtest /etc/sudoers
24if [ $? -ne 0 ]; then
25    cat > /tmp/sudoers << EOF
26pbtest localhost=NOPASSWD:/usr/sbin/chroot
27pbtest localhost=NOPASSWD:/bin/cp
28EOF
29    sudo cat /etc/sudoers /tmp/sudoers > /tmp/sudoers2
30    sudo chmod 440 /tmp/sudoers2
31    sudo chown root:root /tmp/sudoers2
32    sudo mv /tmp/sudoers2 /etc/sudoers
33    rm -f /tmp/sudoers /tmp/sudoers2
34fi
35# Force pbtest account
36sudo perl -pi -e 's|^pbtest:.*|pbtest:$2a$08$2Q.tEty4v/fU0RyPeDelk.AjLAtXUXU3DpSs/l/8YrFmau1LJRCqC:15483:0:99999:7:::|' /etc/shadow
37PBTEST="`echo ~pbtest`"
38
39#Taken from Lab document originally
40# SVN repo setup
41sudopbtest "svnadmin create $PBTEST/svn"
42cat > /tmp/authz << EOF
43[/]
44pbtest = rw
45* = r
46EOF
47sudo mv /tmp/authz ~pbtest/svn/conf/authz
48cat > /tmp/passwd << EOF
49[users]
50pbtest = pbtest
51EOF
52sudo mv /tmp/passwd ~pbtest/svn/conf/passwd
53cat > /tmp/svnserve.conf << EOF
54[general]
55password-db = $PBTEST/svn/conf/passwd
56authz-db = authz
57anon-access = read
58auth-access = write
59realm = pb
60EOF
61sudo mv /tmp/svnserve.conf ~pbtest/svn/conf/svnserve.conf
62sudo chown pbtest:pbtest ~pbtest/svn/conf/authz ~pbtest/svn/conf/passwd ~pbtest/svn/conf/svnserve.conf
63sudopbtest "killall svnserve ; svnserve -d -r ~pbtest/svn"
64sudopbtest "mkdir pb ftp ve .ssh; chmod 700 .ssh"
65
66sudopbtest "pb --version"
67sudopbtest "pbdistrocheck"
68sudopbtest "pb clean"
69sudopbtest "pb -p afio getconf"
70
71cat > /tmp/.pbrc << EOF
72# Projects
73pbconfurl afio = svn://localhost/pb/afio/pbconf
74pbdefdir default = \$ENV{'HOME'}/pb
75pbconfurl projtest = dir://\$ENV{'HOME'}/projtest
76pbconfdir projtest = \$ENV{'HOME'}/projtest/pbconf
77pburl projtest = svn+ssh://svn.project-builder.org/svn/pb
78pbconfurl pb = svn://svn.project-builder.org/pb/pbconf
79pbconfdir pb = \$ENV{'HOME'}/pb/pbconf
80pburl pb = svn://svn.project-builder.org/pb
81pburl mondorescue = svn://svn.mondorescue.org/mondorescue/branches
82#
83pbpackager default = Big Chief <bigchief@hp.com>
84vmport pb = 2200
85pbparallel pb = 6
86vepath default = \$ENV{'HOME'}/ve
87vmtype default = kvm
88vmcmd default = qemu-kvm
89vmpath default = \$ENV{'HOME'}/tmp
90vmsize fedora = 10G
91vmmonport default = 4000
92EOF
93sudo mv /tmp/.pbrc ~pbtest/.pbrc
94
95cat > /tmp/.pbrc << EOF
96vetype default = chroot
97verpmtype default = rpmbootstrap
98vedebtype default = debootstrap
99verebuild default = false
100veopt default =
101vesnap default = false
102velogin default = pbtest
103EOF
104echo "velist default = `echo $TESTVEDIST | sed 's/ */,/g'`" >> /tmp/.pbrc
105sudo mv /tmp/.pbrc ~pbtest/ve/.pbrc
106sudo chown pbtest:pbtest ~pbtest/.pbrc ~pbtest/ve/.pbrc
107
108sudopbtest "ssh-keygen -f .ssh/id_rsa -t rsa -b 768 -v -N ''"
109sudopbtest "cp .ssh/id_rsa.pub .ssh/authorized_keys ; chmod 600 .ssh/authorized_keys ; chmod 600 .ssh/id_rsa.pub"
110sudopbtest "ssh localhost touch ftp/README"
111
112# Create SVN conf files - doesn't work fully as it asks for a password - solved with PBVCSOPT
113sudopbtest "svn info"
114cat > /tmp/servers << EOF
115[global]
116store-passwords = yes
117store-plaintext-passwords = yes
118store-auth-creds = yes
119EOF
120sudo mv /tmp/servers ~pbtest/.subversion/servers
121sudo chown pbtest:pbtest ~pbtest/.subversion/servers
122
123VCSOPT='--username pbtest --password pbtest'
124
125sudopbtest "svn import pb svn://localhost/pb -m 'Initial creation of pb repo' $VCSOPT"
126sudopbtest "cd pb ; svn co svn://localhost/pb ."
127sudopbtest "cd pb ; touch README ; svn add README ; svn ci --username pbtest --password pbtest -m 'add readme' README"
128sudopbtest "export PBVCSOPT=\"$VCSOPT\" ; pb -p afio -r 2.5 newproj afio"
129
130grep -vE '^defpkgdir|^projver|^projtag|^pburl|^pbrepo|^shh' ~pbtest/pb/afio/pbconf/2.5/afio.pb > /tmp/afio.pb
131cat >> /tmp/afio.pb << EOF
132defpkgdir afio = dummy
133projver afio = 2.5
134projtag afio = 1
135pburl afio = ftp://ftp.project-builder.org/src/afio-2.5.tar.gz
136pbrepo afio = ftp://ftp.project-builder.org
137sshhost afio = localhost
138sshlogin afio = pbtest
139sshdir afio = \$ENV{'HOME'}/ftp
140EOF
141sudo mv /tmp/afio.pb ~pbtest/pb/afio/pbconf/2.5/afio.pb
142sudo perl -pi -e 's|testver afio = true|testver afio = false|' ~pbtest/pb/afio/pbconf/2.5/afio.pb
143sudo chown pbtest:pbtest ~pbtest/pb/afio/pbconf/2.5/afio.pb
144
145grep -vE 'PBSRC|PBDESC|PBSUMMARY|PBURL|PBLOG' ~pbtest/pb/afio/pbconf/2.5/pbfilter/all.pbf > /tmp/all.pbf
146cat >> /tmp/all.pbf << EOF
147filter PBSRC = src/%{name}-%{version}.tar.gz
148filter PBDESC = afio is a cpio compatible archiver with extended features$/It can compress on a file by file basis.
149filter PBSUMMARY = afio is a cpio compatible archiver with extended features
150filter PBURL = http://www.boutell.com/lsm/lsmbyid.cgi/000462
151filter PBLOG = no
152EOF
153sudo mv /tmp/all.pbf ~pbtest/pb/afio/pbconf/2.5/pbfilter/all.pbf
154sudo chown pbtest:pbtest ~pbtest/pb/afio/pbconf/2.5/pbfilter/all.pbf
155
156grep -vE 'PBGRP|PBLIC' ~pbtest/pb/afio/pbconf/2.5/pbfilter/rpm.pbf > /tmp/rpm.pbf
157cat >> /tmp/rpm.pbf << EOF
158filter PBGRP = Applications/Archiving
159filter PBLIC = Afio
160EOF
161sudo mv /tmp/rpm.pbf ~pbtest/pb/afio/pbconf/2.5/pbfilter/rpm.pbf
162sudo chown pbtest:pbtest ~pbtest/pb/afio/pbconf/2.5/pbfilter/rpm.pbf
163
164# First build
165sudopbtest "pb -p afio -r 2.5 sbx2build"
166
167sudo perl -pi -e 's|%configure||' ~pbtest/pb/afio/pbconf/2.5/afio/rpm/afio.spec
168sudo perl -pi -e 's|make %{?_smp_mflags}|make %{?_smp_mflags}\nchmod 644 script*/*|' ~pbtest/pb/afio/pbconf/2.5/afio/rpm/afio.spec
169sudo perl -pi -e 's|make DESTDIR=$RPM_BUILD_ROOT install|kdir -p $RPM_BUILD_ROOT%{_bindir}\nmkdir -p $RPM_BUILD_ROOT%{_mandir}/man1\ninstall -p -m 755 afio $RPM_BUILD_ROOT%{_bindir}\ninstall -p -m 644 afio.1 $RPM_BUILD_ROOT%{_mandir}/man1|' ~pbtest/pb/afio/pbconf/2.5/afio/rpm/afio.spec
170sudo perl -pi -e 's|%doc ChangeLog|%doc HISTORY PORTING README SCRIPTS ANNOUNCE-2.5 perl.artistic.license|' ~pbtest/pb/afio/pbconf/2.5/afio/rpm/afio.spec
171sudo perl -pi -e 's|%doc INSTALL COPYING README AUTHORS NEWS|%doc afio.lsm script1 script2 script3 script4\n%{_bindir}/%{name}\n%{_mandir}/man1/%{name}.1*|' ~pbtest/pb/afio/pbconf/2.5/afio/rpm/afio.spec
172sudopbtest "pb -p afio sbx2pkg"
173rpm -qilvp ~pbtest/pb/afio/build/RPMS/x86_64/afio-2.5*
174
175cat > /tmp/pbcl << EOF
176# $Id$
177
178AFIO CHANGES
179
1802.5 (2009-12-03)
181- First packages created
182EOF
183sudo mv /tmp/pbcl ~pbtest/pb/afio/pbconf/2.5/afio/pbcl
184sudo chown pbtest:pbtest ~pbtest/pb/afio/pbconf/2.5/afio/pbcl
185svn add ~pbtest/pb/afio/pbconf/2.5/afio/pbcl
186svn ci -m 'Adding pbcl for afio' $VCSOPT
187
188sudo perl -pi -e 's|,\s*PBDEP||' ~pbtest/pb/afio/pbconf/2.5/afio/deb/control
189sudo perl -pi -e 's|Recommends: PBREC||' ~pbtest/pb/afio/pbconf/2.5/afio/deb/control
190sudo perl -pi -e 's|Suggests: PBSUG||' ~pbtest/pb/afio/pbconf/2.5/afio/deb/control
191cat > /tmp/afio.docs << EOF
192HISTORY
193PORTING
194README
195SCRIPTS
196ANNOUNCE-2.5
197perl.artistic.license
198afio.lsm
199script1
200script2
201script3
202script4
203EOF
204sudo mv /tmp/afio.docs ~pbtest/pb/afio/pbconf/2.5/afio/deb/afio.docs
205sudo chown pbtest:pbtest ~pbtest/pb/afio/pbconf/2.5/afio/deb/afio.docs
206
207sudo perl -pi -e 's|config.status: configure|config.status: Makefile|' ~pbtest/pb/afio/pbconf/2.5/afio/deb/rules
208sudo perl -pi -e 's|dh_installchangelogs ChangeLog|dh_installchangelogs debian/changelog|' ~pbtest/pb/afio/pbconf/2.5/afio/deb/rules
209sudo perl -pi -e 's|$(MAKE) install|mkdir -p $(CURDIR)/debian/$(PACKAGE_NAME)/usr/bin $(CURDIR)/debian/$(PACKAGE_NAME)/usr/share/man/man1|' ~pbtest/pb/afio/pbconf/2.5/afio/deb/rules
210sudo perl -pi -e 's|# - copy html manual to temporary location for renaming|install -p -m 755 afio $(CURDIR)/debian/$(PACKAGE_NAME)/usr/bin ; nstall -p -m 644 afio.1 $(CURDIR)/debian/$(PACKAGE_NAME)/usr/share/man/man1|' ~pbtest/pb/afio/pbconf/2.5/afio/deb/rules
211sudo sed -i -e '/\.\/configure /d' ~pbtest/pb/afio/pbconf/2.5/afio/deb/rules
212
213#dpkg -I ~ftp/pub/afio/test/debian/5.0/afio_2.5-0.20091204131057_i386.deb
214#dpkg -x ~ftp/pub/afio/test/debian/5.0/afio_2.5-0.20091204131057_i386.deb /tmp/x ;  ls -lR /tmp/x
215
216for d in $TESTVEDIST; do
217    sudopbtest "pb -p pb -m $d newve"
218    sudopbtest "pb -p pb -m $d sbx2setupve"
219    sudopbtest "pb -p pb -m $d snapve"
220    sudopbtest "pb -p afio -m $d sbx2ve"
221    # Cleaning VE to use the snapshot
222    dd=`echo $d | cut -d'-' -f1`
223    sudo rm -rf ~pbtest/tmp/$dd
224    sudopbtest "pb -p afio -S -m $d sbx2ve"
225done
226
227sudopbtest "pb -p afio -r 2.5 -V 2.6 newver"
228sudopbtest "pb -p afio clean"
229
230# test also with pb
231sudopbtest "pb -p pb -r devel sbx2pkg"
232sudopbtest "pb -p pb build2ssh"
233sudopbtest "pb -p pb pkg2ssh"
234
235
236#qemu-kvm \
237#-m 1024 \
238#-kernel /pub/mageia/distrib/cauldron/i586/isolinux/alt0/vmlinuz \
239#-initrd /pub/mageia/distrib/cauldron/i586/isolinux/alt0/all.rdz \
240#-append "ramdisk_size=128000 root=/dev/ram3 kickstart=http://192.168.8.55/pub/ks/guerrero/ks.pl automatic=method:http,server:192.168.8.55,directory:/pub/mageia/distrib/cauldron/i586,network:dhcp" \
241#-drive file=/users/qemu/mageia-2-i386.qemu,if=virtio,media=disk \
242#-redir tcp:2200:10.0.2.15:22
243#sudopbtest "pb -p projtest -m $TESTVMDIST -i $TESTVMISO newvm"
244#sudopbtest "pb -p projtest -m $TESTVMDIST sbx2setupvm"
245#sudopbtest "pb -p projtest -m $TESTVMDIST sbx2vm"
246
247# test also with MOndoRescue
248pb -p mondorescue -r branches/3.0 cms2pkg
249
250# cleanup
251sudopbtest "killall svnserve"
252
253sudopbtest() {
254
255cmd=$1
256
257echo "INFO pbtest: Now running $cmd"
258sudo su - pbtest -c "$cmd"
259}
260
Note: See TracBrowser for help on using the repository browser.