gnu-arch-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnu-arch-users] maintaining perl modules with arch?


From: Stig Brautaset
Subject: [Gnu-arch-users] maintaining perl modules with arch?
Date: Fri, 3 Sep 2004 23:11:05 +0100
User-agent: Mutt/1.5.6i

Just thought I'd share a tip.

I've come to use the following hook:

#!/bin/sh

ACTION=$1
INCVER=`tla tree-root`/{arch}/=inc-perlmod-ver.pl

case $1 in
  "precommit")
    if [ -f "$INCVER" -a -x "$INCVER" ] ; then
      tla changes | awk '/^M.*\.pm$/ {print $2}' | xargs -n1 $INCVER
    fi
  ;;
esac


the `=inc-perlmod-ver.pl' program in turn looks like this:

#!/usr/bin/perl -i
use strict;
use warnings;

while (<>) {
    if (/our\s+\$VERSION/) {
        s{(\d+\.)(\d+\.)?(\d+)}{"$1$2" . ($3 + 1)}e;
    }
    print;
}


This has the effect of automatically incrementing the $VERSION number of any
modified perl modules just before commit. It Works for Me(tm), and I thought
somebody might find it useful. May need tweaking to fit your conventions.


Stig




reply via email to

[Prev in Thread] Current Thread [Next in Thread]