source: ProjectBuilder/devel/pb-doc/pb-demo

Last change on this file was 2284, checked in by Bruno Cornec, 7 years ago

Now uses pbprojurl instead of pburl to be consistent with pbconfurl

File size: 7.6 KB
RevLine 
[1915]1demo of project-builder.org
[814]2===========================
3
4# First demonstrate the way of working for pb itself
[1835]5cd ~/local/pb|~/pb|~/svn-git/pb
[814]6# Show the various versions available in this SVK exported dir
7ls
8# get the current tag of the SVK repository
[2135]9#svk info
10# get it from SVN directly
11svn info svn+ssh://svn.mondorescue.org/prj/svn/pb/devel
[814]12
13# get the current version of project-builder
14rpm -q project-builder
[817]15pb --help
[1835]16pb
[814]17
18# Decide to build a package for project-builder based on that devel version
19# to replace the one currently installed
[1835]20pb -p pb -r devel sbx2build|cms2build
[814]21
22# Show the upstream part
[2084]23ls -altg /home/bruno/svn-git/pb/pbdelivery/
[2135]24tar tvfz /home/bruno/svn-git/pb/pbdelivery/project-builder-XXX.tar.gz
[814]25
26# Show the pb specific part
[2084]27tar tvfz /home/bruno/svn-git/pb/pbdelivery/project-builder-develXXX.pbconf.tar.gz
[814]28
29# Now make the packages
30pb -p pb build2pkg
31
[2135]32# Look at the latest packages created
[2084]33ls -altrg /home/bruno/svn-git/pb/pbbuild/RPMS/noarch
[814]34
35# Install the generated packages
[2084]36sudo urpmi /home/bruno/svn-git/pb/pbbuild/RPMS/noarch/*.rpm
[814]37
38# Check that it's the right one
[816]39rpm -q project-builder
[1968]40pb -h
[1835]41git svn info
[814]42
[817]43# Now show how easy it's to build for another distro in a VM
[1101]44ls /home/qemu
[1915]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/
[1835]48
49pb -p pb -m mageia-3-i386 sbx2vm
[817]50# Now show how easy it's to build for another distro in a VE
[1288]51ls /home/rpmbootstrap
[1835]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/
[816]57
[1960]58# Docker part
[1980]59# Mount the external HDD if needed
60sudo mount /dev/sdc1 /mnt
[2079]61$ sudo mount -o bind /mnt/docker /var/cache/docker
[1980]62# Then restart docker to avoid errors with Attempt to write a readonly database
[2006]63$ sudo systemctl restart docker
[2135]64#$ sudo systemctl restart docker_registry
[1915]65# Now show how easy it's to build for another distro in a Docker VE
66# Create Docker container
[2006]67$ docker images
[1980]68
[2006]69# If docker issue with net, restart docker
70$ sudo ip link delete docker0
71$ sudo systemctl restart docker.service
72
[1980]73# Building with rpmbootstrap for a distro
[2006]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}'
[2173]81$ docker run -ti `docker images | grep mageia-5 | head -1 | awk '{print $3}'` /bin/bash
[2006]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
[2135]94$ pb -p pb -m mageia-5-x86_64 -T docker sbx2setupve
[2006]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
[1960]107# On another distro already preped
[2006]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
[2135]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
[2006]119
[2135]120# and then another project
121pb -p mondorescue -T docker -m ubuntu-15.04-x86_64 -T docker prepve
122
123# After the Video:
[1980]124# Another container Ubuntu 13.10
[2135]125$ pb -p pb -m ubuntu-15.04-x86_64 -T docker build2ve
126$ ls -al /var/ftp/pub/pb/test/ubuntu/15.04
[1960]127
[1915]128# On another project
[2006]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
[1915]133
[1942]134# Look at what was created
[2006]135$ docker images
136$ docker history localhost:5000/pb:mageia-4-x86_64-pb-pb
[1915]137
[2006]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#
[1980]146
[2237]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
[1980]169# WIth VMs
[817]170# Now show how easy it's to build for another project for which I'm upstream
[1835]171-> pb -p mondorescue -m debian-6.0-x86_64 sbx2ve
[1288]172
[817]173# Now show how easy it's to build for another project for which I'm not upstream with patches
[1835]174-> pb -p afio -r 2.5 -m debian-6.0-x86_64 sbx2ve
[816]175
[1101]176# Look at conf files
[2252]177cat ~/.pbrc.yml
178cat /home/rpmbootstrap/.pbrc.yml
179cat ~/svn-git/pb/projects/afio/pbconf/2.5/afio.yml
[1838]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
[1835]182ls -R ~/svn-git/pb/projects/afio/pbconf/2.5/
[1288]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
[2252]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
[2284]218 pbprojurl:
[2252]219 afio : ftp://localhost/src/afio-2.5.tar.gz
220 pbrepo:
221 afio : ftp://localhost
[1288]222EOF
223
224pb -p afio clean
[2252]225cat ~/.pbrc.yml
226cat >> ~/.pbrc.yml << EOF
227---
228 pbconfurl:
229 afio: svn://localhost/pb/afio/pbconf
[1288]230EOF
[2252]231echo " pbdefdir:" >> ~/.pbrc.yml
232echo " default: \$ENV{'HOME'}/pb" >> ~/.pbrc.yml
[1288]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
[2252]242cat ~/afio.yml.add >> afio/pbconf/afio.yml
[1288]243pb -p afio sbx2build
244
245# with Ubuntu CD
[2252]246cat >> ~/.pbrc.yml << EOF
247 vmpath:
248 default: /home/qemu
[1288]249EOF
250
Note: See TracBrowser for help on using the repository browser.