BryanDavis has uploaded a new change for review. https://gerrit.wikimedia.org/r/116198
Change subject: Remove obsolete scripts ...................................................................... Remove obsolete scripts * find-nearest-rsync was replaced by scap.utils.find_nearest_host * scap-2 was replaced by inline rsync in scap.tasks.sync_common * scap-old was replaced by scap * sync-common-all is a little used alias for scap Change-Id: If4c1580b04c3a3328f0ca8beeb23058f89f40ba9 --- D bin/find-nearest-rsync D bin/scap-2 D bin/scap-old D bin/sync-common-all 4 files changed, 0 insertions(+), 196 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/scap refs/changes/98/116198/1 diff --git a/bin/find-nearest-rsync b/bin/find-nearest-rsync deleted file mode 100755 index f47da53..0000000 --- a/bin/find-nearest-rsync +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/perl - -use strict; -use Net::Ping; - -my $verbose = 0; -if ( $#ARGV >= 0 && $ARGV[0] eq '--verbose' ) { - $verbose = 1; - shift; -} - -if ( $#ARGV < 0 ) { - print STDERR "Usage: find-nearest-rsync [--verbose] <host> [<host> ...]\n"; - exit( 1 ); -} - -my( $bestHost, $bestRTT ); -my $p = Net::Ping->new( "icmp", 2 ); -$p->hires(); - -foreach my $host ( @ARGV ) { - my ( $success, $rtt, $ip ) = $p->ping( $host ); - if ( not $success ) { - next; - } elsif ( not defined( $bestHost ) ) { - $bestHost = $host; - $bestRTT = $rtt; - } elsif ( $rtt < $bestRTT ) { - $bestRTT = $rtt; - $bestHost = $host; - } - if ( $verbose ) { - printf STDERR "%s: %.6f\n", ( $host, $rtt * 1000 ); - } -} - -if ( not defined( $bestHost ) ) { - print STDERR "find-nearest-rsync: No hosts replied!\n"; - exit( 1 ); -} -print "$bestHost\n"; - diff --git a/bin/scap-2 b/bin/scap-2 deleted file mode 100755 index 7e16985..0000000 --- a/bin/scap-2 +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -BINDIR=/usr/local/bin -PATH=/bin:/usr/bin:/sbin:/usr/sbin: -TERM=dumb - -. /usr/local/lib/mw-deployment-vars.sh - -SERVER="$1" -if [ -z "$SERVER" ]; then - SERVER="${MW_RSYNC_HOST}" -fi - -RSYNC_ARGS=("${MW_RSYNC_ARGS[@]}") -# Only looks at certain MW version if specified -if [ -n "$MW_VERSIONS_SYNC" ]; then - for v in ${MW_VERSIONS_SYNC[@]}; do - RSYNC_ARGS+=("--include='php-$v/'") - done - RSYNC_ARGS+=("--exclude='php-*/'") -fi - -echo -n Copying to `hostname -s` from "$SERVER"... -if rsync "${RSYNC_ARGS[@]}" "$SERVER"::common/ "${MW_COMMON}" -then - echo "ok" -else - echo "failed" - exit 1 -fi - diff --git a/bin/scap-old b/bin/scap-old deleted file mode 100755 index 1b83fe5..0000000 --- a/bin/scap-old +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/bash - -# Acquire a non-blocking lock to prevent parallel runs -exec 200>/var/lock/scap || exit 1 -flock -n 200 || { echo "WARNING: could not acquire /var/lock/scap; scap is already running." >&2; exit 1; } - -SCAP_START=$(date +%s) -NODEFILE= - -function cleanup() { - if [ -n "$NODEFILE" ]; then - rm -f "$NODEFILE" - fi - # The lock is automatically released on exit, but do it here for good measure - flock -u 200 -} - -function die() { - cleanup - if [ -n "$*" ]; then - echo >&2 "$*" - else - echo >&2 "sync failed" - fi - exit 1 -} - -. /usr/local/lib/mw-deployment-vars.sh - -BINDIR=/usr/local/bin - -if [ ! -S "$SSH_AUTH_SOCK" ]; then - die "SSH_AUTH_SOCK not set or not pointing to a socket. Did you start your ssh-agent?" -fi - -DSH_EXPORTS= -# Only sync the active version(s) if requested -if [[ "$1" == --versions=?* ]]; then - versions="${1#--versions=}" - shift - if [ "$versions" == "active" ]; then - # All active MW versions - export MW_VERSIONS_SYNC=$($BINDIR/mwversionsinuse --home) - elif [ -d "$MW_COMMON_SOURCE/php-$versions" ]; then - # A specific MW version - export MW_VERSIONS_SYNC="$versions" - else - die "Invalid MediaWiki version \"$versions\"" - fi - unset versions - # This will export MW_VERSIONS_SYNC to scap-1 on the proxies/servers - echo "MediaWiki versions selected for sync (via --versions): $MW_VERSIONS_SYNC" - DSH_EXPORTS="export MW_VERSIONS_SYNC=\"$MW_VERSIONS_SYNC\";" -else - echo "Syncing all versions." -fi - -if [[ "$MW_SCAP_BETA" == "1" ]]; then - DSH_EXPORTS="export MW_SCAP_BETA=1; $DSH_EXPORTS" -fi - -# Perform syntax check -echo -n "Checking syntax of wmf-config and multiversion..." -if ( ! ( $BINDIR/lint $MW_COMMON_SOURCE/wmf-config && $BINDIR/lint $MW_COMMON_SOURCE/multiversion ) ); then - die "Found syntax errors, cannot sync." -fi -echo " done" - -# Update the current machine so that serialization works. -# Push wikiversions.json changes so mwversionsinuse, set-group-write, -# and mwscript work with the right version of the files. -/usr/local/bin/sync-common || die - -# Update list of extension message files and regenerate -# the localisation cache -/usr/local/bin/mw-update-l10n || die - -# Notify -$BINDIR/dologmsg "!log $USER started scap${*:+: }$*" - -# Disable logging -export DOLOGMSGNOLOG=1 - -echo 'Updating rsync proxies...' -dsh -cM -g scap-proxies -o -oSetupTimeout=10 -- "$DSH_EXPORTS /usr/local/bin/scap-1" -echo 'Finished' - -# Do the main code update in random order to avoid overloading any given rsync server -NODEFILE=$(mktemp) -shuf < /etc/dsh/group/mediawiki-installation > "$NODEFILE" || die - -RSYNC_SERVERS=`sed 's/^#.*//' /etc/dsh/group/scap-proxies` || die -# Condense whitespace -RSYNC_SERVERS=`echo $RSYNC_SERVERS` - -echo 'Copying code to apaches...' -dsh -F40 -cM -f "$NODEFILE" -o -oSetupTimeout=10 -- "$DSH_EXPORTS /usr/local/bin/scap-1 \""$RSYNC_SERVERS"\"" -echo 'Finished' - -echo 'Rebuilding CDB files from /upstream...' -dsh -cM -g mediawiki-installation -o -oSetupTimeout=10 -- "$DSH_EXPORTS /usr/local/bin/scap-rebuild-cdbs" -echo 'Finished' - -# Builds wikiversions.cdb and syncs it to the apaches with the dat file. -# This is done after all else so that deploying new MW versions is easier. -sync-wikiversions || die - -SCAP_END=$(date +%s) -DIFF=$((SCAP_END-SCAP_START)) -MINS=$(((DIFF/60)%60)) -SECS=$((DIFF%60)) -printf -v HUMAN_DIFF "%02dm %02ds" $MINS $SECS - -echo "scap completed in $HUMAN_DIFF." - -export DOLOGMSGNOLOG="" -$BINDIR/dologmsg "!log $USER finished scap${*:+: }$* (duration: $HUMAN_DIFF)" -$BINDIR/deploy2graphite scap $DIFF - -cleanup -exit 0 diff --git a/bin/sync-common-all b/bin/sync-common-all deleted file mode 100755 index c860b3f..0000000 --- a/bin/sync-common-all +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -/usr/local/bin/scap -- To view, visit https://gerrit.wikimedia.org/r/116198 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If4c1580b04c3a3328f0ca8beeb23058f89f40ba9 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/tools/scap Gerrit-Branch: master Gerrit-Owner: BryanDavis <bda...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits