Nikerabbit has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/396579 )

Change subject: Rename import&export scripts for consistency
......................................................................

Rename import&export scripts for consistency

* Drop .sh from autosync and autosync-mediawiki
* Rename autosync* to autoimport*
* Rename nike-export-all to autoexport
* Add autoexport-mediawiki to complement autoimport-mediawiki
* Fix findexportroot to look for repoconfig.yaml, REPOCONF is dead
* Shellscheck fixes

Now we have this nice set of easy to use scripts:
* autoimport (all \ mediawiki in gerrit)
* autoimport-mediawiki
* autoexport (all \ mediawiki in gerrit)
* autoexport-mediawiki

Reasons for separation is that Raimond still handles MediaWiki
while I (or someone else) does all the rest, including MediaWiki
extensions not hosted in Gerrit.

Change-Id: If518f556b1de8e9306755cac65c6f664eda2771f
---
A bin/autoexport
A bin/autoexport-mediawiki
R bin/autoimport
R bin/autoimport-mediawiki
M bin/findexportroot
D bin/nike-export-all
M puppet/modules/wiki/templates/wikimaintenance.erb
7 files changed, 45 insertions(+), 31 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/translatewiki 
refs/changes/79/396579/1

diff --git a/bin/autoexport b/bin/autoexport
new file mode 100755
index 0000000..655c23e
--- /dev/null
+++ b/bin/autoexport
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+set -e
+set -u
+
+DIRSCRIPT=$(dirname "$0")
+DIRSCRIPT=$(cd "$DIRSCRIPT" && pwd)
+
+case "$(basename "$0")" in
+autoexport)
+       PROJECTS=$(php "$DIRSCRIPT/../repong/repong.php" list | grep -v 
^mediawiki)
+       ;;
+autoexport-mediawiki)
+       PROJECTS=$(php "$DIRSCRIPT/../repong/repong.php" list | grep ^mediawiki)
+       ;;
+*)
+       echo "I don't know what to export"
+       exit 1
+       ;;
+esac
+
+_b=$(tput bold)
+b_=$(tput sgr0)
+
+(
+       eval "$(ssh-agent -s)"
+       ssh-add /home/betawiki/id_rsa
+
+       for i in $PROJECTS; do
+               echo "${_b}$i${b_}"
+               "$DIRSCRIPT/repoupdate" "$i" &&
+               "$DIRSCRIPT/repoexport" "$i" &&
+               "$DIRSCRIPT/repocommit" "$i"
+       done
+
+       ssh-agent -k
+)
diff --git a/bin/autoexport-mediawiki b/bin/autoexport-mediawiki
new file mode 120000
index 0000000..24e70ec
--- /dev/null
+++ b/bin/autoexport-mediawiki
@@ -0,0 +1 @@
+autoexport
\ No newline at end of file
diff --git a/bin/autosync.sh b/bin/autoimport
similarity index 100%
rename from bin/autosync.sh
rename to bin/autoimport
diff --git a/bin/autosync-mediawiki.sh b/bin/autoimport-mediawiki
similarity index 100%
rename from bin/autosync-mediawiki.sh
rename to bin/autoimport-mediawiki
diff --git a/bin/findexportroot b/bin/findexportroot
index c480a87..e97562a 100755
--- a/bin/findexportroot
+++ b/bin/findexportroot
@@ -1,20 +1,19 @@
-#!/bin/bash
+#!/bin/sh
 # Used by repo* scripts to find the repository root
 # similar to how like git tries to find .git
 
 while true
 do
-       if [ ! -f "$DIR/REPOCONF" ]
+       if [ ! -f "$DIR/repoconfig.yaml" ]
        then
-               DIR=`dirname $DIR`
+               DIR=$(dirname "$DIR")
        else
-               . "$DIR/REPOCONF"
                break
        fi
 
        if [ "$DIR" = "/" ]
        then
-               echo "Fatal: Could not find REPOCONF file"
-               exit 1;
+               echo "Fatal: Could not find repoconfig.yaml"
+               exit 1
        fi
 done
diff --git a/bin/nike-export-all b/bin/nike-export-all
deleted file mode 100755
index ae38cfc..0000000
--- a/bin/nike-export-all
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-
-DIRSCRIPT="`dirname \"$0\"`"
-DIRSCRIPT="`( cd \"$DIRSCRIPT\" && pwd )`"
-
-PROJECTS=$(php "$DIRSCRIPT/../repong/repong.php" list | grep -v ^mediawiki)
-
-_b=$(tput bold)
-b_=$(tput sgr0)
-
-(
-       eval `ssh-agent -s`
-       ssh-add /home/betawiki/id_rsa
-
-       for i in $PROJECTS; do
-               echo "${_b}$i${b_}"
-               "$DIRSCRIPT/repoupdate" $i &&
-               "$DIRSCRIPT/repoexport" $i &&
-               "$DIRSCRIPT/repocommit" $i
-       done
-
-       ssh-agent -k
-)
diff --git a/puppet/modules/wiki/templates/wikimaintenance.erb 
b/puppet/modules/wiki/templates/wikimaintenance.erb
index 6011e66..11f9ab2 100644
--- a/puppet/modules/wiki/templates/wikimaintenance.erb
+++ b/puppet/modules/wiki/templates/wikimaintenance.erb
@@ -1,6 +1,6 @@
 # file managed by puppet
 @weekly www-data find /www/translatewiki.net/docroot/images/thumb/ -name 
"*.png" -type f -print0 | nice xargs -0 -P4 -I{} optipng -o7 {} 1> /dev/null
 @weekly <%= @user %> nice php 
/srv/mediawiki/targets/production/maintenance/generateSitemap.php --fspath 
/www/translatewiki.net/docroot/sitemap/ --skip-redirects --urlpath 
https://translatewiki.net/sitemap/
-48 6,8,10,12,14,16,18,20,22 * * * <%= @user %> <%= @config %>/bin/autosync.sh 
> /dev/null
-48 7,13,21 * * * <%= @user %> <%= @config %>/bin/autosync-mediawiki.sh > 
/dev/null
+48 6,8,10,12,14,16,18,20,22 * * * <%= @user %> <%= @config %>/bin/autoimport > 
/dev/null
+48 7,13,21 * * * <%= @user %> <%= @config %>/bin/autoimport-mediawiki > 
/dev/null
 */10 * * * * root test -z "$(/bin/systemctl status mw-jobrunner | grep running 
-o)" && <%= @config %>/bin/udpcast JobQueue is not running

-- 
To view, visit https://gerrit.wikimedia.org/r/396579
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If518f556b1de8e9306755cac65c6f664eda2771f
Gerrit-PatchSet: 1
Gerrit-Project: translatewiki
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to