|
|
838cdc |
# Fedora macros
|
|
|
838cdc |
|
|
|
838cdc |
# Create given user with given group (to be used as %pre scriptlet for
|
|
|
838cdc |
# openstack related daemons). Also migrates away from openstack- prefixed
|
|
|
838cdc |
# users/group if it exists
|
|
|
838cdc |
# Optional:
|
|
|
838cdc |
# -u userid to pick
|
|
|
838cdc |
# -g groupid to pick
|
|
|
838cdc |
# -s shell to pick
|
|
|
838cdc |
# Example: openstack_pre_user_group_create keystone keystone
|
|
|
838cdc |
%openstack_pre_user_group_create(u:g:s:) \
|
|
|
838cdc |
getent group %2 >/dev/null || { \
|
|
|
838cdc |
groupadd -r %2 $oldg \
|
|
|
838cdc |
} \
|
|
|
838cdc |
getent passwd %1 >/dev/null || { \
|
|
|
838cdc |
useradd -r -g %2 %{-u:-u %{-u*}} -d %{_sharedstatedir}/%1 %{-s:-s %{-s*}}%{!-s: -s /sbin/nologin} -c "OpenStack %1 Daemon" %1 \
|
|
|
838cdc |
} \
|
|
|
838cdc |
%nil
|
|
|
838cdc |
|
|
|
838cdc |
#
|
|
|
838cdc |
# Macro for removing requirements.txt file
|
|
|
838cdc |
#
|
|
|
838cdc |
%py_req_cleanup rm -rf *requirements.txt
|
|
|
838cdc |
|
|
|
838cdc |
# Create a fake tempest plugin entry point which will
|
|
|
838cdc |
# resides under %{python2_sitelib}/%{service}_tests.egg-info.
|
|
|
838cdc |
# The prefix is %py2_entrypoint %{modulename} %{service}
|
|
|
838cdc |
# where service is the name of the openstack-service or the modulename
|
|
|
838cdc |
# It should used under %install section
|
|
|
838cdc |
# the generated %{python2_sitelib}/%{service}_tests.egg-info
|
|
|
838cdc |
# will go under %files section of tempest plugin subpackage
|
|
|
838cdc |
# Example: %py2_entrypoint %{modulename} %{service}
|
|
|
838cdc |
# In most of the cases %{service} is same as %{modulename}
|
|
|
838cdc |
# but in case of neutron plugins it is different
|
|
|
838cdc |
# like servicename is neutron-lbaas and modulename is neutron_lbass
|
|
|
838cdc |
%py2_entrypoint() \
|
|
|
838cdc |
egg_path=%{buildroot}%{python2_sitelib}/%{1}-*.egg-info \
|
|
|
838cdc |
tempest_egg_path=%{buildroot}%{python2_sitelib}/%{1}_tests.egg-info \
|
|
|
838cdc |
mkdir $tempest_egg_path \
|
|
|
838cdc |
echo %{1} >$tempest_egg_path/top_level.txt \
|
|
|
838cdc |
grep "tempest\\|Tempest" %{1}.egg-info/entry_points.txt >$tempest_egg_path/entry_points.txt \
|
|
|
838cdc |
sed -i "/tempest\\|Tempest/d" $egg_path/entry_points.txt \
|
|
|
838cdc |
cp -r $egg_path/PKG-INFO $tempest_egg_path \
|
|
|
838cdc |
sed -i "s/%{2}/%{1}_tests/g" $tempest_egg_path/PKG-INFO \
|
|
|
838cdc |
%nil
|
|
|
838cdc |
|
|
|
838cdc |
# Macro for creating a fake tempest plugin entrypoint
|
|
|
838cdc |
# Usage: %py3_entrypoint %{modulename} %{service}
|
|
|
838cdc |
%py3_entrypoint() \
|
|
|
838cdc |
egg_path=%{buildroot}%{python3_sitelib}/%{1}-*.egg-info \
|
|
|
838cdc |
tempest_egg_path=%{buildroot}%{python3_sitelib}/%{1}_tests.egg-info \
|
|
|
838cdc |
mkdir $tempest_egg_path \
|
|
|
838cdc |
echo %{1} >$tempest_egg_path/top_level.txt \
|
|
|
838cdc |
grep "tempest\\|Tempest" %{1}.egg-info/entry_points.txt >$tempest_egg_path/entry_points.txt \
|
|
|
838cdc |
sed -i "/tempest\\|Tempest/d" $egg_path/entry_points.txt \
|
|
|
838cdc |
cp -r $egg_path/PKG-INFO $tempest_egg_path \
|
|
|
838cdc |
sed -i "s/%{2}/%{1}_tests/g" $tempest_egg_path/PKG-INFO \
|
|
|
838cdc |
%nil
|
|
|
838cdc |
|
|
|
838cdc |
#
|
|
|
838cdc |
# Apache related macros
|
|
|
838cdc |
#
|
|
|
838cdc |
%apache_name httpd
|
|
|
838cdc |
%apache_site_dir %{_sysconfdir}/%{apache_name}/conf.d/
|
|
|
838cdc |
%apache_conf_dir %{_sysconfdir}/%{apache_name}/conf.d/
|
|
|
838cdc |
%apache_user apache
|
|
|
838cdc |
%apache_group apache
|
|
|
838cdc |
|
|
|
838cdc |
|
|
|
838cdc |
#
|
|
|
838cdc |
# ext_man is used by the singlespec macro but is not defined on Fedora
|
|
|
838cdc |
#
|
|
|
838cdc |
%ext_info .gz
|
|
|
838cdc |
%ext_man .gz
|