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.
This commit is contained in:
Petr Písař 2022-03-23 10:08:19 +01:00
parent e689bd578d
commit aa922d14c6
3 changed files with 28 additions and 27 deletions

5
web-assets.rpmlintrc Normal file
View File

@ -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')

View File

@ -1,22 +1,19 @@
#disable the httpd stuff while we're waiting on getting the path issues %bcond_without httpd
#cleared up
%global enable_httpd 1
%bcond_without nginx %bcond_without nginx
Name: web-assets Name: web-assets
Version: 5 Version: 5
Release: 16%{?dist} Release: 17%{?dist}
Summary: A simple framework for bits pushed to browsers Summary: A simple framework for bits pushed to browsers
BuildArch: noarch
License: MIT License: MIT
URL: https://fedoraproject.org/wiki/User:Patches/PackagingDrafts/Web_Assets URL: https://fedoraproject.org/wiki/User:Patches/PackagingDrafts/Web_Assets
Source0: LICENSE
Source1: LICENSE Source1: README.devel
Source2: macros.web-assets Source2: macros.web-assets
Source3: web-assets.conf Source3: httpd-web-assets.conf
Source4: README.devel Source4: nginx-web-assets.conf
Source5: nginx-web-assets.conf BuildArch: noarch
BuildRequires: coreutils
%description %description
%{summary}. %{summary}.
@ -25,6 +22,7 @@ Source5: nginx-web-assets.conf
Summary: The basic directory layout for Web Assets Summary: The basic directory layout for Web Assets
#there's nothing copyrightable about a few directories and symlinks #there's nothing copyrightable about a few directories and symlinks
License: Public Domain License: Public Domain
Requires: fonts-filesystem
%description filesystem %description filesystem
%{summary}. %{summary}.
@ -37,14 +35,12 @@ Requires: web-assets-filesystem = %{version}-%{release}
%description devel %description devel
%{summary}. %{summary}.
%if 0%{?enable_httpd} %if %{with httpd}
%package httpd %package httpd
Summary: Web Assets aliases for the Apache HTTP daemon Summary: Web Assets aliases for the Apache HTTP daemon
License: MIT License: MIT
Requires: web-assets-filesystem = %{version}-%{release} Requires: web-assets-filesystem = %{version}-%{release}
Requires: httpd Requires: httpd
Requires(post): systemd
Requires(postun): systemd
%description httpd %description httpd
%{summary}. %{summary}.
@ -63,8 +59,8 @@ Requires: nginx
%prep %prep
%setup -c -T %setup -c -T
cp %{SOURCE1} LICENSE cp %{SOURCE0} LICENSE
cp %{SOURCE4} README.devel cp %{SOURCE1} README.devel
%build %build
#nothing to do #nothing to do
@ -72,28 +68,25 @@ cp %{SOURCE4} README.devel
%install %install
mkdir -p %{buildroot}%{_datadir}/web-assets mkdir -p %{buildroot}%{_datadir}/web-assets
mkdir -p %{buildroot}%{_datadir}/javascript mkdir -p %{buildroot}%{_datadir}/javascript
ln -sf ../javascript %{buildroot}%{_datadir}/web-assets/javascript ln -sf ../javascript %{buildroot}%{_datadir}/web-assets/javascript
ln -sf ../javascript %{buildroot}%{_datadir}/web-assets/js ln -sf ../javascript %{buildroot}%{_datadir}/web-assets/js
ln -sf ../fonts %{buildroot}%{_datadir}/web-assets/fonts ln -sf ../fonts %{buildroot}%{_datadir}/web-assets/fonts
install -Dpm0644 %{SOURCE2} %{buildroot}%{_rpmconfigdir}/macros.d/macros.web-assets 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} %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 %endif
%if 0%{?enable_httpd} %if %{with httpd}
install -Dpm0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/httpd/conf.d/web-assets.conf
%post httpd %post httpd
systemctl reload-or-try-restart httpd.service || : [ -x %{_bindir}/systemctl ] && reload-or-try-restart httpd.service || :
%postun httpd %postun httpd
systemctl reload-or-try-restart httpd.service || : [ -x %{_bindir}/systemctl ] && reload-or-try-restart httpd.service || :
%endif %endif
%if %{with nginx} %if %{with nginx}
%post nginx %post nginx
[ -x %{_bindir}/systemctl ] && systemctl reload-or-try-restart nginx.service || : [ -x %{_bindir}/systemctl ] && systemctl reload-or-try-restart nginx.service || :
@ -111,7 +104,7 @@ systemctl reload-or-try-restart httpd.service || :
%license LICENSE %license LICENSE
%doc README.devel %doc README.devel
%if 0%{?enable_httpd} %if %{with httpd}
%files httpd %files httpd
%config(noreplace) %{_sysconfdir}/httpd/conf.d/web-assets.conf %config(noreplace) %{_sysconfdir}/httpd/conf.d/web-assets.conf
%license LICENSE %license LICENSE
@ -124,6 +117,9 @@ systemctl reload-or-try-restart httpd.service || :
%endif %endif
%changelog %changelog
* Wed Mar 23 2022 Petr Pisar <ppisar@redhat.com> - 5-17
- Make a dependency on systemd optional for restarting httpd
* Tue Mar 22 2022 Petr Menšík <pemensik@redhat.com> - 5-16 * Tue Mar 22 2022 Petr Menšík <pemensik@redhat.com> - 5-16
- Add nginx aliases support - Add nginx aliases support