From 9a52ba3f8b6032123540d998028097dd4af3f67917303d0833f8044376dcce02 Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Fri, 23 Jun 2023 20:26:09 +0000 Subject: [PATCH] Accepting request 1094960 from home:gbelinassi - This package factors out code necessary to add support for Userspace Livepatching into packages. - This is not supposed to be installed into client machines. It is supposed to be included as a dependency to packages supporting by Userspace Livepatching. OBS-URL: https://build.opensuse.org/request/show/1094960 OBS-URL: https://build.opensuse.org/package/show/devel:tools/ulp-macros?expand=0&rev=1 --- .gitattributes | 23 +++++++++++++++++++++++ .gitignore | 1 + ulp-macros.changes | 4 ++++ ulp-macros.spec | 44 ++++++++++++++++++++++++++++++++++++++++++++ ulp.macros | 25 +++++++++++++++++++++++++ 5 files changed, 97 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 ulp-macros.changes create mode 100644 ulp-macros.spec create mode 100644 ulp.macros 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/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/ulp-macros.changes b/ulp-macros.changes new file mode 100644 index 0000000..9da0988 --- /dev/null +++ b/ulp-macros.changes @@ -0,0 +1,4 @@ +------------------------------------------------------------------- +Wed Jun 14 15:37:23 UTC 2023 - Giuliano Belinassi + +- First release. diff --git a/ulp-macros.spec b/ulp-macros.spec new file mode 100644 index 0000000..976f5ba --- /dev/null +++ b/ulp-macros.spec @@ -0,0 +1,44 @@ +# +# spec file for package ulp-macros +# +# Copyright (c) 2023 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-macros +Version: 1.0 +Release: 0 +Summary: Macros for enabling Userspace Live Patching into processes +# FIXME: Select a correct license from https://github.com/openSUSE/spec-cleaner#spdx-licenses +License: MIT +# FIXME: use correct group, see "https://en.opensuse.org/openSUSE:Package_group_guidelines" +Group: Development +Source1: ulp.macros +BuildArch: noarch + +%description +This package contain macros for enabling Userspace Live Patching into packages + +%prep + +%build + +%install +install -D -m 0644 %{S:1} %{buildroot}%{_rpmmacrodir}/macros.ulp + +%files +%{_rpmmacrodir}/macros.ulp + +%changelog + diff --git a/ulp.macros b/ulp.macros new file mode 100644 index 0000000..427682a --- /dev/null +++ b/ulp.macros @@ -0,0 +1,25 @@ +# Do the necessary checks in order to enable livepatching support. +# Enable livepatching support for SLE15-SP4 onwards. It requires +# compiler support introduced there. + +# Currently only supported on x86_64. + +# Expand to the necessary livepatching compilation flags if the macro +# livepatching is defined in the spec file. +%cflags_livepatching %{lua: if rpm.expand("%livepatchable") == "1" then if rpm.expand("%_arch") == "x86_64" then print("-fpatchable-function-entry=16,14 -fdump-ipa-clones") end end} + +%tar_lp_basename %{name}-livepatch-%{version}-%{release} +%tar_lp_package_name %{tar_lp_basename}.%{_arch}.tar.xz +%clones_dest_dir %{tar_lp_basename}/%{_arch} + +# Ipa-clones are files generated by gcc which logs changes made across +# functions, and we need to know such changes to build livepatches +# correctly. These files are intended to be used by the livepatch +# developers and may be retrieved by using `osc getbinaries`. +%pack_ipa_dumps \ + %if 0%{?livepatchable} && "%{_arch}" == "x86_64" \ + mkdir -p ipa-clones/%{clones_dest_dir} \ + find . -name "*.ipa-clones" ! -empty -exec cp -t ipa-clones/%{clones_dest_dir} --parents {} + \ + tar -cJf %{tar_lp_package_name} -C ipa-clones --owner root --group root --sort name %{tar_lp_basename} \ + cp %{tar_lp_package_name} %{_topdir}/OTHER \ + %endif