# Detect the distribution in use %global __despace head -n 1 | tr -d '[:space:]' | sed -e 's/[(].*[)]//g' %global __lower4 cut -c 1-4 | tr '[:upper:]' '[:lower:]' %global __distfile %([ -f /etc/SuSE-release ] && echo /etc/SuSE-release || echo /etc/redhat-release) %global __distinit %(sed -e 's/ release .*//' -e 's/\\([A-Za-z]\\)[^ ]*/\\1/g' %{__distfile} | %{__despace} | %{__lower4}) %global __distvers %(sed -e 's/.* release \\([^. ]*\\).*/\\1/' %{__distfile} | %{__despace}) # Identify Alma, CentOS, CentOS Stream and Rocky Linux as rhel %if "%{__distinit}" == "a" || "%{__distinit}" == "c" || "%{__distinit}" == "cl" || "%{__distinit}" == "cs" || "%{__distinit}" == "rl" %global __distinit rhel %endif # Dist tag for Fedora is still "fc" %if "%{__distinit}" == "f" %global __distinit fc %endif %global python2ver %(python2 -c "import sys; print sys.version[:3]" || echo none) %{!?python2_sitelib: %global python2_sitelib %{_prefix}/lib/python%{python2ver}/site-packages} %global moin_static_content_dir %{python2_sitelib}/MoinMoin/web/static/htdocs Summary: A blue theme based on Mandarin, aiming to make Moin prettier Name: moin-theme-solenoid Version: 2012.12.16 Release: 6.%{__distinit}%{__distvers} URL: https://launchpad.net/moin-solenoid/ # Old rpm versions can't handle source filenames with spaces #Source0: http://launchpad.net/moin-solenoid/trunk/%%{version}/+download/Solenoid %%{version}.zip Source0: moin-theme-solenoid-%{version}.tar.bz2 Source1: make-solenoid-tarball.sh License: GPL-2.0-only BuildArch: noarch BuildRequires: coreutils BuildRequires: python2 BuildRequires: sed Requires: moin >= 1.9.0 Requires: python(abi) = %{python2ver} %description A blue theme based on Mandarin, aiming to make Moin prettier. %prep %setup -q sed -i -e 's/\r$//' CHANGES.txt README.txt cat << EOF > README.rpm After installing this package, any newly-created wiki instances should automatically have the solenoid theme available. To make the solenoid theme available to an existing wiki instance: * copy %{_datadir}/moin/data/plugin/theme/solenoid.py* to the data/plugin/theme directory of the wiki instance and do: chown apache:apache /path/to/wiki/data/plugin/theme/solenoid.py* * copy %{_datadir}/moin/data/plugin/action/allactions.py* to the data/plugin/action directory of the wiki instance and do: chown apache:apache /path/to/wiki/data/plugin/action/allactions.py* * copy %{_datadir}/moin/data/plugin/userprefs/themeprefs.py* to the data/plugin/userprefs directory of the wiki instance and do: chown apache:apache /path/to/wiki/data/plugin/userprefs/themeprefs.py* EOF %build # Generate normal (.pyc) byte-compiled files. python2 -c 'import compileall; compileall.compile_dir(".", 1, "/", 1)' # Generate optimized (.pyo) byte-compiled files. python2 -O -c 'import compileall; compileall.compile_dir(".", 1, "/", 1)' %install install -d -m 755 %{buildroot}%{_datadir}/moin/data/plugin/{action,theme,userprefs} install -p -m 644 allactions.py* %{buildroot}%{_datadir}/moin/data/plugin/action/ install -p -m 644 solenoid.py* %{buildroot}%{_datadir}/moin/data/plugin/theme/ install -p -m 644 themeprefs.py* %{buildroot}%{_datadir}/moin/data/plugin/userprefs/ install -d -m 755 %{buildroot}%{moin_static_content_dir}/solenoid install -d -m 755 %{buildroot}%{python2_sitelib}/MoinMoin/i18n/themes/solenoid cp -a htdocs/* %{buildroot}%{moin_static_content_dir}/solenoid/ for translation in translations/*.po do target=$(echo $translation | sed -e 's|.*/\([^/]*\)\.po$|\1_custom.Theme.po|') install -p -m 644 $translation \ %{buildroot}%{python2_sitelib}/MoinMoin/i18n/themes/solenoid/$target done %pretrans -p -- Remove old compat symlink, if present path = "%{moin_static_content_dir}/solenoid" st = posix.stat(path) if st and st.type == "link" then os.remove(path) end %files %license COPYING.txt %doc CHANGES.txt README.rpm README.txt %{_datadir}/moin/data/plugin/action/allactions.py* %{_datadir}/moin/data/plugin/theme/solenoid.py* %{_datadir}/moin/data/plugin/userprefs/themeprefs.py* %{moin_static_content_dir}/solenoid/ %{python2_sitelib}/MoinMoin/i18n/themes/solenoid/ %changelog * Wed Mar 29 2023 Paul Howarth - 2012.12.16-6 - Use SPDX-format license tag - Use %%license unconditionally * Mon Nov 4 2019 Paul Howarth - 2012.12.16-5 - Fix FTBFS on Fedora 31 due to use of unversioned %%{python_sitelib} * Sat Nov 10 2018 Paul Howarth - 2012.12.16-4 - Use python2 instead of generic python - Manually add python(abi) dependency * Sat Jan 6 2018 Paul Howarth - 2012.12.16-3 - Drop support for EOL distributions prior to F-13 - Drop BuildRoot: and Group: tags - Drop explicit buildroot cleaning in %%install section - Drop explicit %%clean section * Wed Feb 18 2015 Paul Howarth - 2012.12.16-2 - Drop support for old distributions prior to FC-5 - No need to support python < 2.4 or moin < 1.9.0 - Drop %%defattr, redundant since rpm 4.4 - Move static content from %%{_datadir} to %%{python_sitelib} as wanted by moin ≥ 1.9.0 and remove any old compat symlink with a %%pretrans script - Use %%license where possible * Mon Sep 23 2013 Paul Howarth - 2012.12.16-1 - Update to 2012.12.16 (see CHANGES.txt for details) * Thu Oct 13 2011 Paul Howarth - 2009.12.5-4 - Nobody else likes macros for commands - Fix dist tag for CentOS 6 and Scientific Linux - BR: python2 rather than just python * Wed Jul 28 2010 Paul Howarth - 2009.12.5-3 - Rebuild for python 2.7 in Rawhide * Wed May 26 2010 Paul Howarth - 2009.12.5-2 - Fix dist tag for RHEL-6 Beta * Mon Dec 7 2009 Paul Howarth - 2009.12.5-1 - Update to 2009.12.5 - Add compat symlink to static content from %%{python_sitelib}/MoinMoin/web/static/htdocs for moin ≥ 1.9.0 - BR: symlinks - Rework translation installation script * Fri Oct 30 2009 Paul Howarth - 2009.8.18-1 - Initial RPM version