Blob Blame History Raw
# Fedora macros

# Create given user with given group (to be used as %pre scriptlet for
# openstack related daemons). Also migrates away from openstack- prefixed
# users/group if it exists
# Optional:
#   -u userid to pick
#   -g groupid to pick
#   -s shell to pick
# Example: openstack_pre_user_group_create keystone keystone
%openstack_pre_user_group_create(u:g:s:) \
    getent group %2 >/dev/null || { \
        groupadd -r %2 $oldg \
    } \
    getent passwd %1 >/dev/null || { \
        useradd -r -g %2 %{-u:-u %{-u*}} -d %{_sharedstatedir}/%1 %{-s:-s %{-s*}}%{!-s: -s /sbin/nologin} -c "OpenStack %1 Daemon" %1 \
    } \
%nil

#
# Macro for removing requirements.txt file
#
%py_req_cleanup rm -rf *requirements.txt

# Create a fake tempest plugin entry point which will
# resides under %{python2_sitelib}/%{service}_tests.egg-info.
# The prefix is %py2_entrypoint %{modulename} %{service}
# where service is the name of the openstack-service or the modulename
# It should used under %install section
# the generated %{python2_sitelib}/%{service}_tests.egg-info
# will go under %files section of tempest plugin subpackage
# Example: %py2_entrypoint %{modulename} %{service}
# In most of the cases %{service} is same as %{modulename}
# but in case of neutron plugins it is different
# like servicename is neutron-lbaas and modulename is neutron_lbass
%py2_entrypoint() \
egg_path=%{buildroot}%{python2_sitelib}/%{1}-*.egg-info \
tempest_egg_path=%{buildroot}%{python2_sitelib}/%{1}_tests.egg-info \
mkdir $tempest_egg_path \
echo %{1} >$tempest_egg_path/top_level.txt \
grep "tempest\\|Tempest" %{1}.egg-info/entry_points.txt >$tempest_egg_path/entry_points.txt \
sed -i "/tempest\\|Tempest/d" $egg_path/entry_points.txt \
cp -r $egg_path/PKG-INFO $tempest_egg_path \
sed -i "s/%{2}/%{1}_tests/g" $tempest_egg_path/PKG-INFO \
%nil

# Macro for creating a fake tempest plugin entrypoint
# Usage: %py3_entrypoint %{modulename} %{service}
%py3_entrypoint() \
egg_path=%{buildroot}%{python3_sitelib}/%{1}-*.egg-info \
tempest_egg_path=%{buildroot}%{python3_sitelib}/%{1}_tests.egg-info \
mkdir $tempest_egg_path \
echo %{1} >$tempest_egg_path/top_level.txt \
grep "tempest\\|Tempest" %{1}.egg-info/entry_points.txt >$tempest_egg_path/entry_points.txt \
sed -i "/tempest\\|Tempest/d" $egg_path/entry_points.txt \
cp -r $egg_path/PKG-INFO $tempest_egg_path \
sed -i "s/%{2}/%{1}_tests/g" $tempest_egg_path/PKG-INFO \
%nil

#
# Apache related macros
#
%apache_name httpd
%apache_site_dir %{_sysconfdir}/%{apache_name}/conf.d/
%apache_conf_dir %{_sysconfdir}/%{apache_name}/conf.d/
%apache_user apache
%apache_group apache


#
# ext_man is used by the singlespec macro but is not defined on Fedora
#
%ext_info .gz
%ext_man .gz