Merge lp:~inetpro/ubuntu-africa/build-instructions into lp:ubuntu-africa

Proposed by Gustav H Meyer on 2015-04-09
Status: Needs review
Proposed branch: lp:~inetpro/ubuntu-africa/build-instructions
Merge into: lp:ubuntu-africa
Diff against target: 251 lines (+247/-0)
1 file modified
pages/build-instructions.rst (+247/-0)
To merge this branch: bzr merge lp:~inetpro/ubuntu-africa/build-instructions
Reviewer Review Type Date Requested Status
Ubuntu Africa Site Developers 2015-04-09 Pending
Review via email: mp+255756@code.launchpad.net

Description of the Change

Added build-instructions

To post a comment you must log in.

Unmerged revisions

5. By Gustav H Meyer on 2015-04-09

Added build-instructions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'pages/build-instructions.rst'
2--- pages/build-instructions.rst 1970-01-01 00:00:00 +0000
3+++ pages/build-instructions.rst 2015-04-09 19:48:04 +0000
4@@ -0,0 +1,247 @@
5+.. title: Build Instructions
6+.. slug: build-instructions
7+.. date: 2015-04-06 12:09:11 UTC
8+.. tags:
9+.. category:
10+.. link:
11+.. description:
12+.. type: text
13+
14+.. sectnum::
15+
16+.. class:: alert alert-info pull-right
17+
18+.. contents:: Table of Contents
19+ :depth: 2
20+
21+Quick Background
22+================
23+
24+The Ubuntu Africa site is a static HTML site generated by the `Nikola <http://getnikola.com/>`_ site generator. Content is written using `reStructuredText <http://docutils.sourceforge.net/rst.html>`_, an easy-to-read, what-you-see-is-what-you-get plaintext markup syntax and parser system, a component of `Docutils <http://docutils.sourceforge.net/index.html>`_. Nikola is written in Python and is in the Ubuntu repositories.
25+
26+.. note::
27+
28+ Nikola version 7.3 or higher is required
29+
30+The tutorial below will show you how to checkout, modify, commit, and propose a merge for the Ubuntu Africa web site. While these instructions are specific about the site, they will work for almost any other project on `Launchpad <https://launchpad.net/>`_.
31+
32+Our QA site is available at: http://ubuntu-africa.snyman.info/
33+
34+Build Environment (Simple Method)
35+=================================
36+
37+Packages to install
38+-------------------
39+
40+::
41+
42+ $ sudo apt-get install bzr qbzr python-virtualenv python-webassets python-dev
43+
44+Make a virtual environment
45+--------------------------
46+
47+virtualenv is a tool to create isolated Python virtual environments and creates a folder which contains all the necessary executables to use the packages that a Python project would need. `More... <http://docs.python-guide.org/en/latest/dev/virtualenvs/>`_
48+
49+::
50+
51+ $ virtualenv --system-site-packages ~/virtualenv
52+ $ ~/virtualenv/bin/pip install --upgrade nikola
53+
54+This allows you to run Nikola like so:
55+
56+::
57+
58+ $ ~/virtualenv/bin/nikola build
59+
60+Set up an alias (optional)
61+~~~~~~~~~~~~~~~~~~~~~~~~~~
62+
63+Edit your .bashrc file and add the following line:
64+
65+::
66+
67+ alias activate_nikola="source ~/virtualenv/bin/activate"
68+
69+Then you can simply activate your virtual environment and use Nikola like so:
70+
71+::
72+
73+ $ activate_nikola
74+ $ nikola build
75+
76+To deactivate, simply type in "deactivate":
77+
78+::
79+
80+ $ deactivate
81+
82+Build Environment (Alternative / Longer Method)
83+===============================================
84+
85+Packages to install
86+-------------------
87+
88+::
89+
90+ $ sudo apt-get install bzr git libxml2-dev libxslt1-dev python-dateutil python-dev python-pygments python-virtualenv zlib1g-dev qbzr
91+
92+Make a virtual environment
93+--------------------------
94+
95+`pyenv install instructions <https://github.com/alanorth/nairobilug.or.ke/blob/9e8ec6fb9240b03dea74dada1a6d3a0af752057b/README.md>`_
96+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
97+
98+::
99+
100+ $ git clone https://github.com/yyuu/pyenv.git ~/.pyenv
101+ $ git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
102+
103+Use editor of your choice to add following lines to end of ~/.bashrc
104+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
105+
106+::
107+
108+ # Enable pyenv
109+ # See: https://github.com/yyuu/pyenv#basic-github-checkout
110+ if [[ -d ~/.pyenv ]]; then
111+ export PYENV_ROOT="$HOME/.pyenv"
112+ export PATH="$PYENV_ROOT/bin:$PATH"
113+
114+ eval "$(pyenv init -)"
115+ # optionally enable pyenv-virtualenv
116+ # See: https://github.com/yyuu/pyenv-virtualenv
117+ if [[ -d ~/.pyenv/plugins/pyenv-virtualenv ]]; then
118+ eval "$(pyenv virtualenv-init -)"
119+ fi
120+ fi
121+
122+Read and execute commands from modified ~/.bashrc
123+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
124+
125+::
126+
127+ $ source ~/.bashrc
128+
129+Setup Projects folder and nikola environment
130+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
131+
132+::
133+
134+ $ pyenv virtualenv Nikola
135+ $ pyenv activate Nikola
136+ $ pip install --upgrade nikola
137+ $ pip install webassets
138+ $ nikola version
139+
140+Bazaar Project Checkout and Testing
141+===================================
142+
143+- `Bazaar User Guide <http://doc.bazaar.canonical.com/latest/en/user-guide/index.html>`_
144+- `Bazaar in five minutes <http://doc.bazaar.canonical.com/latest/en/mini-tutorial/>`_
145+
146+Initialise Bazaar environment
147+-----------------------------
148+
149+If you don't have an account on Launchpad.net, go to `<https://launchpad.net/+login>`_ to create one and log in. Once logged in, you'll need to make sure you have your SSH public key uploaded to your account at https://launchpad.net/people/+me/+editsshkeys. See `Creating an SSH Key Pair <https://help.launchpad.net/YourAccount/CreatingAnSSHKeyPair>`_ for more info.
150+
151+You need to configure Bazaar with your name and email address so that your commits can be identified. You should use your email address which is registered on Launchpad::
152+
153+ $ bzr whoami "MyName MySurname <MyEmail@address.com>"
154+ $ bzr launchpad-login MyLaunchPadID
155+ $ bzr launchpad-login
156+
157+Checkout latest code and test with Nikola
158+-----------------------------------------
159+
160+::
161+
162+ $ mkdir ~/Projects && cd ~/Projects
163+ $ bzr init-repo ubuntu-africa
164+ $ cd ~/Projects/ubuntu-africa
165+ $ bzr co lp:ubuntu-africa trunk
166+ $ cd ~/Projects/ubuntu-africa/trunk/
167+ $ nikola build && nikola serve
168+
169+Create your own Branch
170+~~~~~~~~~~~~~~~~~~~~~~
171+
172+In order to work on the project you need to create branches to do the work in, edit and commit your changes and then push your local branch up to Launchpad, and then propose a merge, and finally merge your changes in to the main branch.
173+
174+.. note::
175+
176+ You can see the history of a branch by browsing its log with `bzr log`.
177+
178+ Once you have completed some work, it’s a good idea to review your changes prior to permanently recording it. This way, you can make sure you’ll be committing what you intend to.
179+
180+ Two bzr commands are particularly useful here: **status** and **diff**.
181+
182+::
183+
184+ $ cd ~/Projects/ubuntu-africa
185+ $ bzr branch trunk new-feature-page
186+ $ cd new-feature-page
187+
188+Make your edits
189+~~~~~~~~~~~~~~~
190+
191+::
192+
193+ $ nikola new_page
194+ ....
195+ Title: New Feature
196+ ....
197+ $ vim pages/new-feature.rst
198+ $ bzr add
199+ adding pages/new-feature.rst
200+
201+Commit your edits
202+~~~~~~~~~~~~~~~~~
203+
204+::
205+
206+ $ bzr commit -m "Added a new-feature page"
207+ Committing to: ~/Projects/ubuntu-africa/new-feature-page/
208+ added pages/new-feature.rst
209+ Committed revision ##.
210+
211+Push a Branch
212+-------------
213+
214+In order to have your branch visible to the other developers, and in order to propose a merge, you need to push it up to Launchpad. This will create a remote branch on Launchpad, identical to your local branch.::
215+
216+ $ bzr push lp:~MyLaunchPadID/ubuntu-africa/new-feature-page
217+ Using default stacking branch /+branch-id/######## at chroot-#####:///~MyLaunchPadID/ubuntu-africa/
218+ Created new stacked branch referring to /+branch-id/########.
219+
220+Propose a Merge
221+---------------
222+
223+Go to your code page on Launchpad at ``https://code.launchpad.net/~MyLaunchPadID`` or to the main `Ubuntu Africa Project Code Page <https://code.launchpad.net/ubuntu-africa>`_, click on your branch in the list and then click on "Propose a Merge" or ask others to review your code before requesting a merge proposal.
224+
225+Merging
226+-------
227+
228+.. attention::
229+
230+ Merging into trunk is done by the core developers. If you are not a core developer, you won't be able to commit to trunk.
231+
232+In your local ``trunk`` directory, run the merge command::
233+
234+ $ bzr merge lp:~john-doe/ubuntu-africa/new-contact-page
235+ +N pages/contact.rst
236+ All changes applied successfully.
237+
238+This merges the changes from that remote branch into your local files. Now you need to commit those changes into the repository, which will send them up to the main branch::
239+
240+ $ bzr commit -m "Add a new contact page" --author="John Doe <john.doe@example.com>"
241+
242+Once again, you need to specify a commit message (usually just a copy of the merge proposal message or the last commit message in the remote branch), and the author of the commit. This author flag gives credit to the original author of the changes, even if they do not have permission to write to the main repository. Give credit where credit is due.
243+
244+Update your local copy with changes made by others
245+--------------------------------------------------
246+
247+One of the important aspects of working with others in a team is keeping your checkout up to date with the latest changes made by others to the central trunk.::
248+
249+ $ cd ~/Projects/ubuntu-africa/trunk/
250+ $ bzr update
251+

Subscribers

People subscribed via source and target branches