From f6d65e533c62f6deb21342d4901ece24497b433e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 4 Jun 2015 07:31:04 +0200 Subject: Update to MediaWiki 1.25.1 --- maintenance/resources/update-oojs-ui.sh | 116 +++++++++++++------------------- maintenance/resources/update-oojs.sh | 4 +- 2 files changed, 48 insertions(+), 72 deletions(-) (limited to 'maintenance/resources') diff --git a/maintenance/resources/update-oojs-ui.sh b/maintenance/resources/update-oojs-ui.sh index 1b352922..f6245f27 100644 --- a/maintenance/resources/update-oojs-ui.sh +++ b/maintenance/resources/update-oojs-ui.sh @@ -1,95 +1,69 @@ #!/usr/bin/env bash -# This script generates a commit that updates our distribution copy of OOjs UI +# This script generates a commit that updates our copy of OOjs UI -if [ -z "$1" ] +if [ -n "$2" ] then - # Missing required parameter - echo >&2 "Usage: $0 path/to/repo/for/oojs-ui" + # Too many parameters + echo >&2 "Usage: $0 []" exit 1 fi -TARGET_REPO=$(cd "$(dirname $0)/../.."; pwd) -TARGET_DIR=resources/lib/oojs-ui -UI_REPO=$1 - -function oojsuihash() { - grep "OOjs UI v" "$TARGET_REPO/$TARGET_DIR/oojs-ui.js" \ - | head -n 1 \ - | grep -Eo '\([a-z0-9]+\)' \ - | sed 's/^(//' \ - | sed 's/)$//' -} - -function oojsuitag() { - grep "OOjs UI v" "$TARGET_REPO/$TARGET_DIR/oojs-ui.js" \ - | head -n 1 \ - | grep -Eo '\bv[0-9a-z.-]+\b' -} - -function oojsuiversion() { - grep "OOjs UI v" "$TARGET_REPO/$TARGET_DIR/oojs-ui.js" \ - | head -n 1 \ - | grep -Eo '\bv[0-9a-z.-]+\b.*$' -} +REPO_DIR=$(cd "$(dirname $0)/../.."; pwd) # Root dir of the git repo working tree +TARGET_DIR="resources/lib/oojs-ui" # Destination relative to the root of the repo +NPM_DIR=$(mktemp -d 2>/dev/null || mktemp -d -t 'update-oojs-ui') # e.g. /tmp/update-oojs-ui.rI0I5Vir # Prepare working tree -cd "$TARGET_REPO" && +cd "$REPO_DIR" && +git reset composer.json && git checkout composer.json && git reset $TARGET_DIR && git checkout $TARGET_DIR && git fetch origin && -git checkout -B upstream-oojsui origin/master || exit 1 - -cd $UI_REPO || exit 1 +git checkout -B upstream-oojs-ui origin/master || exit 1 -# Read the old version and check for changes -OLDHASH=$(oojsuihash) -if [ -z "$OLDHASH" ] +# Fetch upstream version +cd $NPM_DIR +if [ -n "$1" ] then - OLDTAG=$(oojsuitag) + npm install "oojs-ui@$1" || exit 1 +else + npm install oojs-ui || exit 1 fi -if [ "$OLDHASH" == "" ] -then - OLDHASH=$(git rev-parse "$OLDTAG") - if [ $? != 0 ] - then - echo "Could not find OOjs UI version" - cd - - exit 1 - fi -fi -if [ "$(git rev-parse $OLDHASH)" == "$(git rev-parse HEAD)" ] + +OOJSUI_VERSION=$(node -e 'console.log(require("./node_modules/oojs-ui/package.json").version);') +if [ "$OOJSUI_VERSION" == "" ] then - echo "No changes (already at $OLDHASH)" - cd - - exit 0 + echo 'Could not find OOjs UI version' + exit 1 fi -# Build the distribution -npm install && grunt git-build || exit 1 - -# Get the list of changes -NEWCHANGES=$(git log $OLDHASH.. --oneline --no-merges --reverse --color=never) -NEWCHANGESDISPLAY=$(git log $OLDHASH.. --oneline --no-merges --reverse --color=always) - -# Copy files -# - Exclude the default non-svg stylesheet -rsync --recursive --delete --force --exclude 'oojs-ui.css' --exclude 'oojs-ui*.rtl.css' ./dist/ "$TARGET_REPO/$TARGET_DIR" || exit 1 - -# Read the new version -NEWVERSION=$(oojsuiversion) +# Copy files, excluding: +# * the Apex theme files, +# * the minimised distribution files, and +# * the RTL sheets for non-CSSJanus environments +# * the raster- and vector-only distribution sheets +rsync --force --recursive --delete \ + --exclude '*apex*' \ + --exclude 'oojs-ui*.min.*' \ + --exclude 'oojs-ui*.rtl.css' \ + --exclude 'oojs-ui*.raster.css' \ + --exclude 'oojs-ui*.vector.css' \ + ./node_modules/oojs-ui/dist/ "$REPO_DIR/$TARGET_DIR" || exit 1 + +# Clean up temporary area +rm -rf "$NPM_DIR" # Generate commit -cd "$TARGET_REPO" +cd $REPO_DIR || exit 1 + COMMITMSG=$(cat <&2 <