Name: tlpi Version: 221220 Release: %autorelease Summary: Utilities to display namespaces and control groups License: GPLv3+ URL: https://man7.org/tlpi/index.html Source: https://man7.org/tlpi/code/download/tlpi-%version-dist.tar.gz Patch: Makefile.patch BuildRequires: gcc-go BuildRequires: libacl-devel BuildRequires: libcap-devel BuildRequires: libseccomp-devel Requires: tlpi-licenses %global examplesdir %_pkgdocdir/examples %description The book The Linux Programming Interface and training courses given by man7.org are accompanied with a set of code examples. Some of these examples are useful in their own right. This package includes the following utilities. - pid_namespaces Show the PID namespace hierarchy. - namespace_of Show the namespace memberships of one or more processes in the context of the user or PID namespace hierarchy. See the bundled source code for further documentation. - userns_overview Display a hierarchical view of the user namespaces on the system along with the member processes for each namespace. - view_v2_cgroups Display one or more subtrees in the cgroups v2 hierarchy. The following info is displayed for each cgroup: the cgroup type, the controllers enabled in the cgroup, and the process and thread members of the cgroup. %package examples Summary: Example code from the tlpi package BuildArch: noarch Requires: tlpi-licenses %description examples The book The Linux Programming Interface and training courses given by man7.org are accompanied with a set of code examples. This package include these examples in source code form. The package is probably mostly useful in conjunction with the book. %package examples-bin Summary: Compiled examples from the tlpi package Recommends: tlpi-examples = %version-%release Requires: tlpi-licenses %description examples-bin The book The Linux Programming Interface and training courses given by man7.org are accompanied with a set of code examples. This package include the binaries built from these sources. They are installed with a prefix "tlpi-" where "" corresponds to the directory in the source tree. The package is probably mostly useful in conjunction with the book. %package licenses Summary: License files from tlpi source BuildArch: noarch Requires: tlpi-licenses %description licenses This package contains the license files from tlpi packages. %prep %autosetup -p 0 -n tlpi-dist %build # Remember all source files for the examples, save before building ls --format=single-column --directory [a-z]* > dirs_examples find $(cat dirs_examples) -type f -printf '%h %f\n' > source_examples make gccgo -fPIE -pie -o pid_namespaces namespaces/pid_namespaces.go gccgo -fPIE -pie -o namespaces_of namespaces/namespaces_of.go gccgo -fPIE -pie -o userns_overview namespaces/userns_overview.go gccgo -fPIE -pie -o view_v2_cgroups cgroups/view_v2_cgroups.go %install install -D --target-directory=%buildroot%_bindir \ pid_namespaces namespaces_of userns_overview view_v2_cgroups while read dir file do install -D --target-directory=%buildroot%examplesdir/$dir \ --mode=u=rw,go=r $dir/$file done < source_examples install --target-directory=%buildroot%examplesdir \ --mode=u=rw,go=r BUILDING CHANGES Makefile Makefile.inc README find $(cat dirs_examples) -type f -executable -printf '%h %f\n'| \ while read dir file do install $dir/$file %buildroot%_bindir/tlpi-${dir/\//-}-$file done %files %doc namespaces/namespaces_of.go %_bindir/pid_namespaces %_bindir/namespaces_of %_bindir/userns_overview %_bindir/view_v2_cgroups %files examples %doc %examplesdir %files examples-bin %_bindir/tlpi-* %files licenses %license COPYING.* %changelog * Tue Jan 24 2023 Göran Uddeborg - 221220-1 - Updated to the most recent release. - Make sure binaries are built position independent. - Build subpackages from the example code in the sources not previously built. * Mon Mar 28 2022 Göran Uddeborg - 220211-1 - Updated to the most recent release. * Tue Nov 24 2020 Göran Uddeborg - 201025-1 - Initial RPM packaging.