Changeset 1414 for branches/locker-dev/locker/sbin
- Timestamp:
- Jan 12, 2010, 11:55:27 PM (15 years ago)
- Location:
- branches/locker-dev/locker
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/locker-dev/locker
-
Property
svn:mergeinfo
set to
False
/trunk/locker merged eligible
-
Property
svn:mergeinfo
set to
False
-
branches/locker-dev/locker/sbin/commit-email.pl
r719 r1414 1 1 #!/usr/bin/env perl 2 3 # ==================================================================== 4 # This script is deprecated. The Subversion developers recommend 5 # using mailer.py for post-commit and post-revprop change 6 # notifications. If you wish to improve or add features to a 7 # post-commit notification script, please do that work on mailer.py. 8 # See http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/mailer . 9 # ==================================================================== 2 10 3 11 # ==================================================================== … … 10 18 # This script requires Subversion 1.2.0 or later. 11 19 # 12 # $HeadURL: http://svn.collab.net/repos/svn/trunk/ tools/hook-scripts/commit-email.pl.in $13 # $LastChangedDate: 200 8-04-01 13:19:34 -0400 (Tue, 01 Apr 2008) $14 # $LastChangedBy: glasser $15 # $LastChangedRevision: 3 0158$20 # $HeadURL: http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/commit-email.pl.in $ 21 # $LastChangedDate: 2009-05-12 13:25:35 -0400 (Tue, 12 May 2009) $ 22 # $LastChangedBy: blair $ 23 # $LastChangedRevision: 37715 $ 16 24 # 17 25 # ==================================================================== … … 44 52 ###################################################################### 45 53 # Configuration section. 54 55 $ENV{'LC_ALL'} = 'en_US.UTF-8'; 46 56 47 57 # Sendmail path, or SMTP server address. … … 558 568 my @head; 559 569 my $formatted_date; 560 if ( defined$stdout)570 if ($stdout) 561 571 { 562 572 $formatted_date = strftime('%a %b %e %X %Y', localtime()); … … 753 763 } 754 764 755 my $openfork_available = $^O ne "MSWin32"; 765 my $openfork_available = $^O ne "MSWin32"; 756 766 if ($openfork_available) # We can fork on this system. 757 767 { … … 769 779 } 770 780 } 771 else # Running on Windows. No fork. 781 else # Running on Windows. No fork. 772 782 { 773 783 my @commandline = (); 774 784 my $arg; 775 785 776 786 while ($arg = shift) 777 787 { … … 780 790 push(@commandline, $arg); 781 791 } 782 792 783 793 # Now do the pipe. 784 794 open(SAFE_READ, "@commandline |") -
branches/locker-dev/locker/sbin/commit-zephyr
r748 r1414 1 #!/bin/sh 1 #!/bin/bash 2 # 3 # This is a script that can be called from a Subversion post-commit hook 4 # to zephyr a summary of the commit or the full commit. 5 # 6 # Use by putting something like the following in hooks/post-commit: 7 # REPOS="$1" 8 # REV="$2" 9 # /mit/snippets/svn-hooks/commit-zephyr "$REPOS" "$REV" -c scripts 10 # /mit/snippets/svn-hooks/commit-zephyr "$REPOS" "$REV" --full -c scripts-auto -i commits 2 11 3 CLASS=scripts 12 export LC_ALL=en_US.UTF-8 13 14 CLASS=test 4 15 INSTANCE=@ 5 16 FULL=0 … … 39 50 echo svnlook diff "$REPOS" -r "$REV" 40 51 fi 41 ) | zwrite -d -c "$CLASS" -i "$INSTANCE" - s "r$REV - $dirs"52 ) | zwrite -d -c "$CLASS" -i "$INSTANCE" -O "auto" -s "SVN: r$REV" -
branches/locker-dev/locker/sbin/parallel-find.pl
r730 r1414 2 2 3 3 # Script to help generate find the .scripts-version files 4 5 use LockFile::Simple qw(trylock unlock); 6 use File::stat; 4 7 5 8 use lib '/mit/scripts/sec-tools/perl'; … … 7 10 open(FILE, "</mit/scripts/sec-tools/store/scriptslist"); 8 11 my $dump = "/mit/scripts/sec-tools/store/versions"; 12 my $dumpbackup = "/mit/scripts/sec-tools/store/versions-backup"; 9 13 10 (! -e $dump) || die "Output directory exists: $dump"; 11 system("mkdir", $dump) && die; 14 # try to grab a lock on the version directory 15 trylock($dump) || die "Can't acquire lock; lockfile already exists at <$dump.lock>. Another parallel-find may be running. If you are SURE there is not, remove the lock file and retry."; 16 17 sub unlock_and_die ($) { 18 my $msg = shift; 19 unlock($dump); 20 die $msg; 21 } 22 23 # if the versions directory exists, move it to versions-backup 24 # (removing the backup directory if necessary). Then make a new copy. 25 if (-e $dump){ 26 if (-e $dumpbackup){ 27 system("rm -rf $dumpbackup") && unlock_and_die "Can't remove old backup directory $dumpbackup"; 28 } 29 system("mv", $dump, $dumpbackup) && unlock_and_die "Unable to back up current directory $dump"; 30 } 31 system("mkdir", $dump) && unlock_and_die "mkdir failed to create $dump"; 12 32 13 33 use Proc::Queue size => 40, debug => 0, trace => 0; … … 28 48 } 29 49 50 sub old_version ($) { 51 my $dirname = shift; 52 open my $h, "$dirname/.scripts-version"; 53 chomp (my $v = (<$h>)[-1]); 54 return $v; 55 } 56 30 57 sub version ($) { 31 58 my $dirname = shift; 32 open my $h, "$dirname/.scripts-version"; 33 return (<$h>)[-1]; 59 $uid = stat($dirname)->uid; 60 open my $h, "sudo -u#$uid git --git-dir=$dirname/.git describe --tags --always 2>/dev/null |"; 61 chomp($val = <$h>); 62 if (! $val) { 63 print "Failed to read value for $dirname\n" 64 } 65 return $val; 34 66 } 35 67 … … 38 70 my $homedir = shift; 39 71 40 open my $files, "find $homedir/web_scripts -xdev -name .scripts-version 2>/dev/null |";72 open my $files, "find $homedir/web_scripts -xdev -name .scripts-version -o -name .scripts 2>/dev/null |"; 41 73 open my $out, ">$dump/$user"; 42 74 while (my $f = <$files>) { 43 75 chomp $f; 44 $f =~ s!/\.scripts-version$!!; 76 my $new_style; 77 $new_style = ($f =~ s!/\.scripts$!!); 78 if (! $new_style) { 79 $f =~ s!/\.scripts-version$!!; 80 # Don't use .scripts-version of .scripts is around! 81 if (-d "$f/.scripts") { 82 next; 83 } 84 } 45 85 if (! updatable($f)) { 46 86 print STDERR "not updatable: $f"; 47 87 next; 48 88 } 49 $v = version($f);50 print $out "$f:$v ";89 $v = $new_style ? version($f) : old_version($f); 90 print $out "$f:$v\n"; 51 91 } 52 92 return 0; … … 57 97 my $f=fork; 58 98 if(defined ($f) and $f==0) { 59 if ($homedir !~ m|^/afs/athena| ) {60 print "ignoring non-athena-cell $user $homedir\n";99 if ($homedir !~ m|^/afs/athena| && $homedir !~ m|^/afs/sipb| && $homedir !~ m|^/afs/zone|) { 100 print "ignoring foreign-cell $user $homedir\n"; 61 101 exit(0); 62 102 } 63 103 print "$user\n"; 64 104 $ret = find($user, $homedir); 65 66 105 sleep rand 1; 106 exit($ret); 67 107 } 68 108 1 while waitpid(-1, WNOHANG)>0; # avoids memory leaks in Proc::Queue 69 109 } 110 111 unlock($dump); 112 1;
Note: See TracChangeset
for help on using the changeset viewer.