r97196 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97195‎ | r97196 | r97197 >
Date:19:49, 15 September 2011
Author:aaron
Status:deferred (Comments)
Tags:
Comment:
Added MediaWiki code checksum scripts
Modified paths:
  • /trunk/debs/wikimedia-task-appserver/debian/changelog (modified) (history)
  • /trunk/debs/wikimedia-task-appserver/debian/rules (modified) (history)
  • /trunk/debs/wikimedia-task-appserver/mw-cksum (added) (history)
  • /trunk/debs/wikimedia-task-appserver/mw-cksum-list (added) (history)

Diff [purge]

Index: trunk/debs/wikimedia-task-appserver/debian/changelog
@@ -1,3 +1,9 @@
 2+wikimedia-task-appserver (2.3-3) lucid-wikimedia; urgency=low
 3+
 4+ * Added scripts to create MediaWiki fingerprints. Used for checking if installations are synced.
 5+
 6+ -- Aaron Schulz <aschulz@wikimedia.org> Thu, 15 Sep 2011 19:45:54 +0000
 7+
28 wikimedia-task-appserver (2.3-2) lucid-wikimedia; urgency=medium
39
410 * Removed damaging quotes around for loop array (only worked when there was one item)
Index: trunk/debs/wikimedia-task-appserver/debian/rules
@@ -51,7 +51,8 @@
5252 # Install sync/check scripts
5353 install -d -m 0755 $(DESTDIR)/usr/bin
5454 install -d -m 0755 $(DESTDIR)/usr/sbin
55 - install -m 0755 sync-common apache-sanity-check apache-start check-time scap-1skins scap-1 scap-2 mwversionsinuse $(DESTDIR)/usr/bin
 55+ install -m 0755 sync-common apache-sanity-check apache-start check-time $(DESTDIR)/usr/bin
 56+ install -m 0755 scap-1skins scap-1 scap-2 mwversionsinuse mw-cksum mw-cksum-list $(DESTDIR)/usr/bin
5657
5758 # Build architecture-independent files here.
5859 binary-indep: build install
Index: trunk/debs/wikimedia-task-appserver/mw-cksum
@@ -0,0 +1,42 @@
 2+#!/bin/bash
 3+# Gets the hashes for all MW versions, wmf-config and common-other.
 4+# Each key for a MW version is of the format: php-<version>:<sha1>.
 5+# Hashes for wmf-config and common-other are of the format <keyName>:<sha1>.
 6+# If specified, gets the SHA1 for just one keyName (e.g. MW version)
 7+BINDIR="/usr/bin"
 8+COMMON="/usr/local/apache/common-local"
 9+
 10+# Filter the key list to one value
 11+keyName=$1
 12+
 13+# If a MW version is given, give sha1 for a single directory
 14+if [ -n "$keyName" ]; then
 15+ # common-files hash determined differently
 16+ if [ "$keyName" != "common-files" ]; then
 17+ if [ ! -d "$COMMON/$keyName" ]; then
 18+ echo "mw-cksum: $COMMON/$keyName is not a directory."
 19+ exit 1
 20+ fi
 21+ fi
 22+ mwCodeDirs=("$keyName")
 23+# Otherwise, get SHA1 for each active MW version and wmf-config/multiversion
 24+else
 25+ mwCodeDirs=("wmf-config" "multiversion" "common-files")
 26+ mwVersionNums=$($BINDIR/mwversionsinuse)
 27+ if [ -z "$mwVersionNums" ]; then
 28+ echo "Unable to read wikiversions.dat or it is empty"
 29+ exit 1
 30+ fi
 31+ for mwVerNum in ${mwVersionNums[@]}; do
 32+ mwCodeDirs+=("php-$mwVerNum")
 33+ done
 34+fi
 35+
 36+sha1Keys=()
 37+# Get SHA1 hash for each MW code path
 38+for codeDir in ${mwCodeDirs[@]}; do
 39+ sha1Hash=$($BINDIR/mw-cksum-list "$COMMON/$codeDir" | sha1sum)
 40+ sha1Keys+=("$codeDir:${sha1Hash%% *}")
 41+done
 42+
 43+echo ${sha1Keys[@]}
Index: trunk/debs/wikimedia-task-appserver/mw-cksum-list
@@ -0,0 +1,26 @@
 2+#!/bin/bash
 3+# Get a sorted file/md5 list for a MediaWiki installation.
 4+# Expects a directory as the only argument.
 5+
 6+# Path to scan for files
 7+if [ -z "$1" ]; then
 8+ echo "mw-cksum-list: no directory specified"
 9+ exit 1
 10+fi
 11+
 12+# Use maxdepth = 1 if checking the files in common-local.
 13+# Used for 'common-files' parameter in mw-cksum.
 14+if [ $(basename $1) == 'common-files' ]; then
 15+ codePath=$(dirname $1)
 16+ maxDepth="-maxdepth 1"
 17+ filterParams="-name *.dat"
 18+else
 19+ codePath="$1"
 20+ maxDepth=""
 21+ filterParams="( -name *.php -o -name *.cdb ) ! -name *.i18n.php ! -name *.alias.php"
 22+fi
 23+
 24+# Format through AWK to have the path first to improve diffs.
 25+nice -19 find -P $codePath $maxDepth -type f $filterParams \
 26+ -exec stat --printf="%n %a %G %U " {} \; -exec cksum {} \; \
 27+ | awk '{print $1, $2, $3, $4, $5}' | sort;

Follow-up revisions

RevisionCommit summaryAuthorDate
r97200MFT r97196, r97199aaron20:31, 15 September 2011

Comments

#Comment by Bhartshorne (talk | contribs)   20:28, 15 September 2011

the debian/rules file has spaces instead of tabs.

#Comment by Aaron Schulz (talk | contribs)   20:30, 15 September 2011

See r97199.

Status & tagging log