source: devel/pb/t/pbtest @ 1571

Last change on this file since 1571 was 1571, checked in by bruno, 7 years ago
  • Still improving pbtest
  • Property svn:executable set to *
File size: 8.3 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
19grep -q pbtest /etc/passwd
20if [ $? -eq 0 ]; then
21    sudo rm -rf ~pbtest/* ~pbtest/.??*
22    sudo groupdel pbtest
23    sudo userdel pbtest
24fi
25sudo useradd pbtest
26sudo grep -q pbtest /etc/sudoers
27if [ $? -ne 0 ]; then
28    cat >> /tmp/sudoers << EOF
29pbtest localhost=NOPASSWD:/usr/sbin/chroot
30pbtest localhost=NOPASSWD:/bin/cp
31EOF
32    sudo cat /etc/sudoers /tmp/sudoers > /tmp/sudoers2
33    sudo chmod 440 /tmp/sudoers2
34    sudo chown root:root /tmp/sudoers2
35    sudo mv /tmp/sudoers2 /etc/sudoers
36    rm -f /tmp/sudoers /tmp/sudoers2
37fi
38
39#Taken from Lab document originally
40# SVN repo setup
41sudo su - pbtest -c "mkdir -p prj ; svnadmin create prj/svn"
42cat >> /tmp/authz << EOF
43[/]
44pbtest = rw
45* = r
46EOF
47sudo mv /tmp/authz ~pbtest/prj/svn/conf/authz
48cat >> /tmp/passwd << EOF
49pbtest = pbtest
50EOF
51sudo mv /tmp/passwd ~pbtest/prj/svn/conf/passwd
52cat > /tmp/svnserve.conf << EOF
53[general]
54password-db = passwd
55authz-db = authz
56[sasl]
57EOF
58sudo mv /tmp/svnserve.conf ~pbtest/prj/svn/conf/svnserve.conf
59sudo chown pbtest:pbtest ~pbtest/prj/svn/conf/authz ~pbtest/prj/svn/conf/passwd ~pbtest/prj/svn/conf/svnserve.conf
60sudo su - pbtest -c "killall svnserve ; svnserve -d -r ~pbtest/prj/svn"
61sudo su - pbtest -c "mkdir pb ftp ve .ssh; chmod 700 .ssh"
62
63sudo su - pbtest -c "pb --version"
64sudo su - pbtest -c "pbdistrocheck"
65sudo su - pbtest -c "pb clean"
66cat > /tmp/.pbrc << EOF
67# Projects
68pbconfurl afio = svn://localhost/pb/afio/pbconf
69pbdefdir default = \$ENV{'HOME'}/pb
70pbconfurl projtest = dir://\$ENV{'HOME'}/projtest
71pbconfdir projtest = \$ENV{'HOME'}/projtest/pbconf
72pburl projtest = svn+ssh://svn.project-builder.org/prj/svn/pb
73pbconfurl pb = svn+ssh://svn.project-builder.org/prj/svn/pb/pbconf
74pbconfdir pb = \$ENV{'HOME'}/pb/pbconf
75pburl pb = svn+ssh://svn.project-builder.org/prj/svn/pb
76pburl mondorescue = svn://svn.mondorescue.org/mondorescue/branches
77#
78pbpackager default = Big Chief <bigchief@hp.com>
79vmport pb = 2200
80pbparallel pb = 6
81vepath default = \$ENV{'HOME'}/ve
82vmtype default = kvm
83vmcmd default = qemu-kvm
84vmpath default = \$ENV{'HOME'}/tmp
85vmsize fedora = 10G
86vmmonport default = 4000
87EOF
88sudo mv /tmp/.pbrc ~pbtest/.pbrc
89
90cat > /tmp/.pbrc << EOF
91vetype default = chroot
92verpmtype default = rpmbootstrap
93vedebtype default = debootstrap
94verebuild default = false
95veopt default =
96vesnap default = false
97velogin default = pbtest
98EOF
99echo "velist default = `echo $TESTVEDIST | sed 's/ */,/g'`" >> /tmp/.pbrc
100sudo mv /tmp/.pbrc ~pbtest/ve/.pbrc
101sudo chown pbtest:pbtest ~pbtest/.pbrc ~pbtest/ve/.pbrc
102
103sudo su - pbtest -c "ssh-keygen -f .ssh/id_rsa -t rsa -b 768 -v -N ''"
104sudo su - pbtest -c "cp .ssh/id_rsa.pub .ssh/authorized_keys ; chmod 600 .ssh/authorized_keys ; chmod 600 .ssh/id_rsa.pub"
105sudo su - pbtest -c "ssh -i .ssh/id_rsa.pub localhost touch ftp/README"
106sudo su - pbtest -c "svn import pb svn://localhost/pb -m 'Initial creation of pb repo'"
107sudo su - pbtest -c "cd pb ; svn co svn://localhost/pb ."
108sudo su - pbtest -c "pb -p afio newproj afio"
109cat >> /tmp/afio.pb << EOF
110defpkgdir afio = dummy
111projver afio = 2.5
112projtag afio = 1
113pburl afio = ftp://ftp.project-builder.org/src/afio-2.5.tar.gz
114pbrepo afio = ftp://ftp.project-builder.org
115sshhost afio = localhost
116sshlogin afio = pbtest
117sshdir afio = \$ENV{'HOME'}/ftp
118EOF
119sudo mv /tmp/afio.pb ~pbtest/pb/afio/pbconf/afio.pb
120sudo chown pbtest:pbtest ~pbtest/pb/afio/pbconf/afio.pb
121sudo su - pbtest -c "pb -p afio sbx2build"
122
123cat >> /tmp/all.pbf << EOF
124filter PBSRC = src/%{name}-%{version}.tar.gz
125filter PBDESC = afio is a cpio compatible archiver with extended features$/It can compress on a file by file basis.
126filter PBSUMMARY = afio is a cpio compatible archiver with extended features
127filter PBURL = http://www.boutell.com/lsm/lsmbyid.cgi/000462
128filter PBLOG = no
129EOF
130sudo mv /tmp/all.pbf ~pbtest/pb/afio/pbconf/pbfilter/all.pbf
131sudo chown pbtest:pbtest ~pbtest/pb/afio/pbconf/pbfilter/all.pbf
132cat >> /tmp/rpm.pbf << EOF
133filter PBGRP = Applications/Archiving
134filter PBLIC = Afio
135EOF
136sudo mv /tmp/rpm.pbf ~pbtest/pb/afio/pbconf/pbfilter/rpm.pbf
137sudo chown pbtest:pbtest ~pbtest/pb/afio/pbconf/pbfilter/rpm.pbf
138sudo su - pbtest -c "pb -p afio sbx2build"
139
140sudo perl -pi -e 's|%configure||' ~pbtest/pb/afio/pbconf/afio/rpm/afio.spec
141sudo perl -pi -e 's|make %{?_smp_mflags}|make %{?_smp_mflags}\nchmod 644 script*/*|' ~pbtest/pb/afio/pbconf/afio/rpm/afio.spec
142sudo 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/afio/rpm/afio.spec
143sudo perl -pi -e 's|%doc ChangeLog|%doc HISTORY PORTING README SCRIPTS ANNOUNCE-2.5 perl.artistic.license|' ~pbtest/pb/afio/pbconf/afio/rpm/afio.spec
144sudo 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/afio/rpm/afio.spec
145sudo su - pbtest -c "pb -p afio sbx2pkg"
146rpm -qilvp ~pbtest/pb/afio/build/RPMS/x86_64/afio-2.5*
147
148sudo su - pbtest -c "pb -p pb sbx2pkg"
149sudo su - pbtest -c "pb -p pb build2ssh"
150sudo su - pbtest -c "pb -p pb pkg2ssh"
151
152cat >> /tmp/pbcl << EOF
153# $Id$
154
155AFIO CHANGES
156
1572.5 (2009-12-03)
158- First packages created
159EOF
160sudo mv /tmp/pbcl ~pbtest/pb/afio/pbconf/afio/pbcl
161chown pbtest:pbtest ~pbtest/pb/afio/pbconf/afio/pbcl
162svn add ~pbtest/pb/afio/pbconf/afio/pbcl
163svn ci -m 'Adding pbcl for afio'
164
165sudo perl -pi -e 's|,\s*PBDEP||' ~pbtest/pb/afio/pbconf/afio/deb/control
166sudo perl -pi -e 's|Recommends: PBREC||' ~pbtest/pb/afio/pbconf/afio/deb/control
167sudo perl -pi -e 's|Suggests: PBSUG||' ~pbtest/pb/afio/pbconf/afio/deb/control
168cat > /tmp/afio.docs << EOF
169HISTORY
170PORTING
171README
172SCRIPTS
173ANNOUNCE-2.5
174perl.artistic.license
175afio.lsm
176script1
177script2
178script3
179script4
180EOF
181sudo mv /tmp/afio.docs ~pbtest/pb/afio/pbconf/afio/deb/afio.docs
182
183sudo perl -pi -e 's|config.status: configure|config.status: Makefile|' ~pbtest/pb/afio/pbconf/afio/deb/rules
184sudo perl -pi -e 's|dh_installchangelogs ChangeLog|dh_installchangelogs debian/changelog|' ~pbtest/pb/afio/pbconf/afio/deb/rules
185sudo 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/afio/deb/rules
186sudo 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/afio/deb/rules
187sudo sed -i -e '/\.\/configure /d' ~pbtest/pb/afio/pbconf/afio/deb/rules
188
189#dpkg -I ~ftp/pub/afio/test/debian/5.0/afio_2.5-0.20091204131057_i386.deb
190#dpkg -x ~ftp/pub/afio/test/debian/5.0/afio_2.5-0.20091204131057_i386.deb /tmp/x ;  ls -lR /tmp/x
191
192sudo su - pbtest -c "pb -p afio getconf"
193
194for d in $TESTVEDIST; do
195    sudo su - pbtest -c "pb -p afio -m $d newve"
196    sudo su - pbtest -c "pb -p pb -m $d sbx2setupve"
197    sudo su - pbtest -c "pb -p afio -m $d snapve"
198    sudo su - pbtest -c "pb -p afio -m $d sbx2ve"
199    # Cleaning VE to use the snapshot
200    dd=`echo $d | cut -d'-' -f1`
201    sudo rm -rf ~pbtest/tmp/$dd
202    sudo su - pbtest -c "pb -p afio -S -m $d sbx2ve"
203done
204
205# test also with MOndoRescue
206pb -p mondorescue -r branches/3.0 cms2pkg
207
208#qemu-kvm \
209#-m 1024 \
210#-kernel /pub/mageia/distrib/cauldron/i586/isolinux/alt0/vmlinuz \
211#-initrd /pub/mageia/distrib/cauldron/i586/isolinux/alt0/all.rdz \
212#-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" \
213#-drive file=/users/qemu/mageia-2-i386.qemu,if=virtio,media=disk \
214#-redir tcp:2200:10.0.2.15:22
215#sudo su - pbtest -c "pb -p projtest -m $TESTVMDIST -i $TESTVMISO newvm"
216#sudo su - pbtest -c "pb -p projtest -m $TESTVMDIST sbx2setupvm"
217#sudo su - pbtest -c "pb -p projtest -m $TESTVMDIST sbx2vm"
218
219sudo su - pbtest -c "pb -p afio -r 1.0 -V 2.0 newver"
220sudo su - pbtest -c "pb -p afio clean"
221
222# Cleanup
223#sudo userdel pbtest
Note: See TracBrowser for help on using the repository browser.