source: devel/pb/t/pbtest @ 1578

Last change on this file since 1578 was 1578, 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
41sudo su - pbtest -c "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
63sudo su - pbtest -c "killall svnserve ; svnserve -d -r ~pbtest/svn"
64sudo su - pbtest -c "mkdir pb ftp ve .ssh; chmod 700 .ssh"
65
66sudo su - pbtest -c "pb --version"
67sudo su - pbtest -c "pbdistrocheck"
68sudo su - pbtest -c "pb clean"
69sudo su - pbtest -c "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+ssh://svn.project-builder.org/svn/pb/pbconf
79pbconfdir pb = \$ENV{'HOME'}/pb/pbconf
80pburl pb = svn+ssh://svn.project-builder.org/svn/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
108sudo su - pbtest -c "ssh-keygen -f .ssh/id_rsa -t rsa -b 768 -v -N ''"
109sudo su - pbtest -c "cp .ssh/id_rsa.pub .ssh/authorized_keys ; chmod 600 .ssh/authorized_keys ; chmod 600 .ssh/id_rsa.pub"
110sudo su - pbtest -c "ssh localhost touch ftp/README"
111
112# Create SVN conf files - doesn't work fully as it asks for a password - solved with PBVCSOPT
113sudo su - pbtest -c "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
125sudo su - pbtest -c "svn import pb svn://localhost/pb -m 'Initial creation of pb repo' $VCSOPT"
126sudo su - pbtest -c "cd pb ; svn co svn://localhost/pb ."
127sudo su - pbtest -c "cd pb ; touch README ; svn add README ; svn ci --username pbtest --password pbtest -m 'add readme' README"
128sudo su - pbtest -c "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 chown pbtest:pbtest ~pbtest/pb/afio/pbconf/2.5/afio.pb
143
144grep -vE 'PBSRC|PBDESC|PBSUMMARY|PBURL|PBLOG' ~pbtest/pb/afio/pbconf/2.5/pbfilter/all.pbf > /tmp/all.pbf
145cat >> /tmp/all.pbf << EOF
146filter PBSRC = src/%{name}-%{version}.tar.gz
147filter PBDESC = afio is a cpio compatible archiver with extended features$/It can compress on a file by file basis.
148filter PBSUMMARY = afio is a cpio compatible archiver with extended features
149filter PBURL = http://www.boutell.com/lsm/lsmbyid.cgi/000462
150filter PBLOG = no
151EOF
152sudo mv /tmp/all.pbf ~pbtest/pb/afio/pbconf/2.5/pbfilter/all.pbf
153sudo chown pbtest:pbtest ~pbtest/pb/afio/pbconf/2.5/pbfilter/all.pbf
154
155grep -vE 'PBGRP|PBLIC' ~pbtest/pb/afio/pbconf/2.5/pbfilter/rpm.pbf > /tmp/rpm.pbf
156cat >> /tmp/rpm.pbf << EOF
157filter PBGRP = Applications/Archiving
158filter PBLIC = Afio
159EOF
160sudo mv /tmp/rpm.pbf ~pbtest/pb/afio/pbconf/2.5/pbfilter/rpm.pbf
161sudo chown pbtest:pbtest ~pbtest/pb/afio/pbconf/2.5/pbfilter/rpm.pbf
162
163# First build
164sudo su - pbtest -c "pb -p afio sbx2build"
165
166sudo perl -pi -e 's|%configure||' ~pbtest/pb/afio/pbconf/2.5/afio/rpm/afio.spec
167sudo perl -pi -e 's|make %{?_smp_mflags}|make %{?_smp_mflags}\nchmod 644 script*/*|' ~pbtest/pb/afio/pbconf/2.5/afio/rpm/afio.spec
168sudo 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
169sudo 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
170sudo 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
171sudo su - pbtest -c "pb -p afio sbx2pkg"
172rpm -qilvp ~pbtest/pb/afio/build/RPMS/x86_64/afio-2.5*
173
174sudo su - pbtest -c "pb -p pb sbx2pkg"
175sudo su - pbtest -c "pb -p pb build2ssh"
176sudo su - pbtest -c "pb -p pb pkg2ssh"
177
178cat > /tmp/pbcl << EOF
179# $Id$
180
181AFIO CHANGES
182
1832.5 (2009-12-03)
184- First packages created
185EOF
186sudo mv /tmp/pbcl ~pbtest/pb/afio/pbconf/2.5/afio/pbcl
187chown pbtest:pbtest ~pbtest/pb/afio/pbconf/2.5/afio/pbcl
188svn add ~pbtest/pb/afio/pbconf/2.5/afio/pbcl
189svn ci -m 'Adding pbcl for afio' $VCSOPT
190
191sudo perl -pi -e 's|,\s*PBDEP||' ~pbtest/pb/afio/pbconf/2.5/afio/deb/control
192sudo perl -pi -e 's|Recommends: PBREC||' ~pbtest/pb/afio/pbconf/2.5/afio/deb/control
193sudo perl -pi -e 's|Suggests: PBSUG||' ~pbtest/pb/afio/pbconf/2.5/afio/deb/control
194cat > /tmp/afio.docs << EOF
195HISTORY
196PORTING
197README
198SCRIPTS
199ANNOUNCE-2.5
200perl.artistic.license
201afio.lsm
202script1
203script2
204script3
205script4
206EOF
207sudo mv /tmp/afio.docs ~pbtest/pb/afio/pbconf/2.5/afio/deb/afio.docs
208sudo chown pbtest:pbtest ~pbtest/pb/afio/pbconf/2.5/afio/deb/afio.docs
209
210sudo perl -pi -e 's|config.status: configure|config.status: Makefile|' ~pbtest/pb/afio/pbconf/2.5/afio/deb/rules
211sudo perl -pi -e 's|dh_installchangelogs ChangeLog|dh_installchangelogs debian/changelog|' ~pbtest/pb/afio/pbconf/2.5/afio/deb/rules
212sudo 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
213sudo 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
214sudo sed -i -e '/\.\/configure /d' ~pbtest/pb/afio/pbconf/2.5/afio/deb/rules
215
216#dpkg -I ~ftp/pub/afio/test/debian/5.0/afio_2.5-0.20091204131057_i386.deb
217#dpkg -x ~ftp/pub/afio/test/debian/5.0/afio_2.5-0.20091204131057_i386.deb /tmp/x ;  ls -lR /tmp/x
218
219for d in $TESTVEDIST; do
220    sudo su - pbtest -c "pb -p pb -m $d newve"
221    sudo su - pbtest -c "pb -p pb -m $d sbx2setupve"
222    sudo su - pbtest -c "pb -p pb -m $d snapve"
223    sudo su - pbtest -c "pb -p afio -m $d sbx2ve"
224    # Cleaning VE to use the snapshot
225    dd=`echo $d | cut -d'-' -f1`
226    sudo rm -rf ~pbtest/tmp/$dd
227    sudo su - pbtest -c "pb -p afio -S -m $d sbx2ve"
228done
229
230
231#qemu-kvm \
232#-m 1024 \
233#-kernel /pub/mageia/distrib/cauldron/i586/isolinux/alt0/vmlinuz \
234#-initrd /pub/mageia/distrib/cauldron/i586/isolinux/alt0/all.rdz \
235#-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" \
236#-drive file=/users/qemu/mageia-2-i386.qemu,if=virtio,media=disk \
237#-redir tcp:2200:10.0.2.15:22
238#sudo su - pbtest -c "pb -p projtest -m $TESTVMDIST -i $TESTVMISO newvm"
239#sudo su - pbtest -c "pb -p projtest -m $TESTVMDIST sbx2setupvm"
240#sudo su - pbtest -c "pb -p projtest -m $TESTVMDIST sbx2vm"
241
242sudo su - pbtest -c "pb -p afio -r 1.0 -V 2.0 newver"
243sudo su - pbtest -c "pb -p afio clean"
244
245# test also with MOndoRescue
246pb -p mondorescue -r branches/3.0 cms2pkg
247
248# Cleanup
249#sudo userdel pbtest
Note: See TracBrowser for help on using the repository browser.