source: devel/pb-doc/pb-demo

Last change on this file was 2284, checked in by bruno, 3 months ago

Now uses pbprojurl instead of pburl to be consistent with pbconfurl

File size: 7.6 KB
Line 
1demo of project-builder.org
2===========================
3
4# First demonstrate the way of working for pb itself
5cd ~/local/pb|~/pb|~/svn-git/pb
6# Show the various versions available in this SVK exported dir
7ls
8# get the current tag of the SVK repository
9#svk info
10# get it from SVN directly
11svn info svn+ssh://svn.mondorescue.org/prj/svn/pb/devel
12
13# get the current version of project-builder
14rpm -q project-builder
15pb --help
16pb
17
18# Decide to build a package for project-builder based on that devel version
19# to replace the one currently installed
20pb -p pb -r devel sbx2build|cms2build
21
22# Show the upstream part
23ls -altg /home/bruno/svn-git/pb/pbdelivery/
24tar tvfz /home/bruno/svn-git/pb/pbdelivery/project-builder-XXX.tar.gz
25
26# Show the pb specific part
27tar tvfz /home/bruno/svn-git/pb/pbdelivery/project-builder-develXXX.pbconf.tar.gz
28
29# Now make the packages
30pb -p pb build2pkg
31
32# Look at the latest packages created
33ls -altrg /home/bruno/svn-git/pb/pbbuild/RPMS/noarch
34
35# Install the generated packages
36sudo urpmi /home/bruno/svn-git/pb/pbbuild/RPMS/noarch/*.rpm
37
38# Check that it's the right one
39rpm -q project-builder
40pb -h
41git svn info
42
43# Now  show how easy it's to build for another distro in a VM
44ls /home/qemu
45-> pb -p pb -m debian-7-x86_64 sbx2vm
46ls -al /var/ftp/pub/pb/test/debian/7/
47ls -al /var/ftp/pub/pb/test/debian/dists/7/
48
49pb -p pb -m mageia-3-i386 sbx2vm
50# Now  show how easy it's to build for another distro in a VE
51ls /home/rpmbootstrap
52pb -p pb -m centos-6-x86_64 build2ve
53pb -p pb -m ubuntu-11.10-x86_64 build2ve
54-> pb -p pb -m debian-6.0-x86_64 sbx2ve
55ls -al /var/ftp/pub/pb/test/debian/6.0/
56ls -al /var/ftp/pub/pb/test/debian/dists/6.0/
57
58# Docker part
59# Mount the external HDD if needed
60sudo mount /dev/sdc1 /mnt
61$ sudo mount -o bind /mnt/docker /var/cache/docker
62# Then restart docker to avoid errors with Attempt to write a readonly database
63$ sudo systemctl restart docker
64#$ sudo systemctl restart docker_registry
65# Now show how easy it's to build for another distro in a Docker VE
66# Create Docker container
67$ docker images
68
69# If docker issue with net, restart docker
70$ sudo ip link delete docker0
71$ sudo systemctl restart docker.service
72
73# Building with rpmbootstrap for a distro
74# We already imported the upstream container images to save time
75# Start with the local distro to simplify
76#
77$ pb -p pb -m mageia-5-x86_64 -T docker -i mageia:5 newve
78# or without -i if time permits using rpmbootstrap
79$ docker images | grep mageia-5
80$ docker images | grep mageia-5 | awk '{print $3}'
81$ docker run -ti `docker images | grep mageia-5 | head -1 | awk '{print $3}'` /bin/bash
82[root@8158b86786a7 /]# cat /etc/mageia-release
83Mageia release 5 (Official) for x86_64
84[root@8158b86786a7 /]# uname -a
85Linux 8158b86786a7 3.19.8-desktop-3.mga5 #1 SMP Sat Jun 13 17:05:48 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
86[root@8158b86786a7 /]# urpmi tcsh
87    http://distro.ibiblio.org/mageia/distrib/5/x86_64/media/core/release/tcsh-6.18.01-8.mga5.x86_64.rpm
88installing tcsh-6.18.01-8.mga5.x86_64.rpm from /var/cache/urpmi/rpms           
89Preparing...                     #############################################
90      1/1: tcsh                  #############################################
91[root@8158b86786a7 /]# pb --help
92bash: pb: command not found
93[root@8158b86786a7 /]# exit
94$ pb -p pb -m mageia-5-x86_64 -T docker sbx2setupve
95$ docker images | grep mageia-5
96localhost:5000/pb                  mageia-5-x86_64-pb                   43bcfd269f29        2 minutes ago       376.2 MB
97localhost:5000/pb                  mageia-5-x86_64                      466f10e78bba        16 minutes ago      184.5 MB
98$ docker run -ti `docker images | grep mageia-5-x86_64-pb | awk '{print $3}'` /bin/bash
99[root@bbd981bcf4cd /]# pb --help
100pb (aka project-builder.org) Version devel20150930111943-2002
101[root@bbd981bcf4cd /]# exit
102$ pb -p pb -m mageia-5-x86_64 -T docker prepve
103$ docker images | grep mageia-5-x86_64-pb-pb
104localhost:5000/pb                  mageia-5-x86_64-pb-pb                66dd65cab2cc        About a minute ago   378.9 MB
105$ pb -p pb -m mageia-5-x86_64  -T docker sbx2ve
106
107# On another distro already preped
108# we can launch in // the same for ubuntu 15.04
109$ pb -p pb -m ubuntu-15.04-x86_64 -T docker -i ubuntu:15.04 newve
110$ pb -p pb -m ubuntu-15.04-x86_64 -T docker sbx2setupve
111$ pb -p pb -m ubuntu-15.04-x86_64 -T docker prepve
112$ pb -p pb -m ubuntu-15.04-x86_64 -T docker sbx2ve
113
114# Instead of the video:
115pb -p pb -T docker -m ubuntu-15.04-x86_64 -T docker -i ubuntu:15.04 newve
116pb -p pb -T docker -m ubuntu-15.04-x86_64 -T docker sbx2setupve
117pb -p pb -T docker -m ubuntu-15.04-x86_64 -T docker prepve
118pb -p pb -T docker -m ubuntu-15.04-x86_64 -T docker build2ve
119
120# and then another project
121pb -p mondorescue -T docker -m ubuntu-15.04-x86_64 -T docker prepve
122
123# After the Video:
124# Another container Ubuntu 13.10
125$ pb -p pb -m ubuntu-15.04-x86_64 -T docker build2ve
126$ ls -al /var/ftp/pub/pb/test/ubuntu/15.04
127
128# On another project
129$ pb -p mondorescue -m mageia-4-x86_64  -T docker prepve
130$ docker images
131$ ls -al /var/ftp/pub/pb/test/mageia/4/x86_64
132$ ssh bruno@www.mondorescue.org ls -altrg /prj/ftp/test/mageia/4/x86_64
133
134# Look at what was created
135$ docker images
136$ docker history localhost:5000/pb:mageia-4-x86_64-pb-pb
137
138$ docker ps -a
139$ docker attach <ctnid>
140$ docker images
141$ docker run -ti <imgid> /bin/bash
142$ pb -h
143$ docker run -ti <imgid> /bin/bash
144$ ls -al /var/ftp/pub/pb/test/mageia/4/x86_64
145#
146
147# Now check what you built:
148# On a deb based distro:
149pb -p pb -m debian-9-x86_64 sbx2ve
150docker run -ti pb:debian-9-x86_64 /bin/bash
151pb --version
152cd /etc/apt/sources.list.d/
153apt-get install gnupg
154wget -qO - ftp://ftp.mondorescue.org/debian/9/pb.pubkey | apt-key add -
155wget ftp://ftp.mondorescue.org/debian/9/pb.sources.list
156apt-get update
157apt-get install project-builder
158pb --version
159
160# On a rpm based distro
161pb -p pb -m fedora-25-x86_64
162docker run -ti pb:fedora-25-x86_64 /bin/bash
163pb --version
164cd /etc/yum.repos.d
165wget ftp://ftp.mondorescue.org/fedora/25/x86_64/pb.repo
166dnf install project-builder
167pb --version
168
169# WIth VMs
170# Now  show how easy it's to build for another project for which I'm upstream
171-> pb -p mondorescue -m debian-6.0-x86_64 sbx2ve
172
173# Now  show how easy it's to build for another project for which I'm not upstream with patches
174-> pb -p afio -r 2.5 -m debian-6.0-x86_64 sbx2ve
175
176# Look at conf files
177cat ~/.pbrc.yml
178cat /home/rpmbootstrap/.pbrc.yml
179cat ~/svn-git/pb/projects/afio/pbconf/2.5/afio.yml
180cat ~/svn-git/pb/projects/afio/pbconf/2.5/afio/rpm/afio.spec
181cat ~/svn-git/pb/projects/afio/pbconf/2.5/afio/deb/control
182ls -R ~/svn-git/pb/projects/afio/pbconf/2.5/
183
184# Short Lab
185# in pblab account
186# prepa
187# As root
188rm -rf /prj/svn
189svnadmin create /prj/svn
190cat >> /prj/svn/conf/authz << EOF
191[/]
192pblab = rw
193* = r
194EOF
195cat >> /prj/svn/conf/passwd << EOF
196pblab = pblab
197EOF
198cat > /prj/svn/conf/svnserve.conf << EOF
199[general]
200password-db = passwd
201authz-db = authz
202[sasl]
203EOF
204killall svnserve
205~pblab/bin/rc.local
206
207# as pblab
208rm -rf pb .pbrc.yml
209cat > afio.yml.add << EOF
210  defpkgdir:
211    afio : dummy
212  pbpackager:
213    default : Big Chief <bigchief@hp.com>
214  projver:
215    afio : 2.5
216  projtag:
217    afio : 1
218  pbprojurl:
219    afio : ftp://localhost/src/afio-2.5.tar.gz
220  pbrepo:
221    afio : ftp://localhost
222EOF
223
224pb -p afio clean
225cat ~/.pbrc.yml
226cat >> ~/.pbrc.yml << EOF
227---
228  pbconfurl:
229    afio: svn://localhost/pb/afio/pbconf
230EOF
231echo "  pbdefdir:" >>  ~/.pbrc.yml
232echo "    default: \$ENV{'HOME'}/pb" >>  ~/.pbrc.yml
233mkdir pb
234svn import pb svn://localhost/pb -m "Initial creation of pb repo"
235# passwd asked here
236
237cd pb
238svn co svn://localhost/pb .
239pb -p afio newproj afio
240# passwd asked here
241
242cat ~/afio.yml.add >> afio/pbconf/afio.yml
243pb -p afio sbx2build
244
245# with Ubuntu CD
246cat >> ~/.pbrc.yml << EOF
247  vmpath:
248    default: /home/qemu
249EOF
250
Note: See TracBrowser for help on using the repository browser.