diff --git a/README.en.md b/README.en.md index 1a377815029635a03fb03e3d88b3c373892524d1..12640ba086a7a32dbb0ee13d4a6c2b22d3c950ea 100644 --- a/README.en.md +++ b/README.en.md @@ -1,3 +1,36 @@ # openstack-macros -OpenStack services are exclusively released in the openEuler LTS version. Please refer to other Multi-Version branches for the Spec source code. \ No newline at end of file +#### Description +It provides OpenStack RPM macros + +#### Software Architecture +Software architecture description + +#### Installation + +1. xxxx +2. xxxx +3. xxxx + +#### Instructions + +1. xxxx +2. xxxx +3. xxxx + +#### Contribution + +1. Fork the repository +2. Create Feat_xxx branch +3. Commit your code +4. Create Pull Request + + +#### Gitee Feature + +1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md +2. Gitee blog [blog.gitee.com](https://blog.gitee.com) +3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) +4. The most valuable open source project [GVP](https://gitee.com/gvp) +5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) +6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md index 05d871aed4b6c6eddf75489782c1ee57654c5505..411a0524d77840a034c04437b8b6863ea6fb0a87 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,37 @@ # openstack-macros -openstack服务只在openEuler LTS版本发布,Spec源码请参考其他Multi-Version分支。 \ No newline at end of file +#### 介绍 +It provides OpenStack RPM macros + +#### 软件架构 +软件架构说明 + + +#### 安装教程 + +1. xxxx +2. xxxx +3. xxxx + +#### 使用说明 + +1. xxxx +2. xxxx +3. xxxx + +#### 参与贡献 + +1. Fork 本仓库 +2. 新建 Feat_xxx 分支 +3. 提交代码 +4. 新建 Pull Request + + +#### 特技 + +1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md +2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) +3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 +4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 +5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) +6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/macros.openstack-common b/macros.openstack-common new file mode 100644 index 0000000000000000000000000000000000000000..109bdd92b711e2d25f8859c40004028818b4d9ec --- /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 0000000000000000000000000000000000000000..837263cdc76ede12a49d7bbff62699c9ff276d64 --- /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 0000000000000000000000000000000000000000..cd2c0093ebdbd0476fd2490f2edc116086978a9b --- /dev/null +++ b/openstack-macros.spec @@ -0,0 +1,35 @@ +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 - 2021.1.5-1 +- remove "%{dist}" from spec file + +* Tue Jan 5 2021 joechan1988 - 2021.1.5 +- Added openEuler macros +