source: devel/pb/t/pbtest @ 1575

Last change on this file since 1575 was 1575, checked in by bruno, 7 years ago
  • pbtest again improved. Trying to get svn ci to work without password locally, but caching doesn't work yet.
  • Property svn:executable set to *
File size: 8.9 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"
69cat > /tmp/.pbrc << EOF
70# Projects
71pbconfurl afio = svn://localhost/pb/afio/pbconf
72pbdefdir default = \$ENV{'HOME'}/pb
73pbconfurl projtest = dir://\$ENV{'HOME'}/projtest
74pbconfdir projtest = \$ENV{'HOME'}/projtest/pbconf
75pburl projtest = svn+ssh://svn.project-builder.org/svn/pb
76pbconfurl pb = svn+ssh://svn.project-builder.org/svn/pb/pbconf
77pbconfdir pb = \$ENV{'HOME'}/pb/pbconf
78pburl pb = svn+ssh://svn.project-builder.org/svn/pb
79pburl mondorescue = svn://svn.mondorescue.org/mondorescue/branches
80#
81pbpackager default = Big Chief <bigchief@hp.com>
82vmport pb = 2200
83pbparallel pb = 6
84vepath default = \$ENV{'HOME'}/ve
85vmtype default = kvm
86vmcmd default = qemu-kvm
87vmpath default = \$ENV{'HOME'}/tmp
88vmsize fedora = 10G
89vmmonport default = 4000
90EOF
91sudo mv /tmp/.pbrc ~pbtest/.pbrc
92
93cat > /tmp/.pbrc << EOF
94vetype default = chroot
95verpmtype default = rpmbootstrap
96vedebtype default = debootstrap
97verebuild default = false
98veopt default =
99vesnap default = false
100velogin default = pbtest
101EOF
102echo "velist default = `echo $TESTVEDIST | sed 's/ */,/g'`" >> /tmp/.pbrc
103sudo mv /tmp/.pbrc ~pbtest/ve/.pbrc
104sudo chown pbtest:pbtest ~pbtest/.pbrc ~pbtest/ve/.pbrc
105
106sudo su - pbtest -c "ssh-keygen -f .ssh/id_rsa -t rsa -b 768 -v -N ''"
107sudo su - pbtest -c "cp .ssh/id_rsa.pub .ssh/authorized_keys ; chmod 600 .ssh/authorized_keys ; chmod 600 .ssh/id_rsa.pub"
108sudo su - pbtest -c "ssh localhost touch ftp/README"
109
110# Create SVN conf files
111sudo su - pbtest -c "svn info"
112cat > /tmp/servers << EOF
113[global]
114store-passwords = yes
115store-plaintext-passwords = yes
116store-auth-creds = yes
117EOF
118sudo mv /tmp/servers ~pbtest/.subversion/servers
119sudo chown pbtest:pbtest ~pbtest/.subversion/servers
120
121sudo su - pbtest -c "svn import pb svn://localhost/pb -m 'Initial creation of pb repo' --username pbtest --password pbtest"
122sudo su - pbtest -c "cd pb ; svn co svn://localhost/pb ."
123sudo su - pbtest -c "cd pb ; touch README ; svn add README ; svn ci --username pbtest --password pbtest -m 'add readme' README"
124sudo su - pbtest -c "pb -p afio newproj afio"
125cat >> /tmp/afio.pb << EOF
126defpkgdir afio = dummy
127projver afio = 2.5
128projtag afio = 1
129pburl afio = ftp://ftp.project-builder.org/src/afio-2.5.tar.gz
130pbrepo afio = ftp://ftp.project-builder.org
131sshhost afio = localhost
132sshlogin afio = pbtest
133sshdir afio = \$ENV{'HOME'}/ftp
134EOF
135sudo mv /tmp/afio.pb ~pbtest/pb/afio/pbconf/afio.pb
136sudo chown pbtest:pbtest ~pbtest/pb/afio/pbconf/afio.pb
137sudo su - pbtest -c "pb -p afio sbx2build"
138
139cat >> /tmp/all.pbf << EOF
140filter PBSRC = src/%{name}-%{version}.tar.gz
141filter PBDESC = afio is a cpio compatible archiver with extended features$/It can compress on a file by file basis.
142filter PBSUMMARY = afio is a cpio compatible archiver with extended features
143filter PBURL = http://www.boutell.com/lsm/lsmbyid.cgi/000462
144filter PBLOG = no
145EOF
146sudo mv /tmp/all.pbf ~pbtest/pb/afio/pbconf/pbfilter/all.pbf
147sudo chown pbtest:pbtest ~pbtest/pb/afio/pbconf/pbfilter/all.pbf
148cat >> /tmp/rpm.pbf << EOF
149filter PBGRP = Applications/Archiving
150filter PBLIC = Afio
151EOF
152sudo mv /tmp/rpm.pbf ~pbtest/pb/afio/pbconf/pbfilter/rpm.pbf
153sudo chown pbtest:pbtest ~pbtest/pb/afio/pbconf/pbfilter/rpm.pbf
154sudo su - pbtest -c "pb -p afio sbx2build"
155
156sudo perl -pi -e 's|%configure||' ~pbtest/pb/afio/pbconf/afio/rpm/afio.spec
157sudo perl -pi -e 's|make %{?_smp_mflags}|make %{?_smp_mflags}\nchmod 644 script*/*|' ~pbtest/pb/afio/pbconf/afio/rpm/afio.spec
158sudo 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
159sudo 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
160sudo 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
161sudo su - pbtest -c "pb -p afio sbx2pkg"
162rpm -qilvp ~pbtest/pb/afio/build/RPMS/x86_64/afio-2.5*
163
164sudo su - pbtest -c "pb -p pb sbx2pkg"
165sudo su - pbtest -c "pb -p pb build2ssh"
166sudo su - pbtest -c "pb -p pb pkg2ssh"
167
168cat >> /tmp/pbcl << EOF
169# $Id$
170
171AFIO CHANGES
172
1732.5 (2009-12-03)
174- First packages created
175EOF
176sudo mv /tmp/pbcl ~pbtest/pb/afio/pbconf/afio/pbcl
177chown pbtest:pbtest ~pbtest/pb/afio/pbconf/afio/pbcl
178svn add ~pbtest/pb/afio/pbconf/afio/pbcl
179svn ci -m 'Adding pbcl for afio'
180
181sudo perl -pi -e 's|,\s*PBDEP||' ~pbtest/pb/afio/pbconf/afio/deb/control
182sudo perl -pi -e 's|Recommends: PBREC||' ~pbtest/pb/afio/pbconf/afio/deb/control
183sudo perl -pi -e 's|Suggests: PBSUG||' ~pbtest/pb/afio/pbconf/afio/deb/control
184cat > /tmp/afio.docs << EOF
185HISTORY
186PORTING
187README
188SCRIPTS
189ANNOUNCE-2.5
190perl.artistic.license
191afio.lsm
192script1
193script2
194script3
195script4
196EOF
197sudo mv /tmp/afio.docs ~pbtest/pb/afio/pbconf/afio/deb/afio.docs
198sudo chown pbtest:pbtest ~pbtest/pb/afio/pbconf/afio/deb/afio.docs
199
200sudo perl -pi -e 's|config.status: configure|config.status: Makefile|' ~pbtest/pb/afio/pbconf/afio/deb/rules
201sudo perl -pi -e 's|dh_installchangelogs ChangeLog|dh_installchangelogs debian/changelog|' ~pbtest/pb/afio/pbconf/afio/deb/rules
202sudo 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
203sudo 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
204sudo sed -i -e '/\.\/configure /d' ~pbtest/pb/afio/pbconf/afio/deb/rules
205
206#dpkg -I ~ftp/pub/afio/test/debian/5.0/afio_2.5-0.20091204131057_i386.deb
207#dpkg -x ~ftp/pub/afio/test/debian/5.0/afio_2.5-0.20091204131057_i386.deb /tmp/x ;  ls -lR /tmp/x
208
209sudo su - pbtest -c "pb -p afio getconf"
210
211for d in $TESTVEDIST; do
212    sudo su - pbtest -c "pb -p afio -m $d newve"
213    sudo su - pbtest -c "pb -p pb -m $d sbx2setupve"
214    sudo su - pbtest -c "pb -p afio -m $d snapve"
215    sudo su - pbtest -c "pb -p afio -m $d sbx2ve"
216    # Cleaning VE to use the snapshot
217    dd=`echo $d | cut -d'-' -f1`
218    sudo rm -rf ~pbtest/tmp/$dd
219    sudo su - pbtest -c "pb -p afio -S -m $d sbx2ve"
220done
221
222# test also with MOndoRescue
223pb -p mondorescue -r branches/3.0 cms2pkg
224
225#qemu-kvm \
226#-m 1024 \
227#-kernel /pub/mageia/distrib/cauldron/i586/isolinux/alt0/vmlinuz \
228#-initrd /pub/mageia/distrib/cauldron/i586/isolinux/alt0/all.rdz \
229#-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" \
230#-drive file=/users/qemu/mageia-2-i386.qemu,if=virtio,media=disk \
231#-redir tcp:2200:10.0.2.15:22
232#sudo su - pbtest -c "pb -p projtest -m $TESTVMDIST -i $TESTVMISO newvm"
233#sudo su - pbtest -c "pb -p projtest -m $TESTVMDIST sbx2setupvm"
234#sudo su - pbtest -c "pb -p projtest -m $TESTVMDIST sbx2vm"
235
236sudo su - pbtest -c "pb -p afio -r 1.0 -V 2.0 newver"
237sudo su - pbtest -c "pb -p afio clean"
238
239# Cleanup
240#sudo userdel pbtest
Note: See TracBrowser for help on using the repository browser.