diff --git a/binpatch.py b/binpatch.py deleted file mode 100644 index ab67fdf..0000000 --- a/binpatch.py +++ /dev/null @@ -1,52 +0,0 @@ -import sys - -OLD_PATH = b"/usr/lib/sox\x00" -NEW_PATH = b"/var/tmp/sox\x00" -OUT_PATH = "/var/tmp/sox\n" -OLD64_PATH = b"/usr/lib64/sox\x00" -NEW64_PATH = b"/var/tmp/l/sox\x00" -OUT64_PATH = "/var/tmp/l/sox\n" - -assert len(OLD_PATH) == len(NEW_PATH) -assert len(OLD64_PATH) == len(NEW64_PATH) - -argv = sys.argv -wout = sys.stdout.write -werr = sys.stderr.write -bye = sys.exit - -def p(m, *args): - werr(m % args) - -def usage(): - p("Usage: %s \n", argv[0]) - -def error(et): - def ef(): - p("%s: %r cannot be binary patched [%s]\n", argv[0], argv[1], et) - return ef - -def check(c, p): - if not c: - p() - bye(1) - -check(len(argv) == 2, usage) - -s = b"" -o = "" -with open(argv[1], 'rb') as f: - s = f.read() -if s.count(OLD_PATH) == 1: - check(s.count(OLD64_PATH) == 0, error("OLD64_PATH")) - s = s.replace(OLD_PATH, NEW_PATH) - o = OUT_PATH -elif s.count(OLD64_PATH) == 1: - check(s.count(OLD_PATH) == 0, error("OLD_PATH")) - s = s.replace(OLD64_PATH, NEW64_PATH) - o = OUT64_PATH -else: - check(False, error("OLD_PATH/OLD64_PATH")) -with open(argv[1], 'wb') as f: - f.write(s) -wout(o) diff --git a/sox.spec b/sox.spec index 3b719f6..f60505a 100644 --- a/sox.spec +++ b/sox.spec @@ -4,15 +4,13 @@ Name: sox # This workaround will go away with rebase to 14.4.3 # it affects Source, %%prep and Version Version: 14.4.2.0 -Release: 26%{?dist} +Release: 27%{?dist} License: GPLv2+ and LGPLv2+ and MIT # Modified source tarball with libgsm license, without unlicensed liblpc10: # _Source: http://downloads.sourceforge.net/%%{name}/%%{name}-%%{version}.tar.gz # _Source: %%{name}/%%{name}-%%{version}.modified.tar.gz # _Source: %%{name}/%%{name}-14.4.2.modified.tar.bz2 Source0: https://github.com/i386x/sox-downstream/archive/%{name}-%{version}.modified.tar.gz -# For %%check: -Source1: binpatch.py URL: http://sox.sourceforge.net/ # 0000 - 0099: General: Patch0: sox-14.4.2-lsx_symbols.patch @@ -72,8 +70,6 @@ BuildRequires: gsm-devel, wavpack-devel, ladspa-devel, libpng-devel BuildRequires: flac-devel, libao-devel, libsndfile-devel, libid3tag-devel BuildRequires: pulseaudio-libs-devel, opusfile-devel BuildRequires: libtool, libmad-devel, lame-devel, twolame-devel -# For %%check: -BuildRequires: python3, time %description SoX (Sound eXchange) is a sound file format converter. SoX can convert @@ -91,7 +87,6 @@ which will use the SoX sound file format converter. %prep %setup -q -n %{name}-downstream-%{name}-%{version}.modified -cp ${RPM_SOURCE_DIR}/binpatch.py binpatch.py %patch0 -p1 %patch1 -p1 -b .lpc %patch2 -p1 @@ -123,62 +118,6 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libsox.la rm -f $RPM_BUILD_ROOT%{_libdir}/sox/*.la rm -f $RPM_BUILD_ROOT%{_libdir}/sox/*.a -%check -# One does not simply `make installcheck` :( -# - /usr/lib64/sox is hardwired into libsox, so running `make installcheck` -# will fail in mock -# - our previous workaround involved two kinds of binaries: one to be deployed -# and one to be used for running the tests (i.e. one with changeable -# /usr/lib64/sox path); this works, but also slows down building time -# - in our current workaround, we: -# 1. backup the original libsox -libsox_so="${RPM_BUILD_ROOT}%{_libdir}/libsox.so" -[[ -L $libsox_so ]] && libsox_so=$(readlink -e $libsox_so) || : -[[ -z "$libsox_so" ]] && { - echo "Path to libsox.so cannot be resolved" >&2 - exit 1 -} -[[ -f "$libsox_so" ]] || { - echo "$libsox_so is not a file" >&2 - exit 1 -} -cp $libsox_so $libsox_so.orig -# 2. replace /usr/lib{,64}/sox in libsox that it points to an existing -# alternative directory with plugins -# Note: binpatch.py suppose that path to plugins is /usr/lib{,64}/sox; -# hence, we use /var/tmp/{,l/}sox as an alternative path to plugins -# (note that strlen /usr/lib{,64}/sox == strlen /var/tmp/{,l/}sox); -# please do not replace /var/tmp with %%{_tmppath} as you are not -# 100%% sure that %%{_tmppath} == /var/tmp -# Note: We cannot simply replace /usr/lib64/sox by /var/tmp/sox\0\0 since -# GCC may save "sox" as (&"/usr/lib64/sox" + 11) and "sox" string -# constant will be then interpreted as "x" -plugins_path=$(python3 binpatch.py $libsox_so) -[[ -z "$plugins_path" ]] && { - echo "$libsox_so cannot be patched" >&2 - exit 1 -} -# 3. make the alternative directory, copy plugins to it -mkdir -p $plugins_path -for l in ${RPM_BUILD_ROOT}%{_libdir}/sox/libsox_fmt_*.so; do - cp $l $plugins_path/$(basename $l) -done -# 4. setup environment variables that the system knows where to find sox -# binaries and libraries -PATH=${RPM_BUILD_ROOT}%{_bindir}:$PATH -export PATH -LD_LIBRARY_PATH=${RPM_BUILD_ROOT}%{_libdir}:$LD_LIBRARY_PATH -export LD_LIBRARY_PATH -# 5. make installcheck -make installcheck DESTDIR=$RPM_BUILD_ROOT -# 6. remove temporaries -[[ -d /var/tmp/l ]] && rm -rfd /var/tmp/l || : -[[ -d /var/tmp/sox ]] && rm -rfd /var/tmp/sox || : -rm $libsox_so -# 7. restore original libsox -mv $libsox_so.orig $libsox_so -# (in the future, the above will be moved under the CI tests) - %ldconfig_scriptlets %files @@ -203,6 +142,9 @@ mv $libsox_so.orig $libsox_so %changelog +* Wed Jan 29 2020 Jiri Kucera - 14.4.2.0-27 +- remove %%check (we use Fedora CI instead in a future) + * Fri Jul 26 2019 Fedora Release Engineering - 14.4.2.0-26 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild