source: ProjectBuilder/devel/lib/cms.pm@ 2

Last change on this file since 2 was 2, checked in by Bruno Cornec, 17 years ago

Initial check in coming from mondorescue project rewritten partially in perl

  • Property svn:executable set to *
File size: 954 bytes
Line 
1#!/usr/bin/perl -w
2#
3# Creates common environment for SVN/CVS repository
4#
5# $Id$
6#
7
8require Exporter;
9@ISA = qw(Exporter);
10@EXPORT = qw(get_toolhome);
11
12use strict;
13
14# Expects we are in the right directory to launch CMS commands
15
16my @args = ("svn", "info", "2>&1", "/dev/null");
17my $ret;
18system(@args) == 0 or die "system @args failed: $?";
19if ($? == -1) {
20 print "failed to execute: $!\n";
21} elsif ($? & 127) {
22 printf "child died with signal %d, %s coredump\n", ($? & 127), ($? & 128) ? 'with' : 'without';
23} else {
24 $ret = $? >> 8;
25 if ($ret == 0) {
26 $ENV{'REVISION'}=`(cd $TOOLHOME/.. ; svnversion .)`;
27 $ENV{'CMSLOG'}="svn log";
28 $ENV{'CMSEXP'}="svn export";
29 } else {
30 # By default if not SVN take CVS
31 $ENV{'REVISION'}=`(cd $TOOLHOME/.. ; cvs rannotate -f . 2>&1 | awk '{print $1}' | grep -E '^[0-9]' | cut -d. -f2 |sort -nu | tail -1)`;
32 $ENV{'CMSLOG'}="cvs log";
33 $ENV{'CMSEXP'}="cvs export"
34 $ENV{'CVSROOT'}=$ENV{'CVSVAR'};
35 }
36}
371;
Note: See TracBrowser for help on using the repository browser.