diff options
author | CoprDistGit <infra@openeuler.org> | 2025-02-17 02:42:11 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2025-02-17 02:42:11 +0000 |
commit | 065a0eb79a491f2316d79e6962dc95eb1380d390 (patch) | |
tree | 47d0938334bfdcf3d45dbb9dc104d5fcdb8ff0b9 | |
parent | 1cef8522b3ee08aa13706e0c005f156b4191d7ed (diff) |
automatic import of openstack-macrosopeneuler22.03_LTS_SP4
-rw-r--r-- | macros.openstack-common | 25 | ||||
-rw-r--r-- | macros.openstack-openEuler | 70 | ||||
-rw-r--r-- | openstack-macros.spec | 34 | ||||
-rw-r--r-- | sources | 0 |
4 files changed, 129 insertions, 0 deletions
diff --git a/macros.openstack-common b/macros.openstack-common new file mode 100644 index 0000000..109bdd9 --- /dev/null +++ b/macros.openstack-common @@ -0,0 +1,25 @@ +# Macros for building OpenStack RPMs. +# + +# +# OpenStack macros +# + +# the directory where the test files will be installed +%openstack_test_package_dir %{_localstatedir}/lib/%{name}-test + +# Installing a test package is always done the same way. +# the macro takes a single parameter - the component which is the +# name that is installed into site-packages +# e.g. for python-novaclient the name is novaclient +%openstack_test_package_install() \ +install -d -m 755 %{buildroot}/%{openstack_test_package_dir} \ +# Some packages differ here, try to install as much as possible: \ +cp -av \\\ + README.md README.rst PKG-INFO .testr.conf .stestr.conf .*tests bin \\\ + etc examples run_tests.* setup.cfg setup.py \\\ + smoketests static test tests tools tox.ini \\\ + %{buildroot}/%{openstack_test_package_dir} || : \ +rm -rf %{buildroot}/%{openstack_test_package_dir}/%1 \ +ln -s %{python2_sitelib}/%1 %{buildroot}/%{openstack_test_package_dir}/%1 \ +%nil diff --git a/macros.openstack-openEuler b/macros.openstack-openEuler new file mode 100644 index 0000000..837263c --- /dev/null +++ b/macros.openstack-openEuler @@ -0,0 +1,70 @@ +# OpenEuler 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_info .gz +%ext_man .gz diff --git a/openstack-macros.spec b/openstack-macros.spec new file mode 100644 index 0000000..bc0b8c7 --- /dev/null +++ b/openstack-macros.spec @@ -0,0 +1,34 @@ +Name: openstack-macros +Version: 2021.1.5 +Release: 1 +Summary: OpenStack Packaging - RPM Macros +License: ASL 2.0 +Group: Development/Libraries/Python +URL: https://wiki.openstack.org/wiki/Rpm-packaging +Source1: macros.openstack-common +Source2: macros.openstack-openEuler +BuildArch: noarch + +%description +This package provides OpenStack RPM macros. You need it to build OpenStack +packages. + +%prep + +%build + +%install +install -D -m644 %{SOURCE1} %{buildroot}%{_sysconfdir}/rpm/macros.openstack-common +install -D -m644 %{SOURCE2} %{buildroot}%{_sysconfdir}/rpm/macros.openstack-openEuler + + +%files +%{_sysconfdir}/rpm/macros.openstack-common +%{_sysconfdir}/rpm/macros.openstack-openEuler + +%changelog +* Mon Dec 13 2021 zhaoshuang <zhaoshuang@uniontech.com> - 2021.1.5-1 +- remove "%{dist}" from spec file + +* Tue Jan 5 2021 joechan1988 <joseph.chn1988@gmail.com> - 2021.1.5 +- Added openEuler macros |