Accepting request 337522 from Apache
Automatic submission by obs-autosubmit OBS-URL: https://build.opensuse.org/request/show/337522 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/apache-rpm-macros?expand=0&rev=7
This commit is contained in:
commit
44980db3a2
@ -1,3 +1,19 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Sep 30 17:14:29 UTC 2015 - pgajdos@suse.com
|
||||||
|
|
||||||
|
- version 20150930
|
||||||
|
- %apache_test_module_start_apache, %apache_test_module_load:
|
||||||
|
introduce -t option
|
||||||
|
- %apache_test_module_curl: introduce -r option
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Sep 22 07:16:24 UTC 2015 - pgajdos@suse.com
|
||||||
|
|
||||||
|
- version 20150921
|
||||||
|
- make package usable also for other rpm based distros
|
||||||
|
- %apache_test_module_start_apache: introduce -p, -u and -g options
|
||||||
|
- %apache_test_module_curl: introduce -p and -u option
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Sep 18 08:18:45 UTC 2015 - pgajdos@suse.com
|
Fri Sep 18 08:18:45 UTC 2015 - pgajdos@suse.com
|
||||||
|
|
||||||
|
@ -21,21 +21,34 @@
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%define ap_major 2
|
%define ap_major 2
|
||||||
|
%if 0%{?suse_version}
|
||||||
%define ap_branch %(rpm -q --qf "%%{version}" apache%{ap_major} | sed "s:\\(\\..*\\)\\..*:\\1:")
|
%define ap_branch %(rpm -q --qf "%%{version}" apache%{ap_major} | sed "s:\\(\\..*\\)\\..*:\\1:")
|
||||||
|
%else
|
||||||
|
%define ap_branch %(rpm -q --qf "%%{version}" httpd | sed "s:\\(\\..*\\)\\..*:\\1:")
|
||||||
|
%endif
|
||||||
%define ap_pname apache%{ap_major}
|
%define ap_pname apache%{ap_major}
|
||||||
%define ap_apxs %(rpm -ql apache%{ap_major}-devel | grep 'apxs[2]\\?$' | head -n 1)
|
%define ap_apxs %(ls -1 /usr/{,s}bin/apxs{,2} 2>/dev/null | head -n 1)
|
||||||
%define ap_cflags %(%{ap_apxs} -q CFLAGS)
|
%define ap_cflags %(%{ap_apxs} -q CFLAGS)
|
||||||
%define ap_includedir %(%{ap_apxs} -q INCLUDEDIR)
|
%define ap_includedir %(%{ap_apxs} -q INCLUDEDIR)
|
||||||
%define ap_libexecdir %(%{ap_apxs} -q LIBEXECDIR)
|
%define ap_libexecdir %(%{ap_apxs} -q LIBEXECDIR)
|
||||||
%define ap_localstatedir %(%{ap_apxs} -q LOCALSTATEDIR)
|
%define ap_localstatedir %(%{ap_apxs} -q LOCALSTATEDIR)
|
||||||
|
%if 0%{?suse_version}
|
||||||
%define ap_mmn %(MMN=$(%{ap_apxs} -q LIBEXECDIR)_MMN; test -x $MMN && $MMN)
|
%define ap_mmn %(MMN=$(%{ap_apxs} -q LIBEXECDIR)_MMN; test -x $MMN && $MMN)
|
||||||
%define ap_maint_mmn %(MMN=$(rpm -q --provides apache2 | grep suse_maintenance_mmn); test -z "$MMN" && MMN=apache2; echo $MMN)
|
%define ap_maint_mmn %(MMN=$(rpm -q --provides apache2 | grep suse_maintenance_mmn); test -z "$MMN" && MMN=apache2; echo $MMN)
|
||||||
|
%endif
|
||||||
%define ap_serverroot %(%{ap_apxs} -q PREFIX)
|
%define ap_serverroot %(%{ap_apxs} -q PREFIX)
|
||||||
%define ap_sysconfdir %(%{ap_apxs} -q SYSCONFDIR)
|
%define ap_sysconfdir %(%{ap_apxs} -q SYSCONFDIR)
|
||||||
%define ap_datadir %(%{ap_apxs} -q DATADIR)
|
%define ap_datadir %(%{ap_apxs} -q DATADIR)
|
||||||
|
%if 0%{?suse_version}
|
||||||
%define ap_user wwwrun
|
%define ap_user wwwrun
|
||||||
%define ap_group www
|
%define ap_group www
|
||||||
|
%else
|
||||||
|
%define ap_user apache
|
||||||
|
%define ap_group apache
|
||||||
|
%endif
|
||||||
|
%if 0%{?suse_version}
|
||||||
%define ap_access_syntax_version %(if [ $(grep -c '^[[:space:]]*Require all denied' /etc/apache2/httpd.conf) -gt 0 ]; then echo 24; else echo 22; fi)
|
%define ap_access_syntax_version %(if [ $(grep -c '^[[:space:]]*Require all denied' /etc/apache2/httpd.conf) -gt 0 ]; then echo 24; else echo 22; fi)
|
||||||
|
%endif
|
||||||
#
|
#
|
||||||
%if 0%{?suse_version} > 1230
|
%if 0%{?suse_version} > 1230
|
||||||
%define macros_dir %{_libexecdir}/rpm/macros.d
|
%define macros_dir %{_libexecdir}/rpm/macros.d
|
||||||
@ -44,14 +57,18 @@
|
|||||||
%endif
|
%endif
|
||||||
%define macros_file macros.apache
|
%define macros_file macros.apache
|
||||||
Name: apache-rpm-macros
|
Name: apache-rpm-macros
|
||||||
Version: 20150918
|
Version: 20150930
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Apache RPM Macros
|
Summary: Apache RPM Macros
|
||||||
License: Apache-2.0
|
License: Apache-2.0
|
||||||
Group: Productivity/Networking/Web/Servers
|
Group: Productivity/Networking/Web/Servers
|
||||||
Url: http://httpd.apache.org/
|
Url: http://httpd.apache.org/
|
||||||
Source1: macros.apache-module-test
|
Source1: macros.apache-module-test
|
||||||
|
%if 0%{?suse_version}
|
||||||
BuildRequires: apache%{ap_major}-devel
|
BuildRequires: apache%{ap_major}-devel
|
||||||
|
%else
|
||||||
|
BuildRequires: httpd-devel
|
||||||
|
%endif
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
|
||||||
%description
|
%description
|
||||||
|
@ -10,7 +10,8 @@
|
|||||||
#
|
#
|
||||||
# macro: apache_test_module_start_apache -- start apache with specified modules loaded
|
# macro: apache_test_module_start_apache -- start apache with specified modules loaded
|
||||||
#
|
#
|
||||||
# usage: apache_test_module_start_apache -m module_list [-i include_list] [-r document_root]
|
# usage: apache_test_module_start_apache [-m module_list] [-i include_list] [-r document_root]
|
||||||
|
# [-u user] [-g group] [-p port] [-t mpm]
|
||||||
#
|
#
|
||||||
# module_list: colon separated list of module names to be loaded with test run
|
# module_list: colon separated list of module names to be loaded with test run
|
||||||
# search path: %{buildroot} tree
|
# search path: %{buildroot} tree
|
||||||
@ -25,16 +26,22 @@
|
|||||||
# %{apache_test_module_dir}
|
# %{apache_test_module_dir}
|
||||||
# [example value: mod_asn.conf]
|
# [example value: mod_asn.conf]
|
||||||
# document_root: document root of the test server,
|
# document_root: document root of the test server,
|
||||||
# [default value: $PWD/test/htdocs]
|
# [default value: /tmp/%%{name}-test/htdocs]
|
||||||
|
# user: user under which will run test instance (usable only
|
||||||
|
# when the test is run by root)
|
||||||
|
# [default value: abuild]
|
||||||
|
# group: group under which will run test instance (usable only
|
||||||
|
# when the test is run by root)
|
||||||
|
# [default value: abuild]
|
||||||
|
# port: listen on port
|
||||||
|
# [default value: 60080]
|
||||||
|
# mpm: multiprocessing module (prefork, worker, event)
|
||||||
|
# [default value: prefork]
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
%apache_test_module_start_apache(m:,i:,r:) \
|
%apache_test_module_start_apache(m:,i:,r:,u:,g:,t:) \
|
||||||
# constants \
|
# constants \
|
||||||
TEST_DIR='%{__test_dir}' \
|
TEST_DIR='%{__test_dir}' \
|
||||||
TEST_MPM='%{__test_mpm}' \
|
|
||||||
TEST_USER='%{__test_user}' \
|
|
||||||
TEST_GROUP='%{__test_group}' \
|
|
||||||
TEST_PORT='%{__test_port}' \
|
|
||||||
# arguments \
|
# arguments \
|
||||||
# modules to load, from BUILD tree or system \
|
# modules to load, from BUILD tree or system \
|
||||||
MODULES=$(echo %{-m:%{-m*}} | tr ':' ' ') \
|
MODULES=$(echo %{-m:%{-m*}} | tr ':' ' ') \
|
||||||
@ -45,6 +52,24 @@
|
|||||||
if [ -z "$DOCUMENT_ROOT" ]; then \
|
if [ -z "$DOCUMENT_ROOT" ]; then \
|
||||||
DOCUMENT_ROOT=$TEST_DIR/htdocs \
|
DOCUMENT_ROOT=$TEST_DIR/htdocs \
|
||||||
fi \
|
fi \
|
||||||
|
# user and group running the apache instance \
|
||||||
|
# (usable only when the test is run as root) \
|
||||||
|
TEST_USER="%{-u:%{-u*}}" \
|
||||||
|
if [ -z "$TEST_USER" ]; then \
|
||||||
|
TEST_USER='%{__test_user}' \
|
||||||
|
fi \
|
||||||
|
TEST_GROUP="%{-g:%{-g*}}" \
|
||||||
|
if [ -z "$TEST_GROUP" ]; then \
|
||||||
|
TEST_GROUP='%{__test_group}' \
|
||||||
|
fi \
|
||||||
|
TEST_PORT="%{-p:%{-p*}}" \
|
||||||
|
if [ -z "$TEST_PORT" ]; then \
|
||||||
|
TEST_PORT='%{__test_port}' \
|
||||||
|
fi \
|
||||||
|
TEST_MPM="%{-t:%{-t*}}" \
|
||||||
|
if [ -z "$TEST_MPM" ]; then \
|
||||||
|
TEST_MPM='%{__test_mpm}' \
|
||||||
|
fi \
|
||||||
# helpers \
|
# helpers \
|
||||||
APACHE_BRANCH=$(echo %{apache_branch} | tr -d '.') \
|
APACHE_BRANCH=$(echo %{apache_branch} | tr -d '.') \
|
||||||
# begin \
|
# begin \
|
||||||
@ -99,15 +124,6 @@
|
|||||||
done \
|
done \
|
||||||
echo "DocumentRoot $DOCUMENT_ROOT" >> $TEST_CONF_FILE \
|
echo "DocumentRoot $DOCUMENT_ROOT" >> $TEST_CONF_FILE \
|
||||||
echo "DirectoryIndex index.html" >> $TEST_CONF_FILE \
|
echo "DirectoryIndex index.html" >> $TEST_CONF_FILE \
|
||||||
echo "<Directory $DOCUMENT_ROOT>" >> $TEST_CONF_FILE \
|
|
||||||
if [ $APACHE_BRANCH -ge 24 ]; then \
|
|
||||||
echo " Require local" >> $TEST_CONF_FILE \
|
|
||||||
else \
|
|
||||||
echo " Order deny,allow" >> $TEST_CONF_FILE \
|
|
||||||
echo " Deny from all" >> $TEST_CONF_FILE \
|
|
||||||
echo " Allow from localhost" >> $TEST_CONF_FILE \
|
|
||||||
fi \
|
|
||||||
echo "</Directory>" >> $TEST_CONF_FILE \
|
|
||||||
# run apache \
|
# run apache \
|
||||||
CMD=$(ls %{_sbindir}/httpd*-$TEST_MPM | head -n 1) \
|
CMD=$(ls %{_sbindir}/httpd*-$TEST_MPM | head -n 1) \
|
||||||
echo -n "Starting Apache ... " \
|
echo -n "Starting Apache ... " \
|
||||||
@ -142,23 +158,46 @@
|
|||||||
# document root of test instance
|
# document root of test instance
|
||||||
#
|
#
|
||||||
# usage: apache_test_module_curl -d document_to_curl -o output_of_curl
|
# usage: apache_test_module_curl -d document_to_curl -o output_of_curl
|
||||||
|
# -p port -u user:password -r protocol
|
||||||
|
#
|
||||||
|
# document_to_curl: relative to DocumentRoot [default: /]
|
||||||
|
# output_of_curl: where to save document (required)
|
||||||
|
# port: from which port of localhost will be document
|
||||||
|
# downloaded [default value: 60080]
|
||||||
|
# user:password: --user parameter of curl
|
||||||
|
# protocol: protocol to download document
|
||||||
|
# [default: http]
|
||||||
|
#
|
||||||
# example: apache_test_module_curl -d foo/test.html -o test.html
|
# example: apache_test_module_curl -d foo/test.html -o test.html
|
||||||
# apache_test_module_curl -d foo/ -o output.txt
|
# apache_test_module_curl -d foo/ -o output.txt
|
||||||
#
|
#
|
||||||
%apache_test_module_curl(d:,o:) \
|
%apache_test_module_curl(d:,o:,p:,u:,r:) \
|
||||||
TEST_DOCUMENT="%{-d:%{-d*}}" \
|
TEST_DOCUMENT="%{-d:%{-d*}}" \
|
||||||
TEST_OUTPUT="%{-o:%{-o*}}" \
|
TEST_OUTPUT="%{-o:%{-o*}}" \
|
||||||
|
TEST_PORT="%{-p:%{-p*}}" \
|
||||||
|
TEST_CURL_USER="%{-u:%{-u*}}" \
|
||||||
|
TEST_PROTO="%{-r:%{-r*}}" \
|
||||||
|
if [ -z "$TEST_PORT" ]; then \
|
||||||
|
TEST_PORT='%{__test_port}' \
|
||||||
|
fi \
|
||||||
if [ -z "$TEST_OUTPUT" ]; then \
|
if [ -z "$TEST_OUTPUT" ]; then \
|
||||||
echo "Missing argument -o to apache_test_module_curl." \
|
echo "Missing argument -o to apache_test_module_curl." \
|
||||||
exit 1 \
|
exit 1 \
|
||||||
fi \
|
fi \
|
||||||
curl -s "http://localhost:%{__test_port}/$TEST_DOCUMENT" --create-dirs -o "$TEST_OUTPUT" \
|
USER_PARAM="" \
|
||||||
|
if [ ! -z "$TEST_CURL_USER" ]; then \
|
||||||
|
USER_PARAM="-u $TEST_CURL_USER" \
|
||||||
|
fi \
|
||||||
|
if [ -z "$TEST_PROTO" ]; then \
|
||||||
|
TEST_PROTO="http" \
|
||||||
|
fi \
|
||||||
|
curl -s -k "$TEST_PROTO://127.0.0.1:$TEST_PORT/$TEST_DOCUMENT" --create-dirs -o "$TEST_OUTPUT" $USER_PARAM \
|
||||||
%nil
|
%nil
|
||||||
|
|
||||||
#
|
#
|
||||||
# macro: apache_test_module_load -- tests that module(s) can be loaded
|
# macro: apache_test_module_load -- tests that module(s) can be loaded
|
||||||
#
|
#
|
||||||
# usage: apache_test_module_load -m module_list [-i include_list]
|
# usage: apache_test_module_load [-m module_list] [-i include_list] [-t mpm]
|
||||||
#
|
#
|
||||||
# module_list: colon separated list of module names to be loaded with test run
|
# module_list: colon separated list of module names to be loaded with test run
|
||||||
# search path: %{buildroot} tree
|
# search path: %{buildroot} tree
|
||||||
@ -170,9 +209,11 @@
|
|||||||
# search path %{buildroot}%{apache_sysconfdir} tree
|
# search path %{buildroot}%{apache_sysconfdir} tree
|
||||||
# $PWD tree
|
# $PWD tree
|
||||||
# [example value: mod_asn.conf]
|
# [example value: mod_asn.conf]
|
||||||
|
# mpm: multiprocessing module (prefork, worker, event)
|
||||||
|
# [default value: prefork]
|
||||||
#
|
#
|
||||||
%apache_test_module_load(m:,i:) \
|
%apache_test_module_load(m:,i:,t:) \
|
||||||
%apache_test_module_start_apache %{-m:-m %{-m*}} %{-i:-i %{-i*}} \
|
%apache_test_module_start_apache %{-m:-m %{-m*}} %{-i:-i %{-i*}} %{-t:-t %{-t*}} \
|
||||||
%apache_test_module_stop_apache \
|
%apache_test_module_stop_apache \
|
||||||
%nil
|
%nil
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user