1RBM_TUTORIAL(7) RBM_TUTORIAL(7)
2
3
4
6 rbm_tutorial - A tutorial introduction to rbm
7
9 This tutorial will explain how to start using rbm to build rpm and
10 debian packages for different distributions.
11
12 In this example we will package the tor software.
13
15 The first step is to create a rbm workspace. In this example, we will
16 use ~/rbm, but you could use anything :
17
18 $ mkdir ~/rbm
19 $ cd ~/rbm
20
21 The first thing to do is to create the main configuration file, which
22 will contain the configuration for all projects in this workspace. For
23 now, we will just add the compress_tar option, and add more options
24 later when needed.
25
26 $ cat > rbm.conf <<END
27 compress_tar: xz
28 END
29
30 The compress_tar options means that we want tarballs to be compressed
31 using xz.
32
34 We will now add the tor project. To do this we just create the
35 directory inside the projects directory, and put a config file inside
36 containing the configuration for the project. The main option that we
37 will set is git_url, which is the url used to clone the git repository
38 of the software. If your project is using mercurial rather than git,
39 you could set hg_url instead.
40
41 $ mkdir -p projects/tor
42 $ cat > projects/tor/config <<END
43 git_url: https://git.torproject.org/tor.git
44 END
45
46 We can check that the project is correctly defined using the projects
47 command :
48
49 $ rbm projects
50 tor
51
52 And we can display the tor project configuration using the showconf
53 command :
54
55 $ rbm showconf tor
56 ---
57 git_url: https://git.torproject.org/tor.git
58
60 The first thing to do when adding a new project is to configure the
61 version settings: rbm needs to be able to compute the version of the
62 software, for any git commit.
63
64 By default, rbm will use the latest tag on which a commit is based as
65 the version number. Sometimes it works, when the project uses version
66 numbers as tags, but this is not always the case. Alternatively, you
67 can define the version_command option with a shell script or command
68 that will print the version number.
69
70 For tor, we will use the version_command option. The version of the
71 software is defined in the ChangeLog file, so we will use a simple
72 command to get it. The tor config file now look like this :
73
74 git_url: https://git.torproject.org/tor.git
75 version_command: perl -ne 'if (m/^Changes in version ([^-]+)-.*$/) { print "$1\n"; exit }' < ChangeLog
76
77 Using the showconf command, we can check the value of the version
78 option for different commits :
79
80 $ rbm showconf tor version --git-hash master
81 0.2.5.1
82 $ rbm showconf tor version --git-hash tor-0.2.4.17-rc
83 0.2.4.17
84
85 The first time you run this command, the git repository will have to be
86 cloned, which can take some time.
87
89 After setting the configuration for the version, we are now ready to
90 create a tarball based on a git commit. We can do this using the tar
91 command :
92
93 $ rbm tar tor --git-hash master
94 Created /home/boklm/rbm/out/tor-0.2.5.1.tar.xz
95 $ rbm tar tor --git-hash tor-0.2.4.17-rc
96 Created /home/boklm/rbm/out/tor-0.2.4.17.tar.xz
97
99 TODO
100
102 TODO
103
105 TODO
106
108 rbm(1)
109
110
111
112 07/23/2021 RBM_TUTORIAL(7)