From 811ce266630864719df94f757cde407c2b0cdd7d Mon Sep 17 00:00:00 2001 From: "dane dane@31f1291d-b8d6-0310-a050-a5561fc1590b" Date: Sun, 28 Mar 2004 23:00:59 +0000 Subject: BUILD : 1.6.0 (4) BUGS : none NOTES : File cleanup and new AnopeManager script (bin/am) to work with Anope source control. Version schema change with no impact on cpp directives. git-svn-id: svn://svn.anope.org/anope/trunk@4 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2 5417fbe8-f217-4b02-8779-1006273d7864 --- bin/am | 421 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ bin/checklang | 16 --- bin/fixlang | 17 --- bin/getanope | 42 ------ bin/langtool | 239 ++++++++++++++++++++++++++++++++ bin/langtool.pl | 239 -------------------------------- bin/makepatch | 83 ----------- bin/putanope | 104 -------------- 8 files changed, 660 insertions(+), 501 deletions(-) create mode 100755 bin/am delete mode 100755 bin/checklang delete mode 100755 bin/fixlang delete mode 100755 bin/getanope create mode 100755 bin/langtool delete mode 100755 bin/langtool.pl delete mode 100755 bin/makepatch delete mode 100755 bin/putanope (limited to 'bin') diff --git a/bin/am b/bin/am new file mode 100755 index 000000000..b63f185ce --- /dev/null +++ b/bin/am @@ -0,0 +1,421 @@ +#!/usr/bin/env perl + +# ==================================================================== +# anomgr: Anope Manager. Used to manage anope revision on SubVersion. +# +# For usage, see the usage subroutine or run the script with no +# command line arguments. +# +# $HeadURL: $ +# $LastChangedDate: $ +# $LastChangedBy: $ +# $LastChangedRevision: $ +# +# ==================================================================== +require 5.6.0; +use strict; +use Getopt::Std; +use Net::FTP; +use Cwd; + +###################################################################### +# Configuration section. +my $myver="1.0"; +my $svnrev="http://www.zero.org/anosvn.php"; +my $fhint="version.log"; + +# Default values, change or use environment variables instead. +my $copy="anope"; +my $svnpath="/usr/bin"; +my $svnroot="svn://zero.org/repos/$copy"; +my $editor="/usr/bin/vi"; + +# Environment variables SVNBINDIR and SVNROOT override the above +# hardcoded values. +$svnpath="$ENV{SVNBINDIR}" if ($ENV{SVNBINDIR}); +$svnroot="$ENV{SVNROOT}" if ($ENV{SVNROOT}); +$editor="$ENV{EDITOR}" if ($ENV{EDITOR}); + +# Svnlook path. +my $svnlook = "$svnpath/svnlook"; + +# Svn path. +my $svn = "$svnpath/svn"; + +# wget path. Need to change to a perl module instead... +my $wget = "$svnpath/wget"; + +my ( + $rev, + $branch, + $tag, + $ftp, + $dst, + $ver_major, + $ver_minor, + $ver_patch, + $ver_build, + $ver_revision, + $ver_comment, + $svn_comment, + $cver, + $nver, + $ctrlfile, + $tmpfile, + @source, + %opt +); + +{ + my $ok = 1; + foreach my $program ($svnlook, $svn, $editor) + { + if (-e $program) + { + unless (-x $program) + { + warn "$0: required program `$program' is not executable, ", + "edit $0.\n"; + $ok = 0; + } + } + else + { + warn "$0: required program `$program' does not exist, edit $0.\n"; + $ok = 0; + } + } + exit 1 unless $ok; +} + +sub usage() +{ + # More features to add: + # --diff N:M to produce a diff between revisions + # --bugs CLI method to add bug number to the commit message + # --mesg CLI methos to add the commit message + # --create-branch to create a branch + # --create-tag to create a tag + # --switch to switch between branches/tags + print "Usage: $0 <-g | -p | -f> [-r revision | -b branch | -t tag] \n"; + print " Operations:\n"; + print " -g Get Operation\n"; + print " -p Put Operation\n"; + print " -f[tar|diff] FTP Operation, retrieve latest tar or diff\n"; + print " Selector:\n"; + print " -r revision Retrieve by revision number\n"; + print " -b branch Retrieve by branch name\n"; + print " -t tag Retrieve by tag name\n"; + print " Destination:\n"; + print " The working copy to perform the operation in or to. The script will \n"; + print " try to guess where that is, unless you provide a specific path.\n"; + exit; +} + +sub banner() { + + print "Anope Source Managemnt Utility - Version $myver\n\n"; + +} + +sub getans { + my $ans; + while (! (($ans =~ /y/) || ($ans =~ /n/))) { + print "*** Ready to continue? (y/n): "; + $ans = ; + chomp($ans); + $ans = lc($ans); + # $ans = &getans(); + } + + # return $ans; + return ($ans eq "y") ? 1 : 0 +} + +sub find_conflict() { + + my $filename=shift; + my $retval=0; + open (IN2, "$filename") || die "Can't open $filename\n"; + while () { + if (/^<<<<<<new("ftp.zero.org"); + $ftpc->login("ftp","-anonymou@"); + $ftpc->cwd("/incoming"); + + if ( lc($ftp) eq "tar" ) { + print "Retrieving latest tar ball...\n"; + $ftpc->get("anope.tgz"); + } elsif ( lc($ftp) eq "diff" ) { + print "Retrieving latest patch file...\n"; + $ftpc->get("anope.diff"); + } else { + print "Unknown type $ftp, aborting...\n"; + } + $ftpc->quit(); +} + +sub do_get() { + + my $options = "" ; # Options to be passed to the svn command + my $selector = "" ; # Selector to be passed to the svn command + + if ($rev) { + $options .= "-r $rev"; + $selector = "trunk"; + $copy = $copy . "-$rev"; + } elsif ($tag) { + $selector = "tags/$tag"; + $copy = $copy . "-$tag"; + } elsif ($branch) { + $selector = "branches/$branch"; + $copy = $copy . "-$branch"; + } else { + $selector = "trunk"; + } + + if ($dst eq undef) { + my $cwd = &Cwd::cwd(); + if (-f "$cwd/$fhint") { + system("$svn update $options $cwd"); + } elsif (-f "$cwd/$copy/$fhint") { + system("$svn update $options $cwd/$copy"); + } else { + system("$svn checkout $svnroot/$selector $options $cwd/$copy"); + } + } else { + $dst = &Cwd::cwd() if ($dst eq "\.") ; + if (-f "$dst/$fhint") { + system("$svn update $options $dst"); + } else { + system("$svn checkout $svnroot/$selector $options $dst"); + } + } +} + +sub do_put() { + + if ($dst eq undef) { + my $cwd = &Cwd::cwd(); + if (-f "$cwd/$fhint") { + $dst = "$cwd"; + } elsif (-f "$cwd/$copy/$fhint") { + $dst .= "$cwd/$copy"; + } else { + print "Error: Unable to determine your working copy location.\n"; + exit; + } + } else { + $dst = &Cwd::cwd() if ($dst eq "\.") ; + if (! -f "$dst/$fhint") { + print "Error: Unable to determine your working copy location.\n"; + exit; + } + } + + # Check to see if we need to update our working copy first. + my $nupdate; + open (IN, "$svn status --show-updates --verbose $dst|"); + while () { + if (/\*/) { + $nupdate .= "$_"; + } + } + close(IN); + + if ($nupdate ne undef) { + print "*** Warning: There are files modified in the repository that need\n"; + print "*** to be merged back to your working copy before the commit can\n"; + print "*** take place. These files are:\n"; + print $nupdate; + print "Please use: $0 -g $dst\n"; + exit; + } + + # Get a prelim diff of the changes... + my $dcount=0; + my $conflict; + # open (IN, "$svn diff $dst|"); + open (IN, "$svn status $dst|"); + while () { + if (!/^\?/) { + $dcount++; + } + + if (/^C/) { + $_ =~ s/^C\s+//; + chomp($_); + # I don't want to use grep. But my find_conflict sub + # does not seem to work :( Too bad + if (`grep "^<<<<<<<" $_`) { + $conflict .= "$_\n" ; + } else { + system("$svn resolved $_"); + } + } + } + close(IN); + + if ($dcount == 0) { + print "*** Warning: There are no modified files to be commited. Are you\n"; + print "*** sure you are in the right working copy? Verify changes with:\n"; + print "*** $svn diff $dst\n"; + exit; + } + + if ($conflict ne undef) { + print "*** Warning: There are merge conflicts to be resolved! Please take\n"; + print "*** a look at the following files and resolve them manually:\n\n"; + print "$conflict\n"; + exit; + } + + $ctrlfile = "$dst/$fhint"; + # Grab the current revision number. Clunky way, I know! + $ver_revision=`$wget -qO - $svnrev`; + chomp($ver_revision); + + unless ($ver_revision =~ /^\d+/ and $ver_revision > 0) + { + print "*** Error: Got bogus result $ver_revision from $svnrev.\n"; + exit; + } + + $ver_revision++; + open (REV, "$ctrlfile") || die "Can't open $ctrlfile\n"; + while () { + push (@source, $_); + $ver_major = $_ if (/VERSION_MAJOR/); + $ver_minor = $_ if (/VERSION_MINOR/); + $ver_patch = $_ if (/VERSION_PATCH/); + $ver_build = $_ if (/VERSION_BUILD/); + } + close(REV); + + my $junk; + ($junk, $ver_major) = split('"', $ver_major); + ($junk, $ver_minor) = split('"', $ver_minor); + ($junk, $ver_patch) = split('"', $ver_patch); + ($junk, $ver_build) = split('"', $ver_build); + + $cver = "$ver_major.$ver_minor.$ver_patch ($ver_build)"; + $nver = "$ver_major.$ver_minor.$ver_patch ($ver_revision)"; + + # Greet the developer + banner(); + print "*** Repository : $svnroot \n"; + print "*** Working copy : $dst \n" ; + print "*** Current ver. : $cver \n"; + print "*** Updated ver. : $nver \n"; + print "*** Files Changed: $dcount (before indent and version change)\n"; + die ("Aborting...\n") unless &getans(); + + # Need to add a clause for -c "comment" and -b "buglist" + + # Get developers input for commit + $tmpfile=".commit"; + open (OUT, ">$tmpfile") or die ("*** Error! Unable to open $tmpfile file\n"); + print OUT "# Anope commit utility. Please use this template for your commits. +# Add Bugzilla bugs separated by spaces. The note part is free form. +BUILD : $nver +BUGS : +NOTES : "; + close(OUT); + + system("$editor $tmpfile"); + + my $tmp_comment=""; + $ver_comment="#\n"; + $svn_comment=""; + open (IN, "$tmpfile") or die ("*** Error! Unable to open $tmpfile file\n"); + while () { + if ( !/^#/) { + $tmp_comment.="$_"; + chomp($_); + $_ =~ s/\t/ /g; + $ver_comment.="# $_\n"; + $svn_comment.="$_ "; + } + } + close(IN); + + $svn_comment =~ s/\s\s+/ /g; + # Confirm the commit one last time... + print "*** Ready to commit, please verify:\n"; + print "\n$tmp_comment\n"; + + die ("Aborting...\n") unless &getans(); + + print "*** Running Indent...\n"; + system("indent -kr -nut *.c"); + system("rm -f *~"); + + print "*** Bumping the revision number...\n"; + # Re-write the control file + open(OUT, ">$ctrlfile") or die ("*** Error! Unable to open $ctrlfile ... aborting"); + foreach (@source) { + if (/^VERSION_BUILD/) { + $_ =~ s/\"\d+\"/\"$ver_revision\"/; + } elsif (/# \$Log\$/) { + $_ .= "$ver_comment"; + } + print OUT $_; + } + close(OUT); + + print "*** Starting the upload...\n\n"; + my $rval=system("$svn commit $dst --message '$svn_comment'"); + if ( $rval ) { + print "*** Error: Unable to complete commit. Rolling back....\n\n"; + system("$svn revert $ctrlfile"); + } + +} + +{ + usage() if (! @ARGV); + + my $opt = 'hgpf:r:b:t:'; + getopts ("$opt", \%opt) or usage(); + usage() if $opt{h}; + + usage() if ($opt{g} && $opt{p}); + usage() if ($opt{g} && $opt{f}); + usage() if ($opt{p} && $opt{f}); + usage() if ($opt{r} && $opt{b}); + usage() if ($opt{r} && $opt{t}); + usage() if ($opt{b} && $opt{t}); + + $rev = $opt{r} ; + $branch = $opt{b} ; + $tag = $opt{t} ; + $ftp = $opt{f} ; + $dst = shift; + + if ($rev ne undef) { + unless ($rev =~ /^\d+/ and $rev > 0) + { + print "*** Error: Revision number '$rev' must be an integer > 0.\n"; + exit; + } + } + + do_ftp() if $opt{f}; + do_get() if $opt{g}; + do_put() if $opt{p}; + print "*** Done!\n"; + +} + + diff --git a/bin/checklang b/bin/checklang deleted file mode 100755 index bcabe0d88..000000000 --- a/bin/checklang +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# -# $Id: checklang,v 1.1 2003/07/16 04:34:04 dane Exp $ -# - -if [ ! -f en_us.l ]; then - echo "*** You must run this script on the lang directory." - echo "" - exit 1 -fi - -for lang in $(ls *.l) -do - echo "*** CHECKING $lang ***" - ./obs.pl $lang -done diff --git a/bin/fixlang b/bin/fixlang deleted file mode 100755 index 1a1ea875a..000000000 --- a/bin/fixlang +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# -# $Id: fixlang,v 1.1 2003/07/16 04:34:04 dane Exp $ -# - -if [ ! -f en_us.l ]; then - echo "*** You must run this script on the lang directory." - echo "" - exit 1 -fi - -for lang in $(ls *.l) -do - echo "*** CHECKING $lang ***" - ./fixlang.pl $lang - mv fixed.l $lang -done diff --git a/bin/getanope b/bin/getanope deleted file mode 100755 index 58f4c0dc7..000000000 --- a/bin/getanope +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# -# $Id: getanope,v 1.2 2003/11/24 20:23:28 dane Exp $ -# - -MODULE="anope-dev" -BRANCH="" - -if [ "$1" == "" ]; then - DST="$MODULE" -else - DST="$1" -fi - -let cnt="$(echo $CVSROOT | grep anope | wc -l)" -if [ $cnt -eq 0 ]; then - echo "*** Environment variable CVSROOT is not set. Please set it" - echo "*** if you have a developer account with write access." - echo "" - echo "*** Assuming anonymous access. If prompted for a password," - echo "*** just press RETURN to continue." - echo "" - export CVSROOT=":pserver:pubcvs@zero.org:/home/cvs/anope" - - let login="$(grep "pubcvs@zero.org" ~/.cvspass 2> /dev/null | grep anope | wc -l)" - - if [ $login -eq 0 ]; then - cvs -d$CVSROOT login - fi -fi - -echo "Checking out $MODULE" - -if [ "$BRANCH" == "" ]; then - cvs -z3 -d$CVSROOT checkout -d$DST $MODULE -else - cvs -z3 -d$CVSROOT checkout -r$BRANCH -d$DST $MODULE -fi - -echo "*** All done!" - -exit 0 diff --git a/bin/langtool b/bin/langtool new file mode 100755 index 000000000..c1072760c --- /dev/null +++ b/bin/langtool @@ -0,0 +1,239 @@ +#!/usr/bin/perl +# +# Ribosome's all in one language tool +# 1) Compares to check for missing lines +# 2) Compares to check for equal lines +# 3) Fixes (on request) missing lines +# 4) Checks for errors in lines +# 5) Checks for long lines (>60 characters) +# + +# Check to see if we have received arguments +if (!$ARGV[0]) { +print "Usage: $0 [language file]\n"; +exit; +} + +# If yes, set $sourcefile to the language filename +$testagainst = $ARGV[0]; + +# Set $sourcefile to en_us language file +$sourcefile = "en_us.l"; + +# Number of Keys in File, Number of Equal Lines, Number of Missing Lines +# Fixed Lines (optional) and Number of Format Error Lines, Number of Long Lines +my $numberlines = 0; +my $equallines = 0; +my $missinglines = 0; +my $fixedlines = 0; +my $errorline = 0; +my $longlines = 0; + +# Array to hold the lines from the source file and explosion array for long line check + +my @sourcearray; +my @explosion; + +# Create associative arrays which will contain keys and definitions +# One for the control source and one for what is being tested against + +my %sourcehash= (); +my %testhash= (); + +# Check if Files Exist + +if (! -f $sourcefile) { +print "Critical Error: The source file does not exist or is unreadable.\nNote: This tool must be run from the language directory.\n"; +exit; +} + +if (! -f $testagainst) { +print "Critical Error: The language file does not exist or is unreadable\n"; +exit; +} +########################################### +# Function to load sourcefile into memory # +########################################### + +sub load_sourcefile { + + my $_key; # This variable will hold the key + my $_def; # This variable will hold the definition + my $line; # This variable will hold the current line + + open (SOURCEFILE, "< $sourcefile"); # Open the source file + while () { # For each line the source file + $line = $_; # $line is set to the line in the source file + + # Skip comments + if (/^#/) { # This checks for # which indicates comment + next; # If detected, the next line is skipped to + } + + # Start of a key + if (/^[A-Z]/) { # Checks to see if the line is a key + chomp($line); # Removes things that shouldn't be at the end + push (@sourcearray, $line); # Puts the line into the source array + # If a key is defined, load definition into the hash + if ($_key ne undef) { # If the key is defined + $sourcehash{$_key} = $_def; # Add the definition to the associative array + } + $_key=$line; # Set the key to the line + $_def=""; # Reset the definition + next; # Move onto the next line + } + + if ($_key ne undef) { # If the key is set already + $_def.=$line; # The definition is the current line + } + + $sourcehash{$_key} = $_def; # Load the definition into the associative array + } # End of while which reads lines + + close (SOURCEFILE); # Close the source file + +} # End of load_sourcefile function + +################################################# +# Function to load testagainst file into memory # +################################################# + +sub load_testagainst { + + my $_key; # This variable will hold the key + my $_def; # This variable will hold the definition + my $line; # This variable will hold the current line + + open (TESTAGAINSTFILE, "< $testagainst"); # Open the file containing the control lines + while () { # For each line in the file + $line = $_; # $line is set to the lines value + + + # Skip comments + if (/^#/) { # This checks for # which indicates comment + next; # If detected, the next line is skipped to + } + + # Start of a key + if (/^[A-Z]/) { # Checks to see if the line is a key + chomp($line); # Removes things that shouldn't be at the end + + + if ($_key ne undef) { # If the key is defined + $testhash{$_key} = $_def; # Add the definition to the associative array + } + $_key=$line; # Set the key to the line + $_def=""; # Reset the definition + next; # Move onto the next line + } + + if ($_key ne undef) { # If the key is set already + $_def.=$line; # The definition is the current line + } + + $testhash{$_key} = $_def; # Load the definition into the associative array + } # End of while which reads lines + close (TESTAGAINSTFILE); # Close the source file + +} + + +sub get_format { # Function to get the formatting from a string + my $fmt=""; + my $str=shift; # Get the input + + while ($str =~ m/%\w/g) { + $fmt .= $&; + } + + return $fmt; # Return the formatting +} + + +load_sourcefile; # Call function to load the source file +load_testagainst; # Call function to load the test file + +if (!grep(/^LANG_NAME/,%testhash)) { +print "Critical Error: $ARGV[0] is not a valid language file!\n"; +exit; +} + +open (LOG,"> langcheck.log"); # Open logfile for writing + +foreach $sourcearray (@sourcearray) { # For each key stored in the source array + my $_key=$_; # Store key from source array in $_key + + if ((get_format($sourcehash{$sourcearray})) ne (get_format($testhash{$sourcearray}))) { + if ($sourcearray !~ STRFTIME ) { + $errorline++; + print LOG "FORMAT: $sourcearray - (expecting '".get_format($sourcehash{$sourcearray})."' and got '".get_format($testhash{$sourcearray})."')\n"; + } } + + if ($testhash{$sourcearray} eq $sourcehash{$sourcearray} ) { + # If the definitions between the source and the test are equal + $equallines++; # Number of equal lines increases + print LOG "EQUAL: $sourcearray\n"; # Line is written to logfile + } + + if (!grep(/^$sourcearray/,%testhash)) { # If the key is found in the testhash associative array + $missinglines++; # Increase missing lines + print LOG "MISSING: $sourcearray\n"; # Line is written to logfile + } + + @explosion = split(/\n/, $testhash{$sourcearray}); + foreach $explosion (@explosion) { + $explosion =~ s/\002//g; + $explosion =~ s/\037//g; + if (length($explosion) > 61) { + print LOG "LONGLINE: $sourcearray (".substr($explosion,1,30)."...)\n"; + $longlines++; + } + } + +$numberlines++; # Increase the number of lines tested by 1 +} +close (LOG); # Close the logfile + + +######################### +# Show the test results # +######################### + +print "Calculation Results:\n"; +print "----------------------------------\n"; +print "[$numberlines] line(s) were compared\n"; +print "[$equallines] line(s) were found to equal their $sourcefile counterpart(s)\n"; +print "[$missinglines] line(s) were found to be missing\n"; +print "[$longlines] line(s) were found to be long (>60 chars)\n"; +print "[$errorline] line(s) were found to have formatting errors\n"; +print "The specific details of the test have been saved in langcheck.log\n"; + +if ($missinglines) { # If missing lines exist +print "----------------------------------\n"; +print "Missing line(s) have been detected in this test, would you like to fix the file?\n"; +print "This automatically inserts values from the control file ($sourcefile) for the missing values\n"; +print "y/N? (Default: No) "; + +my $input = ; # Ask if the file should be fixed +if ((substr($input,0,1) eq "y") || (substr($input,0,1) eq "Y")) { # If Yes... + +open (FIX, ">> $testagainst"); # Open the file and append changes + +foreach $sourcearray (@sourcearray) { # For each key stored in the source array + my $_key=$_; # Store key from source array in $_key + + if (!grep(/^$sourcearray/,%testhash)) { # If the key is not found in the testhash associative array + print FIX "$sourcearray\n$sourcehash{$sourcearray}"; # Add the line(s) to the language file + $fixedlines++; # Increase the fixed line count + } +} + +close (FIX); # Close file after fixing + +print "Fixing Compete. [$fixedlines] line(s) fixed.\n"; +exit; # And Exit! +} + # Otherwise, quit without fixing +print "Exiting. The language file has NOT been fixed.\n"; + +} diff --git a/bin/langtool.pl b/bin/langtool.pl deleted file mode 100755 index c1072760c..000000000 --- a/bin/langtool.pl +++ /dev/null @@ -1,239 +0,0 @@ -#!/usr/bin/perl -# -# Ribosome's all in one language tool -# 1) Compares to check for missing lines -# 2) Compares to check for equal lines -# 3) Fixes (on request) missing lines -# 4) Checks for errors in lines -# 5) Checks for long lines (>60 characters) -# - -# Check to see if we have received arguments -if (!$ARGV[0]) { -print "Usage: $0 [language file]\n"; -exit; -} - -# If yes, set $sourcefile to the language filename -$testagainst = $ARGV[0]; - -# Set $sourcefile to en_us language file -$sourcefile = "en_us.l"; - -# Number of Keys in File, Number of Equal Lines, Number of Missing Lines -# Fixed Lines (optional) and Number of Format Error Lines, Number of Long Lines -my $numberlines = 0; -my $equallines = 0; -my $missinglines = 0; -my $fixedlines = 0; -my $errorline = 0; -my $longlines = 0; - -# Array to hold the lines from the source file and explosion array for long line check - -my @sourcearray; -my @explosion; - -# Create associative arrays which will contain keys and definitions -# One for the control source and one for what is being tested against - -my %sourcehash= (); -my %testhash= (); - -# Check if Files Exist - -if (! -f $sourcefile) { -print "Critical Error: The source file does not exist or is unreadable.\nNote: This tool must be run from the language directory.\n"; -exit; -} - -if (! -f $testagainst) { -print "Critical Error: The language file does not exist or is unreadable\n"; -exit; -} -########################################### -# Function to load sourcefile into memory # -########################################### - -sub load_sourcefile { - - my $_key; # This variable will hold the key - my $_def; # This variable will hold the definition - my $line; # This variable will hold the current line - - open (SOURCEFILE, "< $sourcefile"); # Open the source file - while () { # For each line the source file - $line = $_; # $line is set to the line in the source file - - # Skip comments - if (/^#/) { # This checks for # which indicates comment - next; # If detected, the next line is skipped to - } - - # Start of a key - if (/^[A-Z]/) { # Checks to see if the line is a key - chomp($line); # Removes things that shouldn't be at the end - push (@sourcearray, $line); # Puts the line into the source array - # If a key is defined, load definition into the hash - if ($_key ne undef) { # If the key is defined - $sourcehash{$_key} = $_def; # Add the definition to the associative array - } - $_key=$line; # Set the key to the line - $_def=""; # Reset the definition - next; # Move onto the next line - } - - if ($_key ne undef) { # If the key is set already - $_def.=$line; # The definition is the current line - } - - $sourcehash{$_key} = $_def; # Load the definition into the associative array - } # End of while which reads lines - - close (SOURCEFILE); # Close the source file - -} # End of load_sourcefile function - -################################################# -# Function to load testagainst file into memory # -################################################# - -sub load_testagainst { - - my $_key; # This variable will hold the key - my $_def; # This variable will hold the definition - my $line; # This variable will hold the current line - - open (TESTAGAINSTFILE, "< $testagainst"); # Open the file containing the control lines - while () { # For each line in the file - $line = $_; # $line is set to the lines value - - - # Skip comments - if (/^#/) { # This checks for # which indicates comment - next; # If detected, the next line is skipped to - } - - # Start of a key - if (/^[A-Z]/) { # Checks to see if the line is a key - chomp($line); # Removes things that shouldn't be at the end - - - if ($_key ne undef) { # If the key is defined - $testhash{$_key} = $_def; # Add the definition to the associative array - } - $_key=$line; # Set the key to the line - $_def=""; # Reset the definition - next; # Move onto the next line - } - - if ($_key ne undef) { # If the key is set already - $_def.=$line; # The definition is the current line - } - - $testhash{$_key} = $_def; # Load the definition into the associative array - } # End of while which reads lines - close (TESTAGAINSTFILE); # Close the source file - -} - - -sub get_format { # Function to get the formatting from a string - my $fmt=""; - my $str=shift; # Get the input - - while ($str =~ m/%\w/g) { - $fmt .= $&; - } - - return $fmt; # Return the formatting -} - - -load_sourcefile; # Call function to load the source file -load_testagainst; # Call function to load the test file - -if (!grep(/^LANG_NAME/,%testhash)) { -print "Critical Error: $ARGV[0] is not a valid language file!\n"; -exit; -} - -open (LOG,"> langcheck.log"); # Open logfile for writing - -foreach $sourcearray (@sourcearray) { # For each key stored in the source array - my $_key=$_; # Store key from source array in $_key - - if ((get_format($sourcehash{$sourcearray})) ne (get_format($testhash{$sourcearray}))) { - if ($sourcearray !~ STRFTIME ) { - $errorline++; - print LOG "FORMAT: $sourcearray - (expecting '".get_format($sourcehash{$sourcearray})."' and got '".get_format($testhash{$sourcearray})."')\n"; - } } - - if ($testhash{$sourcearray} eq $sourcehash{$sourcearray} ) { - # If the definitions between the source and the test are equal - $equallines++; # Number of equal lines increases - print LOG "EQUAL: $sourcearray\n"; # Line is written to logfile - } - - if (!grep(/^$sourcearray/,%testhash)) { # If the key is found in the testhash associative array - $missinglines++; # Increase missing lines - print LOG "MISSING: $sourcearray\n"; # Line is written to logfile - } - - @explosion = split(/\n/, $testhash{$sourcearray}); - foreach $explosion (@explosion) { - $explosion =~ s/\002//g; - $explosion =~ s/\037//g; - if (length($explosion) > 61) { - print LOG "LONGLINE: $sourcearray (".substr($explosion,1,30)."...)\n"; - $longlines++; - } - } - -$numberlines++; # Increase the number of lines tested by 1 -} -close (LOG); # Close the logfile - - -######################### -# Show the test results # -######################### - -print "Calculation Results:\n"; -print "----------------------------------\n"; -print "[$numberlines] line(s) were compared\n"; -print "[$equallines] line(s) were found to equal their $sourcefile counterpart(s)\n"; -print "[$missinglines] line(s) were found to be missing\n"; -print "[$longlines] line(s) were found to be long (>60 chars)\n"; -print "[$errorline] line(s) were found to have formatting errors\n"; -print "The specific details of the test have been saved in langcheck.log\n"; - -if ($missinglines) { # If missing lines exist -print "----------------------------------\n"; -print "Missing line(s) have been detected in this test, would you like to fix the file?\n"; -print "This automatically inserts values from the control file ($sourcefile) for the missing values\n"; -print "y/N? (Default: No) "; - -my $input = ; # Ask if the file should be fixed -if ((substr($input,0,1) eq "y") || (substr($input,0,1) eq "Y")) { # If Yes... - -open (FIX, ">> $testagainst"); # Open the file and append changes - -foreach $sourcearray (@sourcearray) { # For each key stored in the source array - my $_key=$_; # Store key from source array in $_key - - if (!grep(/^$sourcearray/,%testhash)) { # If the key is not found in the testhash associative array - print FIX "$sourcearray\n$sourcehash{$sourcearray}"; # Add the line(s) to the language file - $fixedlines++; # Increase the fixed line count - } -} - -close (FIX); # Close file after fixing - -print "Fixing Compete. [$fixedlines] line(s) fixed.\n"; -exit; # And Exit! -} - # Otherwise, quit without fixing -print "Exiting. The language file has NOT been fixed.\n"; - -} diff --git a/bin/makepatch b/bin/makepatch deleted file mode 100755 index ed01d1b1b..000000000 --- a/bin/makepatch +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash -# Daniel Engel (dane@zero.org) -# -# Creates a patch from any version of Anope to another within the -# same CVS module (in this case, anope-rel). Usage: -# -# ./anope-mkpatch 1.5.1 1.5.5 -# -# The earliest version you can use is 1.5.1 (the first CVS tag) -# -# Feel free to improve this script at will. -# -CVSROOT=":pserver:pubcvs@zero.org:/home/cvs/anope" -MODULE="anope-dev" -OLD="$1" -NEW="$2" -NAME="$1-$2.diff" - -echo "*** Note: This script is able to create patches from one version of 1.5.x" -echo "*** to anoter. The earliest valid version is 1.5.1, and you can only make" -echo "*** a patch between two released versions (i.e. no -rnum versions)" -echo "" - -if [[ $OLD == "" ]]; then - echo "*** Usage: $0 [OLD] [NEW]" - exit 0 -fi - - -if [[ $NEW == "" ]]; then - echo "*** Usage: $0 [OLD] [NEW]" - exit 0 -fi - -OLD="anope-$OLD" -NEW="anope-$NEW" - -if [[ -d $OLD ]]; then - echo "*** Directory $OLD already exists... aborting." - exit 0 -fi - -if [[ -d $NEW ]]; then - echo "*** Directory $OLD already exists... aborting." - exit 0 -fi - -echo "*** Issuing the CVS login, when prompted for a password, just press RETURN..." -cvs -d $CVSROOT login - -if [[ $? -ne 0 ]]; then - echo "*** ERROR: CVS login failed... aborting." - exit 0 -fi - -TOLD="$(echo $OLD | sed 's/\./_/g')" -TNEW="$(echo $NEW | sed 's/\./_/g')" - -echo "*** Cheking out $MODULE ($TOLD)" -cvs -d $CVSROOT checkout -r $TOLD -d $OLD $MODULE > /dev/null 2>&1 -if [[ $? -ne 0 ]]; then - echo "*** ERROR: Unable to checkout $MODULE ($TNEW)... aborting." - exit 0 -fi - -echo "*** Cheking out $MODULE ($TNEW)" -cvs -d $CVSROOT checkout -r $TNEW -d $NEW $MODULE > /dev/null 2>&1 -if [[ $? -ne 0 ]]; then - echo "*** ERROR: Unable to checkout $MODULE ($TNEW)... aborting." - exit 0 -fi - -# I wish i could use cvsrmadm here, but not everybody has it :( -echo "*** Removing CVS control files" -find $OLD -name CVS -exec rm -rf {} \; > /dev/null 2>&1 -find $NEW -name CVS -exec rm -rf {} \; > /dev/null 2>&1 - -echo "*** Creating the patch..." -diff -urN $OLD $NEW > $NAME - -echo "*** Done! The patch is $NAME"; -echo "*** You might want to clean things up with:" -echo "*** rm -rf $OLD $NEW" diff --git a/bin/putanope b/bin/putanope deleted file mode 100755 index d07017dc3..000000000 --- a/bin/putanope +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/sh -# -# $Id: putanope,v 1.14 2003/12/02 23:02:28 joris Exp $ -# - -CTRL="version.log" -MODULE="anope-dev" -TMP="/tmp/putanope.$$" -TMP2="/tmp/putanope2.$$" - -# We need an editor for the log entry -if [ "$EDITOR" == "" ]; then - EDITOR="vi" -fi - -# Use default target, or provided? -if [ "$1" == "" ]; then - DST="$MODULE" -else - DST="$1" -fi - -# Find where to run the rest of the script from. -if [ ! -d $DST ]; then - cd .. - if [ ! -d $DST ]; then - cd .. - if [ ! -d $DST ]; then - echo "*** Directory $DST does not exist, what's going on?" - echo "" - exit 1 - fi - fi -fi - -# CVSROOT dosnt need to be set, just read it form the CVS file :-) -CVSROOT=`cat ${DST}/CVS/Root` - -cd $DST - -# source control file -. $CTRL - -# Version arithmetics -CVER="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_BUILD}" -let minor="$(echo $VERSION_BUILD)" -let new="$minor + 1" -NVER="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${new}" - -# Greet the developer -echo "" -echo "*** Using CVSROOT: $CVSROOT" -echo "*** Using module : $MODULE" -echo "*** Current ver : $CVER" -echo "*** Updated ver : $NVER" -echo "" -echo "*** Make sure you have updated Changes, Changes.conf, and" -echo "*** Changes.lang acordingly before you proceed." -echo -n "*** Ready to continue? (RETURN if so, CTRL-C otherwise) " -read FOO - -cat > $TMP2 < $TMP -cat $TMP > $CTRL - -TS="$(date '+%F %R')" -grep -v "^#" $TMP2 > $TMP -echo "VTAG : cvs checkout -D \"$TS\" $MODULE" >> $TMP - -cd .. - -cvs -d$CVSROOT commit -F $TMP $DST - -rm -f $TMP $TMP2 - -echo "*** Done!" - -exit 0 -- cgit