File ulp-demo.spec of Package ulp-demo-cve-2022-0778

#
# spec file for package libpulp-demo
#
# 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/
#


Name:           ulp-demo
Version:        1.0
Release:        0
Group:          System/Libraries
Summary:	A demo ULP patch and a test application
License:        GPL-2.0-or-later
URL:            https://github.com/giulianobelinassi/libpulp_dummy
Source:         ulp-demo-1.0.tar.gz
Source1:        openssl-1_1-livepatches.tar.bz2
Source2:        openssl-1_1-libs.tar.bz2
Source3:        README.demo
BuildRequires:  gcc
BuildRequires:  libopenssl1_1
BuildRequires:  libopenssl-1_1-devel
BuildRequires:  libpulp-tools
BuildRequires:  make
# needed by check_livepatchable
BuildRequires:  binutils
BuildRequires:  coreutils
BuildRequires:  gawk
BuildRequires:  grep
BuildRequires:  vim

%description
A demo patch to play with User Space Live Patching (ULP). There is a live-patch
for OpenSSL, an application that can be live patched, and instructions for use.

%prep
%setup -q

tar -xf %{S:1}

tar -C openssl-1_1-livepatches -xf %{S:2}
for so in openssl-1_1-livepatches/openssl-1_1-libs/*/usr/lib64/*.so.*; do
  ulp livepatchable $so
done

cp -av %{S:3} .

%build
make test # it's not the test suite but the demo program

cd openssl-1_1-livepatches && make \
  LIBDIR=/usr/lib64 \
  PATCHDIR=/opt/ulp-demo/livepatches \
  PACKAGE=libopenssl1_1

%install
mkdir -p %{buildroot}/opt/ulp-demo/bin
cp -av test %{buildroot}/opt/ulp-demo/bin/ulp-test

cd openssl-1_1-livepatches && make install \
  DESTDIR=%{buildroot} \
  PATCHDIR=/opt/ulp-demo/livepatches \
  PACKAGE=libopenssl1_1

%post
echo You have installed the Userspace Live Patching demo.
echo Please see /usr/share/doc/packages/ulp-demo/README.demo for instructions.

%files
%license LICENSE
%doc README.md
%doc README.demo
%dir /opt/ulp-demo
/opt/ulp-demo/*

%changelog

openSUSE Build Service is sponsored by