Compare commits
No commits in common. "1591fdb7cc380470fd4b86c9c9ffec6834e82327" and "d0f63b2fc8612294f1a69168dc0eb32f86781124" have entirely different histories.
1591fdb7cc
...
d0f63b2fc8
|
@ -86,7 +86,8 @@ in {
|
|||
};
|
||||
|
||||
extensions = {
|
||||
inherit (pkgs.mediawiki-extensions) DeleteBatch UserMerge PluggableAuth SimpleSAMLphp VisualEditor;
|
||||
#inherit (pkgs.mediawiki-extensions) DeleteBatch UserMerge PluggableAuth SimpleSAMLphp VisualEditor;
|
||||
inherit (pkgs.mediawiki-extensions) UserMerge PluggableAuth SimpleSAMLphp VisualEditor;
|
||||
};
|
||||
|
||||
extraConfig = ''
|
||||
|
@ -120,6 +121,7 @@ in {
|
|||
|
||||
# Misc
|
||||
$wgEmergencyContact = "${cfg.passwordSender}";
|
||||
$wgShowIPinHeader = false;
|
||||
$wgUseTeX = false;
|
||||
$wgLocalInterwiki = $wgSitename;
|
||||
|
||||
|
@ -135,10 +137,6 @@ in {
|
|||
]
|
||||
];
|
||||
|
||||
# Debugging
|
||||
$wgShowExceptionDetails = false;
|
||||
$wgShowIPinHeader = false;
|
||||
|
||||
# Fix https://github.com/NixOS/nixpkgs/issues/183097
|
||||
$wgDBserver = "${toString cfg.database.host}";
|
||||
'';
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
{ fetchgit }:
|
||||
{ fetchzip }:
|
||||
let
|
||||
commit = "cad869fbd95637902673f744581b29e0f3e3f61a";
|
||||
project-name = "DeleteBatch";
|
||||
commit = "c17c919bdb9b67bb69f80df43e9ee9d33b1ecf1b";
|
||||
project-name = "UserMerge";
|
||||
tracking-branch = "REL1_41";
|
||||
in
|
||||
(fetchgit {
|
||||
name = "mediawiki-delete-batch-source";
|
||||
url = "https://gerrit.wikimedia.org/r/mediawiki/extensions/${project-name}";
|
||||
rev = "refs/heads/${tracking-branch}";
|
||||
hash = "sha256-M1ek1WdO1/uTjeYlrk3Tz+nlb/fFZH+O0Ok7b10iKak=";
|
||||
}).overrideAttrs (_: {
|
||||
fetchzip {
|
||||
name = "mediawiki-delete-batch";
|
||||
url = "https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/${project-name}/+archive/${commit}.tar.gz";
|
||||
hash = "sha256-+mkzTCo8RVlGoFyfCrSb5YMh4J6Pbi1PZLFu5ps8bWY=";
|
||||
stripRoot = false;
|
||||
passthru = { inherit project-name tracking-branch; };
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
{ fetchgit }:
|
||||
{ fetchzip }:
|
||||
let
|
||||
commit = "4111a57c34e25bde579cce5d14ea094021e450c8";
|
||||
project-name = "PluggableAuth";
|
||||
tracking-branch = "REL1_41";
|
||||
in
|
||||
(fetchgit {
|
||||
fetchzip {
|
||||
name = "mediawiki-pluggable-auth-source";
|
||||
url = "https://gerrit.wikimedia.org/r/mediawiki/extensions/${project-name}";
|
||||
rev = "refs/heads/${tracking-branch}";
|
||||
url = "https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/${project-name}/+archive/${commit}.tar.gz";
|
||||
hash = "sha256-aPtN8A9gDxLlq2+EloRZBO0DfHtE0E5kbV/adk82jvM=";
|
||||
}).overrideAttrs (_: {
|
||||
stripRoot = false;
|
||||
passthru = { inherit project-name tracking-branch; };
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
{ fetchgit }:
|
||||
{ fetchzip }:
|
||||
let
|
||||
commit = "ecb47191fecd1e0dc4c9d8b90a9118e393d82c23";
|
||||
project-name = "SimpleSAMLphp";
|
||||
tracking-branch = "REL1_41";
|
||||
in
|
||||
(fetchgit {
|
||||
fetchzip {
|
||||
name = "mediawiki-simple-saml-php-source";
|
||||
url = "https://gerrit.wikimedia.org/r/mediawiki/extensions/${project-name}";
|
||||
rev = "refs/heads/${tracking-branch}";
|
||||
url = "https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/${project-name}/+archive/${commit}.tar.gz";
|
||||
hash = "sha256-gKu+O49XrAVt6hXdt36Ru7snjsKX6g2CYJ0kk/d+CI8=";
|
||||
}).overrideAttrs (_: {
|
||||
stripRoot = false;
|
||||
passthru = { inherit project-name tracking-branch; };
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i python3 -p "python3.withPackages(ps: with ps; [ beautifulsoup4 requests ])" nix-prefetch-git
|
||||
#!nix-shell -i python3 -p "python3.withPackages(ps: with ps; [ beautifulsoup4 requests ])"
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
@ -8,13 +8,11 @@ import subprocess
|
|||
from collections import defaultdict
|
||||
from pprint import pprint
|
||||
from dataclasses import dataclass
|
||||
import json
|
||||
|
||||
import bs4
|
||||
import requests
|
||||
|
||||
BASE_WEB_URL = "https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions"
|
||||
BASE_GIT_URL = "https://gerrit.wikimedia.org/r/mediawiki/extensions/"
|
||||
BASE_URL = "https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions"
|
||||
|
||||
@dataclass
|
||||
class PluginMetadata:
|
||||
|
@ -47,21 +45,26 @@ def get_metadata(file_content: str) -> dict[str,str] | None:
|
|||
|
||||
|
||||
def get_newest_commit(project_name: str, tracking_branch: str) -> str:
|
||||
content = requests.get(f"{BASE_WEB_URL}/{project_name}/+log/refs/heads/{tracking_branch}/").text
|
||||
content = requests.get(f"{BASE_URL}/{project_name}/+log/refs/heads/{tracking_branch}/").text
|
||||
soup = bs4.BeautifulSoup(content, features="html.parser")
|
||||
a = soup.find('li').findChild('a')
|
||||
commit_sha = a['href'].split('/')[-1]
|
||||
return commit_sha
|
||||
|
||||
|
||||
def get_nix_hash(url: str, commit: str) -> str:
|
||||
def get_nix_hash(tar_gz_url: str) -> str:
|
||||
out, err = subprocess.Popen(
|
||||
["nix-prefetch-git", "--url", url, "--rev", commit, "--fetch-submodules", "--quiet"],
|
||||
["nix-prefetch-url", "--unpack", "--type", "sha256", tar_gz_url],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE
|
||||
).communicate()
|
||||
out, err = subprocess.Popen(
|
||||
["nix", "hash", "to-sri", "--type", "sha256", out.decode().strip()],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE
|
||||
).communicate()
|
||||
|
||||
return json.loads(out.decode().strip())['hash']
|
||||
return out.decode().strip()
|
||||
|
||||
|
||||
def set_commit_and_hash(file_content: str, commit: str, sha256: str) -> str:
|
||||
|
@ -76,16 +79,16 @@ def update(package_file: Path) -> None:
|
|||
|
||||
metadata = get_metadata(file_content)
|
||||
if metadata is None:
|
||||
print(f"ERROR: could not find metadata for {package_file}")
|
||||
return
|
||||
if metadata.commit == "":
|
||||
metadata.commit = "<none>"
|
||||
|
||||
new_commit = get_newest_commit(metadata.project_name, metadata.tracking_branch)
|
||||
new_hash = get_nix_hash(f"{BASE_GIT_URL}/{metadata.project_name}", new_commit)
|
||||
if new_hash is None or new_hash == "":
|
||||
print(f"ERROR: could not fetch hash for {metadata.project_name}")
|
||||
exit(1)
|
||||
if new_commit == metadata.commit:
|
||||
return
|
||||
|
||||
new_url = f"{BASE_URL}/{metadata.project_name}/+archive/{new_commit}.tar.gz"
|
||||
new_hash = get_nix_hash(new_url)
|
||||
|
||||
print(f"Updating {metadata.project_name}: {metadata.commit} -> {new_commit}")
|
||||
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
{ fetchgit }:
|
||||
{ fetchzip }:
|
||||
let
|
||||
commit = "c17c919bdb9b67bb69f80df43e9ee9d33b1ecf1b";
|
||||
project-name = "UserMerge";
|
||||
tracking-branch = "REL1_41";
|
||||
in
|
||||
(fetchgit {
|
||||
fetchzip {
|
||||
name = "mediawiki-user-merge-source";
|
||||
url = "https://gerrit.wikimedia.org/r/mediawiki/extensions/${project-name}";
|
||||
rev = "refs/heads/${tracking-branch}";
|
||||
url = "https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/${project-name}/+archive/${commit}.tar.gz";
|
||||
hash = "sha256-+mkzTCo8RVlGoFyfCrSb5YMh4J6Pbi1PZLFu5ps8bWY=";
|
||||
}).overrideAttrs (_: {
|
||||
stripRoot = false;
|
||||
passthru = { inherit project-name tracking-branch; };
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
{ fetchgit }:
|
||||
{ fetchzip }:
|
||||
let
|
||||
commit = "170d19aad1f28dc6bd3f98ee277680cabba9db0c";
|
||||
project-name = "VisualEditor";
|
||||
tracking-branch = "REL1_41";
|
||||
in
|
||||
(fetchgit {
|
||||
fetchzip {
|
||||
name = "mediawiki-visual-editor-source";
|
||||
url = "https://gerrit.wikimedia.org/r/mediawiki/extensions/${project-name}";
|
||||
rev = "refs/heads/${tracking-branch}";
|
||||
hash = "sha256-5WVlO/OEk4eln5j/w4Tu/MXSmlvjIn7l6H+OTPaV+t4=";
|
||||
}).overrideAttrs (_: {
|
||||
url = "https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/${project-name}/+archive/${commit}.tar.gz";
|
||||
hash = "sha256-Qg5AE1kQ+R4iNYyqzjrcOf3g6WnPSQcYow1tU0RwFk0=";
|
||||
stripRoot = false;
|
||||
passthru = { inherit project-name tracking-branch; };
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue