rbm_tutorial.asc 3.4 KB

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