Page MenuHomePhabricator

Add git repository
Closed, ResolvedPublic

Description

I would like to be able to use ExtensionJson.json to install any extension from git. I thought the git url might already be in it (since it is in the infobox) but I was disappointed that it wasn't there.

What needs to be done to add the git repo?

Event Timeline

I guess you'd have to add a directory => git URL mapping spec to the configuration file and add it to the dump in JsonCollector.

I guess you'd have to add a directory => git URL mapping spec to the configuration file and add it to the dump in JsonCollector.

How does that help extensions not hosted on Gerrit?

The same way it helps extensions hosted on Gerrit - by being able to deduce a git URL from a directory name.

Alternatively, the script could just shell out to git and check the upstream repo URL for each directory. That would assume directories are git checkouts, but there isn't much point in doing otherwise. (Wikibase is a weird edge case with multiple extensions in the same repo, but I think it would work out in the end.)

Alternatively, the script could just shell out to git and check the upstream repo URL for each directory. That would assume directories are git checkouts, but there isn't much point in doing otherwise. (Wikibase is a weird edge case with multiple extensions in the same repo, but I think it would work out in the end.)

I guess I should say I don't know how this script works.

From your description, It sounds like it is working through the a directory of extensions (from https://gerrit.wikimedia.org/r/mediawiki/extensions ??), so all one would need to do is to get the checkout of, say, https://github.com/MWStake/nonwmf-extensions/ and run it there.

Is that right?

A list of directories of extensions, yeah. The Toolforge config uses the two you mentioned.

Can we not examine the submodule remotes for the Git repo URL? I think that might work.

However we get the URL though, where should it be added? A new top-level repository key in each extension? (This will be the first thing to be added here that's not in extension.json.)

The other place that this info is sometimes stored is in composer.json (with key: support.source), but I suspect it's in not all that many extensions' files. We could replicate that naming though.

Change 751066 had a related patch set uploaded (by Samwilson; author: Samwilson):

[labs/tools/extjsonuploader@master] Add Git repository info to extension data

https://gerrit.wikimedia.org/r/751066

However we get the URL though, where should it be added? A new top-level repository key in each extension? (This will be the first thing to be added here that's not in extension.json.)

Thanks! this is exactly what I was asking for in this task!

I appreciate the help clarifying my request.

Macro seal-of-approval:

Actually, I think using the Git remote's URL isn't always correct. For example, CollapsibleVector's remote URL is https://gerrit.wikimedia.org/r/mediawiki/extensions/CollapsibleVector but in composer.json it's https://phabricator.wikimedia.org/diffusion/ECLV/ (although perhaps it shouldn't be pointing to Diffusion any more).

I've updated the above patch to first check the Composer value, and then fall back to the Git remote.

Change 751066 merged by jenkins-bot:

[labs/tools/extjsonuploader@master] Add Git repository info to extension data

https://gerrit.wikimedia.org/r/751066

Oops, the new data has pushed us over the top:

Error when saving: The content you supplied exceeds the article size limit of 2048 kibibytes.

The JSON file at https://extjsonuploader.toolforge.org/ExtensionJson.json now contains the new repository field. But we'll have to remove some data, or move ahead with the splitting up of the Lua module, in order to get it working on-wiki.

I think there are a few fields that we could remove, at least for the time being. AutoloadNamespaces, MessagesDirs, and ResourceFileModulePaths, for instance, aren't used on-wiki anywhere (I think?). Removing those would probably get us down a bit. Any objections?

Change 752338 had a related patch set uploaded (by Samwilson; author: Samwilson):

[labs/tools/extjsonuploader@master] Remove more extension.json keys to reduce size

https://gerrit.wikimedia.org/r/752338

Change 752338 merged by jenkins-bot:

[labs/tools/extjsonuploader@master] Remove more extension.json keys to reduce size

https://gerrit.wikimedia.org/r/752338

Samwilson claimed this task.

This is all done now.