From 5bdad1a3c2b795c725b622798434f2115b471012 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Nov 21 2016 13:32:45 +0000 Subject: [frontend] modularize design files Project https://pagure.io/rhcopr/design benefits from this change. --- diff --git a/frontend/copr-frontend.spec b/frontend/copr-frontend.spec index d07ad24..303a143 100644 --- a/frontend/copr-frontend.spec +++ b/frontend/copr-frontend.spec @@ -5,6 +5,31 @@ %global __python2 %{__python} %endif +# https://fedoraproject.org/wiki/Packaging:Guidelines#Packaging_of_Additional_RPM_Macros +%global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d) + + +%global design_files_list %_datadir/copr/copr-design-filelist +%global design_generator %_datadir/copr/coprs_frontend/generate_colorscheme +%global static_files %_datadir/copr/coprs_frontend/coprs/static + +%global design_files \ +%static_files/header_background.png \ +%static_files/favicon.ico \ +%static_files/copr_logo.png \ +%static_files/css/style-overwrite.css + +%global devel_files \ +%design_generator + +%define exclude_files() %{lua: + macro = "%" .. rpm.expand("%1") .. "_files" + x = rpm.expand(macro) + for line in string.gmatch(x, "([^\\n]+)") do + print("%exclude " .. line .. "\\n") + end +} + Name: copr-frontend Version: 1.103 Release: 1%{?dist} @@ -61,6 +86,7 @@ Requires: python-flask-restful Requires: python-marshmallow >= 2.0.0 Requires: python2-modulemd Requires: python-pygments +Requires: %{name}-design = %{version} # for tests: Requires: pytest @@ -189,6 +215,26 @@ and submit new builds and COPR will create yum repository from latests builds. This package include documentation for COPR code. Mostly useful for developers only. + +%package design +Summary: Template files for %{name} +Requires: %{name} = %{version} + +%description design +Template files for %{name} (basically colors, logo, etc.). This package is +designed to be replaced - build your replacement package against %{name}-devel +to produce compatible {name}-design package, then use man dnf.conf(5) 'priority' +option to prioritize your package against the default package we provide. + + +%package devel +Summary: Development files to build against %{name} + +%description devel +Files which allow a build against %{name}, currently it's useful to build +custom %{name}-design package. + + %prep %setup -q @@ -199,6 +245,7 @@ pushd documentation COPR_CONFIG=../../documentation/copr-documentation.conf make %{?_smp_mflags} python popd + %install install -d %{buildroot}%{_sysconfdir}/copr install -d %{buildroot}%{_datadir}/copr/coprs_frontend @@ -232,9 +279,13 @@ cp -a conf/logrotate %{buildroot}%{_sysconfdir}/logrotate.d/%{name} cp -a conf/logstash.conf %{buildroot}%{_sysconfdir}/logstash.d/copr_frontend.conf touch %{buildroot}%{_var}/log/copr-frontend/frontend.log - ln -fs /usr/share/copr/coprs_frontend/manage.py %{buildroot}/%{_bindir}/copr-frontend +mkdir -p %buildroot/$(dirname %design_files) +cat < %buildroot%design_files_list +%design_files +EOF + %check %if %{with check} && "%{_arch}" == "x86_64" pushd coprs_frontend @@ -246,23 +297,36 @@ ln -fs /usr/share/copr/coprs_frontend/manage.py %{buildroot}/%{_bindir}/copr-fro popd %endif +mkdir -p %buildroot%macrosdir +cat <%buildroot%macrosdir/macros.coprfrontend +%%copr_frontend_version %version +%%copr_frontend_design_filelist %design_files_list +%%copr_frontend_design_generator %design_generator +%%copr_frontend_static_files %static_files +EOF + + %pre getent group copr-fe >/dev/null || groupadd -r copr-fe getent passwd copr-fe >/dev/null || \ useradd -r -g copr-fe -G copr-fe -d %{_datadir}/copr/coprs_frontend -s /bin/bash -c "COPR frontend user" copr-fe /usr/bin/passwd -l copr-fe >/dev/null + %post service httpd condrestart service logstash condrestart %systemd_post copr-fedmsg-listener.service + %preun %systemd_preun copr-fedmsg-listener.service + %postun %systemd_postun_with_restart copr-fedmsg-listener.service + %files %license LICENSE %doc coprs.conf.example @@ -296,11 +360,27 @@ service logstash condrestart %config(noreplace) %{_sysconfdir}/copr/copr_unit_test.conf %config(noreplace) %attr(0755, root, root) %{_sysconfdir}/cron.hourly/copr-frontend +%exclude_files design +%exclude_files devel + + +%files design +%license LICENSE +%design_files + + +%files devel +%license LICENSE +%design_files_list +%devel_files +%macrosdir/* + %files doc %license LICENSE %doc documentation/python-doc + %changelog * Wed Sep 21 2016 clime 1.103-1 - add migration to enable mageia chroots diff --git a/frontend/coprs_frontend/coprs/static/copr.css b/frontend/coprs_frontend/coprs/static/copr.css index 6c5b67e..77826bb 100644 --- a/frontend/coprs_frontend/coprs/static/copr.css +++ b/frontend/coprs_frontend/coprs/static/copr.css @@ -6,10 +6,6 @@ body { background-color: #eee; } -h3 a { - color: #3d69a8!important; -} - footer dt h3 { margin-top: 0px; } diff --git a/frontend/coprs_frontend/coprs/static/css/style-overwrite.css b/frontend/coprs_frontend/coprs/static/css/style-overwrite.css new file mode 100644 index 0000000..ca8abda --- /dev/null +++ b/frontend/coprs_frontend/coprs/static/css/style-overwrite.css @@ -0,0 +1 @@ +a{color:#2b64b4}a:hover,a:focus{color:#214d8b}.nav-tabs>li.active>a,.nav-tabs>li.active>a:hover,.nav-tabs>li.active{color:#214d8b}h3 a{color:#214d8b !important} \ No newline at end of file diff --git a/frontend/coprs_frontend/coprs/static/header_background.png b/frontend/coprs_frontend/coprs/static/header_background.png index 61fcb6f..b6ff87c 100644 Binary files a/frontend/coprs_frontend/coprs/static/header_background.png and b/frontend/coprs_frontend/coprs/static/header_background.png differ diff --git a/frontend/coprs_frontend/coprs/templates/layout.html b/frontend/coprs_frontend/coprs/templates/layout.html index 86d73f5..4bcdb0b 100644 --- a/frontend/coprs_frontend/coprs/templates/layout.html +++ b/frontend/coprs_frontend/coprs/templates/layout.html @@ -25,6 +25,7 @@ + diff --git a/frontend/coprs_frontend/generate_colorscheme b/frontend/coprs_frontend/generate_colorscheme new file mode 100755 index 0000000..bed9834 --- /dev/null +++ b/frontend/coprs_frontend/generate_colorscheme @@ -0,0 +1,55 @@ +#! /bin/sh -x + +opt_static_files=coprs_frontend/coprs/static +opt_base_color='#214d8b' +# opt_base_color='#900000' # Red Hat Internal Copr + +# We don't have to be too much careful when arg-parsing .. +while test $# -gt 0 +do + case $1 in + --*) + opt=${1##--} + opt=${opt//-/_} + echo $opt + shift + eval opt_$opt=\$1 + shift + ;; + *) + shift + continue + ;; + esac +done + +mkdir -p "$opt_static_files/css" + +cat < li.active > a, .nav-tabs > li.active > a:hover, .nav-tabs > li.active { + color: @base; +} +h3 a { + color: @base!important; +} +EOF + +lighten_base () +{ + lessc - <