# 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: The "balanced" theme for the moin wiki engine Name: moin-theme-balanced Version: 0.5 Release: 15.%{__distinit}%{__distvers} URL: http://moinmo.in/ThemeMarket/Balanced Source0: balanced_theme-%{version}.zip Patch0: moin-theme-balanced-moin16.patch Patch1: moin-theme-balanced-0.5-icons.patch Patch2: moin-theme-balanced-0.5-userprefs.patch License: GPL-2.0-or-later BuildArch: noarch BuildRequires: coreutils BuildRequires: python2 BuildRequires: sed Requires: moin >= 1.9.0 Requires: python(abi) = %{python2ver} %description The balanced theme was originally developed by Heather Stern and Henrik Omma for the Ubuntu wiki. It draws on features from both modern and classic. The theme has since been tweaked and generalized by Omma and is now used by the following wikis: http://wiki.ubuntu.com/ http://wiki.kubuntu.org/ http://wiki.edubuntu.org/ http://wiki.theopencd.org/ http://orchard.theopencd.org/ http://wiki.softwarefreedomday.org/ Notable features are a separation of the color settings into separate css files that can easily be modified and an early version of of a flexible side-menu and tabs system that makes Moin more useful as a CMS. %package kubuntu Summary: Kubuntu-color variant of the "balanced" theme for the moin wiki engine Requires: %{name} = %{version}-%{release} %description kubuntu %{summary}. %package orchard Summary: Orchard-color variant of the "balanced" theme for the moin wiki engine Requires: %{name} = %{version}-%{release} %description orchard %{summary}. %prep %setup -q -c sed -i -e 's/\r$//g' Readme-balanced.txt balanced/css/screen.css # Fix for moin ≥ 1.6 %patch -P 0 -p1 # Add missing icons %patch -P 1 -p1 # Fix userprefs %patch -P 2 -p1 cat << EOF > README.rpm After installing this package, any newly-created wiki instances should automatically have the @THEME@ theme available. To make the @THEME@ theme available to an existing wiki instance, copy %{_datadir}/moin/data/plugin/theme/@THEME@.py* to the data/plugin/theme directory of the wiki instance and do: chown apache:apache /path/to/wiki/data/plugin/theme/@THEME@.py* EOF # Make all the different variants for subtheme in kubuntu orchard do mkdir -p balanced-${subtheme}/css sed -e "s/@THEME@/balanced-${subtheme}/g" \ README.rpm > balanced-${subtheme}/README.rpm sed -e 's/\(name[[:space:]]*=[[:space:]]*\)'"'balanced'/\1'balanced-"${subtheme}"'/" \ balanced.py > balanced-${subtheme}/balanced-${subtheme}.py cd balanced-${subtheme}/css ln -s ../../balanced/css/{common,print,projection,screen-standard}.css . mv ../../balanced/css/screen-${subtheme}-colours.css . sed -e "s/tocd/${subtheme}/" ../../balanced/css/screen.css > screen.css cd - cd balanced-${subtheme} ln -s ../balanced/img . cd - done sed -i -e 's/@THEME@/balanced/g' README.rpm %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/theme install -p -m 644 balanced.py* %{buildroot}%{_datadir}/moin/data/plugin/theme/ install -d -m 755 %{buildroot}%{moin_static_content_dir}/balanced/{css,img} install -p -m 644 balanced/css/*.css %{buildroot}%{moin_static_content_dir}/balanced/css/ install -p -m 644 balanced/img/*.png %{buildroot}%{moin_static_content_dir}/balanced/img/ # Symlink to conflict and renamed icons from modern theme ln -s ../../modern/img/moin-{conflict,renamed}.png %{buildroot}%{moin_static_content_dir}/balanced/img/ # Symlink to attach icon from modern theme ln -s ../../modern/img/attach.png %{buildroot}%{moin_static_content_dir}/balanced/img/ for subtheme in kubuntu orchard do install -d -m 755 %{buildroot}%{moin_static_content_dir}/balanced-${subtheme}/css install -p -m 644 balanced-${subtheme}/css/*.css \ %{buildroot}%{moin_static_content_dir}/balanced-${subtheme}/css/ ln -s ../balanced/img \ %{buildroot}%{moin_static_content_dir}/balanced-${subtheme}/img install -p -m 644 balanced-${subtheme}/balanced-${subtheme}.py* \ %{buildroot}%{_datadir}/moin/data/plugin/theme/ done %pretrans -p -- Remove old compat symlink, if present path = "%{moin_static_content_dir}/balanced" st = posix.stat(path) if st and st.type == "link" then os.remove(path) end %pretrans -p kubuntu -- Remove old compat symlink, if present path = "%{moin_static_content_dir}/balanced-kubuntu" st = posix.stat(path) if st and st.type == "link" then os.remove(path) end %pretrans -p orchard -- Remove old compat symlink, if present path = "%{moin_static_content_dir}/balanced-orchard" st = posix.stat(path) if st and st.type == "link" then os.remove(path) end %files %doc Readme-balanced.txt README.rpm %{_datadir}/moin/data/plugin/theme/balanced.py* %{moin_static_content_dir}/balanced/ %files kubuntu %doc balanced-kubuntu/README.rpm %{_datadir}/moin/data/plugin/theme/balanced-kubuntu.py* %{moin_static_content_dir}/balanced-kubuntu/ %files orchard %doc balanced-orchard/README.rpm %{_datadir}/moin/data/plugin/theme/balanced-orchard.py* %{moin_static_content_dir}/balanced-orchard/ %changelog * Wed Mar 29 2023 Paul Howarth - 0.5-15 - Use SPDX-format license tag - Avoid deprecated patch syntax * Sat Nov 10 2018 Paul Howarth - 0.5-14 - Use python2 instead of generic python - Manually add python(abi) dependency * Fri Jan 5 2018 Paul Howarth - 0.5-13 - 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 - 0.5-12 - 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 * Thu Oct 13 2011 Paul Howarth - 0.5-11 - Maintain timestamps where possible - Nobody else likes macros for commands - Fix dist tag for CentOS 6 and Scientific Linux * Wed Jul 28 2010 Paul Howarth - 0.5-10 - Rebuild for python 2.7 in Rawhide * Wed May 26 2010 Paul Howarth - 0.5-9 - Fix dist tag for RHEL-6 Beta * Thu Dec 31 2009 Paul Howarth - 0.5-8 - Add compat symlinks to static content from %%{python_sitelib}/MoinMoin/web/static/htdocs for moin ≥ 1.9.0 - BR: symlinks - Add symlinks to missing conflict, renamed, and attach icons from modern theme, and add patch to refer to them - Fix userprefs for moin ≥ 1.7.0, require moin ≥ 1.7.0 - Dist tag for Rawhide no longer needs special-casing * Tue Jul 7 2009 Paul Howarth - 0.5-7 - Define RPM macros in global scope - Update URL to theme-specific page on new moin site - Add patch for moin ≥ 1.6, require moin ≥ 1.6 * Tue Nov 6 2007 Paul Howarth - 0.5-6 - Fix dist tag for Fedora 7 onwards - Clarify license as GPL version 2 or later * Mon Dec 11 2006 Paul Howarth - 0.5-5 - Rebuild for python 2.5 on Rawhide * Tue Dec 5 2006 Paul Howarth - 0.5-4 - Fix python-abi dep for python 2.3 - Fix mock build where python is not in the initial buildroot * Mon Sep 18 2006 Paul Howarth - 0.5-3 - Fix dist tag for development builds - Define %%{__id_u} in a more portable way - Don't ghost .pyo files - Buildreq python, not python-devel * Wed Mar 29 2006 Paul Howarth - 0.5-2 - Support build on CentOS - Add README.rpm - Create subthemes for kubuntu and orchard colour variations * Thu Feb 16 2006 Paul Howarth - 0.5-1 - Initial package build