Puritan: Difference between revisions

From OLPC
Jump to navigation Jump to search
No edit summary
 
(15 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Software}}
{{Software}}
<b><font color=red><big>For information on current-day OLPC software build systems, see [[Build system]].</big></font></b>
=== Puritan ===
[http://dev.laptop.org/git/users/mstone/puritan Source code]. [http://dev.laptop.org/git?p=users/mstone/puritan;f=README;hb=ui README]. Latest version: '''0.4'''.


{{Dated}}
Puritan is a disk-image compiler which converts source material including [http://dev.laptop.org/git?p=users/mstone/puritan;f=config.py;hb=devel_jffs2#l32 packages], [http://dev.laptop.org/git?p=users/mstone/puritan;f=config.py;hb=devel_jffs2#l163 activities], and [http://dev.laptop.org/git?p=users/mstone/puritan;f=install_hacks.py;hb=devel_jffs2 hacks] into installable disk images. It consists of two pieces: a [http://dev.laptop.org/git?p=users/mstone/puritan;f=puritan/main.py;hb=ui UI] and a family of '''compilations''' ([http://dev.laptop.org/git?p=users/mstone/puritan;f=main.py;hb=devel_jffs2 example]). The compilations are simple Python programs which populate a filesystem with the materials you supply, then wrap it up with a bow-tie. The UI runs the compilations in a controlled environment created by [http://fedoraproject.org/wiki/Projects/Mock Mock] and configured according to the compilation's [http://dev.laptop.org/git?p=users/mstone/puritan;f=bootstrap;hb=devel_jffs2 bootstrap] and [http://dev.laptop.org/git?p=users/mstone/puritan;f=dependencies;hb=devel_jffs2 dependencies] files.




== Puritan ==
[http://dev.laptop.org/git/users/mstone/puritan Source code]. [http://dev.laptop.org/git?p=users/mstone/puritan;f=README;hb=ui README]. Latest version: ''ui:'' '''[http://dev.laptop.org/git?p=users/mstone/puritan;a=tree;hb=e7a6bdb6dfa0b6bd067a0c9bb12c480bea09b81f e7a6bdb6]''', ''compilation:'' '''[http://dev.laptop.org/git?p=users/mstone/puritan;a=tree;hb=8b944b2dcdb770acf802bf7324a1d6c26bc07573 8b944b2d]'''.
{{:Puritan/Introduction}}


== Principles ==
===== Fedora Instructions =====
{{:Puritan/Principles}}


The Puritan UI is invoked by installing a [http://dev.laptop.org/~mstone/releases/RPMS/ puritan rpm] (built from the [http://dev.laptop.org/git?p=users/mstone/puritan;a=shortlog;h=ui ui branch])


== Instructions ==
wget -O puritan.rpm http://dev.laptop.org/~mstone/releases/RPMS/puritan-0.4-1.olpc2.noarch.rpm
{{:Puritan/Instructions}}
sudo rpm -Uvh puritan.rpm


then by checking out a 'puritan compilation' to be run by <tt>/usr/bin/puritan</tt>


== Configuration ==
$(git clone git://dev.laptop.org/users/mstone/puritan compilation; cd compilation; git checkout origin/devel_jffs2)
Puritan is highly and easily configurable by means of small modifications to the files and directories contained in each compilation. Detailed suggestions on how to [[Puritan/Configuration|configure Puritan]] are available.
puritan -v ./compilation HEAD ./results build


If you want to download a set of RPMs for post-processing (for example, because you want to layer a risky feature on top of them), you can also run


== Notes and Tricks ==
puritan -v ./compilation HEAD ./results download


* Use the [http://dev.laptop.org/git/users/mstone/puritan source], Luke! (It was written to be read!)
Your results should appear in ./results.
* with some uis and compilations, various subcommands (e.g. 'build') may fail because /etc/mock/fedora-9-i386.cfg is not present in Debian's mock package 0.9.7-2
** one workaround is to create it from http://teach.laptop.org/~mstone/fedora-9-i386.cfg.
* Mock and SElinux do not interact very well.
** at least one workaround is discussed [http://fedoraproject.org/wiki/Extras/MockTricks#Using_mock_under_SELinux on the Fedora MockTricks]] page.
** the author simply disables selinux with <tt>sudo setenforce 0</tt> in order to avoid the hassle.
* [http://meld.sourceforge.net/ Meld] is a great tool for diffing the filesystem trees produced by the 'produce_tree' build stage and for comparing your builds to those made by others.
* [[Git]] will be your friend, but, to get the most out of the relationship, you're going to have to invest in it. Ask for help when you need it!
** <tt>gitk --all</tt> or <tt>git log</tt> will show you lots of other compilations you could run!
* The latest compilation now automatically caches packages in a directory called 'smart/packages' inside the compilation. Some other state is also cached, so if things start behaving strangely, try deleting the 'smart' directory.


== Help Out ==


Puritan was designed from the ground up to support decentralized development because its author felt that deployment autonomy was going to be critical to the success of the OLPC project. Therefore, please use your autonomy! In particular, please help improve puritan by:


* Using it! As much as you can! Produce cool disk images! Publish your patches! (patch review available on request).
===== Debian Instructions =====

''Note: yum seems to be broken on Debian at the moment, which is preventing this recipe from working. :('' --[[User:Mstone|Michael Stone]] 03:02, 7 March 2008 (EST)

sudo apt-get install mock git-core
sudo usermod -a -G mock $USERNAME
git clone git://dev.laptop.org/users/mstone/puritan ui
$(git clone git://dev.laptop.org/users/mstone/puritan compilation; cd compilation; git checkout origin/devel_jffs2)
/usr/bin/python2.5 ui/puritan/main.py ./compilation HEAD ./results



==== Help Out ====
Finally, please help improve puritan by:

* Making puritan work on your platform - it's only dependencies are python2.5, git-core, and mock!
* Making puritan work on your platform - it's only dependencies are python2.5, git-core, and mock!
* Maintaining the devel_ext3 compilation
* Maintaining the devel_ext3 compilation
* Adding some reasonable package or buildroot caching system so that it runs faster without impairing build repeatability
* Adding some reasonable ''automatic'' package or buildroot caching system so that it runs faster without impairing build repeatability
* Improving the UI with commands for manipulating compilations, or for diffing builds, or for profiling compilations, or ...
* Improving the UI with commands for manipulating compilations, or for diffing builds, or for profiling compilations, or ...


[[Category:Build system]]
[[Category:Puritan]]

Latest revision as of 16:56, 8 February 2011

For information on current-day OLPC software build systems, see Build system.


Emblem-warning.png The currency of this article or section may be limited by out-of-date information.
There may be relevant discussion on its talk page


Puritan

Source code. README. Latest version: ui: e7a6bdb6, compilation: 8b944b2d. Puritan is a disk-image compiler which converts source material including packages, activities, and hacks into installable disk images. It consists of two pieces: a UI and a family of compilations (example). The compilations are simple Python programs which populate a filesystem with the materials you supply, then format it for distribution. The UI runs the compilations in a controlled environment created by Mock and configured according to the compilation's bootstrap and dependencies files.

Puritan was developed as a replacement for Pilgrim but was never officially adopted by OLPC. For details on the active OLPC build system, see Build system.

Principles

Puritan is based on several fundamental principles.

  1. Tools should be usable for both decentralized and centralized patterns of development.
  2. People **will** want to make unpackaged changes to their builds.
  3. Caching matters.
  4. Interactive development matters.
  5. Build reproducibility matters.
  6. Error-detection, handling, and cleanup matter.
  7. People working on the OLPC build system will become accustomed to git and python.


Instructions

Preparation

To use Puritan, you need to install dependencies:

 # NB: mock >= 0.9.7 is needed.
 # debian:
 sudo apt-get install mock git-core
 # fedora:
 sudo yum install mock git-core
 # both
 sudo usermod -a -G mock $USER
 newgrp mock

and to check out and run a 'ui' and a 'compilation'.

 (git clone git://dev.laptop.org/users/mstone/puritan compilation; cd compilation; git branch --track 767 origin/767; git checkout 767)
 git clone git://dev.laptop.org/users/mstone/puritan ui
 python2.5 ui/puritan/main.py   # read help
 sudo python2.5 ui/puritan/main.py -v build ./compilation HEAD ./results -- -i


Interactive Debugging

The '-i' option above enables an interactive error-handling mode. If an error occurs,

with the most recent compilation and ui, you will be dropped directly into bash inside the buildroot.

  • to resume the compilation, type
 exit 0
  • to quit the compilation, type
 exit 1

with earlier compilations which still support interactive error-handling: instructions


Other Notes

Fedora

Note: if you encounter permission errors when running this command, you may need to:

 sudo setenforce 0  # disable selinux

Note: a word of warning: while _my_ uis and compilations will treat your computer nicely, other people's might not. Caveat emptor.

Ubuntu

mock_0.9.7-2 on ubuntu requires [1] in order to run. Additionally, if you run puritan as root, you should either

usermod -a -G mock -u $SUDO_UID
unset SUDO_UID  # or
All

Some puritan compilations now feature a 'download' operation which can be used to download all packages that the compilation will install for later (offline) use:

 sudo python2.5 ui/puritan/main.py -v download ./compilation HEAD ./results 

This command will generate a program in the results directory which can be used to download the packages.


Configuration

Puritan is highly and easily configurable by means of small modifications to the files and directories contained in each compilation. Detailed suggestions on how to configure Puritan are available.


Notes and Tricks

  • Use the source, Luke! (It was written to be read!)
  • with some uis and compilations, various subcommands (e.g. 'build') may fail because /etc/mock/fedora-9-i386.cfg is not present in Debian's mock package 0.9.7-2
  • Mock and SElinux do not interact very well.
    • at least one workaround is discussed on the Fedora MockTricks] page.
    • the author simply disables selinux with sudo setenforce 0 in order to avoid the hassle.
  • Meld is a great tool for diffing the filesystem trees produced by the 'produce_tree' build stage and for comparing your builds to those made by others.
  • Git will be your friend, but, to get the most out of the relationship, you're going to have to invest in it. Ask for help when you need it!
    • gitk --all or git log will show you lots of other compilations you could run!
  • The latest compilation now automatically caches packages in a directory called 'smart/packages' inside the compilation. Some other state is also cached, so if things start behaving strangely, try deleting the 'smart' directory.

Help Out

Puritan was designed from the ground up to support decentralized development because its author felt that deployment autonomy was going to be critical to the success of the OLPC project. Therefore, please use your autonomy! In particular, please help improve puritan by:

  • Using it! As much as you can! Produce cool disk images! Publish your patches! (patch review available on request).
  • Making puritan work on your platform - it's only dependencies are python2.5, git-core, and mock!
  • Maintaining the devel_ext3 compilation
  • Adding some reasonable automatic package or buildroot caching system so that it runs faster without impairing build repeatability
  • Improving the UI with commands for manipulating compilations, or for diffing builds, or for profiling compilations, or ...