Accepting request 775108 from Apache

Automatic submission by obs-autosubmit

OBS-URL: https://build.opensuse.org/request/show/775108
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/apache-rpm-macros?expand=0&rev=13
This commit is contained in:
Dominique Leuenberger 2020-02-20 14:37:27 +00:00 committed by Git OBS Bridge
commit 00833ad20a
3 changed files with 13 additions and 232 deletions

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Tue Feb 11 09:12:20 UTC 2020 - pgajdos@suse.com
- version update to 20200211
* remove %apache_test_* macros, %apache_rex_* is the replacement
(package apache-rex)
- deleted sources
- macros.apache-module-test (not needed)
-------------------------------------------------------------------
Sun Nov 24 17:42:16 UTC 2019 - Neal Gompa <ngompa13@gmail.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package apache-rpm-macros
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -12,7 +12,7 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
@ -59,13 +59,12 @@
%endif
%define macros_file macros.apache
Name: apache-rpm-macros
Version: 20160120
Version: 20200211
Release: 0
Summary: Apache RPM Macros
License: Apache-2.0
Group: Productivity/Networking/Web/Servers
Url: http://httpd.apache.org/
Source1: macros.apache-module-test
URL: http://httpd.apache.org/
%if 0%{?suse_version}
BuildRequires: apache%{ap_major}-devel
%else
@ -104,7 +103,6 @@ echo >> %{macros_file}
%install
mkdir -p %{buildroot}%{macros_dir}
install -m 644 %{macros_file} %{buildroot}%{macros_dir}
install -m 644 %{SOURCE1} %{buildroot}%{macros_dir}
%files
%defattr(-,root,root)

View File

@ -1,226 +0,0 @@
%__test_dir /tmp/%{name}-test
%__test_mpm prefork
%__test_user abuild
%__test_group abuild
%__test_port 60080
# world writeable dir for testing purposes (logs, document root, ..)
%apache_test_module_dir %{__test_dir}
#
# 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]
# [-u user] [-g group] [-p port] [-t mpm]
#
# module_list: colon separated list of module names to be loaded with test run
# search path: %{buildroot} tree
# %{apache_libexecdir}-prefork
# %{apache_libexecdir}
# [example value: asn:dbd]
# include_list: colon separated list of names of apache configuration files
# to be included; can be either existing path or just name
# of the configuration file,which will be searched under:
# %{buildroot}%{apache_sysconfdir} tree
# $PWD tree
# %{apache_test_module_dir}
# [example value: mod_asn.conf]
# document_root: document root of the test server,
# [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:,u:,g:,p:,t:) \
# constants \
TEST_DIR='%{__test_dir}' \
# arguments \
# modules to load, from BUILD tree or system \
MODULES=$(echo %{-m:%{-m*}} | tr ':' ' ') \
# configs to include \
CONFIGS="%{-i:%{-i*}}" \
# document root of the test server \
DOCUMENT_ROOT="%{-r:%{-r*}}" \
if [ -z "$DOCUMENT_ROOT" ]; then \
DOCUMENT_ROOT=$TEST_DIR/htdocs \
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 \
# apache binary \
CMD=$(ls %{_sbindir}/httpd*-$TEST_MPM | head -n 1) \
# begin \
echo "-----------------------------------------------------------" \
echo "APACHE MODULE TEST" \
echo \
echo "modules to load: $MODULES" \
echo "configs to include: $CONFIGS" \
# create test dir \
mkdir -p $TEST_DIR \
# create document root if not exist \
mkdir -p $DOCUMENT_ROOT \
# create test/httpd-test.conf \
TEST_CONF_FILE="$TEST_DIR/httpd.conf" \
SYSTEM_MODULE_PATH="%{apache_libexecdir}-$TEST_MPM" \
echo "ServerName test" > $TEST_CONF_FILE \
echo "User $TEST_USER" >> $TEST_CONF_FILE \
echo "Group $TEST_GROUP" >> $TEST_CONF_FILE \
echo "Listen $TEST_PORT" >> $TEST_CONF_FILE \
echo "PidFile $TEST_DIR/pid" >> $TEST_CONF_FILE \
echo "ErrorLog $TEST_DIR/error_log" >> $TEST_CONF_FILE \
echo "LoadModule dir_module $SYSTEM_MODULE_PATH/mod_dir.so" >> $TEST_CONF_FILE \
echo "LoadModule auth_basic_module $SYSTEM_MODULE_PATH/mod_auth_basic.so" >> $TEST_CONF_FILE \
if [ %{apache_branch} -ge 204 ]; then \
echo "LoadModule authz_core_module $SYSTEM_MODULE_PATH/mod_authz_core.so" >> $TEST_CONF_FILE \
fi \
echo "LoadModule authz_host_module $SYSTEM_MODULE_PATH/mod_authz_host.so" >> $TEST_CONF_FILE \
for m in $(echo $MODULES | tr ':' ' '); do \
# if module is compiled in statically, do not load \
$CMD -f $TEST_CONF_FILE -M | grep $m && continue \
module_path=$(find %{buildroot} %{apache_libexecdir}-$TEST_MPM %{apache_libexecdir} -name "mod_$m.so" | tail -n 1) \
if [ -z "$module_path" ]; then \
echo "ERROR: Module $m not found." \
exit 1 \
fi \
echo "Will load ${m}_module $module_path" \
echo "LoadModule ${m}_module $module_path" >> $TEST_CONF_FILE \
done \
for c in $(echo $CONFIGS | tr ':' ' '); do \
if [ -f $c ]; then \
if [[ ! "$c" = /* ]]; then \
c="$PWD/$c" \
fi \
include_path="$c" \
else \
include_path=$(find %{buildroot}%{apache_sysconfdir} %{apache_test_module_dir} $PWD -name "$c" 2>/dev/null | tail -n 1) \
fi \
if [ -z "$include_path" ]; then \
echo "ERROR: Config file $c not found." \
exit 1 \
fi \
echo "Will include $include_path" \
echo "Include $include_path" >> $TEST_CONF_FILE \
done \
echo "DocumentRoot $DOCUMENT_ROOT" >> $TEST_CONF_FILE \
echo "DirectoryIndex index.html" >> $TEST_CONF_FILE \
# run apache \
echo -n "Starting Apache ... " \
$CMD -f $TEST_CONF_FILE -k start \
# wait to be sure apache finished start \
sleep 2 \
if [ ! -f $TEST_DIR/pid ]; then \
echo "FAILED, $TEST_DIR/error_log: >&2" \
cat $TEST_DIR/error_log >&2 \
echo "See $TEST_DIR for details" >&2 \
echo "FAILED, $TEST_DIR/error_log:" \
cat $TEST_DIR/error_log \
echo "See $TEST_DIR for details" \
exit 1 \
fi \
echo "SUCCESS" \
%nil
#
# macro: apache_test_module_stop_apache -- stops apache previously started with *_start_apache
#
# usage: apache_test_module_stop_apache [-f]
#
# -f: force
#
%apache_test_module_stop_apache(f) \
TEST_DIR='%{__test_dir}' \
SIGNAL=%{!-f:TERM}%{-f:KILL} \
# stop apache \
echo "Stopping Apache ..." \
kill -$SIGNAL -$(cat $TEST_DIR/pid) \
echo "Done." \
echo "-----------------------------------------------------------" \
%nil
#
# macro: apache_test_module_curl -- outputs curl on particular document relative to
# document root of test instance
#
# 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
# apache_test_module_curl -d foo/ -o output.txt
#
%apache_test_module_curl(d:,o:,p:,u:,r:) \
TEST_DOCUMENT="%{-d:%{-d*}}" \
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 \
echo "Missing argument -o to apache_test_module_curl." \
exit 1 \
fi \
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
#
# macro: apache_test_module_load -- tests that module(s) can be loaded
#
# 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
# search path: %{buildroot} tree
# %{apache_libexecdir}-prefork
# %{apache_libexecdir}
# [example value: asn:dbd]
# include_list: colon separated list of names of apache configuration files
# to be included (path relative to current dir)
# search path %{buildroot}%{apache_sysconfdir} tree
# $PWD tree
# [example value: mod_asn.conf]
# mpm: multiprocessing module (prefork, worker, event)
# [default value: prefork]
#
%apache_test_module_load(m:,i:,t:) \
%apache_test_module_start_apache %{-m:-m %{-m*}} %{-i:-i %{-i*}} %{-t:-t %{-t*}} \
%apache_test_module_stop_apache \
%nil