jenkins-bot has submitted this change and it was merged.

Change subject: Add submodules to master checkoutMediaWiki
......................................................................


Add submodules to master checkoutMediaWiki

Builds on the ideas in I0a206a8b5c4beabcbd161fbabebf223f5bd104d2 adds
additional necessary repos.

Bug: T88442
Change-Id: I76ea0b71df6bfd89344b977660fa7e839602e7d7
---
M multiversion/checkoutMediaWiki.php
1 file changed, 63 insertions(+), 0 deletions(-)

Approvals:
  Chad: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/multiversion/checkoutMediaWiki.php 
b/multiversion/checkoutMediaWiki.php
index d225ac4..fa0ba35 100644
--- a/multiversion/checkoutMediaWiki.php
+++ b/multiversion/checkoutMediaWiki.php
@@ -65,6 +65,69 @@
                        print "Error checking out branch\n";
                        exit( 1 );
                }
+
+               # master has no extensions, vendor, or skins in submodules
+               if ( $checkoutVersion === 'master' ) {
+                       $gerrit = 'https://gerrit.wikimedia.org';
+
+                       $repos = array(
+                               'extensions' => 'r/p/mediawiki/extensions',
+                               'vendor'     => 'r/p/mediawiki/vendor',
+                               'skins'      => 'r/p/mediawiki/skins',
+                       );
+
+                       foreach ( $repos as $dir => $upstream ) {
+                               # un-escapshellarg'd path needed for chdir, 
file_exists, etc.
+                               $rawPath = "${destIP}/${dir}";
+
+                               list( $path, $upstream ) = array_map(
+                                       'escapeshellarg',
+                                       array(
+                                               $rawPath,
+                                               "${gerrit}/${upstream}",
+                                       )
+                               );
+
+                               # if the directory exists, checkout upstream 
into it
+                               if ( file_exists( $rawPath ) ) {
+                                       chdir( $rawPath );
+
+                                       $cmds = array(
+                                               'git init',
+                                               "git remote add origin 
${upstream}",
+                                               'git fetch',
+                                               'git checkout -f -t 
origin/master',
+                                       );
+
+                               # otherwise, clone the repository
+                               } else {
+                                       $cmds = array(
+                                               "git clone ${upstream} ${path}",
+                                       );
+                               }
+
+                               foreach ( $cmds as $cmd ) {
+                                       passthru( $cmd, $ret );
+
+                                       if ( $ret ) {
+                                               print "'${cmd}' failed in 
${path}\n";
+                                               exit( 1 );
+                                       }
+                               }
+
+                               chdir( $rawPath );
+
+                               # Update submodules for checked out repos
+                               passthru( 'git submodule update --init 
--recursive' , $ret );
+
+                               if ( $ret ) {
+                                       print "Submodule update failed in 
${dir}\n";
+                                       exit( 1 );
+                               }
+                               chdir( $destIP );
+                       }
+               }
+
                passthru( 'git submodule update --init --recursive', $ret );
                if ( $ret ) {
                        print "Error updating submodules\n";

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I76ea0b71df6bfd89344b977660fa7e839602e7d7
Gerrit-PatchSet: 5
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Thcipriani <tcipri...@wikimedia.org>
Gerrit-Reviewer: Chad <ch...@wikimedia.org>
Gerrit-Reviewer: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: Thcipriani <tcipri...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to