add package

This commit is contained in:
duyyb 2019-12-14 17:58:26 +08:00
parent f75257e90f
commit b532dfd21f
5 changed files with 155 additions and 0 deletions

19
LICENSE Normal file
View File

@ -0,0 +1,19 @@
Copyright 2013 T.C. Hollingsworth <tchollingsworth@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.

8
README.devel Normal file
View File

@ -0,0 +1,8 @@
web-assets-devel contains the RPM macros that implement the Fedora Web Assets
and JavaScript packaging policies.
For more information on packaging Web Assets, see:
https://fedoraproject.org/wiki/Packaging:Web_Assets
For more information on packaging JavaScript, see:
https://fedoraproject.org/wiki/Packaging:JavaScript

13
macros.web-assets Normal file
View File

@ -0,0 +1,13 @@
%_webassetdir %{_datadir}/web-assets
%_jsdir %{_datadir}/javascript
%js_includes() %{expand: \
%(
ver=$(rpm -q --qf='%%{version}' -- %1)
if [[ $? -eq 0 ]]; then
echo "Provides: js-includes(%1) = $ver"
else
echo "Provides: js-includes(%1)"
fi
)
}

43
web-assets.conf Normal file
View File

@ -0,0 +1,43 @@
<Directory /usr/share/web-assets>
Options -Indexes +FollowSymLinks
<IfModule mod_authz_core.c>
# Apache 2.4
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order deny,allow
Allow from all
</IfModule>
</Directory>
<Directory /usr/share/javascript>
Options -Indexes +FollowSymLinks
<IfModule mod_authz_core.c>
# Apache 2.4
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order deny,allow
Allow from all
</IfModule>
</Directory>
<Directory /usr/share/fonts>
Options -Indexes
<IfModule mod_authz_core.c>
# Apache 2.4
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order deny,allow
Allow from all
</IfModule>
</Directory>
Alias /.sysassets/fonts /usr/share/fonts
Alias /.sysassets/javascript /usr/share/javascript
Alias /.sysassets/js /usr/share/javascript
Alias /.sysassets /usr/share/web-assets

72
web-assets.spec Normal file
View File

@ -0,0 +1,72 @@
Name: web-assets
Version: 5
Release: 9
Summary: The package is a simple framework that pushes bits to the browser
License: MIT
URL: https://fedoraproject.org/wiki/User:Patches/PackagingDrafts/Web_Assets
Source1: LICENSE
Source2: macros.web-assets
Source3: web-assets.conf
Source4: README.devel
BuildArch: noarch
Provides: %{name}-filesystem = %{version}-%{release}
Obsoletes: %{name}-filesystem < %{version}-%{release}
%description
The package is a simple framework for pushing bits to browsers.
%package devel
Summary: Support RPM macro of Web Assets package
License: MIT
Requires: %{name}-filesystem = %{version}-%{release}
%description devel
Support RPM macro of Web Assets package.
%package httpd
Summary: Web Assets also known as the Apache HTTP daemon
License: MIT
Requires: %{name}-filesystem = %{version}-%{release} httpd
Requires(post): systemd
Requires(postun): systemd
%description httpd
Web Assets also known as the Apache HTTP daemon.
%prep
%autosetup -c -T
cp %{SOURCE1} LICENSE
cp %{SOURCE4} README.devel
%build
%install
install -d %{buildroot}%{_datadir}/%{name} %{buildroot}%{_datadir}/javascript
ln -sf ../javascript %{buildroot}%{_datadir}/%{name}/javascript
ln -sf ../javascript %{buildroot}%{_datadir}/%{name}/js
ln -sf ../fonts %{buildroot}%{_datadir}/%{name}/fonts
install -Dpm0644 %{SOURCE2} %{buildroot}%{_rpmconfigdir}/macros.d/macros.%{name}
install -Dpm0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/httpd/conf.d/%{name}.conf
%post httpd
systemctl reload-or-try-restart httpd.service || :
%postun httpd
systemctl reload-or-try-restart httpd.service || :
%files
%doc LICENSE
%{_datadir}/{web-assets,javascript}
%files devel
%doc README.devel
%{_rpmconfigdir}/macros.d/macros.web-assets
%files httpd
%config(noreplace) %{_sysconfdir}/httpd/conf.d/web-assets.conf
%changelog
* Thu Dec 12 2019 duyeyu <duyeyu@huawei.com> - 5-9
- initial package