Friday, October 14, 2005

 

Autoupdating software for free

OK, so I allegedly work for a company that has the best known software updater in computers today. Allegedly.

In any case, the situation came up at work where I need to update a Perl solution used internally. This perl solution consists of about 50 scripts (hard to count how many with these CVS folders everywhere) that perform various functions.

Some of these files have to be edited by the user, but the overall solution was written in Perl for a reason - users should be able to tweak it. So, consider that any of those 100 files might be updated by the end user. This adds a tough requirement - it has to be able to handle user modified files in a sane way.

Part of the problem is my lazy programming. I started out with a config file that was a Perl script wearing a fake moustache and glasses. Not much of a disguise but it turned out not to be so bad for my three test subjects. Well, when updating, if I add a new config variable, it would somehow have to make it's way into that script.

First I tried CVS, because I thought that the CVS merge could fix everything. It can't. :) The merge, when it worked, was OK, but there are some files that will always be in conflict, and a config file is one of them. Any time a user changes a default option from "no" to "yes", that line goes into conflict. When CVS puts a file in conflict, that is CVS talk for wrecking your lazy perl script config file. Additionally I think CVS has some high overhead, and setting up a pserver took entirely too long.

I started looking for how to disable that conflict handling behavior, and found a few things that seemed possibly promising, such as cvswrapper and other options... but ultimately it was a square peg that didn't fit in the slightly smaller rectangular hole, or ... something like that.

CVS led to a 5 minute investigation of subversion but I quickly found this Slashdot article which reminded me about rsync. D'oh!

rsync isn't perfect here either, but it's closer. It has an option to skip files if the modified time is newer. This is 99% what I want except that if I update the default config file, it will overwrite the modified version the user installed. SO, I need a "builder" script that installs the product in the rsync repository and sets the modified dates back, I'm thinking about 20 years to account for wackiness on the target machines. In QA it's not uncommon to goof around with your date to test... date stuff. So 20 years should be pretty safe. I hope :)

Comments: Post a Comment

Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?