!1 openstack-macros:Add source packages and spec file
From: @zhangy1317 Reviewed-by: Signed-off-by:
This commit is contained in:
commit
c2a0a12d9a
25
macros.openstack-common
Normal file
25
macros.openstack-common
Normal file
@ -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
|
||||
70
macros.openstack-openEuler
Normal file
70
macros.openstack-openEuler
Normal file
@ -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
|
||||
32
openstack-macros.spec
Normal file
32
openstack-macros.spec
Normal file
@ -0,0 +1,32 @@
|
||||
Name: openstack-macros
|
||||
Version: 2021.1.5
|
||||
Release: 0%{?dist}
|
||||
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
|
||||
* Tue Jan 5 2021 joechan1988 <joseph.chn1988@gmail.com> - 2021.1.5
|
||||
- Added openEuler macros
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user