From 6faedc38ac2547888031114fbd0accedfa8ca905 Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Thu, 28 Nov 2019 18:33:25 +0100 Subject: [PATCH 1/2] Revert "Make waf Python3-only (#1753963)." --- waf-2.0.18-logo.patch => waf-1.6.9-logo.patch | 8 +- waf-1.8.11-libdir.patch | 13 ++ ...no-W.patch => waf-1.8.11-sphinx-no-W.patch | 6 +- waf-2.0.18-libdir.patch | 13 -- waf.spec | 213 +++++++++++++----- 5 files changed, 178 insertions(+), 75 deletions(-) rename waf-2.0.18-logo.patch => waf-1.6.9-logo.patch (55%) create mode 100644 waf-1.8.11-libdir.patch rename waf-2.0.18-sphinx-no-W.patch => waf-1.8.11-sphinx-no-W.patch (62%) delete mode 100644 waf-2.0.18-libdir.patch diff --git a/waf-2.0.18-logo.patch b/waf-1.6.9-logo.patch similarity index 55% rename from waf-2.0.18-logo.patch rename to waf-1.6.9-logo.patch index d804e51..4dc73ed 100644 --- a/waf-2.0.18-logo.patch +++ b/waf-1.6.9-logo.patch @@ -1,7 +1,7 @@ -diff -up waf-2.0.18/docs/sphinx/conf.py.orig waf-2.0.18/docs/sphinx/conf.py ---- waf-2.0.18/docs/sphinx/conf.py.orig 2019-04-20 19:06:49.000000000 +0200 -+++ waf-2.0.18/docs/sphinx/conf.py 2019-10-05 17:58:58.380982949 +0200 -@@ -428,7 +428,7 @@ else: +diff -up waf-1.6.9/docs/sphinx/conf.py.orig waf-1.6.9/docs/sphinx/conf.py +--- waf-1.6.9/docs/sphinx/conf.py.orig 2011-11-20 15:51:43.000000000 +0100 ++++ waf-1.6.9/docs/sphinx/conf.py 2011-11-26 14:27:33.996165116 +0100 +@@ -415,7 +415,7 @@ html_theme = 'default' # The name of an image file (relative to this directory) to place at the top # of the sidebar. diff --git a/waf-1.8.11-libdir.patch b/waf-1.8.11-libdir.patch new file mode 100644 index 0000000..faa88f2 --- /dev/null +++ b/waf-1.8.11-libdir.patch @@ -0,0 +1,13 @@ +diff -up waf-1.8.11/waf-light.orig waf-1.8.11/waf-light +--- waf-1.8.11/waf-light.orig 2015-06-20 22:24:00.000000000 +0200 ++++ waf-1.8.11/waf-light 2015-06-22 20:23:07.171667528 +0200 +@@ -149,6 +149,9 @@ def find_lib(): + w = test(i + '/lib/' + dirname) + if w: return w + ++ w = test('/usr/share/%s' % WAF) ++ if w: return w ++ + #waf-local + dir = join(base, (sys.platform != 'win32' and '.' or '') + dirname) + w = test(dir) diff --git a/waf-2.0.18-sphinx-no-W.patch b/waf-1.8.11-sphinx-no-W.patch similarity index 62% rename from waf-2.0.18-sphinx-no-W.patch rename to waf-1.8.11-sphinx-no-W.patch index bc08584..a8f3cef 100644 --- a/waf-2.0.18-sphinx-no-W.patch +++ b/waf-1.8.11-sphinx-no-W.patch @@ -1,6 +1,6 @@ -diff -up waf-2.0.18/docs/sphinx/wscript.orig waf-2.0.18/docs/sphinx/wscript ---- waf-2.0.18/docs/sphinx/wscript.orig 2019-04-20 19:06:49.000000000 +0200 -+++ waf-2.0.18/docs/sphinx/wscript 2019-10-05 18:00:54.822911036 +0200 +diff -up waf-1.8.11/docs/sphinx/wscript.orig waf-1.8.11/docs/sphinx/wscript +--- waf-1.8.11/docs/sphinx/wscript.orig 2015-06-11 18:11:04.000000000 +0200 ++++ waf-1.8.11/docs/sphinx/wscript 2015-06-22 18:36:02.078701412 +0200 @@ -19,7 +19,6 @@ def configure(cfg): cfg.find_program('convert', var='CONVERT') cfg.load('daemon', tooldir=['../../playground/daemon/']) diff --git a/waf-2.0.18-libdir.patch b/waf-2.0.18-libdir.patch deleted file mode 100644 index 2fc53b9..0000000 --- a/waf-2.0.18-libdir.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -up waf-2.0.18/waf-light.orig waf-2.0.18/waf-light ---- waf-2.0.18/waf-light.orig 2019-07-14 10:41:10.000000000 +0200 -+++ waf-2.0.18/waf-light 2019-10-05 17:55:42.254788427 +0200 -@@ -152,6 +152,9 @@ def find_lib(): - w = test(i + '/lib/' + dirname) - if w: return w - -+ w = test('/usr/share/%s' % WAF) -+ if w: return w -+ - #waf-local - dir = join(base, (sys.platform != 'win32' and '.' or '') + dirname) - w = test(dir) diff --git a/waf.spec b/waf.spec index be99f9b..7adc878 100644 --- a/waf.spec +++ b/waf.spec @@ -1,73 +1,121 @@ +%if 0%{?fedora} +%global with_python3 1 +%endif + +%if 0%{?with_python3} +# Turn off the brp-python-bytecompile script +%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') +%endif # with_python3 + +# Enable building without html docs (e.g. in case no recent sphinx is +# available) +%global with_docs 1 + +# Priorities for the alternatives system +%global waf_py3_priority 30 +%global waf_py2_priority 20 + Name: waf Version: 2.0.19 -Release: 1%{?dist} +Release: 1%{?dist}.1 Summary: A Python-based build system # The entire source code is BSD apart from pproc.py (taken from Python 2.5) License: BSD and Python URL: https://waf.io/ # Original tarfile can be found at # https://waf.io/waf-%%{version}.tar.bz2 or -# We remove waf logos, licensed CC BY-NC +# We remove: +# - docs/book, licensed CC BY-NC-ND +# - Waf logos, licensed CC BY-NC Source: waf-%{version}.stripped.tar.bz2 Source1: unpack_wafdir.py -# also search for waflib in /usr/share/waf -Patch0: waf-2.0.18-libdir.patch -# do not try to use the (removed) waf logos -Patch1: waf-2.0.18-logo.patch -# do not add -W when running sphinx-build -Patch2: waf-2.0.18-sphinx-no-W.patch - -# Enable building without html docs (e.g. in case no recent sphinx is -# available) -%bcond_without docs +Patch0: waf-1.8.11-libdir.patch +Patch1: waf-1.6.9-logo.patch +Patch2: waf-1.8.11-sphinx-no-W.patch BuildArch: noarch + +BuildRequires: python2-devel +%if 0%{?with_python3} BuildRequires: python3-devel -%if %{with docs} +%endif # with_python3 +%if 0%{?with_docs} +%if 0%{?fedora} || 0%{?rhel} >= 7 BuildRequires: python3-sphinx +%else +BuildRequires: python-sphinx10 +%endif BuildRequires: graphviz BuildRequires: ImageMagick -%endif # with docs - -# waf-2.0.18-2 in F32 the first python3-only version (i.e. not having -# a -python3 subpackage). Do not hardcode that as Obsoletes: though, -# to be able to roll out e.g. a 2.0.19 for older Fedora branches, but -# maintain upgradability -Provides: %{name}-python3 = %{version}-%{release} -Obsoletes: %{name}-python3 < %{version}-%{release} - -%if "%{?python3_version}" != "" -# Seems like automatic ABI dependency is not detected since the files -# are going to a non-standard location -Requires: python(abi) = %{python3_version} +%endif # with_docs +%if "%{?python2_version}" != "" +# Seems like automatic ABI dependency is not detected since the files are +# going to a non-standard location +Requires: python(abi) = %{python2_version} %endif +# alternatives +Requires(posttrans): %{_sbindir}/alternatives +Requires(preun): %{_sbindir}/alternatives + # the demo suite contains a perl module, which draws in unwanted # provides and requires -%global __requires_exclude_from ^%{_docdir}/.*$ -%global __provides_exclude_from ^%{_docdir}/.*$ +%global __requires_exclude_from %{_docdir} +%global __provides_exclude_from %{_docdir} +# for EPEL, we need the old filters +%global __perl_provides %{nil} +%global __perl_requires %{nil} -%global _description %{expand: + +%description Waf is a Python-based framework for configuring, compiling and installing applications. It is a replacement for other tools such as -Autotools, Scons, CMake or Ant.} - -%description %_description +Autotools, Scons, CMake or Ant. -%if %{with docs} +%if 0%{?with_python3} +%package -n %{name}-python3 +Summary: Python3 support for %{name} +%if "%{?python3_version}" != "" +Requires: python(abi) = %{python3_version} +%endif + +%description -n %{name}-python3 +Waf is a Python-based framework for configuring, compiling and +installing applications. It is a replacement for other tools such as +Autotools, Scons, CMake or Ant. + +This package contains the Python 3 version of %{name}. +%endif # with_python3 + + +%if 0%{?with_docs} %package -n %{name}-doc Summary: Documentation for %{name} Requires: %{name} = %{version}-%{release} +# obsolete the previous docs subpackage - guideline specifies -doc +# since: Fedora 18, RHEL 7 (mark the provides/obsoletes RHEL only after +# we no longer need to provide upgrade paths from affected Fedora releases) +Provides: %{name}-docs = %{version}-%{release} +Obsoletes: %{name}-docs < 1.6.11-2 -%description -n %{name}-doc %_description +%description -n %{name}-doc +Waf is a Python-based framework for configuring, compiling and +installing applications. It is a replacement for other tools such as +Autotools, Scons, CMake or Ant. This package contains the HTML documentation for %{name}. -%endif # with docs +%endif # with_docs %prep -%autosetup -p1 +%setup -q +# also search for waflib in /usr/share/waf +%patch0 -p1 +# do not try to use the (removed) waf logos +%patch1 -p1 +# do not add -W when running sphinx-build +%patch2 -p1 %build @@ -78,72 +126,126 @@ for f in waflib/extras/*.py ; do extras="${extras:+$extras,}$f" ; fi done -%{__python3} ./waf-light --make-waf --strip --tools="$extras" +%{__python2} ./waf-light --make-waf --strip --tools="$extras" -%if %{with docs} +%if 0%{?with_docs} # build html docs export WAFDIR=$(pwd) pushd docs/sphinx -%{__python3} ../../waf -v configure build +%if ! ( 0%{?fedora} || 0%{?rhel} >= 7 ) +export SPHINX_BUILD=sphinx-1.0-build +%endif +%{__python2} ../../waf -v configure build popd -%endif # with docs +%endif # with_docs %install -%{__python3} %{S:1} _temp +%{__python2} %{S:1} _temp pushd _temp +find . -name '*.py' -printf '%%P\0' | + xargs -0 -I{} install -m 0644 -p -D {} %{buildroot}%{_datadir}/waf/{} +popd +%if 0%{?with_python3} +%{__python3} %{S:1} _temp3 +pushd _temp3 find . -name '*.py' -printf '%%P\0' | xargs -0 -I{} install -m 0644 -p -D {} %{buildroot}%{_datadir}/waf3/{} popd +%endif # with_python3 # install the frontend -install -m 0755 -p -D waf-light %{buildroot}%{_bindir}/waf -ln -s waf %{buildroot}%{_bindir}/waf-3 -ln -s waf %{buildroot}%{_bindir}/waf-%{python3_version} +install -m 0755 -p -D waf-light %{buildroot}%{_bindir}/waf-%{python2_version} +ln -s waf-%{python2_version} %{buildroot}%{_bindir}/waf-2 +%if 0%{?with_python3} +install -m 0755 -p -D waf-light %{buildroot}%{_bindir}/waf-%{python3_version} +ln -s waf-%{python3_version} %{buildroot}%{_bindir}/waf-3 +%endif # with_python3 + +# alternatives-controlled +touch %{buildroot}%{_bindir}/waf # remove shebangs from and fix EOL for all scripts in wafadmin find %{buildroot}%{_datadir}/ -name '*.py' \ -exec sed -i -e '1{/^#!/d}' -e 's|\r$||g' {} \; # fix waf script shebang line -sed -i "1c#! %{__python3}" %{buildroot}%{_bindir}/waf +sed -i "1c#! %{__python2}" %{buildroot}%{_bindir}/waf-%{python2_version} +%if 0%{?with_python3} +sed -i "1c#! %{__python3}" %{buildroot}%{_bindir}/waf-%{python3_version} +%endif # with_python3 # remove x-bits from everything going to doc find demos utils -type f -exec chmod 0644 {} \; # fix shebang lines in the demos -find demos \( -name '*.py' -o -name '*.py.in' -o -name 'wscript' -o -name 'wscript_build' \) \ +mkdir demos_py2 ; cp -a demos demos_py2 +find demos_py2 \( -name '*.py' -o -name 'wscript' -o -name 'wscript_build' \) \ + -exec sed -e '1{/^#!/d}' -e '1i#!%{__python2}' -i {} \; +%if 0%{?with_python3} +mkdir demos_py3 ; cp -a demos demos_py3 +find demos_py3 \( -name '*.py' -o -name 'wscript' -o -name 'wscript_build' \) \ -exec sed -e '1{/^#!/d}' -e '1i#!%{__python3}' -i {} \; +%endif # with_python3 # remove hidden file rm -f docs/sphinx/build/html/.buildinfo +%if 0%{?with_python3} # do byte compilation +%py_byte_compile %{__python2} %{buildroot}%{_datadir}/waf %py_byte_compile %{__python3} %{buildroot}%{_datadir}/waf3 +%endif # with_python3 + + +%posttrans +%{_sbindir}/alternatives --install %{_bindir}/waf \ + waf %{_bindir}/waf-2 %{waf_py2_priority} || : + + +%preun +%{_sbindir}/alternatives --remove \ + waf %{_bindir}/waf-2 || : %files -%doc README.md ChangeLog demos +%doc README.md ChangeLog demos_py2/demos +%ghost %attr(0755,-,-) %{_bindir}/waf +%{_bindir}/waf-%{python2_version} +%{_bindir}/waf-2 +%{_datadir}/waf + + +%if 0%{?with_python3} +%posttrans -n %{name}-python3 +%{_sbindir}/alternatives --install %{_bindir}/waf \ + waf %{_bindir}/waf-3 %{waf_py3_priority} || : + + +%preun -n %{name}-python3 +%{_sbindir}/alternatives --remove \ + waf %{_bindir}/waf-3 || : + + +%files -n %{name}-python3 +%doc README.md ChangeLog demos_py3/demos +%ghost %attr(0755,-,-) %{_bindir}/waf %{_bindir}/waf-%{python3_version} %{_bindir}/waf-3 -%{_bindir}/waf %{_datadir}/waf3 +%endif # with_python3 -%if %{with docs} +%if 0%{?with_docs} %files -n %{name}-doc %doc docs/sphinx/build/html -%endif # with docs +%endif # with_docs %changelog -* Thu Nov 28 2019 Thomas Moschny - 2.0.19-1 +* Thu Nov 28 2019 Thomas Moschny - 2.0.19-1.1 - Update to 2.0.19. -* Tue Oct 8 2019 Thomas Moschny - 2.0.18-2 -- Make waf Python3-only (#1753963). -- Spec file modernization and cleanups. - * Sat Oct 5 2019 Thomas Moschny - 2.0.18-1 - Update to 2.0.18. @@ -592,3 +694,4 @@ rm -f docs/sphinx/build/html/.buildinfo * Sun Jan 20 2008 Michel Salim - 1.3.1-1 - Initial Fedora package + From c44aba130e8c93cb1c54cbe295f05b67000e4721 Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Tue, 14 Apr 2020 12:11:46 +0200 Subject: [PATCH 2/2] Update to 2.0.20. --- repack.sh | 2 +- sources | 2 +- waf.spec | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/repack.sh b/repack.sh index f5c67a6..5f9a6bf 100755 --- a/repack.sh +++ b/repack.sh @@ -1,6 +1,6 @@ #! /bin/bash -version=2.0.19 +version=2.0.20 prerel= src=waf-${version}${prerel}.tar.bz2 diff --git a/sources b/sources index f5b4616..e7e56db 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (waf-2.0.19.stripped.tar.bz2) = 03fb06fb3d4002b583df2f55959154502ae1c14eb4ad0671bff5f48a5d3546f9c7f2d1e2cbd83448c9e9c1d2ecc30fb3c6d68479508f8b884193a96cc9bd2c9f +SHA512 (waf-2.0.20.stripped.tar.bz2) = 21f61dc7ce6cd96d818caea28d9add9afbd60396e1fb72cf79ec94b451b11bae0275e99c180f084973688ee19f525d59cddf567f600d55403c88ecfd63c42ca7 diff --git a/waf.spec b/waf.spec index 7adc878..722fdc2 100644 --- a/waf.spec +++ b/waf.spec @@ -16,8 +16,8 @@ %global waf_py2_priority 20 Name: waf -Version: 2.0.19 -Release: 1%{?dist}.1 +Version: 2.0.20 +Release: 1%{?dist} Summary: A Python-based build system # The entire source code is BSD apart from pproc.py (taken from Python 2.5) License: BSD and Python @@ -243,6 +243,9 @@ rm -f docs/sphinx/build/html/.buildinfo %changelog +* Tue Apr 14 2020 Thomas Moschny - 2.0.20-1 +- Update to 2.0.20. + * Thu Nov 28 2019 Thomas Moschny - 2.0.19-1.1 - Update to 2.0.19.