Skip to content

Commit 24a4bbd

Browse files
committed
Build OpenSCAP with clang sanitizers
1 parent 9be578b commit 24a4bbd

File tree

2 files changed

+246
-10
lines changed

2 files changed

+246
-10
lines changed

.packit.yaml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,22 @@ srpm_build_deps:
1212
jobs:
1313
- job: copr_build
1414
trigger: pull_request
15-
metadata:
16-
targets:
17-
- fedora-all-x86_64
18-
- centos-stream-8-x86_64
19-
- centos-stream-9-x86_64
15+
targets:
16+
- fedora-all-x86_64
17+
- centos-stream-8-x86_64
18+
- centos-stream-9-x86_64
2019

2120
- job: tests
2221
trigger: pull_request
23-
metadata:
24-
targets:
25-
- fedora-all-x86_64
26-
- centos-stream-8-x86_64
27-
- centos-stream-9-x86_64
22+
targets:
23+
- fedora-all-x86_64
24+
- centos-stream-8-x86_64
25+
- centos-stream-9-x86_64
26+
27+
- job: copr_build
28+
trigger: pull_request
29+
specfile_path: custom_specs/openscap_clang.spec
30+
identifier: clang
31+
targets:
32+
- epel-8-x86_64
33+
- epel-9-x86_64

custom_specs/openscap_clang.spec

Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
%global toolchain clang
2+
# This spec file is not synchronized to the Fedora downstream.
3+
# It serves as Fedora CI configuration and as support for downstream updates.
4+
Name: openscap
5+
Release: 0%{?dist}
6+
Version: 1.3.0
7+
Epoch: 1
8+
Summary: Set of open source libraries enabling integration of the SCAP line of standards
9+
License: LGPLv2+
10+
URL: http://www.open-scap.org/
11+
Source0: https://github.com/OpenSCAP/%{name}/releases/download/%{version}/%{name}-%{version}.tar.gz
12+
BuildRequires: make
13+
BuildRequires: cmake >= 2.6
14+
BuildRequires: clang compiler-rt
15+
BuildRequires: swig libxml2-devel libxslt-devel perl-generators perl-XML-Parser
16+
BuildRequires: rpm-devel
17+
BuildRequires: libgcrypt-devel
18+
BuildRequires: pcre-devel
19+
BuildRequires: libacl-devel
20+
BuildRequires: libselinux-devel
21+
BuildRequires: libcap-devel
22+
BuildRequires: libblkid-devel
23+
BuildRequires: bzip2-devel
24+
BuildRequires: asciidoc
25+
BuildRequires: openldap-devel
26+
BuildRequires: glib2-devel
27+
BuildRequires: dbus-devel
28+
BuildRequires: libyaml-devel
29+
BuildRequires: xmlsec1-devel xmlsec1-openssl-devel
30+
BuildRequires: systemd
31+
%if %{?_with_check:1}%{!?_with_check:0}
32+
BuildRequires: perl-XML-XPath
33+
BuildRequires: bzip2
34+
BuildRequires: python3-dbusmock
35+
%endif
36+
Requires: bash
37+
Requires: bzip2-libs
38+
Requires: dbus
39+
Requires: glib2
40+
Requires: libacl
41+
Requires: libblkid
42+
Requires: libcap
43+
Requires: libselinux
44+
Requires: openldap
45+
Requires: popt
46+
# Fedora has procps-ng, which provides procps
47+
Requires: procps
48+
Requires: xmlsec1 xmlsec1-openssl
49+
50+
%description
51+
OpenSCAP is a set of open source libraries providing an easier path
52+
for integration of the SCAP line of standards. SCAP is a line of standards
53+
managed by NIST with the goal of providing a standard language
54+
for the expression of Computer Network Defense related information.
55+
56+
%package devel
57+
Summary: Development files for %{name}
58+
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
59+
Requires: libxml2-devel
60+
Requires: pkgconfig
61+
BuildRequires: doxygen
62+
63+
%description devel
64+
The %{name}-devel package contains libraries and header files for
65+
developing applications that use %{name}.
66+
67+
%package python3
68+
Summary: Python 3 bindings for %{name}
69+
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
70+
BuildRequires: python3-devel
71+
72+
%description python3
73+
The %{name}-python3 package contains the bindings so that %{name}
74+
libraries can be used by python3.
75+
76+
%package scanner
77+
Summary: OpenSCAP Scanner Tool (oscap)
78+
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
79+
Requires: libcurl >= 7.12.0
80+
BuildRequires: libcurl-devel >= 7.12.0
81+
82+
%description scanner
83+
The %{name}-scanner package contains oscap command-line tool. The oscap
84+
is configuration and vulnerability scanner, capable of performing
85+
compliance checking using SCAP content.
86+
87+
%package utils
88+
Summary: OpenSCAP Utilities
89+
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
90+
Requires: rpmdevtools rpm-build
91+
Requires: %{name}-scanner%{?_isa} = %{epoch}:%{version}-%{release}
92+
93+
%description utils
94+
The %{name}-utils package contains command-line tools build on top
95+
of OpenSCAP library. Historically, openscap-utils included oscap
96+
tool which is now separated to %{name}-scanner sub-package.
97+
98+
%package engine-sce
99+
Summary: Script Check Engine plug-in for OpenSCAP
100+
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
101+
102+
%description engine-sce
103+
The Script Check Engine is non-standard extension to SCAP protocol. This
104+
engine allows content authors to avoid OVAL language and write their assessment
105+
commands using a scripting language (Bash, Perl, Python, Ruby, ...).
106+
107+
%package engine-sce-devel
108+
Summary: Development files for %{name}-engine-sce
109+
Requires: %{name}-devel%{?_isa} = %{epoch}:%{version}-%{release}
110+
Requires: %{name}-engine-sce%{?_isa} = %{epoch}:%{version}-%{release}
111+
Requires: pkgconfig
112+
113+
%description engine-sce-devel
114+
The %{name}-engine-sce-devel package contains libraries and header files
115+
for developing applications that use %{name}-engine-sce.
116+
117+
%package containers
118+
Summary: Utils for scanning containers
119+
Requires: %{name} = %{epoch}:%{version}-%{release}
120+
Requires: %{name}-scanner
121+
BuildArch: noarch
122+
123+
%description containers
124+
Tool for scanning Atomic containers.
125+
126+
%prep
127+
%autosetup -p1
128+
129+
%build
130+
echo "Toolchain is %toolchain"
131+
%undefine __cmake_in_source_build
132+
%set_build_flags
133+
CFLAGS="$CFLAGS -fsanitize=thread"
134+
# gconf is a legacy system not used any more, and it blocks testing of oscap-anaconda-addon
135+
# as gconf is no longer part of the installation medium
136+
cmake \
137+
-S "." \
138+
-B "%{__cmake_builddir}" \
139+
-DCMAKE_C_COMPILER=clang \
140+
-DCMAKE_BUILD_TYPE=Debug \
141+
-DENABLE_PERL=OFF \
142+
-DENABLE_DOCS=ON \
143+
-DOPENSCAP_PROBE_UNIX_GCONF=OFF \
144+
-DGCONF_LIBRARY= \
145+
-DCMAKE_INSTALL_PREFIX:PATH=/usr \
146+
-DINCLUDE_INSTALL_DIR:PATH=/usr/include \
147+
-DLIB_INSTALL_DIR:PATH=/usr/lib64 \
148+
-DSYSCONF_INSTALL_DIR:PATH=/etc \
149+
-DSHARE_INSTALL_PREFIX:PATH=/usr/share \
150+
..
151+
%cmake_build
152+
make docs
153+
154+
%check
155+
%if %{?_with_check:1}%{!?_with_check:0}
156+
ctest -V %{?_smp_mflags}
157+
%endif
158+
159+
%install
160+
%cmake_install
161+
162+
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
163+
164+
# fix python shebangs
165+
pathfix.py -i %{__python3} -p -n $RPM_BUILD_ROOT%{_bindir}/scap-as-rpm
166+
167+
%ldconfig_scriptlets
168+
169+
# enable oscap-remediate.service here for now
170+
# https://github.com/hughsie/PackageKit/issues/401
171+
# https://bugzilla.redhat.com/show_bug.cgi?id=1833176
172+
mkdir -p %{buildroot}%{_unitdir}/system-update.target.wants/
173+
ln -sf ../oscap-remediate.service %{buildroot}%{_unitdir}/system-update.target.wants/oscap-remediate.service
174+
175+
%files
176+
%doc AUTHORS NEWS README.md
177+
%license COPYING
178+
%doc %{_pkgdocdir}/manual/
179+
%dir %{_datadir}/openscap
180+
%dir %{_datadir}/openscap/schemas
181+
%dir %{_datadir}/openscap/xsl
182+
%dir %{_datadir}/openscap/cpe
183+
%{_libdir}/libopenscap.so.*
184+
%{_datadir}/openscap/schemas/*
185+
%{_datadir}/openscap/xsl/*
186+
%{_datadir}/openscap/cpe/*
187+
188+
%files python3
189+
%{python3_sitearch}/*
190+
191+
%files devel
192+
%doc %{_pkgdocdir}/html/
193+
%{_libdir}/libopenscap.so
194+
%{_libdir}/pkgconfig/*.pc
195+
%{_includedir}/openscap
196+
%exclude %{_includedir}/openscap/sce_engine_api.h
197+
198+
%files engine-sce-devel
199+
%{_libdir}/libopenscap_sce.so
200+
%{_includedir}/openscap/sce_engine_api.h
201+
202+
%files scanner
203+
%{_mandir}/man8/oscap.8*
204+
%{_bindir}/oscap
205+
%{_bindir}/oscap-chroot
206+
%{_sysconfdir}/bash_completion.d
207+
%{_libexecdir}/oscap-remediate
208+
%{_unitdir}/oscap-remediate.service
209+
%{_unitdir}/system-update.target.wants/
210+
211+
%files utils
212+
%doc docs/oscap-scan.cron
213+
%{_mandir}/man8/*
214+
%exclude %{_mandir}/man8/oscap.8*
215+
%exclude %{_mandir}/man8/oscap-docker.8*
216+
%{_bindir}/*
217+
%exclude %{_bindir}/oscap
218+
%exclude %{_bindir}/oscap-docker
219+
%exclude %{_bindir}/oscap-chroot
220+
221+
%files engine-sce
222+
%{_libdir}/libopenscap_sce.so.*
223+
224+
%files containers
225+
%{_bindir}/oscap-docker
226+
%{_mandir}/man8/oscap-docker.8*
227+
%{python3_sitelib}/oscap_docker_python/*
228+
%{_bindir}/oscap-podman
229+
%{_mandir}/man8/oscap-podman.8*
230+

0 commit comments

Comments
 (0)