diff --git a/Dockerfile b/Dockerfile index 022d98f0..39834f45 100644 --- a/Dockerfile +++ b/Dockerfile @@ -116,14 +116,12 @@ RUN set -x; \ # Skins COPY _sources/scripts/extensions-skins.php /tmp/extensions-skins.php COPY _sources/patches/* /tmp/ -COPY _sources/configs/skins.yaml /tmp/skins.yaml -RUN php /tmp/extensions-skins.php "skins" "/tmp/skins.yaml" # Extensions # The following extensions are downloaded via Composer and also do not need to be downloaded here: # Bootstrap, DataValues (and related extensions like DataValuesCommon), ParserHooks. -COPY _sources/configs/extensions.yaml /tmp/extensions.yaml -RUN php /tmp/extensions-skins.php "extensions" "/tmp/extensions.yaml" +COPY _sources/configs/contents.yaml /tmp/contents.yaml +RUN php /tmp/extensions-skins.php "/tmp/contents.yaml" # Patch composer RUN set -x; \ diff --git a/_sources/configs/extensions.yaml b/_sources/configs/contents.yaml similarity index 95% rename from _sources/configs/extensions.yaml rename to _sources/configs/contents.yaml index 37174e0b..a322c899 100644 --- a/_sources/configs/extensions.yaml +++ b/_sources/configs/contents.yaml @@ -1,7 +1,30 @@ # Canasta YAML file for extensions for MediaWiki 1.39. # Where the repository is not specified, the Wikimedia Git repository for the -# extension with that name is used, and the default branch used is REL1_39. +# extension/skin with that name is used, and the default branch used is REL1_39. # Where the repository *is* specified, the default branch used is master. +skins: + - chameleon: + commit: f34a56528ada14ac07e1b03beda41f775ef27606 # v. 4.2.1 + repository: https://github.com/ProfessionalWiki/chameleon + additional steps: + - composer update + - CologneBlue: + commit: 4d588eb78d7e64e574f631c5897579537305437d + - MinervaNeue: + bundled: true + - Modern: + commit: fb6c2831b5f150e9b82d98d661710695a2d0f8f2 + - MonoBook: + bundled: true + - Pivot: + branch: v2.3.0 + commit: d79af7514347eb5272936243d4013118354c85c1 + - Refreshed: + commit: 86f33620f25335eb62289aa18d342ff3b980d8b8 + - Timeless: + bundled: true + - Vector: + bundled: true extensions: - AbuseFilter: bundled: true diff --git a/_sources/configs/skins.yaml b/_sources/configs/skins.yaml deleted file mode 100644 index 249bf2db..00000000 --- a/_sources/configs/skins.yaml +++ /dev/null @@ -1,27 +0,0 @@ -# Canasta YAML file for skins for MediaWiki 1.39. -# Where the repository is not specified, the Wikimedia Git repository for the -# skins with that name is used, and the default branch used is REL1_39. -# Where the repository *is* specified, the default branch used is master. -skins: - - chameleon: - commit: f34a56528ada14ac07e1b03beda41f775ef27606 # v. 4.2.1 - repository: https://github.com/ProfessionalWiki/chameleon - additional steps: - - composer update - - CologneBlue: - commit: 4d588eb78d7e64e574f631c5897579537305437d - - MinervaNeue: - bundled: true - - Modern: - commit: fb6c2831b5f150e9b82d98d661710695a2d0f8f2 - - MonoBook: - bundled: true - - Pivot: - branch: v2.3.0 - commit: d79af7514347eb5272936243d4013118354c85c1 - - Refreshed: - commit: 86f33620f25335eb62289aa18d342ff3b980d8b8 - - Timeless: - bundled: true - - Vector: - bundled: true \ No newline at end of file diff --git a/_sources/scripts/extensions-skins.php b/_sources/scripts/extensions-skins.php index 27937ccf..3819daf0 100644 --- a/_sources/scripts/extensions-skins.php +++ b/_sources/scripts/extensions-skins.php @@ -8,64 +8,65 @@ $MW_VERSION = getenv("MW_VERSION"); $MW_VOLUME = getenv("MW_VOLUME"); $MW_ORIGIN_FILES = getenv("MW_ORIGIN_FILES"); -$type = $argv[1]; -$path = $argv[2]; +$path = $argv[1]; $yamlData = yaml_parse_file($path); -foreach ($yamlData[$type] as $obj) { - $name = key($obj); - $data = $obj[$name]; - - $repository = $data['repository'] ?? null; - $commit = $data['commit'] ?? null; - $branch = $data['branch'] ?? null; - $patches = $data['patches'] ?? null; - $persistentDirectories = $data['persistent-directories'] ?? null; - $additionalSteps = $data['additional steps'] ?? null; - $bundled = $data['bundled'] ?? false; - - if ($persistentDirectories !== null) { - exec("mkdir -p $MW_ORIGIN_FILES/canasta-$type/$name"); - foreach ($directory as $persistentDirectories) { - exec("mv $MW_HOME/canasta-$type/$name/$directory $MW_ORIGIN_FILES/canasta-$type/$name/"); - exec("ln -s $MW_VOLUME/canasta-$type/$name/$directory $MW_HOME/canasta-$type/$name/$directory"); - } - } - - if (!$bundled) { - $gitCloneCmd = "git clone "; +foreach (["skins", "extensions"] as $type) { + foreach ($yamlData[$type] as $obj) { + $name = key($obj); + $data = $obj[$name]; - if ($repository === null) { - $repository = "https://github.com/wikimedia/mediawiki-$type-$name"; - if ($branch === null) { - $branch = $MW_VERSION; - $gitCloneCmd .= "--single-branch -b $branch "; + $repository = $data['repository'] ?? null; + $commit = $data['commit'] ?? null; + $branch = $data['branch'] ?? null; + $patches = $data['patches'] ?? null; + $persistentDirectories = $data['persistent-directories'] ?? null; + $additionalSteps = $data['additional steps'] ?? null; + $bundled = $data['bundled'] ?? false; + + if (!$bundled) { + $gitCloneCmd = "git clone "; + + if ($repository === null) { + $repository = "https://github.com/wikimedia/mediawiki-$type-$name"; + if ($branch === null) { + $branch = $MW_VERSION; + $gitCloneCmd .= "--single-branch -b $branch "; + } } - } - - $gitCloneCmd .= "$repository $MW_HOME/$type/$name"; - $gitCheckoutCmd = "cd $MW_HOME/$type/$name && git checkout -q $commit"; + + $gitCloneCmd .= "$repository $MW_HOME/$type/$name"; + $gitCheckoutCmd = "cd $MW_HOME/$type/$name && git checkout -q $commit"; - exec($gitCloneCmd); - exec($gitCheckoutCmd); + exec($gitCloneCmd); + exec($gitCheckoutCmd); - if ($patches !== null) { - foreach ($patches as $patch) { - $gitApplyCmd = "cd $MW_HOME/$type/$name && git apply /tmp/$patch"; - exec($gitApplyCmd); + if ($patches !== null) { + foreach ($patches as $patch) { + $gitApplyCmd = "cd $MW_HOME/$type/$name && git apply /tmp/$patch"; + exec($gitApplyCmd); + } + } + } + + if ($additionalSteps !== null) { + foreach ($additionalSteps as $step) { + if ($step === "composer update") { + $composerUpdateCmd = "cd $MW_HOME/$type/$name && composer update --no-dev"; + exec($composerUpdateCmd); + } elseif ($step === "git submodule update") { + $submoduleUpdateCmd = "cd $MW_HOME/$type/$name && git submodule update --init"; + exec($submoduleUpdateCmd); + } } } - } - if ($additionalSteps !== null) { - foreach ($additionalSteps as $step) { - if ($step === "composer update") { - $composerUpdateCmd = "cd $MW_HOME/$type/$name && composer update --no-dev"; - exec($composerUpdateCmd); - } elseif ($step === "git submodule update") { - $submoduleUpdateCmd = "cd $MW_HOME/$type/$name && git submodule update --init"; - exec($submoduleUpdateCmd); + if ($persistentDirectories !== null) { + exec("mkdir -p $MW_ORIGIN_FILES/canasta-$type/$name"); + foreach ($directory as $persistentDirectories) { + exec("mv $MW_HOME/canasta-$type/$name/$directory $MW_ORIGIN_FILES/canasta-$type/$name/"); + exec("ln -s $MW_VOLUME/canasta-$type/$name/$directory $MW_HOME/canasta-$type/$name/$directory"); } } }