MIFAR UI College of Medicine
Site Map Site Map Documentation Physiologic Imaging

Setup for MIFAR development

Mifar is hosted as a bazaar repository, instead of CVS or subversion. Since bazaar has a smaller user base than many other source control systems, step by step instructions for setting up a bazaar development enviroment and getting the mifar sources are listedhere

Repository

The mifar repository may be accessed via one of two URLs:

Inside there we have:

mifar/
  dev/
    0.6/
    0.6.3/
    0.7/
  release/
  stable/

mifar/dev/0.6/ is a conversion of all of the CVS ancestry of the HEAD branch. It has a lot of revisions (~2500) and is only maintained for historical reasons.

mifar/dev/0.7/ is the current active development version. This is the code you want if your going to do new mifar development.

mifar/dev/0.6.3/ is the last version of mifar that is in production use at the University of Iowa. Only patches and minor improvments are still being done on this code. Many of the server programs in this version are not cross platform, and will not be updated as they are being replaced in 0.7.

Installing Bzr

In general see the Installation instructions But to be specific:

  • Install python2.4. Either compile from source, or however you can get it.

  • Install elementtree and cElementTree (I don't think Red Hat has this, but debian/Ubuntu does). Installing from source is basically just downloading and running python2.4 setup.py install.

  • Install paramiko for sftp support. Paramiko is a python-only package that is also a simple 'python2.4 setup.py install'

    Paramiko only needs pycrypto on platforms without openssh installed (like cygwin) or if you want to run the test suite.

  • Get the bzr source tree, you'll need at least version 0.7rc1. This package is also 'setup.py' in the source tree, but unless you want stuff installed from source to be mixed in with you'll need an extra argument:

  • Plugins. Bazaar is a modular source control system that supports plugins. A listing of all Bazaar plugins can be found here . The mifar build scripts specifically make use of the version-info plugin. To install the plugin system wide:

    • Find the Bazaar plugin directory, usually this is /usr/lib/python2.4/site-packages/bzrlib/plugins under UNIX and C:\python2.4\site-packages\bzrlib\plugins under Windows.
    • Create the subdirectory: version-info under the plugins directory
    • Copy all files from http://bzr.arbash-meinel.com/plugins/version_info/ into the newly created directory.
  • User settings for bazaar are maintianed in your home directory under the directory ./bazaar for POSIX systems and %APPDATA/bazaar/2.0 for windows systems. A shell config file with just your proper email address is good enough for starters. So create the file $HOME/.bazaar/bazaar.conf, or in windows %APPDATA%bazaar2.0bazaar.conf, and include your proper email address in the default section. For eample my starter bazaar.conf file looks like:

    [DEFAULT]
    email = Chris Piker <christopher-piker@uiowa.edu>
    

    To test this file issue:

    bzr whoami
    

    and make sure the output looks appropriate.

Using Bazaar

  • Introduce yourself to bzr by reading http://bazaar.canonical.com/IntroductionToBzr

  • Create a local branch on your computer to do work:

    $ mkdir bazaar
    $ cd bazaar
    $ bzr get sftp://USERNAME@src.i-clic.uihc.uiowa.edu//srv/bzr/mifar/dev/0.7/ mifar-dev-0.7
      --or if you don't have ssh access--
    $ bzr get http://src.i-clic.uihc.uiowa.edu/bzr/mifar/dev/0.7 mifar-dev-0.7
    $ cd mifar-dev-0.7
    
  • Check that everything is up-to-date

    $ bzr status
    

    Or the easier to type shortcut

    $ bzr st
    
  • Make some changes as you do new work

    echo "# I was here" >> SConstruct
    
  • See that things have changed

    $ bzr st
    modified:
      SConstruct
    
  • Decide you didn't want to do that

    $ bzr revert
    $ bzr st
    $ # No output means no changes
    
  • Do some real changes, and then commit them.

    <hack hack hack>
    $ bzr commit -m "Made some new changes"
    
  • If you have write access to the main mifar repository, you can push your changes back

    $ bzr push sftp://USERNAME@src.i-clic.uihc.uiowa.edu//srv/bzr/mifar/dev/0.7/
    

    NOTE: From now on, bzr should remember your default push and pull locations, so that you don't have to type them all the time.

    The above 'push' will complain that it is unable to update the working directory. This is fine. bzr doesn't support updating remote working directories unless you use one of the rsync plugins. Since we are only hosting the branches on src, it doesn't matter if the working directory is out of date.

  • If anyone else is going to share the dev/0.7 directory (such as myself, or you on a different machine), you will want to update your local tree from the published one

    $ bzr pull # This remembers the location from the original 'get'
    
  • If you made a local commit, and somebody else already made a commit and pushed the changes to the published location, your push will fail. You need to merge the changes and then publish

    $ bzr merge # uses old location
    # Review changes, resolve conflicts
    $ bzr commit -m "merged John's stupid changes"
    $ bzr push
    

    If you find that the pull/commit/push cycle is a bit tedious, the bazaar comunity is working to support 'bound branches'. Where it commits to the published branch before it commits to the local one. And your commit will fail if you are out of date. (Same as cvs where you have to 'cvs update' before you can 'cvs commit' if someone changed what you were working on). This hasn't been merged into the official bzr yet, but it will be once they get a few other things merged in.

  • Final notes. The tutorial is pretty good, the bazaar mailing list has quite a few active users. Also 'bzr help' gives a short-list of help, while 'bzr help commands' gives the long list. And 'bzr help FOO' gives the specific help for command FOO.

Working with Other Developers

From time to time, but at least every day, you should check to see if anyone else has made changes to the branch of mifar that you're working on. To do so change to your local mifar branch directory and issue:

bzr missing

This will let you know if there are any new changes in the server branch. To download them issue:

bzr merge

The will update your working tree but not change your local branch information ie. none of the bazaar control files (the stuff in .bzr) will be affected. Review the changes and commit them to you working branch using:

bzr commit

For time to time you may wish to contribute new changes to the mifar source repository. To do so, run through the above steps to make sure your local branch is up to date, and then issue the command:

bzr push

This will add your recent changes to the server branch. Since the server branch is remote, only the control files in .bzr will be changed, to warn you of this bzr will print a message similar to:

bzr: WARNING: Unable to update the working tree of: ...

Don't worry about it, this is expected due to the way we're using bazaar. Also, I'd recommend that you drop a quick note to mifar-developers@xia.i-clic.uihc.uiowa.edu to with the revision numbers of your changes and which branch they were applied to. Keep these message short and include the word "revnote" in the subject line.


If you have any problems with the page contact Chris Piker at the
Division of Physiologic Imaging.