wiki:BittenRecipesExtractorScript

Version 5 (modified by Jason Miller, 12 years ago) (diff)

--

Bitten Recipe Extractor

Description

Two small scripts who's purpose is to retrieve a Trac's Bitten rule sets. Thus allowing you to make off-line changes quickly with your favorite text editor.
Once satisfied with your changes, a second script uploads said changes.

Bugs/Feature Requests

Existing bugs and feature requests for BittenRecipesExtractorScript are here.

If you have any issues, create a new ticket.

Known Issues

When I have been modifying the scripts using emacs (and possibly some other editors do this), the editor will create a backup swap file, which just so happens to match the file matching routine I have in place for recipes to be committed. I have not seen this cause issues, but it most certainly is not desirable. My advice is to edit a master copy, such as the ones in the subversion directory, and copy those two files, to your recipe directory and use them there.

Super User access is needed when reading and writing to the Trac database directly.
Also, on some of my clusters that I work with, multiple version of python can exist. Meaning, if you receive errors like:

ImportError: No module named trac.env

You need to adjust your PATH environment to include the path to which ever python version was used to install and run Trac:

export PATH=/usr/local/python2.7/bin:$PATH

Note: This, being the one reason I do not include the common #!/usr/bin/python interrupter header in my scripts.

Download

Download the zipped source from [download:bittenrecipesextractorscript here].

Source

You can check out BittenRecipesExtractorScript from here using Subversion, or browse the source with Trac.

Example

I may combined these two scripts into one someday, but for now the usage follows:

Reading and Writing Recipes

Create a directory for which the recipes will be saved at. Each Bitten Rule will be a separate <recipe_name>.recipe file. The two python scripts must be copied to this newly created directory.
Each python script uses the same single argument. The only argument that is needed, is the path to your Trac environment. Which exactly what is necessary when ever you run:

trac-admin /some/trac/environment

To be absolutely clear on this, and to add additional text spam to this site:

sudo python recipe_get.py /some/trac/environment
sudo python recipe_put.py /some/trac/environment

Whilst in the same directory as your saved recipes. You can leave these files there and continue to run both scripts for eternity. No need to clean them up. And quite frankly, leaving them alone for backup reasons, is a darn good idea.

Editing the Recipe Files

The file syntax is fairly straight forward. The values are delimited by two carrot characters. Please, if there is a quicker better way, do submit a ticket.

From the first value to last:

  • The unique recipe name (NEVER CHANGE THIS)
  • The path in your repository
  • Is this recipe active or not? 1 being active, 0 being inactive
  • The bitten recipe itself
  • The minimum revision (if blank set to None)
  • The maximum revision (if blank set to None)
  • The recipe name as seen on the Trac Bitten Builds page
  • The recipe description

I have seen no harm in changing all but the first value. In fact, I have altered the other values with incorrect data, and was easily able to recover from it, by making my corrections, and running the recipe_put.py script again.

Recent Changes

11018 by mjasonmiller on 2011-12-05 16:08:09
I give up. Its too early to be coding. But this should fix everything.
11017 by mjasonmiller on 2011-12-05 16:01:49
Sigh. Ignore my last comment...
11016 by mjasonmiller on 2011-12-05 16:00:03
Woops. Fixing simple list issue. I swear to test my code before commiting...
(more)

Author/Contributors

Author: mjasonmiller
Maintainer: mjasonmiller
Contributors: