From aa922d14c6a979be30a36eddc59e12935f988f4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Wed, 23 Mar 2022 10:08:19 +0100 Subject: [PATCH] Unify httpd and nginx packaging This makes the spec file more uniform. A change is that the post and postun scripts for httpd do not pull in systemd. An httpd.service is restarted only if systemd has already been installed. This makes a systemd-less container easier. (The ball is on httpd side now.) This patch also fixes few missing dependencies. --- web-assets.conf => httpd-web-assets.conf | 0 web-assets.rpmlintrc | 5 +++ web-assets.spec | 50 +++++++++++------------- 3 files changed, 28 insertions(+), 27 deletions(-) rename web-assets.conf => httpd-web-assets.conf (100%) create mode 100644 web-assets.rpmlintrc diff --git a/web-assets.conf b/httpd-web-assets.conf similarity index 100% rename from web-assets.conf rename to httpd-web-assets.conf diff --git a/web-assets.rpmlintrc b/web-assets.rpmlintrc new file mode 100644 index 0000000..0f36bfe --- /dev/null +++ b/web-assets.rpmlintrc @@ -0,0 +1,5 @@ +addFilter('web-assets-filesystem\.noarch: W: no-documentation') +# The target is provided by fonts-filesystem. +addFilter('web-assets-filesystem\.noarch: W: dangling-relative-symlink /usr/share/web-assets/fonts \.\./fonts') +# RPM macros live in /usr/lib. +addFilter('web-assets-devel\.noarch: W: only-non-binary-in-usr-lib') diff --git a/web-assets.spec b/web-assets.spec index 3280029..918e7fe 100644 --- a/web-assets.spec +++ b/web-assets.spec @@ -1,22 +1,19 @@ -#disable the httpd stuff while we're waiting on getting the path issues -#cleared up -%global enable_httpd 1 +%bcond_without httpd %bcond_without nginx Name: web-assets Version: 5 -Release: 16%{?dist} +Release: 17%{?dist} Summary: A simple framework for bits pushed to browsers -BuildArch: noarch - License: MIT URL: https://fedoraproject.org/wiki/User:Patches/PackagingDrafts/Web_Assets - -Source1: LICENSE +Source0: LICENSE +Source1: README.devel Source2: macros.web-assets -Source3: web-assets.conf -Source4: README.devel -Source5: nginx-web-assets.conf +Source3: httpd-web-assets.conf +Source4: nginx-web-assets.conf +BuildArch: noarch +BuildRequires: coreutils %description %{summary}. @@ -25,6 +22,7 @@ Source5: nginx-web-assets.conf Summary: The basic directory layout for Web Assets #there's nothing copyrightable about a few directories and symlinks License: Public Domain +Requires: fonts-filesystem %description filesystem %{summary}. @@ -37,14 +35,12 @@ Requires: web-assets-filesystem = %{version}-%{release} %description devel %{summary}. -%if 0%{?enable_httpd} +%if %{with httpd} %package httpd Summary: Web Assets aliases for the Apache HTTP daemon License: MIT Requires: web-assets-filesystem = %{version}-%{release} Requires: httpd -Requires(post): systemd -Requires(postun): systemd %description httpd %{summary}. @@ -63,8 +59,8 @@ Requires: nginx %prep %setup -c -T -cp %{SOURCE1} LICENSE -cp %{SOURCE4} README.devel +cp %{SOURCE0} LICENSE +cp %{SOURCE1} README.devel %build #nothing to do @@ -72,28 +68,25 @@ cp %{SOURCE4} README.devel %install mkdir -p %{buildroot}%{_datadir}/web-assets mkdir -p %{buildroot}%{_datadir}/javascript - ln -sf ../javascript %{buildroot}%{_datadir}/web-assets/javascript ln -sf ../javascript %{buildroot}%{_datadir}/web-assets/js ln -sf ../fonts %{buildroot}%{_datadir}/web-assets/fonts - install -Dpm0644 %{SOURCE2} %{buildroot}%{_rpmconfigdir}/macros.d/macros.web-assets - +%if %{with httpd} +install -Dpm0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/httpd/conf.d/web-assets.conf +%endif %if %{with nginx} -install -Dpm0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/nginx/default.d/web-assets.conf +install -Dpm0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/nginx/default.d/web-assets.conf %endif -%if 0%{?enable_httpd} -install -Dpm0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/httpd/conf.d/web-assets.conf - +%if %{with httpd} %post httpd -systemctl reload-or-try-restart httpd.service || : +[ -x %{_bindir}/systemctl ] && reload-or-try-restart httpd.service || : %postun httpd -systemctl reload-or-try-restart httpd.service || : +[ -x %{_bindir}/systemctl ] && reload-or-try-restart httpd.service || : %endif - %if %{with nginx} %post nginx [ -x %{_bindir}/systemctl ] && systemctl reload-or-try-restart nginx.service || : @@ -111,7 +104,7 @@ systemctl reload-or-try-restart httpd.service || : %license LICENSE %doc README.devel -%if 0%{?enable_httpd} +%if %{with httpd} %files httpd %config(noreplace) %{_sysconfdir}/httpd/conf.d/web-assets.conf %license LICENSE @@ -124,6 +117,9 @@ systemctl reload-or-try-restart httpd.service || : %endif %changelog +* Wed Mar 23 2022 Petr Pisar - 5-17 +- Make a dependency on systemd optional for restarting httpd + * Tue Mar 22 2022 Petr Menšík - 5-16 - Add nginx aliases support