"Fossies" - the Fresh Open Source Software Archive

Member "nss_ldap-265/cvslib.pl" (6 Nov 2009, 1333 Bytes) of package /linux/privat/old/nss_ldap-265.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #ident $Id: cvslib.pl,v 2.1 2009/11/06 10:26:22 lukeh Exp $
    2 
    3 $CVSVERSIONDIR = $ENV{'CVSVERSIONDIR'};
    4 
    5 $INFOFILE = $CVSVERSIONDIR ne "" ? $CVSVERSIONDIR."/CVSVersionInfo.txt" : "CVSVersionInfo.txt";
    6 
    7 $DISTDIR = $ENV{'HOME'} . "/dist";
    8 
    9 sub getSGSFile
   10 {
   11     if (-f "version.h") { return "version.h"; }
   12     elsif (-f "vers.c") { return "vers.c"; }
   13     else { return; }
   14 }
   15 
   16 sub nameToTag
   17 {
   18     local($tag) = shift;
   19     $tag =~ s/\./\~/g;
   20     return ($tag);
   21 }
   22 
   23 sub getCVSRepository
   24 {
   25     if (!(-d "CVS"))
   26     {
   27         return;
   28     }
   29 
   30     open(ROOT, "CVS/Root") || return;
   31     open(REPOSITORY, "CVS/Repository") || return;
   32     local ($CVSROOT) = <ROOT>;
   33     chop ($CVSROOT);
   34     if ($CVSROOT =~ '^:') {
   35         local(@C) = split(/:/, $CVSROOT);
   36         $CVSROOT = $C[3];
   37     }
   38     local ($CVSREPOSITORY) = <REPOSITORY>;
   39     chop ($CVSREPOSITORY);
   40     close(ROOT);
   41     close(REPOSITORY);
   42 
   43     if ($CVSREPOSITORY =~ /^\//)
   44     {
   45         $CVSREPOSITORY =~ s/^$CVSROOT\///g;
   46     }
   47     return($CVSREPOSITORY);
   48 }
   49 
   50 sub getCVSVersionInfo
   51 {
   52     local ($VERSION, $PROJECT);
   53 
   54     if (-f $INFOFILE)
   55     {
   56         open(INFOFILE, $INFOFILE) || return;
   57         while(<INFOFILE>)
   58         {
   59             if (/^#/) { next; }
   60 
   61             local ($key, $value) = split(/:\s+/);
   62             chop($value);
   63 
   64             if ($key eq "ProjectVersion")
   65             {
   66                     $VERSION = $value;
   67             }
   68             elsif ($key eq "ProjectName")
   69             {
   70                     $PROJECT = $value;
   71             }
   72         }
   73     }
   74     close(INFOFILE);
   75     return "$PROJECT-$VERSION";
   76 }
   77