Author: dylan
Date: 2004-08-10 17:14:09 -0400 (Tue, 10 Aug 2004)
New Revision: 347

Removed:
   trunk/dev-tools/gpg-sign-files.pl
   trunk/dev-tools/hot-backup.pl
Log:
Removed old scripts that are no longer
used / needed.


Deleted: trunk/dev-tools/gpg-sign-files.pl
===================================================================
--- trunk/dev-tools/gpg-sign-files.pl   2004-08-10 18:03:33 UTC (rev 346)
+++ trunk/dev-tools/gpg-sign-files.pl   2004-08-10 21:14:09 UTC (rev 347)
@@ -1,41 +0,0 @@
-#!/usr/bin/perl
-
-
-use strict;
-use warnings;
-use Crypt::GPG;
-use Fatal qw(:void open close);
-
-
-if (@ARGV < 2) {
-       print "Usage: $0 key-id file1 [...] < passphrase.txt\n";
-       exit 0;
-}
-
-my $key    = shift;
-my $phrase = readline STDIN;
-chomp $phrase;
-
-my $gpg = new Crypt::GPG;
-
-$gpg->gpgbin('/usr/bin/gpg');  # The GnuPG executable.
-$gpg->secretkey($key);         # Set ID of default secret key.
-$gpg->passphrase($phrase);     # Set passphrase.
-
-
-
-foreach my $file (@ARGV) {
-       open my $fh, "<$file";
-       undef $/;
-
-       my $data = <$fh>;
-       close $fh;
-
-       open my $out, ">$file.sig";
-       print $out $gpg->sign($data) or die "Can't sign $file.";
-       close $out;
-
-       system('gpg', '--dearmor', "$file.sig");
-       unlink("$file.sig");
-       rename("$file.sig.gpg", "$file.sig");
-}

Deleted: trunk/dev-tools/hot-backup.pl
===================================================================
--- trunk/dev-tools/hot-backup.pl       2004-08-10 18:03:33 UTC (rev 346)
+++ trunk/dev-tools/hot-backup.pl       2004-08-10 21:14:09 UTC (rev 347)
@@ -1,207 +0,0 @@
-#!/usr/bin/perl
-#
-#  hot-backup.pl: perform a "hot" backup of a Berkeley DB repository.
-#                 (and clean old logfiles after backup completes.)
-######################################################################
-
-use strict;
-use warnings;
-use File::Spec;
-use File::Basename 'basename';
-use IO::Dir;
-use Getopt::Long;
-use File::Path ();
-
-######################################################################
-# Global Settings
-
-my %option = (
-       'symlink'   => 0,
-       'no-append' => 0,
-       backlog     => 10,
-       svnadmin    => '/usr/bin/svnadmin',
-       svnlook     => '/usr/bin/svnlook',
-);
-
-GetOptions(\%option, 'backlog=i', 'no-append', 'svnadmin=s', 'svnlook=s', 
'symlink');
-
-
-# Path to svnlook utility
-my $svnlook = $option{svnlook};
-
-# Path to svnadmin utility
-my $svnadmin = $option{svnadmin};
-
-# Number of backups to keep around (0 for "keep them all")
-my $num_backups = 5;
-
-######################################################################
-# Command line arguments
-
-
-if (@ARGV != 2) {
-       print 'Usage: ', basename($0), ' [options] <repos_path> <backup_path>', 
"\n";
-       exit 1;
-}
-
-# Path to repository
-my $repo_dir = $ARGV[0];
-my $repo     =  basename(File::Spec->rel2abs($repo_dir || ''));
-
-# Where to store the repository backup.  The backup will be placed in
-# a *subdirectory* of this location, named after the youngest
-# revision.
-my $backup_dir = $ARGV[1];
-
-######################################################################
-# Main
-
-print "Beginning hot backup of '$repo_dir'.\n";
-
-
-### Step 1: get the youngest revision.
-
-my $pipe;
-my $pid = open($pipe, '-|', $svnlook, 'youngest', $repo_dir)
-       or die "Can't open $svnlook, $!";
-
-my $youngest = readline $pipe;
-chomp $youngest;
-
-print "Youngest revision is $youngest\n";
-
-### Step 2: Find next available backup path
-
-#backup_subdir = os.path.join(backup_dir, repo + "-" + youngest)
-my $backup_subdir = File::Spec->catfile($backup_dir, "$repo-$youngest");
-
-
-
-# If there is already a backup of this revision, then append the
-# next highest increment to the path. We still need to do a backup
-# because the repository might have changed despite no new revision
-# having been created. We find the highest increment and add one
-# rather than start from 1 and increment because the starting
-# increments may have already been removed due to num_backups.
-
-unless ($option{'no-append'}) {
-       my $regexp = qr/^$repo-$youngest(?:-(\d+))?$/;
-       #regexp = re.compile("^" + repo + "-" + youngest + 
"(-(?P<increment>[0-9]+))?$")
-
-       my @dirs  = listdir($backup_dir);
-       my @young = grep(/$regexp/, @dirs);
-
-       if (@young) {
-               @young = sort { comparator($a, $b) } @young;
-               my $last = pop @young;
-               my ($increment) = $last =~ /$regexp/;
-
-               if ($increment) {
-                       $backup_subdir = File::Spec->catdir($backup_dir, 
"$repo-$youngest-" . ($increment + 1));
-               } else {
-                       $backup_subdir = File::Spec->catdir($backup_dir, 
"$repo-$youngest-1");
-               }
-       }
-}
-
-### Step 3: Ask subversion to make a hot copy of a repository.
-###         copied last.
-
-
-unless (-d $backup_subdir) {
-       print "Backing up repository to '$backup_subdir'...\n";
-       my $err = system($svnadmin, 'hotcopy', $repo_dir, $backup_subdir, 
'--clean-logs');
-
-       if ($err != 0) {
-               print "Unable to backup the repository.\n";
-               exit $err;
-       } else {
-               print "Done.\n";
-       }
-} else {
-       warn "Looks like $backup_subdir exists.\n",
-            "This can only mean we're in --no-append mode.\n";
-}
-
-### Step 3+1: If --symlink is given, symlink the latest version.
-if ($option{symlink}) {
-       my $current = File::Spec->catfile($backup_dir, "$repo-current");
-       print "Symlinking $backup_subdir to $current (if needed)\n";
-       
-       my $do_link = 1;
-       
-       if (-e $current) {
-               my $link = readlink $current
-                       or warn "Error reading link $current, $!\n";
-               
-               if ($link ne $backup_subdir) {
-                       unlink($current) or warn "Can't unlink $current. $!\n";
-               } else {
-                       $do_link = 0;
-               }
-       }
-       
-       if ($do_link) {
-               print "Performing symlink\n";
-               symlink($backup_subdir, $current) 
-                       or warn "Can't symlink $backup_subdir to $current! 
$!\n";
-       }
-}
-
-### Step 4: finally, remove all repository backups other than the last
-###         $option{backlog}.
-
-if ($option{backlog} > 0) {
-       my $regexp = qr/^$repo-\d+(-\d+)?$/;
-       my @dirs = listdir($backup_dir);
-       my @old  = grep (/$regexp/, @dirs);
-       @old = sort { comparator($a, $b) } @old;
-       
-       my $start = max(0, @old-$option{backlog});
-       my $stop  = @old;
-       splice(@old, $start, $stop);
-
-       my $item;
-       for $item (@old) {
-               my $old_backup_subdir = File::Spec->catdir($backup_dir, $item);
-               print "Removing old backup: $old_backup_subdir\n";
-               File::Path::rmtree($old_backup_subdir);
-       }
-}
-
-######################################################################
-# Helper functions
-
-sub comparator {
-       my ($a, $b) = @_;
-
-       my $regexp = qr/-([0-9]+)(?:-([0-9]+))?$/;
-       my ($reva, $inca) = $a =~ $regexp;
-       my ($revb, $incb) = $b =~ $regexp;
-
-       if ($reva < $revb) {
-               return -1;
-       } elsif ($reva > $revb) {
-               return 1;
-       } else {
-               if (not $inca) {
-                       return -1;
-               } elsif (not $incb) {
-                       return 1;
-               } elsif (int($inca) < int($incb)) {
-                       return -1;
-               } else {
-                       return 1;
-               }
-       }               
-}
-
-sub listdir {
-       my ($dir) = @_;
-       grep (!/^\.\.?$/, IO::Dir->new($backup_dir)->read);
-}
-
-sub max {
-       my ($a, $b) = @_;
-       $a > $b ? $a : $b;
-}


Reply via email to