Name: freesurfer-data-fetch Version: 1.0 Release: 1%{?dist} Summary: Fetch FreeSurfer's atlases, template subjects and models on demand # The tool and the manifests are ours (MIT). The data they fetch is MGH's, under the # FreeSurfer licence, and is not rehosted: every URL is MGH's public git-annex. This lives # in neurofedora-nonfree because it exists only to serve freesurfer7/freesurfer8. License: MIT URL: https://gitlab.com/morgan.hough/neurofedora Source0: freesurfer-data-install # Generated by ci/freesurfer-data-manifest.py from the v8.2.0 / v7.4.1 source tarballs and # checked against MGH's official installs of the same versions (no size disagreement). Source1: freesurfer-data-manifest-8.2.0.tsv Source2: freesurfer-data-manifest-7.4.1.tsv BuildArch: noarch BuildRequires: python3-devel Requires: python3 %description FreeSurfer keeps the data recon-all reads (the average/ atlases and colortables, the fsaverage subject, the SynthMorph models, ...) in git-annex rather than in its source release, so no RPM carries it: about 11 GB per version. This tool downloads each file from MGH's public annex, checks it against the sha256 and size in its annex key, and installs it under /var/lib/freesurfer-data/VERSION, linked into /usr/lib/freesurfer-VERSION where FreeSurfer reads it. freesurfer-data-install --list sudo freesurfer-data-install recon-all # core + synthmorph, about 7.6 GB sudo freesurfer-data-install --fs 7.4.1 core Nothing is downloaded when this package is installed or upgraded. %prep %build %install install -D -m 0755 %{SOURCE0} %{buildroot}%{_bindir}/freesurfer-data-install install -D -m 0644 %{SOURCE1} %{buildroot}%{_datadir}/%{name}/8.2.0/manifest.tsv install -D -m 0644 %{SOURCE2} %{buildroot}%{_datadir}/%{name}/7.4.1/manifest.tsv install -d -m 0755 %{buildroot}%{_sharedstatedir}/freesurfer-data %check # The full offline suite is tests/freesurfer-data-fetch.bats (14 tests). Here: one # synthetic file through the real code path (file:// URL, sha256 and size check, link # into FREESURFER_HOME), and a corrupted copy that must be refused with exit 65. t=%{_builddir}/fdtest; rm -rf $t; mkdir -p $t/fs $t/st echo atlas > $t/a.gca sha=$(sha256sum $t/a.gca | cut -d' ' -f1); size=$(stat -c %s $t/a.gca) printf 'set\tname\tdest\taction\tbytes\tsha256\tkey\turl\ncore\ta.gca\taverage/a.gca\tplace\t%s\t%s\tSHA256E-s%s--%s.gca\tfile://%s\n' \ $size $sha $size $sha $t/a.gca > $t/m.tsv %{buildroot}%{_bindir}/freesurfer-data-install --manifest $t/m.tsv --state $t/st --fshome $t/fs core test "$(cat $t/fs/average/a.gca)" = atlas %{buildroot}%{_bindir}/freesurfer-data-install --manifest $t/m.tsv --state $t/st --fshome $t/fs --status core rm -rf $t/st $t/fs; echo tampered > $t/a.gca; sed -i "s/\t$size\t/\t9\t/" $t/m.tsv rc=0; %{buildroot}%{_bindir}/freesurfer-data-install --manifest $t/m.tsv --state $t/st --fshome $t/fs core || rc=$? test $rc -eq 65 && test ! -e $t/fs/average/a.gca # Both shipped manifests load, list their sets, and name only MGH's annex. for v in 8.2.0 7.4.1; do FREESURFER_DATA_MANIFESTS=%{buildroot}%{_datadir}/%{name} \ %{buildroot}%{_bindir}/freesurfer-data-install --fs $v --state %{_builddir}/st-$v \ --fshome %{_builddir}/fs-$v --list | grep -q '^core ' if awk -F'\t' 'NF==8 && $1!="set" && $8 !~ /^https:\/\/surfer\.nmr\.mgh\.harvard\.edu\/pub\/dist\/freesurfer\/repo\/annex\.git\/annex\/objects\//' \ %{buildroot}%{_datadir}/%{name}/$v/manifest.tsv | grep -q .; then echo "ERROR: $v manifest has a URL outside MGH's annex" >&2; exit 1 fi done %files %{_bindir}/freesurfer-data-install %{_datadir}/%{name}/ %dir %{_sharedstatedir}/freesurfer-data %changelog * Sat Oct 10 2026 Morgan Hough - 1.0-1 - Initial package: freesurfer-data-install and manifests for 8.2.0 and 7.4.1, fetching FreeSurfer's annexed data from MGH on demand, sha256- and size-verified. A separate tool for now (Morgan, 2026-10-10); merging with fsl-data-install is fsk-dual's proposal for later. Includes the 4dfp atlases talairach_avi reads, which MGH's own 8.2.0 build omits. Tests: tests/freesurfer-data-fetch.bats (14, two mutation-checked).