From d1a96adae468bc4a22fb3b720ba00a248fcf7dc0 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Fri, 6 Dec 2024 10:11:30 -0500 Subject: [PATCH] Omit lenna.png from the source archive - https://pagure.io/neuro-sig/NeuroFedora/issue/576 - https://github.com/G-Node/nixpy/issues/545 --- .gitignore | 1 + get_source | 50 +++++++++++++++++++++++++++++++++++++++++++++++ python-nixio.spec | 24 +++++++++++++++++++---- sources | 2 +- 4 files changed, 72 insertions(+), 5 deletions(-) create mode 100755 get_source diff --git a/.gitignore b/.gitignore index 8bd9645..3e6aab7 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ /nixpy-1.5.1.tar.gz /nixpy-1.5.2.tar.gz /nixpy-1.5.3.tar.gz +/nixpy-1.5.3-filtered.tar.gz diff --git a/get_source b/get_source new file mode 100755 index 0000000..1ac2cc4 --- /dev/null +++ b/get_source @@ -0,0 +1,50 @@ +#!/bin/sh +set -o errexit +set -o nounset + +if [ "$#" != '1' ] +then + cat 1>&2 < Downloading: ${URL}" 1>&2 +curl -L -O "${URL}" + +ARCHIVE="$(find . -mindepth 1 -maxdepth 1 -type f -name '*.tar.gz' -print -quit)" +echo "--> Extracting: $(basename "${ARCHIVE}")" 1>&2 +tar -xzf "${ARCHIVE}" +echo '--> Removing Lenna/Lena image due to licensing and other issues' 1>&2 +TARDIR="$(basename "${ARCHIVE}" '.tar.gz')" +MTIME="$(stat -c '%Y' "${TARDIR}")" +# https://github.com/G-Node/nixpy/issues/545 +find "${TARDIR}" -type f -name lenna.png -print -delete +# Make sure the original mtime is preserved even if we modified the base +# directory by removing something at the top level. (So far, we didn’t.) +touch -d @"${MTIME}" "${TARDIR}" +FILTERED="$(basename "${ARCHIVE}" .tar.gz)-filtered.tar.gz" +echo "--> Re-archiving: ${FILTERED}" 1>&2 +# https://www.gnu.org/software/tar/manual/html_section/Reproducibility.html +TZ=UTC LC_ALL=C tar \ + --create \ + --sort=name \ + --format=posix \ + --numeric-owner --owner=0 --group=0 \ + --mode=go+u,go-w \ + --pax-option='delete=atime,delete=ctime' \ + "${TARDIR}/" | + gzip -9 > "${FILTERED}" +mv -v "${FILTERED}" "${OUTDIR}" +echo 'Done.' 1>&2 diff --git a/python-nixio.spec b/python-nixio.spec index 4badb94..9e0f86f 100644 --- a/python-nixio.spec +++ b/python-nixio.spec @@ -11,12 +11,22 @@ Summary: Python bindings for NIX # Automatically converted from old format: BSD - review is highly recommended. License: LicenseRef-Callaway-BSD URL: %forgeurl -Source0: %forgesource +# We need to upload a filtered version of the source archive because +# docs/source/examples/lenna.png has several issues, including the lack of a +# license. We have asked upstream to deal with this in +# Please consider replacing lenna.png +# https://github.com/G-Node/nixpy/issues/545 +# but for now, we must obtain the filtered archive by running the script in +# Source2: +# ./get_source ${VERSION} +%dnl Source0: %forgesource +Source0: nixpy-%{version}-filtered.tar.gz # The tagged snapshot on GitHub still says "dev" but the manually uploaded # release does not, so use the info.json from there # https://github.com/G-Node/nixpy/issues/528 Source1: info.json - +# * Script used to obtain Source0: ./get_source %%{version} +Source2: get_source BuildArch: noarch # No need for nix, they're uncoupling it from the C++ @@ -48,7 +58,7 @@ BuildRequires: %{py3_dist matplotlib} %{description} %prep -%forgesetup +%autosetup -n nixpy-%{version} # it sets examples_path based on the name of the cwd sed -i "s/nixpy/nixpy-%{version}/" nixio/test/test_doc_examples.py @@ -66,7 +76,13 @@ cp %{SOURCE1} nixio/info.json -v -p %pyproject_save_files nixio %check -%{pytest} +# These require the removed lenna.png sample file: +k="${k-}${k+ and }not (TestDocumentationExamples and test_image_data)" +k="${k-}${k+ and }not (TestDocumentationExamples and test_image_with_metadata)" +k="${k-}${k+ and }not (TestDocumentationExamples and test_multiple_rois)" +k="${k-}${k+ and }not (TestDocumentationExamples and test_single_roi)" + +%pytest -k "${k-}" %files -n python3-nixio -f %{pyproject_files} %{_bindir}/nixio diff --git a/sources b/sources index ef0608e..c783ccb 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (nixpy-1.5.3.tar.gz) = 1b3fd6bb638797a90a2e899d9ae3663a6a0ee3dfc5fe8c6c0806ed5ac2a34ef54771cdb1a715bf400020c6f5df7f3f348ee7129ed1e055381fa11aa5a8b6b218 +SHA512 (nixpy-1.5.3-filtered.tar.gz) = 00472f0666b4313124b90b8f14219d1f2a5e56e7174b4eaa2174a7d88a3251513f5fc279d49c1b19dbca3c1c5470ae90049347370e94077aeda24c4db1e5e786