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
#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 <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
- Add nginx aliases support