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
RevLine 
[1564]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
[1565]14TESTVEDIST="fedora-16-x86_64 mageia-1-i386 debian-6.0-x86_64 ubuntu-11.04-i386"
[1564]15# Only one VM is tested for now.
16TESTVMDIST="fedora-16-i386"
17TESTVMISO="/users/bruno/iso/Fedora-16-i386-DVD.iso"
18
[1574]19sudo rm -rf ~pbtest/* ~pbtest/.??*
20sudo userdel pbtest
21sudo groupdel pbtest
[1564]22sudo useradd pbtest
[1566]23sudo grep -q pbtest /etc/sudoers
[1565]24if [ $? -ne 0 ]; then
[1577]25    cat > /tmp/sudoers << EOF
[1570]26pbtest localhost=NOPASSWD:/usr/sbin/chroot
27pbtest localhost=NOPASSWD:/bin/cp
[1564]28EOF
[1567]29    sudo cat /etc/sudoers /tmp/sudoers > /tmp/sudoers2
[1569]30    sudo chmod 440 /tmp/sudoers2
31    sudo chown root:root /tmp/sudoers2
[1567]32    sudo mv /tmp/sudoers2 /etc/sudoers
33    rm -f /tmp/sudoers /tmp/sudoers2
[1565]34fi
[1573]35# Force pbtest account
[1574]36sudo perl -pi -e 's|^pbtest:.*|pbtest:$2a$08$2Q.tEty4v/fU0RyPeDelk.AjLAtXUXU3DpSs/l/8YrFmau1LJRCqC:15483:0:99999:7:::|' /etc/shadow
[1573]37PBTEST="`echo ~pbtest`"
[1564]38
[1565]39#Taken from Lab document originally
40# SVN repo setup
[1573]41sudo su - pbtest -c "svnadmin create $PBTEST/svn"
[1577]42cat > /tmp/authz << EOF
[1565]43[/]
44pbtest = rw
45* = r
46EOF
[1573]47sudo mv /tmp/authz ~pbtest/svn/conf/authz
[1577]48cat > /tmp/passwd << EOF
[1574]49[users]
[1565]50pbtest = pbtest
51EOF
[1573]52sudo mv /tmp/passwd ~pbtest/svn/conf/passwd
[1567]53cat > /tmp/svnserve.conf << EOF
[1565]54[general]
[1573]55password-db = $PBTEST/svn/conf/passwd
[1565]56authz-db = authz
[1573]57anon-access = read
58auth-access = write
[1575]59realm = pb
[1565]60EOF
[1573]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"
[1565]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"
[1577]69sudo su - pbtest -c "pb -p afio getconf"
70
[1567]71cat > /tmp/.pbrc << EOF
[1564]72# Projects
[1565]73pbconfurl afio = svn://localhost/pb/afio/pbconf
[1567]74pbdefdir default = \$ENV{'HOME'}/pb
75pbconfurl projtest = dir://\$ENV{'HOME'}/projtest
76pbconfdir projtest = \$ENV{'HOME'}/projtest/pbconf
[1573]77pburl projtest = svn+ssh://svn.project-builder.org/svn/pb
78pbconfurl pb = svn+ssh://svn.project-builder.org/svn/pb/pbconf
[1567]79pbconfdir pb = \$ENV{'HOME'}/pb/pbconf
[1573]80pburl pb = svn+ssh://svn.project-builder.org/svn/pb
[1565]81pburl mondorescue = svn://svn.mondorescue.org/mondorescue/branches
[1564]82#
[1565]83pbpackager default = Big Chief <bigchief@hp.com>
[1564]84vmport pb = 2200
85pbparallel pb = 6
[1567]86vepath default = \$ENV{'HOME'}/ve
[1565]87vmtype default = kvm
88vmcmd default = qemu-kvm
[1567]89vmpath default = \$ENV{'HOME'}/tmp
[1564]90vmsize fedora = 10G
[1565]91vmmonport default = 4000
[1564]92EOF
[1566]93sudo mv /tmp/.pbrc ~pbtest/.pbrc
[1564]94
[1567]95cat > /tmp/.pbrc << EOF
[1565]96vetype default = chroot
97verpmtype default = rpmbootstrap
98vedebtype default = debootstrap
99verebuild default = false
100veopt default =
101vesnap default = false
102velogin default = pbtest
103EOF
[1567]104echo "velist default = `echo $TESTVEDIST | sed 's/ */,/g'`" >> /tmp/.pbrc
[1566]105sudo mv /tmp/.pbrc ~pbtest/ve/.pbrc
106sudo chown pbtest:pbtest ~pbtest/.pbrc ~pbtest/ve/.pbrc
[1565]107
108sudo su - pbtest -c "ssh-keygen -f .ssh/id_rsa -t rsa -b 768 -v -N ''"
[1566]109sudo su - pbtest -c "cp .ssh/id_rsa.pub .ssh/authorized_keys ; chmod 600 .ssh/authorized_keys ; chmod 600 .ssh/id_rsa.pub"
[1572]110sudo su - pbtest -c "ssh localhost touch ftp/README"
[1574]111
[1577]112# Create SVN conf files - doesn't work fully as it asks for a password - solved with PBVCSOPT
[1574]113sudo su - pbtest -c "svn info"
114cat > /tmp/servers << EOF
[1575]115[global]
[1574]116store-passwords = yes
117store-plaintext-passwords = yes
[1575]118store-auth-creds = yes
[1574]119EOF
120sudo mv /tmp/servers ~pbtest/.subversion/servers
121sudo chown pbtest:pbtest ~pbtest/.subversion/servers
122
[1577]123VCSOPT='--username pbtest --password pbtest'
124
125sudo su - pbtest -c "svn import pb svn://localhost/pb -m 'Initial creation of pb repo' $VCSOPT"
[1565]126sudo su - pbtest -c "cd pb ; svn co svn://localhost/pb ."
[1575]127sudo su - pbtest -c "cd pb ; touch README ; svn add README ; svn ci --username pbtest --password pbtest -m 'add readme' README"
[1578]128sudo su - pbtest -c "export PBVCSOPT=\"$VCSOPT\" ; pb -p afio -r 2.5 newproj afio"
[1577]129
[1578]130grep -vE '^defpkgdir|^projver|^projtag|^pburl|^pbrepo|^shh' ~pbtest/pb/afio/pbconf/2.5/afio.pb > /tmp/afio.pb
[1567]131cat >> /tmp/afio.pb << EOF
[1565]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
[1567]139sshdir afio = \$ENV{'HOME'}/ftp
[1565]140EOF
[1578]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
[1565]143
[1578]144grep -vE 'PBSRC|PBDESC|PBSUMMARY|PBURL|PBLOG' ~pbtest/pb/afio/pbconf/2.5/pbfilter/all.pbf > /tmp/all.pbf
[1567]145cat >> /tmp/all.pbf << EOF
[1565]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
[1578]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
[1577]154
[1578]155grep -vE 'PBGRP|PBLIC' ~pbtest/pb/afio/pbconf/2.5/pbfilter/rpm.pbf > /tmp/rpm.pbf
[1567]156cat >> /tmp/rpm.pbf << EOF
[1565]157filter PBGRP = Applications/Archiving
158filter PBLIC = Afio
159EOF
[1578]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
[1577]162
163# First build
[1565]164sudo su - pbtest -c "pb -p afio sbx2build"
165
[1578]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
[1564]171sudo su - pbtest -c "pb -p afio sbx2pkg"
[1565]172rpm -qilvp ~pbtest/pb/afio/build/RPMS/x86_64/afio-2.5*
173
[1564]174sudo su - pbtest -c "pb -p pb sbx2pkg"
[1565]175sudo su - pbtest -c "pb -p pb build2ssh"
176sudo su - pbtest -c "pb -p pb pkg2ssh"
[1564]177
[1577]178cat > /tmp/pbcl << EOF
[1565]179# $Id$
[1564]180
[1565]181AFIO CHANGES
182
1832.5 (2009-12-03)
184- First packages created
185EOF
[1578]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
[1577]189svn ci -m 'Adding pbcl for afio' $VCSOPT
[1565]190
[1578]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
[1567]194cat > /tmp/afio.docs << EOF
[1565]195HISTORY
196PORTING
197README
198SCRIPTS
199ANNOUNCE-2.5
200perl.artistic.license
201afio.lsm
202script1
203script2
204script3
205script4
206EOF
[1578]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
[1567]209
[1578]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
[1565]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
[1564]219for d in $TESTVEDIST; do
[1577]220    sudo su - pbtest -c "pb -p pb -m $d newve"
[1565]221    sudo su - pbtest -c "pb -p pb -m $d sbx2setupve"
[1577]222    sudo su - pbtest -c "pb -p pb -m $d snapve"
[1565]223    sudo su - pbtest -c "pb -p afio -m $d sbx2ve"
[1564]224    # Cleaning VE to use the snapshot
225    dd=`echo $d | cut -d'-' -f1`
226    sudo rm -rf ~pbtest/tmp/$dd
[1565]227    sudo su - pbtest -c "pb -p afio -S -m $d sbx2ve"
[1564]228done
229
[1565]230
[1564]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
[1565]242sudo su - pbtest -c "pb -p afio -r 1.0 -V 2.0 newver"
243sudo su - pbtest -c "pb -p afio clean"
[1564]244
[1577]245# test also with MOndoRescue
246pb -p mondorescue -r branches/3.0 cms2pkg
247
[1564]248# Cleanup
[1565]249#sudo userdel pbtest
Note: See TracBrowser for help on using the repository browser.