Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions sync/wikiman/wikiman-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@
},
"remove": {
"$ref": "#/$defs/RemoveList"
},
"patches": {
"$ref": "#/$defs/PatchList"
}
},
"additionalProperties": false,
Expand All @@ -88,6 +91,9 @@
},
"remove": {
"$ref": "#/$defs/RemoveList"
},
"patches": {
"$ref": "#/$defs/PatchList"
}
},
"additionalProperties": false,
Expand All @@ -102,6 +108,27 @@
"items": {
"type": "string"
}
},
"PatchList": {
"description": "Patches to apply to the repo",
"type": "array",
"items": {
"$ref": "#/$defs/Patch"
}
},
"Patch": {
"description": "A patch to apply (currently only Gerrit base64 patches are supported)",
"type": "object",
"properties": {
"url": {
"description": "URL to download the patch from",
"type": "string"
}
},
"additionalProperties": false,
"required": [
"url"
]
}
}
}
24 changes: 13 additions & 11 deletions sync/wikiman/wikiman.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ def get_github_url_from_ref(github: Github, ref: str, repository: str):

return f"https://codeload.github.com/{repository}/zip/{commit.sha}"

def make_artifact_entry(details: Dict[str, str], extra_remove: List[str]) -> Dict[str, Any]:
name = details['name']
def make_artifact_entry(details: Dict[str, Any], extra_remove: List[str]) -> Dict[str, Any]:
name: str = details['name']
patches: List[Dict[str, str]] = details.get('patches', [])

if "repoName" in details.keys():
artifact_url = get_github_url_from_ref(github_client, details['repoRef'], details['repoName'])
Expand All @@ -45,14 +46,14 @@ def make_artifact_entry(details: Dict[str, str], extra_remove: List[str]) -> Dic
else:
raise ValueError(f"'repoName' or 'url' key not specified for '{name}' in '{SOURCE_YAMLFILE}'")

entry = {
return {
'name': name,
'artifactUrl': artifact_url,
'artifactLevel': 1,
'destination': details['destination'],
'patchUrls': [patch['url'] for patch in patches],
'remove' : extra_remove + details.get('remove', []),
}
return entry

# pylint: disable=too-many-ancestors
class FixedIndentingDumper(yaml.Dumper):
Expand All @@ -63,22 +64,23 @@ def increase_indent(self, flow=False, indentless=False):
default_branch = get_mediawiki_branch_from_version(mediawiki_version) # pylint: disable-msg=C0103
remove_from_all = codebases.get('removeFromAll', [])
output: List[Dict] = [make_artifact_entry({
'name': 'mediawiki',
'repoName': 'wikimedia/mediawiki',
'repoRef': codebases.get('mediawikiRepoRef', default_branch),
'destination': './dist',
'remove': codebases.get('mediawikiRemove', [])
'name': 'mediawiki',
'repoName': 'wikimedia/mediawiki',
'repoRef': codebases.get('mediawikiRepoRef', default_branch),
'destination': './dist',
'remove': codebases.get('mediawikiRemove', []),
'patches': codebases.get('mediawikiPatches', []),
}, remove_from_all)]

output += [
make_artifact_entry( {**ext,'destination': f"./dist/extensions/{ext['name']}", 'repoRef': ext.get('repoRef', default_branch)}, remove_from_all )
for ext in extensions
]
]

output += [
make_artifact_entry( {**skin,'destination': f"./dist/skins/{skin['name']}", 'repoRef': skin.get('repoRef', default_branch)}, remove_from_all )
for skin in skins
]
]

# write out to the lock.yaml file
with open(DESTINATION_YAMLFILE, 'w') as outfile:
Expand Down
18 changes: 18 additions & 0 deletions wikiman.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,16 @@ extensions:
repoName: wikimedia/mediawiki-extensions-CirrusSearch
- name: WikibaseCirrusSearch
repoName: wikimedia/mediawiki-extensions-WikibaseCirrusSearch
patches:
# Add a config option to allow ignoring Elasticsearch errors
- url: https://gerrit.wikimedia.org/r/changes/mediawiki%2Fextensions%2FWikibaseCirrusSearch~1120939/revisions/2/patch?download
# Fallback to EntityTermSearchHelper when no results are found
- url: https://gerrit.wikimedia.org/r/changes/mediawiki%2Fextensions%2FWikibaseCirrusSearch~1120941/revisions/1/patch?download
- name: WikibaseLexemeCirrusSearch
repoName: wikimedia/mediawiki-extensions-WikibaseLexemeCirrusSearch
patches:
# Add a config option to allow ignoring Elasticsearch errors
- url: https://gerrit.wikimedia.org/r/changes/mediawiki%2Fextensions%2FWikibaseLexemeCirrusSearch~1120949/revisions/1/patch?download
- name: UniversalLanguageSelector
repoName: wikimedia/mediawiki-extensions-UniversalLanguageSelector
- name: cldr
Expand All @@ -62,6 +70,9 @@ extensions:
repoName: wikimedia/mediawiki-extensions-TwoColConflict
- name: OAuth
repoName: wikimedia/mediawiki-extensions-OAuth
patches:
# Remove warning when using OAuth server's URL
- url: https://gerrit.wikimedia.org/r/changes/mediawiki%2Fextensions%2FOAuth~1197610/revisions/2/patch?download
- name: WikibaseLexeme
repoName: wikimedia/mediawiki-extensions-WikibaseLexeme
- name: SyntaxHighlight_GeSHi
Expand Down Expand Up @@ -92,6 +103,10 @@ extensions:
repoName: wikimedia/mediawiki-extensions-SecureLinkFixer
- name: Echo
repoName: wikimedia/mediawiki-extensions-Echo
patches:
# Fixes SQLBagOStuff duplicate warnings due to a bug in the Echo extension.
# Remove when updated to 1.44+ (Bug: T412100).
- url: https://gerrit.wikimedia.org/r/changes/mediawiki%2Fextensions%2FEcho~1093496/revisions/1/patch?download
- name: Poem
repoName: wikimedia/mediawiki-extensions-Poem
- name: TemplateData
Expand Down Expand Up @@ -134,6 +149,9 @@ extensions:
## These extensions use urls directly
- name: Wikibase
url: https://github.com/wbstack/mediawiki-tars/raw/a58eaf2a2c2324649985da8281e264a600d029fc/Wikibase-1782811529-REL1_43.tar.gz
patches:
# Support for fallback search helpers in CombinedEntitySearchHelper
- url: https://gerrit.wikimedia.org/r/changes/mediawiki%2Fextensions%2FWikibase~1120952/revisions/1/patch?download
remove:
- build
- vendor
Expand Down
Loading