setools/setools.spec
2016-08-03 08:12:13 +00:00

392 lines
12 KiB
RPMSpec

#
# spec file for package setools
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#
%define dataversion 3.3
Name: setools
Version: 3.3.8
Release: 0
Url: https://github.com/TresysTechnology/setools3/wiki
Summary: Policy analysis tools for SELinux
License: GPL-2.0
Group: System/Base
Source: https://github.com/TresysTechnology/setools3/archive/%{name}-%{version}.tar.gz
Source1: setools.pam
Source2: apol.desktop
Source3: seaudit.desktop
Source4: sediffx.desktop
Patch0: %{name}-3.3.5-javacflags.patch
Patch1: %{name}-3.3.5-nonvoid.patch
Patch2: %{name}-3.3.5-strcmp.patch
Patch6: %{name}-setup_py-prefix.patch
Patch7: %{name}-swig-2x.patch
Patch8: %{name}-swig-2.0.7.patch
Patch9: %{name}-am121.patch
Patch10: %{name}-libsepol.patch
Patch23: add-to-header-define_cond_filename_trans.patch
Patch24: setools-tclass.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: bison
BuildRequires: flex
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: glibc-devel
BuildRequires: gtk2-devel
BuildRequires: java-devel
BuildRequires: javapackages-tools
BuildRequires: libbz2-devel
BuildRequires: libglade2-devel
BuildRequires: libselinux-devel
BuildRequires: libsepol-devel-static
BuildRequires: libstdc++-devel
BuildRequires: libtool
BuildRequires: libxml2-devel
BuildRequires: pkgconfig
BuildRequires: python-devel
BuildRequires: sqlite3-devel
BuildRequires: swig
BuildRequires: tcl-devel
BuildRequires: tk-devel
BuildRequires: update-alternatives
BuildRequires: update-desktop-files
Requires: setools-console = %{version}-%{release}
Requires: setools-gui = %{version}-%{release}
Requires: setools-libs = %{version}-%{release}
Requires: setools-libs-tcl = %{version}-%{release}
%description
SETools is a collection of graphical tools, command-line tools, and
libraries designed to facilitate SELinux policy analysis.
This meta-package depends upon the main packages necessary to run
SETools.
%package libs
Summary: Policy analysis support libraries for SELinux
License: LGPL-2.0
Group: System Environment/Libraries
%description libs
SETools is a collection of graphical tools, command-line tools, and
libraries designed to facilitate SELinux policy analysis.
This package includes the following run-time libraries:
libapol policy analysis library
libpoldiff semantic policy difference library
libqpol library that abstracts policy internals
libseaudit parse and filter SELinux audit messages in log files
libsefs SELinux file contexts library
%package -n python-setools
Summary: Python bindings for SELinux policy analysis
License: LGPL-2.0
Group: Development/Languages
Requires: python
Requires: setools-libs = %{version}
%description -n python-setools
SETools is a collection of graphical tools, command-line tools, and
libraries designed to facilitate SELinux policy analysis.
This package includes Python bindings for the following libraries:
libapol policy analysis library
libpoldiff semantic policy difference library
libqpol library that abstracts policy internals
libseaudit parse and filter SELinux audit messages in log files
libsefs SELinux file contexts library
%package java
Summary: Java bindings for SELinux policy analysis
License: LGPL-2.0
Group: Development/Languages
Requires: java
Requires: setools-libs = %{version}
%description java
SETools is a collection of graphical tools, command-line tools, and
libraries designed to facilitate SELinux policy analysis.
This package includes Java bindings for the following libraries:
libapol policy analysis library
libpoldiff semantic policy difference library
libqpol library that abstracts policy internals
libseaudit parse and filter SELinux audit messages in log files
libsefs SELinux file contexts library
%package tcl
Summary: Tcl bindings for SELinux policy analysis
License: LGPL-2.0
Group: Development/Languages
Requires: setools-libs = %{version}
Requires: tcl
%description tcl
SETools is a collection of graphical tools, command-line tools, and
libraries designed to facilitate SELinux policy analysis.
This package includes Tcl bindings for the following libraries:
libapol policy analysis library
libpoldiff semantic policy difference library
libqpol library that abstracts policy internals
libseaudit parse and filter SELinux audit messages in log files
libsefs SELinux file contexts library
%package devel
Summary: Policy analysis development files for SELinux
License: LGPL-2.0
Group: Development/Libraries
Requires: libselinux-devel
Requires: libsepol-devel
Requires: setools-libs = %{version}
%description devel
SETools is a collection of graphical tools, command-line tools, and
libraries designed to facilitate SELinux policy analysis.
This package includes header files and archives for the following
libraries:
libapol policy analysis library
libpoldiff semantic policy difference library
libqpol library that abstracts policy internals
libseaudit parse and filter SELinux audit messages in log files
libsefs SELinux file contexts library
%package console
Summary: Policy analysis command-line tools for SELinux
License: GPL-2.0
Group: System/Base
Requires: setools-libs = %{version}
%description console
SETools is a collection of graphical tools, command-line tools, and
libraries designed to facilitate SELinux policy analysis.
This package includes the following console tools:
seaudit-report audit log analysis tool
sechecker SELinux policy checking tool
secmds command line tools: seinfo, sesearch, findcon,
replcon, and indexcon
sediff semantic policy difference tool
%package gui
Summary: Policy analysis graphical tools for SELinux
License: GPL-2.0
Group: System/Base
Requires: bwidget
Requires: glib2
Requires: gtk2
Requires: setools-libs = %{version}
Requires: setools-tcl = %{version}
Requires: tcl
Requires: tk
# Requires: usermode
%description gui
SETools is a collection of graphical tools, command-line tools, and
libraries designed to facilitate SELinux policy analysis.
This package includes the following graphical tools:
apol policy analysis tool
seaudit audit log analysis tool
sediffx semantic policy difference tool
%define setoolsdir %{_datadir}/setools-%{dataversion}
%define tcllibdir %{_libdir}/setools
%prep
%setup -q -n %{name}3-%{name}-%{version}
%patch0
%patch1
%patch2
%patch6 -p1
%patch7
%patch8
%patch9 -p1
%patch10 -p1
%patch23 -p1
%patch24 -p1
%build
autoreconf -fi
%configure \
--disable-bwidget-check \
--disable-selinux-check \
--enable-swig-python \
--enable-swig-java \
--enable-swig-tcl \
--with-java-prefix=%{java_home} \
--with-javac-flags="-source 1.5 -target 1.5"
make %{?jobs:-j%jobs}
%install
make DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p" install
mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
mkdir -p $RPM_BUILD_ROOT%{_datadir}/pixmaps
install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/pam.d
install -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/seaudit
# install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/security/console.apps
# install -p -m 644 packages/rpm/seaudit.console $RPM_BUILD_ROOT%{_sysconfdir}/security/console.apps/seaudit
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/applications
install -p -m 644 apol/apol.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/apol.png
install -p -m 644 seaudit/seaudit.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/seaudit.png
install -p -m 644 sediff/sediffx.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/sediffx.png
%suse_update_desktop_file -i apol System Security
%suse_update_desktop_file -i seaudit System Security
%suse_update_desktop_file -i sediffx System
# replace absolute symlinks with relative symlinks
ln -sf ../setools-%{dataversion}/qpol.jar $RPM_BUILD_ROOT/%{_javadir}/qpol.jar
ln -sf ../setools-%{dataversion}/apol.jar $RPM_BUILD_ROOT/%{_javadir}/apol.jar
ln -sf ../setools-%{dataversion}/poldiff.jar $RPM_BUILD_ROOT/%{_javadir}/poldiff.jar
ln -sf ../setools-%{dataversion}/seaudit.jar $RPM_BUILD_ROOT/%{_javadir}/seaudit.jar
ln -sf ../setools-%{dataversion}/sefs.jar $RPM_BUILD_ROOT/%{_javadir}/sefs.jar
# remove static libs
rm -f $RPM_BUILD_ROOT/%{_libdir}/*.a
# ensure permissions are correct
chmod 0755 $RPM_BUILD_ROOT%{_libdir}/*.so.*
chmod 0755 $RPM_BUILD_ROOT%{_libdir}/%{name}/*/*.so.*
# chmod 0755 $RPM_BUILD_ROOT%{py_sitedir}/*.so.*
chmod 0755 $RPM_BUILD_ROOT%{_bindir}/*
chmod 0755 $RPM_BUILD_ROOT%{_sbindir}/*
chmod 0755 $RPM_BUILD_ROOT%{setoolsdir}/seaudit-report-service
chmod 0644 $RPM_BUILD_ROOT%{tcllibdir}/*/pkgIndex.tcl
# workaround python bindings installer that install files in both locations - TODO: fix properly
if [ "%{python_sitelib}" != "%{python_sitearch}" ]; then
mv $RPM_BUILD_ROOT%{python_sitelib}/setools/* $RPM_BUILD_ROOT%{python_sitearch}/setools/
fi
%files libs
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING COPYING.GPL COPYING.LGPL KNOWN-BUGS NEWS README
%{_libdir}/libqpol.so.*
%{_libdir}/libapol.so.*
%{_libdir}/libpoldiff.so.*
%{_libdir}/libsefs.so.*
%{_libdir}/libseaudit.so.*
%dir %{setoolsdir}
%files -n python-setools
%defattr(-,root,root,-)
%{python_sitearch}/setools*.egg-info
%dir %{python_sitearch}/setools
%{python_sitearch}/setools/*
%files java
%defattr(-,root,root,-)
%{_libdir}/libjqpol.so.*
%{_libdir}/libjapol.so.*
%{_libdir}/libjpoldiff.so.*
%{_libdir}/libjseaudit.so.*
%{_libdir}/libjsefs.so.*
%{setoolsdir}/*.jar
%{_javadir}/*.jar
%files tcl
%defattr(-,root,root,-)
%dir %{tcllibdir}
%{tcllibdir}/qpol/
%{tcllibdir}/apol/
%{tcllibdir}/poldiff/
%{tcllibdir}/seaudit/
%{tcllibdir}/sefs/
%files devel
%defattr(-,root,root,-)
%{_libdir}/*.so
%{_libdir}/pkgconfig/*
%{_includedir}/qpol/
%{_includedir}/apol/
%{_includedir}/poldiff/
%{_includedir}/seaudit/
%{_includedir}/sefs/
%files console
%defattr(-,root,root,-)
%{_bindir}/seinfo
%{_bindir}/sesearch
%{_bindir}/indexcon
%{_bindir}/findcon
%{_bindir}/replcon
%{_bindir}/sechecker
%{_bindir}/sediff
%{_bindir}/seaudit-report
%{setoolsdir}/sechecker-profiles/
%{setoolsdir}/sechecker_help.txt
%{setoolsdir}/seaudit-report-service
%{setoolsdir}/seaudit-report.conf
%{setoolsdir}/seaudit-report.css
%{_mandir}/man1/findcon.1.gz
%{_mandir}/man1/indexcon.1.gz
%{_mandir}/man1/replcon.1.gz
%{_mandir}/man1/sechecker.1.gz
%{_mandir}/man1/sediff.1.gz
%{_mandir}/man1/seinfo.1.gz
%{_mandir}/man1/sesearch.1.gz
%{_mandir}/man8/seaudit-report.8.gz
%files gui
%defattr(-,root,root,-)
%{_bindir}/sediffx
%{_bindir}/apol
%dir %{tcllibdir}
%{tcllibdir}/apol_tcl/
%{setoolsdir}/sediff_help.txt
%{setoolsdir}/apol_help.txt
%{setoolsdir}/domaintrans_help.txt
%{setoolsdir}/file_relabel_help.txt
%{setoolsdir}/infoflow_help.txt
%{setoolsdir}/types_relation_help.txt
%{setoolsdir}/apol_perm_mapping_*
%{setoolsdir}/seaudit_help.txt
%{setoolsdir}/*.glade
%{setoolsdir}/*.png
%{setoolsdir}/apol.gif
%{setoolsdir}/dot_seaudit
%{_mandir}/man1/apol.1.gz
%{_mandir}/man1/sediffx.1.gz
%{_mandir}/man8/seaudit.8.gz
%{_sbindir}/seaudit
%config(noreplace) %{_sysconfdir}/pam.d/seaudit
# %config(noreplace) %{_sysconfdir}/security/console.apps/seaudit
%{_datadir}/applications/*
%attr(0644,root,root) %{_datadir}/pixmaps/*.png
%post libs -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig
%post java -p /sbin/ldconfig
%postun java -p /sbin/ldconfig
%post tcl -p /sbin/ldconfig
%postun tcl -p /sbin/ldconfig
%changelog