[Piglit] The beginnings of a git-based website for piglit

Carl Worth cworth at cworth.org
Tue Feb 14 15:46:52 PST 2012

Over lunch yesterday, Eric mentioned how he's like to setup a git-based
website for piglit, (and how he had been struggling with getting ikiwiki
setup). We both had the insight that if we didn't care to support any
web-based editing, (publishing only via git), that there's almost no
code to write to get something working.

I proved that true by coding something up quite trivial today,. (And
it's only accidental that my website is already being served as
http://piglit.freedesktop.org . I wrote the scripts to publish to the
obvious place, not realizing that Apache was already configured to serve
that content.)

Anyone can checkout what I've done by cloning the following git


As you'll see, it's simply a stubbed-out markdown file for the content
and a Makefile that turns that into HTML, (using the mkd2html program as
supplied by the discount[1] implementation of markdown).

So one can build the html with just "make" and could even install it to
the live website (assuming appropriate permissions) with "make publish"
after setting:


in Makefile.config.

Alternately, I've coded up a git hook that will automatically publish
the website when a commit is received. That's included below[2].

Next steps:

  1. Add content from this email to a README, (including adding the
     sample hook file to the repository).

  2. Think about what might go wrong if people push simultaneously to a
     shared repository with the hook enabled. One option is to make
     unique working directories for each user, (things would be less
     efficient if we did a new working directory for every instance of
     the hook running).

  3. Add support for publishing branches of the website, (so that users
     can preview their changes on the real web server before changing
     the live content). This is a simple matter of looping over the
     input to the post-receive hook act publishing to a different
     directory for each.

  4. Create some actual content for the website.

I'd be glad to hear any feedback from anyone. I am happy with how simple
this setup is. Yet I still think it will be extremely functional.


[1]: Discount is available in recent Debian, and upstream is here:


The freeesktop.org machine is running stale Debian, so I just compiled
discount locally and installed mkd2html to /usr/local/bin.

[2]: Here's the trivial post-receive hook I'm using for now. Simply copy
to hooks/post-receive and "chmod +x" to enable.


# Force GIT_DIR to an absolute path, (just to be safe)
export GIT_DIR=$(readlink -f ${GIT_DIR})

# Place the checkout next to the git directory
export GIT_WORK_TREE=$(readlink -f ${GIT_DIR}/../piglit-www-checkout)

# Git isn't happy if the working directory doesn't exist
mkdir -p ${GIT_WORK_TREE}

# Checkout the source
git checkout -f

# Build and publish the website
make publish
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20120214/7c2cb079/attachment.pgp>

More information about the Piglit mailing list