First you need to get all the dependencies installed
On Ubuntu, type the following:
sudo apt-get install python python-gtk2 python-zopeinterface python-psycopg2 python-imaging \ python-reportlab postgresql postgresql-client python-dateutil python-mako python-gudev \ python-poppler python-webkit python-twisted-core python-twisted-web librsvg2-common python-xlwt \ gettext intltool git git-review python-setuptools pep8 pyflakes python-mock pylint python-storm
Downloading the Stoq sources
It'll download the source for stoq, stoqdrivers and kiwi and help you setup the environment variables and other things needed to run stoq smoothly:
You can configure postgresql in a few different way, the easiest is to just create a new database user. To be compatible with the wizard you'll need to create a user with the same username as yours.
On a Debian/Ubuntu system this is accomplished with:
sudo -u postgres createuser -ds $USER
For other systems, just su / sudo to the postgres user and run createuser -ds
When you created a user you need to create an initial stoq.conf, this is easiest to do by using the first time wizard in stoq. It will automatically run if you haven't started stoq before or if you have an empty ~/.stoq directory.
Then it's enough to just start stoq
--sql = show all sql commands --debug = run in pdb and enable a few debugging only features
Administrating the database
stoqdbadmin contains a couple of commands that will help the development and administration of your stoq database
Pass in -v se be more verbose.
Creates a database shell where you can type SQL commands.
Create a python console with a stoq environment fully setup where you for instance can manipulate domain objects.
Update the database schema to the latest version
Pass in the -b option to avoid creating a backup
Creates a new database.
Pass in the -e option to also create a set of examples, good for developer testing.
This is also used to remove the existing database, when you need to reset it for some reason. But be careful.
Now when you're done here, head over to Documentation and start learning how the different Stoq components are related.
Working with Git
- Links explaining basics, staging area, working tree
- For bzr users this might help:
- A couple of other open source projects has documented the Gerrit process
- Create an account on Gerrit
- Add your SSH key
Gerrit adds a commit hook (in .git/hooks/commit-msg) to add a Change-Id line which is then used to identify the gerrit issue with a specific git commit. Gerrit will not add a Change-Id if one already exists in a commit.
Sometimes you need to remove the Change-Id manually, for example when you want to change the branch you submitted your patch to. Eg, it was first target to go into the branch release-1, but then it changed and you want to push it to release-2.
- Uploading a patch
If you are using repo (Repo instructions), you can send your changes with the command:
$ repo upload
Or if you used the git-stoq integration you will have a branch called review, then you can just do
$ git review
to get the patch uploaded.
This is the same as doing (in a more verbose way):
$ git push ssh://gerrit.async.com.br:29418/stoq.git HEAD:refs/for/master
That submits your current working tree (HEAD) for review (refs/for) in the master branch (/master)
- git commit --amend
If you need to update a patch you first modify your source tree and then amend the patch to the previous commit. This is done so that the Change-Id gerrit added is the same.
Remember to git add all the modified files or add the -a flag to git commit (all files)
- update for review
If you want to update patch, you just submit it again, via git-review
- Gerrit: rebase button
If a patch you depended on changed somehow you might need to rebase it. That can be done by downloading the patch and running rebase normally.
Alternatively you can just click on the rebase button in the ui and it will do it for you.
- Once the code has passed the tests (so the verified flag is set) and a reviewer has approved the code
it will be integrated. Someone has to push the 'submit' button for that to happen.