summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authordane dane@31f1291d-b8d6-0310-a050-a5561fc1590b <dane dane@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2004-03-28 23:00:59 +0000
committerdane dane@31f1291d-b8d6-0310-a050-a5561fc1590b <dane dane@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2004-03-28 23:00:59 +0000
commit811ce266630864719df94f757cde407c2b0cdd7d (patch)
tree5e27d2709cb7dfd5c4368c6f778ab15f879104d6 /bin
parent55bf4dbcabf378e9472b7d31d6edf87f6ac853e9 (diff)
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
Diffstat (limited to 'bin')
-rwxr-xr-xbin/am421
-rwxr-xr-xbin/checklang16
-rwxr-xr-xbin/fixlang17
-rwxr-xr-xbin/getanope42
-rwxr-xr-xbin/langtool (renamed from bin/langtool.pl)0
-rwxr-xr-xbin/makepatch83
-rwxr-xr-xbin/putanope104
7 files changed, 421 insertions, 262 deletions
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] <destination>\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 = <STDIN>;
+ 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 (<IN2>) {
+ if (/^<<<<<<</) {
+ $retval=1;
+ }
+ }
+ close(IN2);
+
+ return $retval;
+}
+
+sub do_ftp() {
+
+ my $ftpc;
+ $ftpc = Net::FTP->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 (<IN>) {
+ 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 (<IN>) {
+ 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 (<REV>) {
+ 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 (<IN>) {
+ 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.pl b/bin/langtool
index c1072760c..c1072760c 100755
--- a/bin/langtool.pl
+++ b/bin/langtool
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 <<EOF
-# Anope commit utility. Please use this template for your commits.
-# Add Mantis bugs separated by spaces. The note part is free form.
-BUILD : $NVER
-BUGS :
-NOTES :
-EOF
-
-$EDITOR $TMP2
-
-echo "*** Ready to commit, please verify:"
-echo ""
-grep -v "^#" $TMP2
-echo ""
-echo -n "*** Perform commit? (RETURN if so, CTRL-C otherwise) "
-read FOO
-
-echo "*** Running indent..."
-for source in *.c
-do
- indent -kr -nut $source
-done
-
-# Clean up indent backup files
-rm -f *~
-
-echo "*** Bumping the version number..."
-sed "s/VERSION_BUILD=\"$VERSION_BUILD\"/VERSION_BUILD=\"$new\"/" $CTRL > $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