push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
{
lib,
stdenv,
fetchFromGitHub,
}:
stdenv.mkDerivation {
pname = "OpenBUGS";
version = "3.2.3";
outputs = [ "out" ];
src = fetchFromGitHub {
owner = "jsta";
repo = "openbugs";
rev = "cd921342ba13ee89ee60f9aebd2e96c42bd59ae3";
sha256 = "sha256-11LrScN1kvtq0Fo7RWGjbQO0U5b5brCbipl5pdZnrFs=";
};
meta = with lib; {
description = "Software package for performing Bayesian analysis and simulation using Markov Chain Monte Carlo";
homepage = "https://github.com/jsta/openbugs/";
changelog = "https://github.com/jsta/openbugs/blob/master/ChangeLog";
platforms = [
"i686-linux"
"x86_64-linux"
];
license = licenses.gpl3Only;
maintainers = with maintainers; [ andresnav ];
};
}

View File

@@ -0,0 +1,243 @@
{
lib,
stdenv,
fetchFromGitHub,
fetchpatch,
fetchurl,
# build
cmake,
ctags,
python3Packages,
swig,
# math
eigen,
blas,
lapack,
glpk,
# data
protobuf,
json_c,
libxml2,
hdf5,
curl,
# compression
libarchive,
bzip2,
xz,
snappy,
lzo,
# more math
nlopt,
lp_solve,
colpack,
# extra support
pythonSupport ? false,
opencvSupport ? false,
opencv ? null,
withSvmLight ? false,
}:
assert pythonSupport -> python3Packages != null;
assert opencvSupport -> opencv != null;
assert (!blas.isILP64) && (!lapack.isILP64);
let
pname = "shogun";
version = "6.1.4";
rxcppVersion = "4.0.0";
gtestVersion = "1.8.0";
srcs = {
toolbox = fetchFromGitHub {
owner = "shogun-toolbox";
repo = "shogun";
rev = "shogun_${version}";
hash = "sha256-38aULxK50wQ2+/ERosSpRyBmssmYSGv5aaWfWSlrSRc=";
fetchSubmodules = true;
};
# The CMake external projects expect the packed archives
rxcpp = fetchurl {
url = "https://github.com/Reactive-Extensions/RxCpp/archive/v${rxcppVersion}.tar.gz";
sha256 = "sha256-UOc5WrG8KgAA3xJsaSCjbdPE7gSnFJay9MEK31DWUXg=";
};
gtest = fetchurl {
url = "https://github.com/google/googletest/archive/release-${gtestVersion}.tar.gz";
sha256 = "sha256-WKb0J3yivIVlIis7vVihd2CenEiOinJkk1m6UUUNt9g=";
};
};
in
stdenv.mkDerivation (finalAttrs: {
inherit pname version;
outputs = [
"out"
"dev"
"doc"
];
src = srcs.toolbox;
patches = [
# Fix compile errors with GCC 9+
# https://github.com/shogun-toolbox/shogun/pull/4811
(fetchpatch {
url = "https://github.com/shogun-toolbox/shogun/commit/c8b670be4790e0f06804b048a6f3d77c17c3ee95.patch";
sha256 = "sha256-MxsR3Y2noFQevfqWK3nmX5iK4OVWeKBl5tfeDNgjcXk=";
})
(fetchpatch {
url = "https://github.com/shogun-toolbox/shogun/commit/5aceefd9fb0e2132c354b9a0c0ceb9160cc9b2f7.patch";
sha256 = "sha256-AgJJKQA8vc5oKaTQDqMdwBR4hT4sn9+uW0jLe7GteJw=";
})
# Fix virtual destruction
(fetchpatch {
url = "https://github.com/shogun-toolbox/shogun/commit/ef0e4dc1cc4a33c9e6b17a108fa38a436de2d7ee.patch";
sha256 = "sha256-a9Rm0ytqkSAgC3dguv8m3SwOSipb+VByBHHdmV0d63w=";
})
./fix-virtual-destruction.patch
# Fix compile errors with json-c
# https://github.com/shogun-toolbox/shogun/pull/4104
(fetchpatch {
url = "https://github.com/shogun-toolbox/shogun/commit/365ce4c4c700736d2eec8ba6c975327a5ac2cd9b.patch";
sha256 = "sha256-OhEWwrHtD/sOcjHmPY/C9zJ8ruww8yXrRcTw38nGEJU=";
})
# Fix compile errors with Eigen 3.4
./eigen-3.4.patch
]
++ lib.optional (!withSvmLight) ./svmlight-scrubber.patch;
nativeBuildInputs = [
cmake
swig
ctags
]
++ (with python3Packages; [
python
jinja2
ply
]);
buildInputs = [
eigen
blas
lapack
glpk
protobuf
json_c
libxml2
hdf5
curl
libarchive
bzip2
xz
snappy
lzo
nlopt
lp_solve
colpack
]
++ lib.optionals pythonSupport (
with python3Packages;
[
python
numpy
]
)
++ lib.optional opencvSupport opencv;
cmakeFlags =
let
excludeTestsRegex = lib.concatStringsSep "|" [
# segfault
"SerializationXML"
"TrainedModelSerialization"
# broken by openblas 0.3.21
"mathematics_lapack"
# fails on aarch64
"LinearTimeMMD"
"QuadraticTimeMMD"
"SGVectorTest"
"Statistics"
# hangs on aarch64
"PRange"
# these take too long on CI
"evaluation_cross_validation"
"modelselection_combined_kernel"
"modelselection_grid_search"
];
in
[
(lib.cmakeBool "BUILD_META_EXAMPLES" true)
(lib.cmakeBool "CMAKE_DISABLE_FIND_PACKAGE_ARPACK" true)
(lib.cmakeBool "CMAKE_DISABLE_FIND_PACKAGE_ARPREC" true)
(lib.cmakeBool "CMAKE_DISABLE_FIND_PACKAGE_CPLEX" true)
(lib.cmakeBool "CMAKE_DISABLE_FIND_PACKAGE_Mosek" true)
(lib.cmakeBool "CMAKE_DISABLE_FIND_PACKAGE_TFLogger" true)
(lib.cmakeBool "CMAKE_DISABLE_FIND_PACKAGE_ViennaCL" true)
(lib.cmakeFeature "CMAKE_CTEST_ARGUMENTS" "--exclude-regex;'${excludeTestsRegex}'")
(lib.cmakeBool "ENABLE_TESTING" finalAttrs.finalPackage.doCheck)
(lib.cmakeBool "DISABLE_META_INTEGRATION_TESTS" true)
(lib.cmakeBool "TRAVIS_DISABLE_META_CPP" true)
(lib.cmakeBool "INTERFACE_PYTHON" pythonSupport)
(lib.cmakeBool "OpenCV" opencvSupport)
(lib.cmakeBool "USE_SVMLIGHT" withSvmLight)
];
CXXFLAGS = "-faligned-new";
doCheck = true;
postUnpack = ''
mkdir -p $sourceRoot/third_party/{rxcpp,GoogleMock}
ln -s ${srcs.rxcpp} $sourceRoot/third_party/rxcpp/v${rxcppVersion}.tar.gz
ln -s ${srcs.gtest} $sourceRoot/third_party/GoogleMock/release-${gtestVersion}.tar.gz
'';
postPatch = ''
# Fix preprocessing SVMlight code
sed -i \
-e 's@#ifdef SVMLIGHT@#ifdef USE_SVMLIGHT@' \
-e '/^#ifdef USE_SVMLIGHT/,/^#endif/ s@#endif@#endif //USE_SVMLIGHT@' \
src/shogun/kernel/string/CommUlongStringKernel.cpp
sed -i -e 's/#if USE_SVMLIGHT/#ifdef USE_SVMLIGHT/' src/interfaces/swig/Machine.i
sed -i -e 's@// USE_SVMLIGHT@//USE_SVMLIGHT@' src/interfaces/swig/Transfer.i
sed -i -e 's@/\* USE_SVMLIGHT \*/@//USE_SVMLIGHT@' src/interfaces/swig/Transfer_includes.i
''
+ lib.optionalString (!withSvmLight) ''
# Run SVMlight scrubber
patchShebangs scripts/light-scrubber.sh
echo "removing SVMlight code"
./scripts/light-scrubber.sh
'';
postInstall = ''
mkdir -p $doc/share/doc/shogun/examples
mv $out/share/shogun/examples/cpp $doc/share/doc/shogun/examples
cp ../examples/undocumented/libshogun/*.cpp $doc/share/doc/shogun/examples/cpp
rm -r $out/share
'';
postFixup = ''
# CMake incorrectly calculates library path from dev prefix
substituteInPlace $dev/lib/cmake/shogun/ShogunTargets-release.cmake \
--replace-fail "\''${_IMPORT_PREFIX}/lib/" "$out/lib/"
'';
meta = with lib; {
description = "Toolbox which offers a wide range of efficient and unified machine learning methods";
homepage = "http://shogun-toolbox.org/";
license = if withSvmLight then licenses.unfree else licenses.gpl3Plus;
maintainers = with maintainers; [
edwtjo
smancill
];
};
})

View File

@@ -0,0 +1,74 @@
From: Sebastián Mancilla <smancill@smancill.dev>
Subject: [PATCH] Fix compile errors when using Eigen 3.4
---
.../machine/gp/MultiLaplaceInferenceMethod.cpp | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/shogun/machine/gp/MultiLaplaceInferenceMethod.cpp b/src/shogun/machine/gp/MultiLaplaceInferenceMethod.cpp
index 2e27678d2..60050afea 100644
--- a/src/shogun/machine/gp/MultiLaplaceInferenceMethod.cpp
+++ b/src/shogun/machine/gp/MultiLaplaceInferenceMethod.cpp
@@ -84,9 +84,9 @@ class CMultiPsiLine : public func_base
float64_t result=0;
for(index_t bl=0; bl<C; bl++)
{
- eigen_f.block(bl*n,0,n,1)=K*alpha->block(bl*n,0,n,1)*CMath::exp(log_scale*2.0);
- result+=alpha->block(bl*n,0,n,1).dot(eigen_f.block(bl*n,0,n,1))/2.0;
- eigen_f.block(bl*n,0,n,1)+=eigen_m;
+ eigen_f.segment(bl*n,n)=K*alpha->segment(bl*n,n)*CMath::exp(log_scale*2.0);
+ result+=alpha->segment(bl*n,n).dot(eigen_f.segment(bl*n,n))/2.0;
+ eigen_f.segment(bl*n,n)+=eigen_m;
}
// get first and second derivatives of log likelihood
@@ -272,7 +272,7 @@ void CMultiLaplaceInferenceMethod::update_alpha()
{
Map<VectorXd> alpha(m_alpha.vector, m_alpha.vlen);
for(index_t bl=0; bl<C; bl++)
- eigen_mu.block(bl*n,0,n,1)=eigen_ktrtr*CMath::exp(m_log_scale*2.0)*alpha.block(bl*n,0,n,1);
+ eigen_mu.segment(bl*n,n)=eigen_ktrtr*CMath::exp(m_log_scale*2.0)*alpha.segment(bl*n,n);
//alpha'*(f-m)/2.0
Psi_New=alpha.dot(eigen_mu)/2.0;
@@ -316,7 +316,7 @@ void CMultiLaplaceInferenceMethod::update_alpha()
for(index_t bl=0; bl<C; bl++)
{
- VectorXd eigen_sD=eigen_dpi.block(bl*n,0,n,1).cwiseSqrt();
+ VectorXd eigen_sD=eigen_dpi.segment(bl*n,n).cwiseSqrt();
LLT<MatrixXd> chol_tmp((eigen_sD*eigen_sD.transpose()).cwiseProduct(eigen_ktrtr*CMath::exp(m_log_scale*2.0))+
MatrixXd::Identity(m_ktrtr.num_rows, m_ktrtr.num_cols));
MatrixXd eigen_L_tmp=chol_tmp.matrixU();
@@ -341,11 +341,11 @@ void CMultiLaplaceInferenceMethod::update_alpha()
VectorXd tmp2=m_tmp.array().rowwise().sum();
for(index_t bl=0; bl<C; bl++)
- eigen_b.block(bl*n,0,n,1)+=eigen_dpi.block(bl*n,0,n,1).cwiseProduct(eigen_mu.block(bl*n,0,n,1)-eigen_mean_bl-tmp2);
+ eigen_b.segment(bl*n,n)+=eigen_dpi.segment(bl*n,n).cwiseProduct(eigen_mu.segment(bl*n,n)-eigen_mean_bl-tmp2);
Map<VectorXd> &eigen_c=eigen_W;
for(index_t bl=0; bl<C; bl++)
- eigen_c.block(bl*n,0,n,1)=eigen_E.block(0,bl*n,n,n)*(eigen_ktrtr*CMath::exp(m_log_scale*2.0)*eigen_b.block(bl*n,0,n,1));
+ eigen_c.segment(bl*n,n)=eigen_E.block(0,bl*n,n,n)*(eigen_ktrtr*CMath::exp(m_log_scale*2.0)*eigen_b.segment(bl*n,n));
Map<MatrixXd> c_tmp(eigen_c.data(),n,C);
@@ -409,7 +409,7 @@ float64_t CMultiLaplaceInferenceMethod::get_derivative_helper(SGMatrix<float64_t
{
result+=((eigen_E.block(0,bl*n,n,n)-eigen_U.block(0,bl*n,n,n).transpose()*eigen_U.block(0,bl*n,n,n)).array()
*eigen_dK.array()).sum();
- result-=(eigen_dK*eigen_alpha.block(bl*n,0,n,1)).dot(eigen_alpha.block(bl*n,0,n,1));
+ result-=(eigen_dK*eigen_alpha.segment(bl*n,n)).dot(eigen_alpha.segment(bl*n,n));
}
return result/2.0;
@@ -489,7 +489,7 @@ SGVector<float64_t> CMultiLaplaceInferenceMethod::get_derivative_wrt_mean(
result[i]=0;
//currently only compute the explicit term
for(index_t bl=0; bl<C; bl++)
- result[i]-=eigen_alpha.block(bl*n,0,n,1).dot(eigen_dmu);
+ result[i]-=eigen_alpha.segment(bl*n,n).dot(eigen_dmu);
}
return result;

View File

@@ -0,0 +1,20 @@
From: Sebastián Mancilla <smancill@smancill.dev>
Subject: Fix virtual destruction
---
src/shogun/solver/LDASolver.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/shogun/solver/LDASolver.h b/src/shogun/solver/LDASolver.h
index 9300a85c5..d500eca5d 100644
--- a/src/shogun/solver/LDASolver.h
+++ b/src/shogun/solver/LDASolver.h
@@ -87,7 +87,7 @@ namespace shogun
compute_within_cov();
}
- ~LDASolver()
+ virtual ~LDASolver()
{
SG_UNREF(m_features)
SG_UNREF(m_labels)

View File

@@ -0,0 +1,76 @@
From: Sebastián Mancilla <smancill@smancill.dev>
Subject: Update SVMlight scrubber script
This requires previously fixing a few wrong preprocessor directives that
are supposed to fence code using SVMlight.
- The script was too eager and removing *.light files in SVMlight format
that are used by other tests. The code reading those files doesn't use
any SVMlight code so it should be fine to keep it and run the tests.
- The Python test *domainadaptationsvm.py was not removed because of
wrong globbing.
- Remove a couple of examples using SVMlight that were missed.
- The script is actually modifying (and breaking) itself because the
grep for the USE_SVMLIGHT macro is too eager again and matches itself
(and the version stored in upstream's Debian package control tarball
is broken because of it). Just fix it by grepping for preprocessor
directives only.
- No need to fix the Transfer_includes.i file in the script with a final
%} when its preprocessor directives have been fixed.
- The Swig files were moved to a new directory at some point but the
script was not updated accordingly.
---
scripts/light-scrubber.sh | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff a/scripts/light-scrubber.sh b/scripts/light-scrubber.sh
--- a/scripts/light-scrubber.sh
+++ b/scripts/light-scrubber.sh
@@ -26,14 +26,16 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-rm -rf examples/*/*/{*light*,*_domainadaptationsvm_*} \
+rm -rf examples/*/*/{*light*.*,*domainadaptationsvm*} \
examples/undocumented/matlab_and_octave/tests/*light* \
+ examples/undocumented/python/serialization_string_kernels.py \
+ examples/undocumented/python/mkl_binclass.py \
src/shogun/classifier/svm/SVMLight.* \
src/shogun/classifier/svm/SVMLightOneClass.* \
src/shogun/regression/svr/SVRLight.* \
doc/md/LICENSE_SVMlight*
-for _file in `grep -rl USE_SVMLIGHT .`
+grep -rl '^#ifdef USE_SVMLIGHT' . | while read -r _file
do
sed -i.orig -e \
'/\#ifdef USE_SVMLIGHT/,/\#endif \/\/USE_SVMLIGHT/c \\' ${_file} && \
@@ -41,7 +43,7 @@ do
rm -rf ${_file}.orig
done
-for _file in `find . -depth -name 'CMakeLists.txt'`
+find . -depth -name 'CMakeLists.txt' | while read -r _file
do
sed -i.orig -e 's!.*_sv[mr]light_.*!!g' ${_file} && \
touch -r ${_file}.orig ${_file} && \
@@ -56,13 +58,7 @@ do
rm -rf ${_file}.orig
done
-_file="src/interfaces/modular/Transfer_includes.i" && \
-cp -a ${_file} ${_file}.orig && \
-echo '%}' >> ${_file} && \
-touch -r ${_file}.orig ${_file} && \
-rm -rf ${_file}.orig
-
-_file="src/interfaces/modular/Machine.i" && \
+_file="src/interfaces/swig/Machine.i" && \
sed -i.orig -e '/.*CSVRLight.*/d' ${_file} && \
touch -r ${_file}.orig ${_file} && \
rm -rf ${_file}.orig