summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViorel Munteanu <ceamac@gentoo.org>2024-02-16 16:38:50 +0200
committerViorel Munteanu <ceamac@gentoo.org>2024-02-16 16:39:37 +0200
commit8b824d1f9769dfa4f8fd1ed99ecd1d87ce4d4e9e (patch)
tree079674ec49362cbad2b428203bb5476b5722305b /media-libs
parentmedia-sound/deadbeef: add vfs_zip plugin (diff)
downloadgentoo-8b824d1f9769dfa4f8fd1ed99ecd1d87ce4d4e9e.tar.gz
gentoo-8b824d1f9769dfa4f8fd1ed99ecd1d87ce4d4e9e.tar.bz2
gentoo-8b824d1f9769dfa4f8fd1ed99ecd1d87ce4d4e9e.zip
media-libs/netpbm: fix tests on musl
Apply a patch from upstream to fix one test. Disable the other broken tests on musl. Backport one test from netpbm-11.5.2 to netpbm-11.2.7. Closes: https://bugs.gentoo.org/907295 Signed-off-by: Viorel Munteanu <ceamac@gentoo.org>
Diffstat (limited to 'media-libs')
-rw-r--r--media-libs/netpbm/files/netpbm-11.2.7-fix-pnmcolormap2-test.patch213
-rw-r--r--media-libs/netpbm/files/netpbm-11.5.2-fix-tests-musl.patch157
-rw-r--r--media-libs/netpbm/netpbm-11.2.7.ebuild6
-rw-r--r--media-libs/netpbm/netpbm-11.5.2.ebuild5
4 files changed, 380 insertions, 1 deletions
diff --git a/media-libs/netpbm/files/netpbm-11.2.7-fix-pnmcolormap2-test.patch b/media-libs/netpbm/files/netpbm-11.2.7-fix-pnmcolormap2-test.patch
new file mode 100644
index 000000000000..a3af51371767
--- /dev/null
+++ b/media-libs/netpbm/files/netpbm-11.2.7-fix-pnmcolormap2-test.patch
@@ -0,0 +1,213 @@
+Backport pnmcolormap2 test from 11.5.x to 11.2.x
+
+See also https://bugs.gentoo.org/907295
+
+--- a/test/pnmcolormap2.test
++++ b/test/pnmcolormap2.test
+@@ -5,51 +5,143 @@
+ tmpdir=${tmpdir:-/tmp}
+ map=${tmpdir}/map.ppm
+
+-echo "Test. Should print 'match' eight times."
+-# Threshold values (targetN=xx.xx) here were produced by calculating
+-# the S/N ratio with reduced colors.
++echo "Test. Should print 'match' eighteen times."
++
++# Threshold values (tgtN=xx.xx) were produced by calculating
++# the S/N ratio when the original image is compared against a
++# reference image with fewer colors than the target output image.
+
+ # colors in following tests / colors for calculating threshold
+-# 100 / 90
+-# 200 / 180
+-# 30 / 25
++# 256 / 224
++# 128 / 96 -splitspread
++# 128 / 108 other
++# 64 / 44 -center (default)
++# 64 / 48 -splitspread
++# 64 / 56 other
++
++# -center
++echo pnmcolormap 256
++tgt1=37.19; tgt2=37.86; tgt3=37.77
++pnmcolormap 256 testimg.ppm > ${map}
++pnmremap -mapfile=${map} testimg.ppm |\
++pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
++rm ${map}
++
++echo pnmcolormap 128
++tgt1=34.46; tgt2=35.61; tgt3=34.97
++pnmcolormap 128 testimg.ppm > ${map}
++pnmremap -mapfile=${map} testimg.ppm |\
++pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
++rm ${map}
++
++echo pnmcolormap 64
++tgt1=30.30; tgt2=33.10; tgt3=31.74
++pnmcolormap 64 testimg.ppm > ${map}
++pnmremap -mapfile=${map} testimg.ppm |\
++pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
++rm ${map}
++
++echo pnmcolormap -meancolor 256
++tgt1=38.36; tgt2=38.63; tgt3=38.95
++pnmcolormap -meancolor 256 testimg.ppm > ${map}
++pnmremap -mapfile=${map} testimg.ppm |\
++pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
++rm ${map}
++
++echo pnmcolormap -meancolor 128
++tgt1=35.86; tgt2=37.17; tgt3=36.65
++pnmcolormap -meancolor 128 testimg.ppm > ${map}
++pnmremap -mapfile=${map} testimg.ppm |\
++pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
++rm ${map}
++
++echo pnmcolormap -meancolor 64
++tgt1=33.64; tgt2=34.92; tgt3=34.44
++pnmcolormap -meancolor 64 testimg.ppm > ${map}
++pnmremap -mapfile=${map} testimg.ppm |\
++pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
++rm ${map}
++
++echo pnmcolormap -meanpixel 256
++tgt1=38.40; tgt2=38.65; tgt3=38.90
++pnmcolormap -meanpixel 256 testimg.ppm > ${map}
++pnmremap -mapfile=${map} testimg.ppm |\
++pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
++rm ${map}
++
++echo pnmcolormap -meanpixel 128
++tgt1=35.75; tgt2=37.13; tgt3=36.69
++pnmcolormap -meanpixel 128 testimg.ppm > ${map}
++pnmremap -mapfile=${map} testimg.ppm |\
++pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
++rm ${map}
++
++echo pnmcolormap -meanpixel 64
++tgt1=33.75; tgt2=34.79; tgt3=34.53
++pnmcolormap -meanpixel 64 testimg.ppm > ${map}
++pnmremap -mapfile=${map} testimg.ppm |\
++pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
++rm ${map}
++
++echo pnmcolormap -spreadluminosity 256
++tgt1=36.82; tgt2=36.87; tgt3=37.25
++pnmcolormap -spreadluminosity 256 testimg.ppm > ${map}
++pnmremap -mapfile=${map} testimg.ppm |\
++pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
++rm ${map}
+
+-pnmcolormap 100 testimg.ppm > ${map}
++echo pnmcolormap -spreadluminosity 128
++tgt1=34.61; tgt2=33.40; tgt3=34.66
++pnmcolormap -spreadluminosity 128 testimg.ppm > ${map}
+ pnmremap -mapfile=${map} testimg.ppm |\
+- pnmpsnr -target1=33.42 -target2=35.14 -target3=34.35 testimg.ppm -
++pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
+ rm ${map}
+
+-pnmcolormap -meancolor 100 testimg.ppm > ${map}
++echo pnmcolormap -spreadluminosity 64
++tgt1=32.35; tgt2=30.23; tgt3=32.35
++pnmcolormap -spreadluminosity 64 testimg.ppm > ${map}
+ pnmremap -mapfile=${map} testimg.ppm |\
+- pnmpsnr -target1=34.91 -target2=36.86 -target3=35.84 testimg.ppm -
++pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
+ rm ${map}
+
+-pnmcolormap -meanpixel 100 testimg.ppm > ${map}
++echo pnmcolormap -splitcolorct 256
++tgt1=37.55; tgt2=38.37; tgt3=38.04
++pnmcolormap -splitcolorct 256 testimg.ppm > ${map}
+ pnmremap -mapfile=${map} testimg.ppm |\
+- pnmpsnr -target1=34.95 -target2=36.77 -target3=35.81 testimg.ppm -
++pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
+ rm ${map}
+
+-pnmcolormap -spreadluminosity 100 testimg.ppm > ${map}
++echo pnmcolormap -splitcolorct 128
++tgt1=34.84; tgt2=35.72; tgt3=34.64
++pnmcolormap -splitcolorct 128 testimg.ppm > ${map}
+ pnmremap -mapfile=${map} testimg.ppm |\
+- pnmpsnr -target1=33.71 -target2=32.91 -target3=33.93 testimg.ppm -
++pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
+ rm ${map}
+
+-pnmcolormap -splitcolorct 100 testimg.ppm > ${map}
++echo pnmcolormap -splitcolorct 64
++tgt1=31.56; tgt2=33.74; tgt3=32.93
++pnmcolormap -splitcolorct 64 testimg.ppm > ${map}
+ pnmremap -mapfile=${map} testimg.ppm |\
+- pnmpsnr -target1=33.97 -target2=35.34 -target3=34.23 testimg.ppm -
++pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
+ rm ${map}
+
+-pnmcolormap -splitspread 100 testimg.ppm > ${map}
++echo pnmcolormap -splitspread 256
++tgt1=35.18; tgt2=37.26; tgt3=36.17
++pnmcolormap -splitspread 256 testimg.ppm > ${map}
+ pnmremap -mapfile=${map} testimg.ppm |\
+- pnmpsnr -target1=32.98 -target2=35.06 -target3=33.19 testimg.ppm -
++pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
+ rm ${map}
+
+-pnmcolormap 200 testimg.ppm > ${map}
++echo pnmcolormap -splitspread 128
++tgt1=33.18; tgt2=35.58; tgt3=33.71
++pnmcolormap -splitspread 128 testimg.ppm > ${map}
+ pnmremap -mapfile=${map} testimg.ppm |\
+- pnmpsnr -target1=36.14 -target2=36.87 -target3=36.79 testimg.ppm -
++pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
+ rm ${map}
+
+-pnmcolormap 30 testimg.ppm > ${map}
++echo pnmcolormap -splitspread 64
++tgt1=31.27; tgt2=33.03; tgt3=30.97
++pnmcolormap -splitspread 64 testimg.ppm > ${map}
+ pnmremap -mapfile=${map} testimg.ppm |\
+- pnmpsnr -target1=28.53 -target2=31.62 -target3=29.99 testimg.ppm -
++pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
+ rm ${map}
+--- a/test/pnmcolormap2.ok
++++ b/test/pnmcolormap2.ok
+@@ -1,9 +1,37 @@
+-Test. Should print 'match' eight times.
++Test. Should print 'match' eighteen times.
++pnmcolormap 256
+ match
++pnmcolormap 128
+ match
++pnmcolormap 64
+ match
++pnmcolormap -meancolor 256
+ match
++pnmcolormap -meancolor 128
+ match
++pnmcolormap -meancolor 64
+ match
++pnmcolormap -meanpixel 256
+ match
++pnmcolormap -meanpixel 128
++match
++pnmcolormap -meanpixel 64
++match
++pnmcolormap -spreadluminosity 256
++match
++pnmcolormap -spreadluminosity 128
++match
++pnmcolormap -spreadluminosity 64
++match
++pnmcolormap -splitcolorct 256
++match
++pnmcolormap -splitcolorct 128
++match
++pnmcolormap -splitcolorct 64
++match
++pnmcolormap -splitspread 256
++match
++pnmcolormap -splitspread 128
++match
++pnmcolormap -splitspread 64
+ match
diff --git a/media-libs/netpbm/files/netpbm-11.5.2-fix-tests-musl.patch b/media-libs/netpbm/files/netpbm-11.5.2-fix-tests-musl.patch
new file mode 100644
index 000000000000..4d8bd6c3b74d
--- /dev/null
+++ b/media-libs/netpbm/files/netpbm-11.5.2-fix-tests-musl.patch
@@ -0,0 +1,157 @@
+Some tests are broken on musl.
+
+https://sourceforge.net/p/netpbm/code/4843/
+pnmindex, ppmtomitsu tests that don't use pnmcolormap
+
+So far, this only fixed ppmtomitsu.
+
+See also https://bugs.gentoo.org/907295
+
+--- a/test/pnmindex.ok
++++ b/test/pnmindex.ok
+@@ -7,12 +7,18 @@
+ 3099638253 5290
+ Test 4. Should print 1397700642 3160
+ 1397700642 3160
+-Test 5. Should print 2303488589 28514
+-2303488589 28514
+-Test 6. Should print 1706277976 100455
+-1706277976 100455
+-Test 7. Should print 801388440 100455
++Test 5. Should print 243472565 28514
++243472565 28514
++Test 6. Should print 801388440 100455
+ 801388440 100455
++Test 7. Should print 256 twice
++256
++256
++Test 8. Should print 100 twice
++100
++100
++Test 9. Should print match
++match
+ Test Invalid
+ Expected failure 1 (no output)
+ Expected failure 2 (no output)
+--- a/test/pnmindex.test
++++ b/test/pnmindex.test
+@@ -3,6 +3,9 @@
+ # Also requires: pamcat pamscale pbmtext pnmcolormap pnmindex
+ # Also requires: pnminvert pnmquant pnmremap
+
++tmpdir=${tmpdir:-/tmp}
++pnmindex256_ppm=${tmpdir}/pnmindex256.ppm
++
+ echo "Test 1. Should print 3391481002 889"
+ pnmindex maze.pbm | cksum
+
+@@ -17,18 +20,28 @@
+ pnmindex -size 20 -across=3 testgrid.pbm testgrid.pbm testgrid.pbm \
+ testgrid.pbm testgrid.pbm testgrid.pbm | cksum
+
+-echo "Test 5. Should print 2303488589 28514"
+-pnmindex testimg.ppm | cksum
++echo "Test 5. Should print 243472565 28514"
++pnmindex -noquant testimg.ppm | cksum
+
+-echo "Test 6. Should print 1706277976 100455"
+-pnmindex -size 50 -across=2 testimg.ppm testimg.ppm testimg.ppm \
+- testimg.ppm testimg.ppm testimg.ppm | cksum
+-
+-echo "Test 7. Should print 801388440 100455"
++echo "Test 6. Should print 801388440 100455"
+ pnmindex -size 50 -across=2 -noquant testimg.ppm testimg.ppm testimg.ppm \
+- testimg.ppm testimg.ppm testimg.ppm | cksum
++ testimg.ppm testimg.ppm testimg.ppm | tee ${pnmindex256_ppm} | cksum
+
++echo "Test 7. Should print 256 twice"
++pnmindex testimg.ppm | ppmhist -nomap -noheader | wc -l
++pnmindex -colors 256 testimg.ppm | ppmhist -nomap -noheader | wc -l
+
++echo "Test 8. Should print 100 twice"
++pnmindex -colors 100 testimg.ppm | ppmhist -nomap -noheader | wc -l
++pnmindex -colors 100 testimg.ppm testimg.ppm | ppmhist -nomap -noheader | wc -l
++
++
++echo "Test 9. Should print match"
++pnmindex -size 50 -across=2 -quant -colors=256 testimg.ppm testimg.ppm testimg.ppm \
++ testimg.ppm testimg.ppm testimg.ppm |\
++ pnmpsnr -rgb -target1=41.31 -target2=40.76 -target3=40.71 ${pnmindex256_ppm} -
++
++
+ echo "Test Invalid"
+
+ . ${srcdir}/test-invalid.inc
+--- a/test/ppmtomitsu.ok
++++ b/test/ppmtomitsu.ok
+@@ -1,9 +1,9 @@
+-Test 0. Should print 458455366 101484
+-458455366 101484
++Test 0. Should print 668243897 101532
++668243897 101532
+ Test 1. Should print 3110813682 101562
+ 3110813682 101562
+-Test 2. Should print 4168174994 34399
+-4168174994 34399
++Test 2. Should print 825518840 34209
++825518840 34209
+ Test 3. Should print 3201293405 310
+ 3201293405 310
+ Test 4. Should print 3354679572 752
+@@ -10,5 +10,5 @@
+ 3354679572 752
+ Test 5. Should print 3999654426 101549
+ 3999654426 101549
+-Test 6. Should print 4201246884 101549
+-4201246884 101549
++Test 6. Should print 3103038403 101549
++3103038403 101549
+--- a/test/ppmtomitsu.test
++++ b/test/ppmtomitsu.test
+@@ -1,31 +1,31 @@
+ #! /bin/sh
+ # This script tests: ppmtomitsu
+-# Also requires: pnmcolormap pnmremap
++# Also requires: pamseq pamdepth
+
+ tmpdir=${tmpdir:-/tmp}
+-testimg100_ppm=${tmpdir}/testimg100.ppm
++testimg216_ppm=${tmpdir}/testimg216.ppm
+
+-echo "Test 0. Should print 458455366 101484"
+-# equivalent to: Pnmquant 100 testimg.ppm
+-pnmcolormap 100 testimg.ppm | pnmremap -nofloyd -mapfile=- testimg.ppm |\
+- tee ${testimg100_ppm} | cksum
++echo "Test 0. Should print 668243897 101532"
+
++pamseq 3 5 -tupletype=RGB | pamdepth 255 | pnmremap -nofloyd -mapfile=- testimg.ppm |\
++ tee ${testimg216_ppm} | cksum
++
+ echo "Test 1. Should print 3110813682 101562"
+-ppmtomitsu testimg.ppm | cksum
++ppmtomitsu testimg.ppm | cksum
+
+-echo "Test 2. Should print 4168174994 34399"
+-ppmtomitsu ${testimg100_ppm} | cksum
++echo "Test 2. Should print 825518840 34209"
++ppmtomitsu ${testimg216_ppm} | cksum
+
+ echo "Test 3. Should print 3201293405 310"
+-ppmtomitsu testgrid.pbm | cksum
++ppmtomitsu testgrid.pbm | cksum
+
+ echo "Test 4. Should print 3354679572 752"
+-ppmtomitsu -tiny testgrid.pbm | cksum
++ppmtomitsu -tiny testgrid.pbm | cksum
+
+ echo "Test 5. Should print 3999654426 101549"
+-ppmtomitsu -tiny testimg.ppm | cksum
++ppmtomitsu -tiny testimg.ppm | cksum
+
+-echo "Test 6. Should print 4201246884 101549"
+-ppmtomitsu -tiny ${testimg100_ppm} | cksum
++echo "Test 6. Should print 3103038403 101549"
++ppmtomitsu -tiny ${testimg216_ppm} | cksum
+
+-rm ${testimg100_ppm}
++rm ${testimg216_ppm}
diff --git a/media-libs/netpbm/netpbm-11.2.7.ebuild b/media-libs/netpbm/netpbm-11.2.7.ebuild
index 3afe4523512a..df9c2909f438 100644
--- a/media-libs/netpbm/netpbm-11.2.7.ebuild
+++ b/media-libs/netpbm/netpbm-11.2.7.ebuild
@@ -57,6 +57,7 @@ PATCHES=(
"${FILESDIR}"/netpbm-10.86.21-build.patch
"${FILESDIR}"/netpbm-11.0.0-misc-deps.patch
"${FILESDIR}"/netpbm-11.1.0-fix-clang-O2.patch
+ "${FILESDIR}"/netpbm-11.2.7-fix-pnmcolormap2-test.patch
)
netpbm_libtype() {
@@ -160,10 +161,13 @@ src_prepare() {
fi
# this test requires LC_ALL=en_US.iso88591, not available on musl
+ # ppmpat-random is broken on musl
+ # bug #907295
if use elibc_musl; then
sed -i \
-e 's:pbmtext-iso88591.*::' \
- test/Test-Order || die
+ -e 's:ppmpat-random.*::' \
+ -i test/Test-Order || die
fi
}
diff --git a/media-libs/netpbm/netpbm-11.5.2.ebuild b/media-libs/netpbm/netpbm-11.5.2.ebuild
index 742eedc19d7d..0a74a2fd9cea 100644
--- a/media-libs/netpbm/netpbm-11.5.2.ebuild
+++ b/media-libs/netpbm/netpbm-11.5.2.ebuild
@@ -57,6 +57,7 @@ PATCHES=(
"${FILESDIR}"/netpbm-10.86.21-build.patch
"${FILESDIR}"/netpbm-11.0.0-misc-deps.patch
"${FILESDIR}"/netpbm-11.1.0-fix-clang-O2.patch
+ "${FILESDIR}"/netpbm-11.5.2-fix-tests-musl.patch
)
netpbm_libtype() {
@@ -155,9 +156,13 @@ src_prepare() {
fi
# this test requires LC_ALL=en_US.iso88591, not available on musl
+ # ppmpat-random and pnmindex are broken on musl
+ # bug #907295
if use elibc_musl; then
sed \
-e 's:pbmtext-iso88591.*::' \
+ -e 's:ppmpat-random.*::' \
+ -e 's:pnmindex.*::' \
-i test/Test-Order || die
fi
}