Joe Crobak's Website

Header Image

Python setup.py bdist_rpm on CentOS 5.5

Posted on Feb 1, 2011

I recently learned that python setup.py can be used to build a rpm using the bdist command.  Since we're using puppet to manage installed software, this makes it really easy to add python modules to a bunch of servers.

During the process of trying to build a rpm, I ran into a problem: "Installed (but unpackaged) file(s) found." The details of this problem are explained here: https://bugzilla.redhat.com/show_bug.cgi?id=198877

Comment #1 in the above bug offers a work-around, which I simplified into the following two commands:

echo 'python setup.py install --optimize 1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES' > install.spec
python setup.py bdist_rpm --install-script install.spec --packager="Joe Crobak"

RPMs are placed in the dist dir.

Leave a Comment

Moving wordpress blog to lighttpd

Posted on Jan 15, 2011

I've moved my wordpress blog from a hosted account on godaddy.com to a server that's running lighttpd on ubuntu. The move was more complex than I expected, so I thought I'd share some details for others...

  1. I already had lighttpd installed, but I followed these instructions to add php support to lighttpd: Lighttpd+PHP - Ubuntu Wiki.
  2. I followed these great instructions for installing wordpress: Installing Wordpress 3.0 on Ubuntu 10.04...
  3. I used wordpress import/export to export my data from the old wordpress install. The old install was version 2.8, but the file imported just fine into wordpress 3.0. Here are some good instructions from wordpress.com: Moving a Blog.
  4. I had to install all the plugins I wanted on my new install.  This required my wordpress install be owned by the www-data user, which lighttpd is installed as.  I did a sudo chown -R ww-data:www-data on the install directory.
  5. I migrated my links from the old wordpress install using the instructions from wordpress.com: Import-Export Links.
  6. Make index.php the 404 handler, i.e. server.error-handler-404 = "/index.php" per Setting up a Wordpress Blog on lighttpd.
  7. Add rewrite rules so that most urls in / gets handled by index.php per URL Rewriting for Wordpress and lighttpd.
  8. Update the permalink settings to use /%year%/%monthnum%/%postname%/

In the end, my lighttpd config looks something like:

$HTTP["host"] == "www.crobak.org" {
  server.document-root = "/var/www/www.crobak.org"

  server.error-handler-404 = "/index.php"

  url.rewrite-final = (

    # Exclude some directories from rewriting
    "^/(wp-admin|wp-includes|wp-content|gallery2)/(.*)" => "$0",

    # Exclude .php files at root from rewriting
    "^/(.*.php)" => "$0",

    # Handle permalinks and feeds
    "^/(.*)$" => "/index.php/$1"
  )
}

I've also switched to the awesome new Twenty Ten 1.1 Theme by the WordPress team.

Leave a Comment

JAVA_HOME on Mac OS X

Posted on Oct 8, 2009

I was working on configuring HBase to run on my Mac OS X machine, and I ran into a hiccup setting up the JAVA_HOME environment variable. Eventually, I determined that there's a "Home" directory inside of each Java Framework. So, the full command is is:

export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home

Leave a Comment

What to Take to an Ultimate Frisbee Tournament

Posted on Oct 2, 2009

I've had this list scribbled on the back of a receipt for months, and thought I should commit it somewhere more permanent.  Hopefully it's of use to someone out there!

The basics

  • Underwear (x3-4)
  • Towel
  • Socks (x4, two-pair each day)
  • Shorts
  • Shirts
    • Dark (x2)
    • Light (x2)
    • Sleeping
    • Driving

  • Cleats
  • Sandals
  • Grooming
    • Shampoo
    • Q-Tips
    • Soap
    • Toothbrush
    • Toothpaste
  • Sunscreen
  • Bugspray
  • Disc(s)
  • Hat or Bandana
  • Rain gear
  • Cold gear (sweatshirt, pants)
  • Chair
  • Cooler

Sustenance

  • Water bottles
  • Gatorade
  • Food (granola, pb&j, etc)
  • Ibuprofen

If Camping

  • Tent
  • Sleeping Bag
  • Bed Roll
  • Pillow
  • Flashlight

Leave a Comment

Aliases and colorful ls in Mac OS X

Posted on Jun 20, 2009

At work, we use svn as a code repository and svnmerge for branch management.  A coworker who recently switched to Mac asked me how he could assign a global variable so that he could run the svnmerge command without specifying the full path to the python script.  The solution was to add an alias to svnmerge that is loaded on shell startup.  Since Mac OS X uses the bash shell, he needed to add the following to his .profile file (the .profile file sits in the home directory and can be created if it doesn't yet exist):

alias svnmerge='/path/to/svnmerge.py'

The svnmerge.py file also needs to be executable (chmod a+x svnmerge.py).  The changes will take effect the next time you open a new shell.

While I'm at it, it's worth mentioning another useful option that I have in my .profile file.  By adding export CLICOLOR=1, the ls command will output in color to distinguish between directories, files, and executables.

Leave a Comment

Blog Search

About

Joe Crobak is a software engineer at the United States Digital Service and runs Hadoop Weekly.

Elsewhere on the internet:

subscribe via RSS