commit d244363cd3e42130d3adb51aa1fd265f096d26f3f45a2ac59948a2d625ce10ff Author: Adrian Schröter Date: Fri May 3 17:31:16 2024 +0200 Sync from SUSE:SLFO:Main opensm revision 6d6210f1ee8871591bcf928e3efc2ee9 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/_service b/_service new file mode 100644 index 0000000..df187cd --- /dev/null +++ b/_service @@ -0,0 +1,17 @@ + + + git + https://github.com/linux-rdma/opensm.git + no + .git + opensm + @PARENT_TAG@.@TAG_OFFSET@.%h + (opensm-)?(.*) + \2 + 844ab3b7edaad983449b5d3a4a773088b8daa299 + + + *opensm*.tar + gz + + diff --git a/baselibs.conf b/baselibs.conf new file mode 100644 index 0000000..6f5e844 --- /dev/null +++ b/baselibs.conf @@ -0,0 +1,8 @@ +libopensm9 +libosmcomp5 +libosmvendor5 +opensm-devel + requires -opensm- + requires "libopensm9- = " + requires "libosmcomp5- = " + requires "libosmvendor5- = " diff --git a/conf.sysconfig b/conf.sysconfig new file mode 100644 index 0000000..1bc8bee --- /dev/null +++ b/conf.sysconfig @@ -0,0 +1,72 @@ +# Problem #1: Multiple IB fabrics needing a subnet manager +# +# In the event that a machine has more than one IB subnet attached, +# and that machine is an opensm server, by default, opensm will +# only attach to one port and will not manage the fabric on the +# other port. There are two ways to solve this problem: +# +# 1) Start opensm on multiple machines and configure it to manage +# different fabrics on each machine +# 2) Configure opensm to start multiple instances on a single +# machine +# +# Both solutions to this problem require non-standard configurations. +# In other words, you would normally have to modify /etc/rdma/opensm.conf +# and once you do that, the file will no longer be updated for new +# options when opensm is upgraded. In an effort to allow people to +# have more than one subnet managed by opensm without having to modify +# the system default opensm.conf file, we have enabled two methods +# for modifying the default opensm config items needed to enable +# multiple fabric management. +# +# Method #1: Create multiple opensm.conf files in non-standard locations +# Copy /etc/rdma/opensm.conf to /etc/rdma/opensm.conf. +# (do this once for each instance you want started) +# Edit each copy of the opensm.conf file to reflect the necessary changes +# for a multiple instance startup. If you need to manage more than +# one fabric, you will have to change the guid option in each file +# to specify the guid of the specific port you want opensm attached +# to. +# +# The advantage to method #1 is that, on the off chance you want to do +# really special custom things on different ports, like have different +# QoS settings depending on which port you are attached to, you have the +# freedom to edit any and all settings for each instance without those +# changes affecting other instances or being lost when opensm upgrades. +# +# Method #2: Specify multiple GUIDS variable entries in this file +# Uncomment the below GUIDS variable and enter each guid you need to attach +# to into the list. If using this method you need to enter each +# guid into the list as we won't attach to any default ports, only +# those specified in the list. +# +#GUIDS="0x0002c90300048ca1 0x0002c90300048ca2" +# +# The obvious advantage to method #2 is that it's simple and doesn't +# clutter up your file system, but it is far more limited in what you +# can do. If you enable method #2, then even if you create the files +# referenced in method #1, they will be ignored. +# +# Problem #2: Activating a backup subnet manager +# +# The default priority of opensm is set so that it wants to be the +# primary subnet manager. This is great when you are only running +# opensm on one server, but if you want to have a non-primary opensm +# instance for failover, then you have to manually edit the opensm.conf +# file like for problem #1. This carries with it all the problems +# listed above. If you wish to enable opensm as a non-primary manager, +# then you can uncomment the PRIORITY variable below and set it to +# some number between 0 and 15, where 15 is the highest priority and +# the primary manager, with 0 being the lowest backup server. This method +# will work with the GUIDS option above, and also with the multiple +# config files in method #1 above. However, only a single priority is +# supported here. If you wanted more than one priority (say this machine +# is the primary on the first fabric, and second on the second fabric, +# while the other opensm server is primary on the second fabric and +# second on the primary), then the only way to do that is to use method #1 +# above and individually edit the config files. If you edit the config +# files to set the priority and then also set the priority here, then +# this setting will override the config files and render that particular +# edit useless. +# +#PRIORITY=15 diff --git a/opensm-3.3.24.0.844ab3b7edaa.tar.gz b/opensm-3.3.24.0.844ab3b7edaa.tar.gz new file mode 100644 index 0000000..973c279 --- /dev/null +++ b/opensm-3.3.24.0.844ab3b7edaa.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f4e934a6225f901c61a0d13f940ac8ccc71a9af52353ad9f217e6efddd06f964 +size 1392133 diff --git a/opensm-remove-date-time.patch b/opensm-remove-date-time.patch new file mode 100644 index 0000000..20cf016 --- /dev/null +++ b/opensm-remove-date-time.patch @@ -0,0 +1,13 @@ +diff --git opensm/osm_console.c opensm/osm_console.c +index 0f68afe0..f1892e2d 100644 +--- opensm/osm_console.c ++++ opensm/osm_console.c +@@ -1647,7 +1647,7 @@ static void help_version(FILE * out, int detail) + + static void version_parse(char **p_last, osm_opensm_t * p_osm, FILE * out) + { +- fprintf(out, "%s build %s %s\n", p_osm->osm_version, __DATE__, __TIME__); ++ fprintf(out, "%s build\n", p_osm->osm_version); + } + + /* more parse routines go here */ diff --git a/opensm.changes b/opensm.changes new file mode 100644 index 0000000..3950bde --- /dev/null +++ b/opensm.changes @@ -0,0 +1,332 @@ +------------------------------------------------------------------- +Tue Jan 11 13:21:31 UTC 2022 - Nicolas Morey-Chaisemartin + +- Update opensm sysconfig defaults to match current launch script + Most options have been removed as they should be configured in the opensm.conf file + +------------------------------------------------------------------- +Wed Oct 13 12:09:33 UTC 2021 - Johannes Segitz + +- Added hardening to systemd service(s) (bsc#1181400). Modified: + * opensm.service + +------------------------------------------------------------------- +Tue Aug 24 07:19:22 UTC 2021 - Nicolas Morey-Chaisemartin + +- Update to version 3.3.24 (jsc#SLE-19252) + - Support for NDR link speed + - Backward compatibility for old drivers + - Several bug fixes + +------------------------------------------------------------------- +Wed Nov 4 11:43:55 UTC 2020 - Nicolas Morey-Chaisemartin + +- Support any value for %{_libexecdir} (bsc#1178326) + +------------------------------------------------------------------- +Fri Mar 20 11:30:37 UTC 2020 - Nicolas Morey-Chaisemartin + +- Update to version 3.3.23 + - Add support for registering an opensm plugin as a new routing engine + - Internal improvements and bug fixes + +------------------------------------------------------------------- +Thu Apr 18 07:56:14 UTC 2019 - Nicolas Morey-Chaisemartin + +- Update to version 3.3.22 + - Internal library reorganization to remove circular dependencies + - Added a few additional command line options which were supported by options to be consistent with RedHat Fedora startup script + - Internal improvements and bug fixes +- Remove unneeded build dependencies + +------------------------------------------------------------------- +Mon Sep 24 15:25:18 UTC 2018 - nmoreychaisemartin@suse.com + +- Update to version 3.3.21 (fate#326015) + * Support for HDR links and 2x link width + * Nue routing algorithm + * Support for ignoring throttled links with DFSSSP + * Support for long transaction timout for SM class transactions + * Many bug fixes +- Drop opensm-type_punning.patch as it was fixed upstream + +------------------------------------------------------------------- +Fri Jun 15 06:04:24 UTC 2018 - nmoreychaisemartin@suse.com + +- Update Source and URL as opensm was moved to GitHub +- Add a _service file to be able to auto-fetch from github + +------------------------------------------------------------------- +Wed Jan 3 09:28:00 UTC 2018 - nmoreychaisemartin@suse.com + +- Update opensm.service to use the new rdma-core + systemd target (bsc#1074439) + +------------------------------------------------------------------- +Thu Nov 23 13:52:19 UTC 2017 - rbrown@suse.com + +- Replace references to /var/adm/fillup-templates with new + %_fillupdir macro (boo#1069468) + +------------------------------------------------------------------- +Fri Jun 23 12:23:04 UTC 2017 - nmoreychaisemartin@suse.com + +- Have new libs packages obsolete the old opensm-libs3 + +------------------------------------------------------------------- +Mon Jun 19 18:53:39 UTC 2017 - jengelh@inai.de + +- Implement shared library packaging guideline +- Rectify opensm-type_punning.patch: + a union does not fix type punning problems (let alone + misalignmened pointers), one must use memcpy. + +------------------------------------------------------------------- +Mon Jun 12 09:39:52 UTC 2017 - nmoreychaisemartin@suse.com + +- Backport changes from SLE12-SP3 (bsc#1041403) +- Add opensm-remove-date-time.patch to remove __DATE__ and + __TIME__ from build +- Rename /usr/sbin/rcopensmd to /usr/sbin/rcopensm to match binary + +------------------------------------------------------------------- +Thu Jun 8 10:20:28 UTC 2017 - nmoreychaisemartin@suse.com + +- Update to version 3.3.20 + * No concise list of changes present so see the file ChangeLog in + the package documentation directory. +- Update opensm-type_punning.patch to new sources + +------------------------------------------------------------------- +Mon Mar 21 13:38:46 CET 2016 - pth@suse.de + +- Drop opensm-autotools.patch as the fix is in. +- Refresh opensm-type_punning.patch to match changed sources. + +------------------------------------------------------------------- +Fri Mar 11 18:17:09 CET 2016 - pth@suse.de + +- Update to 3.3.19 git version (bsc#970668) + Changes to numerous to be listed here so please see + ChangeLog for the changes since 3.3.17. + +------------------------------------------------------------------- +Sun Mar 8 10:26:43 UTC 2015 - p.drouand@gmail.com + +- Update to version 3.3.19 + * No concise list of changes present so see the file ChangeLog in + the package documentation directory. +- Move to systemd + * Replace opensmd with opensm.service + * Replace sldd.sh with opensm.launch + * Add systemd-rpm-macros and %{?systemd_requires} require + * Replace sysvinit post/postun macros with systemd one +- Use download Url as source +- Get rid of some extra stuff + +------------------------------------------------------------------- +Tue Aug 26 12:30:29 UTC 2014 - fcrozat@suse.com + +- Add obsoletes/provides to baselibs.conf. + +------------------------------------------------------------------- +Tue Aug 12 14:05:39 CEST 2014 - pth@suse.de + +- Fix the Processname stated in a comment (bnc#884648). + +------------------------------------------------------------------- +Tue Jun 3 11:24:34 CEST 2014 - pth@suse.de + +- Update to OFED 3.12 final. + +------------------------------------------------------------------- +Tue Apr 22 18:00:40 CEST 2014 - pth@suse.de + +- Build for s390. + +------------------------------------------------------------------- +Thu Feb 13 19:11:08 CET 2014 - pth@suse.de + +- Update to 3.3.17 for fate#315488. No concise list of changes + present so see the file ChangeLog in the package documentation + directory. + +------------------------------------------------------------------- +Mon Feb 10 16:38:41 CET 2014 - pth@suse.de + +- Fix license, include COPYING. +- Fix baselibs.conf. + +------------------------------------------------------------------- +Fri Jan 31 13:56:29 CET 2014 - pth@suse.de + +- Only ppc64le is supported so remove everything that triggered + on ppc or ppc64. +- Remove opensm-no_g0_when_daemon.patch as the fix has been + integrated. + +------------------------------------------------------------------- +Fri Jan 24 19:21:41 CET 2014 - pth@suse.de + +- Remove old tarball. + +------------------------------------------------------------------- +Mon Jan 20 16:57:59 CET 2014 - pth@suse.de + +- Update to 3.3.16 from OFED 3.12. +- Use spdx.org format for license specification. +- fix type-punning by using unions: opensm-type_punning.patch. + +------------------------------------------------------------------- +Wed Jan 15 14:07:05 CET 2014 - pth@suse.de + +- Use spdx.org for license specification. + +------------------------------------------------------------------- +Thu Sep 13 17:00:27 CEST 2012 - pth@suse.de + +- Use sed instead of a patch to fix the use of __DATE__ and __TIME__. + +------------------------------------------------------------------- +Tue Sep 11 15:11:57 CEST 2012 - pth@suse.de + +- Update to 3.3.13 from OFED 1.5.4.1 + +------------------------------------------------------------------- +Tue Jul 3 19:55:39 CEST 2012 - pth@suse.de + +- Update to 3.3.12 from OFED 1.5.4. +- Split off shared libraries to their own package. +- Don't use __DATE_ and __TIME__ in version output. +- Provide /usr/sbin/rcopensmd symlink. + +------------------------------------------------------------------- +Tue May 8 18:34:52 CEST 2012 - pth@suse.de + +- BuildRequire automake, autoconf and libtool. + +------------------------------------------------------------------- +Tue Dec 14 16:45:13 UTC 2010 - pth@suse.de + +- Fix name of libibumad devel package. + +------------------------------------------------------------------- +Mon Dec 13 15:14:05 CET 2010 - pth@suse.de + +- Split off static libraries to their own sub package. + +------------------------------------------------------------------- +Wed Oct 27 07:17:59 UTC 2010 - jjolly@novell.com + +- one more dependency version for libibumad + +------------------------------------------------------------------- +Wed Oct 27 04:56:45 UTC 2010 - jjolly@novell.com + +- Versioned the libibumad dependency + +------------------------------------------------------------------- +Mon Oct 25 22:38:20 UTC 2010 - jjolly@novell.com + +- Update to v3.3.7 from OFED 1.5.2 +- Removed Weighted Routing Patch + +------------------------------------------------------------------- +Thu Dec 3 15:28:48 CET 2009 - jjolly@suse.de + +- Corrected path in opensmd to opensm (bnc#529746) + +------------------------------------------------------------------- +Thu Dec 3 15:18:25 CET 2009 - jjolly@suse.de + +- Weighted routing patch (bnc#540371,FATE#306944) + +------------------------------------------------------------------- +Thu Dec 3 08:37:39 CET 2009 - jjolly@suse.de + +- Updated to 3.2.6_20090317 from OFED 1.4.2 + +------------------------------------------------------------------- +Wed Jan 7 12:34:56 CET 2009 - olh@suse.de + +- obsolete old -XXbit packages (bnc#437293) + +------------------------------------------------------------------- +Thu Nov 20 22:42:48 CET 2008 - jjolly@suse.de + +- Updated to 3.2.3_20081117_b70e2d2 from OFED 1.4 rc5 + - adapted header files for OFED 1.4 + +------------------------------------------------------------------- +Thu Nov 6 18:00:45 CET 2008 - ihno@suse.de + +- Adding baselibs.conf +- Adding ExcludeArch s390 s390x + +------------------------------------------------------------------- +Fri Oct 24 18:11:22 CEST 2008 - jjolly@suse.de + +- Updated to version from the OFED 1.4 RC3 + +------------------------------------------------------------------- +Thu Sep 11 14:00:31 CEST 2008 - jjolly@suse.de + +- Update to 3.2.2 from the OFED 1.4 RC1 + +------------------------------------------------------------------- +Tue Mar 4 05:53:56 CET 2008 - jjolly@suse.de + +- Update to 3.1.10 from the OFED 1.3 GA release +- Added bison and flex to the BuildRequires list + +------------------------------------------------------------------- +Wed Feb 13 16:27:17 CET 2008 - pth@suse.de + +- Remove references to $srcdir from RPATH. +- Add Short-Description to opensm init script +- Add AM_PROG_CC_C_O to configure +- Run autoreconf +- Pass [foreign] to AM_INIT_AUTOMAKE +- Update to 3.1.8: + Number of changes far too long, see NEWS for a detailed list + +------------------------------------------------------------------- +Tue Oct 2 23:57:13 CEST 2007 - dbahi@suse.de + +- Added %preun to stop opensmd + +------------------------------------------------------------------- +Mon Aug 20 17:37:40 CEST 2007 - hvogel@suse.de + +- Update to version from OFED 1.2.5 +- readd the init scripts from OFED instead of the default opensm + one + +------------------------------------------------------------------- +Tue Aug 7 13:41:39 CEST 2007 - hvogel@suse.de + +- Update to version from OFED 1.2c + +------------------------------------------------------------------- +Thu Jul 12 09:24:44 CEST 2007 - hvogel@suse.de + +- Install a missing script +- Install configuration as sysconfig file +- Include init script + +------------------------------------------------------------------- +Wed Jul 4 12:29:54 CEST 2007 - hvogel@suse.de + +- Add GPL COPYING file [#289225] + +------------------------------------------------------------------- +Tue Jul 3 13:00:34 CEST 2007 - hvogel@suse.de + +- Use 3.0.3 which is the correct version included in + OFED 1.2 + +------------------------------------------------------------------- +Wed Jun 20 14:11:10 CEST 2007 - hvogel@suse.de + +- Initial Package, Version 2.2.0 + diff --git a/opensm.launch b/opensm.launch new file mode 100644 index 0000000..c1fbf4a --- /dev/null +++ b/opensm.launch @@ -0,0 +1,44 @@ +#!/bin/bash +# +# Launch the necessary OpenSM daemons for systemd +# +# sysconfig: /etc/sysconfig/opensm +# config: /etc/rdma/opensm.conf +# + +shopt -s nullglob + +prog=/usr/sbin/opensm +[ -f /etc/sysconfig/opensm ] && . /etc/sysconfig/opensm + +[ -n "$PRIORITY" ] && prio="-p $PRIORITY" + +if [ -z "$GUIDS" ]; then + CONFIGS="" + CONFIG_CNT=0 + for conf in /etc/rdma/opensm.conf.[0-9]*; do + CONFIGS="$CONFIGS $conf" + let CONFIG_CNT++ + done +else + GUID_CNT=0 + for guid in $GUIDS; do + let GUID_CNT++ + done +fi +# Start opensm +if [ -n "$GUIDS" ]; then + SUBNET_COUNT=0 + for guid in $GUIDS; do + SUBNET_PREFIX=`printf "0xfe800000000000%02d" $SUBNET_COUNT` + (while true; do $prog $prio -g $guid --subnet_prefix $SUBNET_PREFIX; sleep 30; done) & + let SUBNET_COUNT++ + done +elif [ -n "$CONFIGS" ]; then + for config in $CONFIGS; do + (while true; do $prog $prio -F $config; sleep 30; done) & + done +else + (while true; do $prog $prio; sleep 30; done) & +fi +exit 0 diff --git a/opensm.service b/opensm.service new file mode 100644 index 0000000..0b10ef8 --- /dev/null +++ b/opensm.service @@ -0,0 +1,24 @@ +[Unit] +Description=Starts the OpenSM InfiniBand fabric Subnet Manager +Documentation=man:opensm +DefaultDependencies=false +Before=network.target remote-fs-pre.target +After=rdma-hw.target + +[Service] +# added automatically, for details please see +# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort +ProtectSystem=full +ProtectHome=true +ProtectHostname=true +ProtectKernelTunables=true +ProtectKernelModules=true +ProtectKernelLogs=true +ProtectControlGroups=true +RestrictRealtime=true +# end of automatic additions +Type=forking +ExecStart=@LIBEXEC@/opensm-launch + +[Install] +WantedBy=network.target diff --git a/opensm.spec b/opensm.spec new file mode 100644 index 0000000..32222cf --- /dev/null +++ b/opensm.spec @@ -0,0 +1,187 @@ +# +# spec file for package opensm +# +# Copyright (c) 2022 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%define git_ver .0.844ab3b7edaa +#Compat macro for new _fillupdir macro introduced in Nov 2017 +%if ! %{defined _fillupdir} + %define _fillupdir /var/adm/fillup-templates +%endif + +%define lib_osm_major 9 +%define lib_osmcomp_major 5 +%define lib_osmvendor_major 5 + +Name: opensm +Summary: Infiniband Subnet Manager +License: BSD-2-Clause OR GPL-2.0-only +Group: Productivity/Networking/System +Version: 3.3.24 +Release: 0 +Source: opensm-%{version}%{git_ver}.tar.gz +Source1: conf.sysconfig +Source2: %{name}.launch +Source3: opensm.service +Source4: baselibs.conf +Patch1: opensm-remove-date-time.patch +URL: https://github.com/linux-rdma/opensm +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: bison +BuildRequires: flex +BuildRequires: gcc-c++ +BuildRequires: libibumad-devel +BuildRequires: libtool +BuildRequires: systemd-rpm-macros +PreReq: %fillup_prereq +Requires: logrotate +%{?systemd_requires} + +%description +OpenSM provides an implementation for an InfiniBand Subnet Manager and +Administration. Such a software entity is required to run for in order +to initialize the InfiniBand hardware (at least one per each InfiniBand +subnet). + +%package -n libopensm%{lib_osm_major} +Summary: Opensm runtime library +Group: System/Libraries +Obsoletes: opensm-libs3 + +%description -n libopensm%{lib_osm_major} +This package contains one of the opensm runtime libraries. + +%package -n libosmcomp%{lib_osmcomp_major} +Summary: Opensm runtime library +Group: System/Libraries +Obsoletes: opensm-libs3 + +%description -n libosmcomp%{lib_osmcomp_major} +This package contains one of the opensm runtime libraries. + +%package -n libosmvendor%{lib_osmvendor_major} +Summary: Opensm runtime library +Group: System/Libraries +Obsoletes: opensm-libs3 + +%description -n libosmvendor%{lib_osmvendor_major} +This package contains one of the opensm runtime libraries. + +%package devel +Summary: Development files for OpenSM +Group: Development/Libraries/C and C++ +Requires: libibumad-devel +Requires: libopensm%{lib_osm_major} = %{version} +Requires: libosmcomp%{lib_osmcomp_major} = %{version} +Requires: libosmvendor%{lib_osmvendor_major} = %{version} + +%description devel +Symlinks for the dynamic libraries and header files for OpenSM. + +%prep +%setup -q -n %{name}-%{version}%{git_ver} +%patch1 + +cp %{S:1} %{S:2} %{S:3} . +FAKE_BUILDDATE=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%b %%e %%Y') +FAKE_BUILDTIME=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%H:%%M:%%S') +sed -i -e "s/__DATE__/\"$FAKE_BUILDDATE\"/" -e "s/__TIME__/\"$FAKE_BUILDTIME\"/" opensm/osm_console.c + +%build +autoreconf -fi +%configure --disable-static +make %{?_smp_mflags} V=1 + +%install +export NO_BRP_STALE_LINK_ERROR=yes +make DESTDIR=%{buildroot} install +install -D -m 644 scripts/opensm.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/opensm + +# get rid of the included init script because we use a systemd unit file instead +rm -rf %{buildroot}%_sysconfdir/init.d/ +install -Dm 644 %{SOURCE3} %{buildroot}%_unitdir/%{name}.service +sed -i -e 's$@LIBEXEC@$%{_libexecdir}$g' %{buildroot}%_unitdir/%{name}.service +install -D %{SOURCE2} %{buildroot}%{_libexecdir}/opensm-launch +ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rc%{name} + +# install the sysconfig configuration file +install -m 644 -D conf.sysconfig %{buildroot}%{_fillupdir}/sysconfig.%name + +# and make a compat link +ln -s %_sysconfdir/sysconfig/opensm %{buildroot}/%_sysconfdir/opensm.conf +sed -i -e 's$-L/usr/src/packages/BUILD/%{name}-%{version}/complib$$g' %{buildroot}%{_libdir}/libosmvendor.la + +#we don't package static libraries anymore. +rm -f %{buildroot}%_libdir/lib{opensm,osmcomp,osmvendor}.la + +%pre +%service_add_pre opensm.service + +%post +%{fillup_only} +%service_add_post opensm.service + +%preun +%service_del_preun opensm.service + +%postun +%service_del_postun opensm.service + +%post -n libopensm%{lib_osm_major} -p /sbin/ldconfig +%postun -n libopensm%{lib_osm_major} -p /sbin/ldconfig +%post -n libosmcomp%{lib_osmcomp_major} -p /sbin/ldconfig +%postun -n libosmcomp%{lib_osmcomp_major} -p /sbin/ldconfig +%post -n libosmvendor%{lib_osmvendor_major} -p /sbin/ldconfig +%postun -n libosmvendor%{lib_osmvendor_major} -p /sbin/ldconfig + +%files +%defattr(-, root, root) +%_sysconfdir/opensm.conf +%doc COPYING +%_unitdir/opensm.service +%config %_sysconfdir/logrotate.d/opensm +%_sbindir/* +%{_libexecdir}/opensm-launch +%_mandir/man5/torus-2QoS.conf.5.gz +%_mandir/man8/torus-2QoS.8.gz +%_mandir/man8/opensm.8.gz +%_mandir/man8/osmtest.8.gz +%{_fillupdir}/sysconfig.%name + +%files -n libopensm%{lib_osm_major} +%defattr(-, root, root) +%_libdir/libopensm.so.%{lib_osm_major}* + +%files -n libosmcomp%{lib_osmcomp_major} +%defattr(-,root,root) +%_libdir/libosmcomp.so.%{lib_osmcomp_major}* + +%files -n libosmvendor%{lib_osmvendor_major} +%defattr(-,root,root) +%_libdir/libosmvendor.so.%{lib_osmvendor_major}* + +%files devel +%defattr(-,root,root) +%_includedir/infiniband/complib/ +%_includedir/infiniband/iba/ +%_includedir/infiniband/opensm/ +%_includedir/infiniband/vendor/ +%_libdir/libopensm.so +%_libdir/libosmcomp.so +%_libdir/libosmvendor.so + +%changelog