|
| 1 | +# SPDX-FileCopyrightText: 2017 Fermi Research Alliance, LLC |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +# RPM package for HEPCloud DEcisionengine pre-requisites |
| 5 | + |
| 6 | +# Disable shebang mangling (see GHI#436) |
| 7 | +%undefine __brp_mangle_shebangs |
| 8 | + |
| 9 | +# Release Candidates NVR format |
| 10 | +#%define release 0.1.rc1 |
| 11 | +# Official Release NVR format |
| 12 | +#%define release 2 |
| 13 | + |
| 14 | +%define auto_version %(FULLVER=$(git describe --tag | sed 's/-/_/g'); GVER=$(sed 's/.*_\\\([[:digit:]].*\\\)_/dev\\\1+/g' <<< ${FULLVER}); VER=${FULLVER//_*}; echo ${VER%.*}.$((${VER##*.}+1)).${GVER}) |
| 15 | +%define auto_release 1 |
| 16 | + |
| 17 | +%define version __HCDE_RPM_VERSION__ |
| 18 | +%define release __HCDE_RPM_RELEASE__ |
| 19 | + |
| 20 | +%define decisionengine_home %{_sharedstatedir}/decisionengine |
| 21 | + |
| 22 | +#%define frontend_xml frontend.xml |
| 23 | +#%define factory_xml glideinWMS.xml |
| 24 | +%define condor_dir %{_localstatedir}/lib/gwms-factory/condor |
| 25 | +%define systemddir %{_prefix}/lib/systemd/system |
| 26 | + |
| 27 | +Name: decisionengine |
| 28 | +Version: %{version} |
| 29 | +Release: %{release}%{?dist} |
| 30 | +Summary: HEPCloud DecisionEngine |
| 31 | +License: Apache-2.0 |
| 32 | +URL: http://https://hepcloud.github.io/ |
| 33 | +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root |
| 34 | +BuildArch: noarch |
| 35 | +Prefix: %{_prefix} |
| 36 | +Vendor: Fermilab <None> |
| 37 | + |
| 38 | +#Source: creation/templates/frontend_startup_sl7 |
| 39 | +#Source1: creation/templates/factory_startup_sl7 |
| 40 | + |
| 41 | +BuildRequires: python3 >= 3.9 |
| 42 | +BuildRequires: python3-devel |
| 43 | +BuildRequires: git |
| 44 | +BuildRequires: make |
| 45 | +BuildRequires: openssl-devel |
| 46 | +BuildRequires: gcc |
| 47 | +BuildRequires: gcc-c++ |
| 48 | +BuildRequires: swig |
| 49 | +#BuildRequires: python3-setuptools python3-wheel rpm-build |
| 50 | + |
| 51 | +%description |
| 52 | +The HEPCloud DecisionEngine provides a simple way to access the Grid, Cloud and HPC |
| 53 | +resources through a dynamic HTCondor pool of grid-submitted resources. |
| 54 | +It allows resource scheduling for disparate resource providers, including those |
| 55 | +which may have a cost or a restricted allocation of cycles. |
| 56 | + |
| 57 | +HEPCloud DecisionEngine is installed via PIP. |
| 58 | +These RPMs provide all the pre-requisites and necessary setup. |
| 59 | + |
| 60 | +Code documentation, release notes and install instructions are on github.io: |
| 61 | +https://hepcloud.github.io/decisionengine/ |
| 62 | + |
| 63 | +#shadow-utils systemd python3.9dist(pip) python3.9dist(setuptools) python3.9dist(wheel) gcc gcc-c++ make python3.9-devel podman glideinwms-vofrontend-core glideinwms-vofrontend-glidein glideinwms-vofrontend-httpd glideinwms-vofrontend-libs glideinwms-userschedd glideinwms-usercollector |
| 64 | + |
| 65 | + |
| 66 | +%package deps |
| 67 | +Summary: The HEPCloud Decision Engine dependencies. |
| 68 | +Requires: python3 >= 3.9 |
| 69 | +# These were form the python packaging |
| 70 | +Requires: shadow-utils |
| 71 | +Requires: systemd |
| 72 | +Requires: python3.9dist(pip) |
| 73 | +Requires: python3.9dist(setuptools) |
| 74 | +Requires: python3.9dist(wheel) |
| 75 | +# end form the python packaging |
| 76 | +Requires: postgresql |
| 77 | +Requires: postgresql-server |
| 78 | +Requires: postgresql-devel |
| 79 | +Requires: httpd |
| 80 | +Requires: podman |
| 81 | +Requires: python3-cryptography |
| 82 | +Requires: python3-pip |
| 83 | +Requires: gettext |
| 84 | +%description deps |
| 85 | +This subpackage includes all the RPM dependencied for the HEPCloud Decision Engine Framework. |
| 86 | + |
| 87 | + |
| 88 | +%package modules-deps |
| 89 | +Summary: The HEPCloud Decision Engine Modules dependencies. |
| 90 | +Requires: python3 >= 3.9 |
| 91 | +Requires: decisionengine-deps = %{version}-%{release} |
| 92 | +Requires: glideinwms-vofrontend-libs |
| 93 | +Requires: glideinwms-vofrontend-glidein |
| 94 | +Requires: glideinwms-vofrontend-core |
| 95 | +Requires: glideinwms-vofrontend-httpd |
| 96 | +# These may actually be on another host |
| 97 | +Requires: glideinwms-userschedd |
| 98 | +Requires: glideinwms-usercollector |
| 99 | +%description modules-deps |
| 100 | +This subpackage includes all the RPM dependencied for the HEPCloud Decision Engine Modules. |
| 101 | + |
| 102 | + |
| 103 | +%prep |
| 104 | +%setup -q -n decisionengine |
| 105 | +# Apply the patches here if any |
| 106 | +#%patch -P 0 -p1 |
| 107 | + |
| 108 | + |
| 109 | +%build |
| 110 | +#cp %{SOURCE7} . |
| 111 | +#chmod 700 chksum.sh |
| 112 | +#./chksum.sh v%{version}-%{release}.osg etc/checksum.frontend "CVS doc .git .gitattributes poolwatcher factory/check* factory/glideFactory* factory/test* factory/manage* factory/stop* factory/tools creation/create_glidein creation/reconfig_glidein creation/info_glidein creation/lib/cgW* creation/web_base/factory*html creation/web_base/collector_setup.sh creation/web_base/condor_platform_select.sh creation/web_base/condor_startup.sh creation/web_base/create_mapfile.sh creation/web_base/singularity_setup.sh creation/web_base/singularity_wrapper.sh creation/web_base/singularity_lib.sh creation/web_base/gconfig.py creation/web_base/glidein_startup.sh creation/web_base/job_submit.sh creation/web_base/local_start.sh creation/web_base/setup_x509.sh creation/web_base/update_proxy.py creation/web_base/validate_node.sh chksum.sh etc/checksum* unittests build" |
| 113 | +#./chksum.sh v%{version}-%{release}.osg etc/checksum.factory "CVS doc .git .gitattributes poolwatcher frontend/* creation/reconfig_glidein creation/clone_glidein creation/lib/cgW* creation/web_base/factory*html creation/web_base/collector_setup.sh creation/web_base/condor_platform_select.sh creation/web_base/condor_startup.sh creation/web_base/create_mapfile.sh creation/web_base/singularity_setup.sh creation/web_base/singularity_wrapper.sh creation/web_base/singularity_lib.sh creation/web_base/gconfig.py creation/web_base/glidein_startup.sh creation/web_base/job_submit.sh creation/web_base/local_start.sh creation/web_base/setup_x509.sh creation/web_base/update_proxy.py creation/web_base/validate_node.sh chksum.sh etc/checksum* unittests build creation/lib/matchPolicy*" |
| 114 | + |
| 115 | +%install |
| 116 | +rm -rf $RPM_BUILD_ROOT |
| 117 | + |
| 118 | +# Set the Python version |
| 119 | +%global __python %{__python3} |
| 120 | + |
| 121 | +# TODO: Check if some of the following are needed |
| 122 | +# seems never used |
| 123 | +# %define py_ver %(python -c "import sys; v=sys.version_info[:2]; print '%d.%d'%v") |
| 124 | + |
| 125 | +# From http://fedoraproject.org/wiki/Packaging:Python |
| 126 | +# Assuming python3_sitelib and python3_sitearch are defined, not supporting RHEL < 7 or old FC |
| 127 | +# Define python_sitelib |
| 128 | + |
| 129 | +#Change src_dir in reconfig_Frontend |
| 130 | +#sed -i "s/WEB_BASE_DIR *=.*/WEB_BASE_DIR = \"\/var\/lib\/gwms-frontend\/web-base\"/" creation/reconfig_frontend |
| 131 | + |
| 132 | +#Create the RPM startup files (init.d) from the templates |
| 133 | +#creation/create_rpm_startup . frontend_initd_startup_template factory_initd_startup_template %{SOURCE1} %{SOURCE6} |
| 134 | + |
| 135 | +# Create some directories |
| 136 | +install -d $RPM_BUILD_ROOT%{decisionengine_home} |
| 137 | +install -d $RPM_BUILD_ROOT%{_sysconfdir}/decisionengine |
| 138 | +install -d $RPM_BUILD_ROOT%{_localstatedir}/log/decisionengine |
| 139 | +install -d $RPM_BUILD_ROOT%{_localstatedir}/log/decisionengine/config.d |
| 140 | +cp -r config/* %{buildroot}/%{_sysconfdir}/decisionengine/ |
| 141 | + |
| 142 | +%clean |
| 143 | +rm -rf $RPM_BUILD_ROOT |
| 144 | + |
| 145 | + |
| 146 | +%pre deps |
| 147 | +# Add the "decisionengine" user and group if they do not exist |
| 148 | +getent group decisionengine >/dev/null || groupadd -r decisionengine |
| 149 | +getent passwd decisionengine >/dev/null || \ |
| 150 | + useradd -r -g decisionengine -d %{decisionengine_home} \ |
| 151 | + -c "HEPCloud Decision Engine user" -s /sbin/nologin decisionengine |
| 152 | +# If the decisionengine user already exists make sure it is part of decisionengine group |
| 153 | +usermod --append --groups decisionengine decisionengine >/dev/null |
| 154 | + |
| 155 | + |
| 156 | +%post deps |
| 157 | +# make sure our home area makes sense since we have a dynamic id |
| 158 | +chown decisionengine:decisionengine %{decisionengine_home} |
| 159 | +chmod 750 %{decisionengine_home} |
| 160 | + |
| 161 | +# If the decisionengine user already exists make sure it is part of |
| 162 | +# the decisionengine group |
| 163 | +usermod --append --groups decisionengine decisionengine >/dev/null |
| 164 | + |
| 165 | +# Change the ownership of log and lock dir if they already exist |
| 166 | +if [ -d %{_localstatedir}/log/decisionengine ]; then |
| 167 | + chown -R decisionengine:decisionengine %{_localstatedir}/log/decisionengine |
| 168 | +fi |
| 169 | + |
| 170 | +systemctl daemon-reload |
| 171 | + |
| 172 | + |
| 173 | +%postun deps |
| 174 | +systemctl daemon-reload |
| 175 | + |
| 176 | + |
| 177 | +%files deps |
| 178 | +%defattr(-,decisionengine,decisionengine,-) |
| 179 | +%dir %{decisionengine_home} |
| 180 | +%dir %{_sysconfdir}/decisionengine |
| 181 | +%dir %{_sysconfdir}/decisionengine/config.d |
| 182 | +%config(noreplace) %{_sysconfdir}/decisionengine/decision_engine.jsonnet |
| 183 | +# add all files in config.d |
| 184 | +%attr(-, decisionengine, decisionengine) %dir %{_localstatedir}/log/decisionengine |
| 185 | + |
| 186 | +%files modules-deps |
0 commit comments