Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

packages: add keyutils #2907

Merged
merged 1 commit into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions packages/keyutils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "keyutils"
version = "0.1.0"
edition = "2021"
publish = false
build = "build.rs"

[lib]
path = "pkg.rs"

[package.metadata.build-package]
releases-url = "https://people.redhat.com/~dhowells/keyutils/"

[[package.metadata.build-package.external-files]]
url = "https://people.redhat.com/~dhowells/keyutils/keyutils-1.6.1.tar.bz2"
sha512 = "ea6e20b2594234c7f51581eef2b8fd19c109fa9eacaaef8dfbb4f237bd1d6fdf071ec23b4ff334cb22a46461d09d17cf499987fd1f00e66f27506888876961e1"

[build-dependencies]
glibc = { path = "../glibc" }
9 changes: 9 additions & 0 deletions packages/keyutils/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use std::process::{exit, Command};

fn main() -> Result<(), std::io::Error> {
let ret = Command::new("buildsys").arg("build-package").status()?;
if !ret.success() {
exit(1);
}
Ok(())
}
1 change: 1 addition & 0 deletions packages/keyutils/keyutils-tmpfiles.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
C /etc/request-key.conf - - - -
78 changes: 78 additions & 0 deletions packages/keyutils/keyutils.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
Name: %{_cross_os}keyutils
Version: 1.6.1
Release: 1%{?dist}
Summary: Linux key management utilities
License: GPL-2.0-or-later AND GPL-2.1-or-later
Url: http://people.redhat.com/~dhowells/keyutils/
Source0: http://people.redhat.com/~dhowells/keyutils/keyutils-%{version}.tar.bz2
Source1: keyutils-tmpfiles.conf
Source2: request-key.conf

BuildRequires: %{_cross_os}glibc-devel

%description
%{summary}.

%package devel
Summary: Development package for building Linux key management utilities

%description devel
%{summary}.

%prep
%setup -n keyutils-%{version} -q

%global keyutilsmake \
%set_cross_build_flags \\\
export CC=%{_cross_target}-gcc ; \
%make_build \\\
NO_ARLIB=1 \\\
ETCDIR=%{_cross_sysconfdir} \\\
LIBDIR=%{_cross_libdir} \\\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: it's very unlikely that this will ever matter, but setting PREFIX will put the right paths in libkeyutils.pc (which we don't and probably won't use):

Suggested change
LIBDIR=%{_cross_libdir} \\\
PREFIX=%{_cross_prefix} \\\
LIBDIR=%{_cross_libdir} \\\

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the PREFIX here and compared libkeyutils.pc before and after the change, but it seems like the paths are already correct?

Before:

libdir=/x86_64-bottlerocket-linux-gnu/sys-root/usr/lib
includedir=/x86_64-bottlerocket-linux-gnu/sys-root/usr/include

Name: libkeyutils
Description: keyutils library
Version: 1.6.1
Cflags: -I${includedir}
Libs: -L${libdir} -lkeyutils

After:

libdir=/x86_64-bottlerocket-linux-gnu/sys-root/usr/lib
includedir=/x86_64-bottlerocket-linux-gnu/sys-root/usr/include

Name: libkeyutils
Description: keyutils library
Version: 1.6.1
Cflags: -I${includedir}
Libs: -L${libdir} -lkeyutils

USRLIBDIR=%{_cross_libdir} \\\
BINDIR=%{_cross_bindir} \\\
SBINDIR=%{_cross_sbindir} \\\
MANDIR=%{_cross_mandir} \\\
INCLUDEDIR=%{_cross_includedir} \\\
SHAREDIR=%{_cross_datadir}/keyutils \\\
RELEASE=.%{release} \\\
NO_GLIBC_KEYERR=1 \\\
CC="${CC}" \\\
CFLAGS="${CFLAGS}" \\\
LDFLAGS="${LDFLAGS}" \\\
DESTDIR=%{buildroot} \\\
%{nil}


%build
%keyutilsmake

%install
%keyutilsmake install

install -d %{buildroot}%{_cross_tmpfilesdir}
install -d %{buildroot}%{_cross_factorydir}%{_cross_sysconfdir}

install -p -m 0644 %{S:1} %{buildroot}%{_cross_tmpfilesdir}/keyutils.conf
install -p -m 0644 %{S:2} %{buildroot}%{_cross_factorydir}%{_cross_sysconfdir}/request-key.conf

%files
%{_cross_attribution_file}
%license LICENCE.GPL LICENCE.LGPL
%{_cross_tmpfilesdir}/keyutils.conf
%{_cross_bindir}/keyctl
%{_cross_sbindir}/key.dns_resolver
%{_cross_sbindir}/request-key
%{_cross_datadir}/keyutils
%{_cross_libdir}/libkeyutils.so.*
%{_cross_factorydir}%{_cross_sysconfdir}/request-key.conf

%exclude %{_cross_mandir}
%exclude %{_cross_sysconfdir}/request-key.conf

%files devel
%{_cross_libdir}/libkeyutils.so
%{_cross_includedir}/keyutils.h
%{_cross_libdir}/pkgconfig/libkeyutils.pc

%changelog
1 change: 1 addition & 0 deletions packages/keyutils/pkg.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// not used
2 changes: 2 additions & 0 deletions packages/keyutils/request-key.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
create dns_resolver * * /sbin/key.dns_resolver %k
negate * * * /bin/keyctl negate %k 30 %S
1 change: 1 addition & 0 deletions packages/release/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ hotdog = { path = "../hotdog" }
iproute = { path = "../iproute" }
iptables = { path = "../iptables" }
kexec-tools = { path = "../../packages/kexec-tools" }
keyutils = { path = "../keyutils" }
libaudit = { path = "../libaudit" }
libgcc = { path = "../libgcc" }
libstd-rust = { path = "../libstd-rust" }
Expand Down
1 change: 1 addition & 0 deletions packages/release/release.spec
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ Requires: %{_cross_os}hotdog
Requires: %{_cross_os}iproute
Requires: %{_cross_os}iptables
Requires: %{_cross_os}kexec-tools
Requires: %{_cross_os}keyutils
Requires: %{_cross_os}makedumpfile
Requires: %{_cross_os}os
Requires: %{_cross_os}policycoreutils
Expand Down
8 changes: 8 additions & 0 deletions variants/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.