Add support for wikidiff2 (#918)

pull/921/head
Michele Locati 2024-04-30 16:23:57 +02:00 committed by GitHub
parent 7413b1f8e9
commit 91038e2e4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 104 additions and 1 deletions

View File

@ -13,3 +13,4 @@ simdjson !jessie !stretch
sodium !jessie sodium !jessie
sqlsrv !7.1-alpine3.9 !7.1-alpine3.10 !arm sqlsrv !7.1-alpine3.9 !7.1-alpine3.10 !arm
vips !alpine3.9 !jessie vips !alpine3.9 !jessie
wikidiff2 !jessie !stretch

View File

@ -128,6 +128,7 @@ uv 8.0 8.1 8.2 8.3
vips 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 vips 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3
vld 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 vld 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3
wddx 5.5 5.6 7.0 7.1 7.2 7.3 wddx 5.5 5.6 7.0 7.1 7.2 7.3
wikidiff2 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3
xdebug 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 xdebug 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3
xdiff 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 xdiff 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3
xhprof 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 xhprof 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3

View File

@ -1458,6 +1458,14 @@ buildRequiredPackageLists() {
wddx@debian) wddx@debian)
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libxml2-dev" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libxml2-dev"
;; ;;
wikidiff2@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libstdc++"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile git"
;;
wikidiff2@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libthai0"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile git libthai-dev"
;;
xdebug@alpine) xdebug@alpine)
if test $PHP_MAJMIN_VERSION -ge 800; then if test $PHP_MAJMIN_VERSION -ge 800; then
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile linux-headers" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile linux-headers"
@ -2232,6 +2240,59 @@ installLibMPDec() {
cd - >/dev/null cd - >/dev/null
} }
# Check if libdatrie is installed
#
# Return:
# 0 (true)
# 1 (false)
isLibDatrieInstalled() {
if ! test -f /usr/local/lib/libdatrie.so && ! test -f /usr/lib/libdatrie.so && ! test -f /usr/lib/x86_64*/libdatrie.so; then
return 1
fi
if ! test -f /usr/local/include/datrie/trie.h && ! test -f /usr/include/datrie/trie.h; then
return 1
fi
return 0
}
# Install libdatrie
installLibDatrie() {
printf 'Installing libdatrie\n'
installLibDatrie_src="$(getPackageSource https://github.com/tlwg/libdatrie/releases/download/v0.2.13/libdatrie-0.2.13.tar.xz)"
cd -- "$installLibDatrie_src"
./configure
make -j$(getProcessorCount)
make install
cd - >/dev/null
}
# Check if libdatrie is installed
#
# Return:
# 0 (true)
# 1 (false)
isLibThaiInstalled() {
return 1
if ! test -f /usr/local/lib/libthai.so && ! test -f /usr/lib/libthai.so && ! test -f /usr/lib/x86_64*/libthai.so; then
return 1
fi
if ! test -f /usr/local/include/thai/thailib.h && ! test -f /usr/include/thai/thailib.h; then
return 1
fi
return 0
}
# Install libdatrie
installLibThai() {
printf 'Installing libthai\n'
installLibThai_src="$(getPackageSource https://github.com/tlwg/libthai/releases/download/v0.1.29/libthai-0.1.29.tar.xz)"
cd -- "$installLibThai_src"
./configure
make -j$(getProcessorCount)
make install
cd - >/dev/null
}
# Install Composer # Install Composer
installComposer() { installComposer() {
installComposer_version="$(getWantedPHPModuleVersion @composer)" installComposer_version="$(getWantedPHPModuleVersion @composer)"
@ -4053,6 +4114,33 @@ installRemoteModule() {
fi fi
fi fi
;; ;;
wikidiff2)
case "$DISTRO" in
alpine)
if ! isLibDatrieInstalled; then
installLibDatrie
fi
if ! isLibThaiInstalled; then
installLibThai
fi
;;
esac
if test -z "$installRemoteModule_version"; then
if test $PHP_MAJMIN_VERSION -le 702; then
installRemoteModule_version=1.13.0
else
installRemoteModule_version="$(git -c versionsort.suffix=- ls-remote --tags --refs --quiet --exit-code --sort=version:refname https://github.com/wikimedia/mediawiki-php-wikidiff2.git 'refs/tags/*.*.*' | tail -1 | cut -d/ -f3)"
fi
fi
installRemoteModule_src="$(getPackageSource "https://codeload.github.com/wikimedia/mediawiki-php-wikidiff2/tar.gz/refs/tags/$installRemoteModule_version")"
cd -- "$installRemoteModule_src"
phpize
./configure
make -j$(getProcessorCount)
make install
cd - >/dev/null
installRemoteModule_manuallyInstalled=1
;;
xdebug) xdebug)
if test -z "$installRemoteModule_version"; then if test -z "$installRemoteModule_version"; then
if test $PHP_MAJMIN_VERSION -le 500; then if test $PHP_MAJMIN_VERSION -le 500; then
@ -4507,7 +4595,7 @@ fixLetsEncrypt() {
invokeAptGetUpdate invokeAptGetUpdate
fi fi
printf -- '- installing newer ca-certificates package\n' printf -- '- installing newer ca-certificates package\n'
DEBIAN_FRONTEND=noninteractive apt-get install -qqy --no-install-recommends $IPE_APTGET_INSTALLOPTIONS ca-certificates DEBIAN_FRONTEND=noninteractive apt-get install -qqy --no-install-recommends ${IPE_APTGET_INSTALLOPTIONS:-} ca-certificates
fi fi
;; ;;
*) *)

13
scripts/tests/wikidiff2 Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env php
<?php
require_once __DIR__ . '/_bootstrap.php';
$diff = wikidiff2_inline_json_diff("a\nb\nc", "a\nd\nc", 1);
$data = json_decode($diff, true);
if (!is_array($data)) {
fwrite(STDERR, "Unexpected result of wikidiff2_inline_json_diff():\n{$diff}\n");
exit(1);
}
echo "wikidiff2 works as expected\n";
exit(0);