diff --git a/.gitignore b/.gitignore index 82c8ff8..775f0fc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /libcgroup-0.41.tar.bz2 /libcgroup-v0.42.1.tar.gz /libcgroup-v0.42.2.tar.gz +/libcgroup-v2.0.tar.gz +/3c0c7b164b4221d78459fccdd49643a5dcb3f73d.tar.gz diff --git a/libcgroup-0.37-chmod.patch b/libcgroup-0.37-chmod.patch index c5d25c2..efe12ce 100644 --- a/libcgroup-0.37-chmod.patch +++ b/libcgroup-0.37-chmod.patch @@ -1,8 +1,8 @@ diff --git a/src/api.c b/src/api.c -index 24ae48d..54a6736 100644 +index 4a980a1..df9afe8 100644 --- a/src/api.c +++ b/src/api.c -@@ -159,6 +159,10 @@ static int cg_chown_file(FTS *fts, FTSENT *ent, uid_t owner, gid_t group) +@@ -170,6 +170,10 @@ static int cg_chown_file(FTS *fts, FTSENT *ent, uid_t owner, gid_t group) return ret; } @@ -13,7 +13,7 @@ index 24ae48d..54a6736 100644 /* * TODO: Need to decide a better place to put this function. */ -@@ -166,6 +170,8 @@ static int cg_chown_recursive(char **path, uid_t owner, gid_t group) +@@ -177,6 +181,8 @@ static int cg_chown_recursive(char **path, uid_t owner, gid_t group) { int ret = 0; FTS *fts; @@ -22,7 +22,7 @@ index 24ae48d..54a6736 100644 cgroup_dbg("chown: path is %s\n", *path); fts = fts_open(path, FTS_PHYSICAL | FTS_NOCHDIR | -@@ -183,6 +189,7 @@ static int cg_chown_recursive(char **path, uid_t owner, gid_t group) +@@ -194,6 +200,7 @@ static int cg_chown_recursive(char **path, uid_t owner, gid_t group) cgroup_warn("Warning: fts_read failed\n"); break; } diff --git a/libcgroup-0.40.rc1-coverity.patch b/libcgroup-0.40.rc1-coverity.patch index b75a230..db8847a 100644 --- a/libcgroup-0.40.rc1-coverity.patch +++ b/libcgroup-0.40.rc1-coverity.patch @@ -1,5 +1,5 @@ diff --git a/src/config.c b/src/config.c -index 3ffa263..b5d51b3 100644 +index 1306033..88cc5dd 100644 --- a/src/config.c +++ b/src/config.c @@ -326,7 +326,7 @@ int config_group_task_perm(char *perm_type, char *value, int flag) @@ -59,21 +59,3 @@ index 4cef53e..90920d1 100644 struct sockaddr_nl my_nla; char buff[BUFF_SIZE]; int rc = -1; -diff --git a/src/tools/lscgroup.c b/src/tools/lscgroup.c -index bfb1724..d15a0c2 100644 ---- a/src/tools/lscgroup.c -+++ b/src/tools/lscgroup.c -@@ -96,11 +96,11 @@ static int display_controller_data(char *input_path, char *controller, char *nam - if (ret != 0) - return ret; - -- strncpy(cgroup_dir_path, info.full_path, FILENAME_MAX); -+ strncpy(cgroup_dir_path, info.full_path, FILENAME_MAX - 1); - /* remove problematic '/' characters from cgroup directory path*/ - trim_filepath(cgroup_dir_path); - -- strncpy(input_dir_path, input_path, FILENAME_MAX); -+ strncpy(input_dir_path, input_path, FILENAME_MAX - 1); - - /* remove problematic '/' characters from input directory path*/ - trim_filepath(input_dir_path); diff --git a/libcgroup-0.40.rc1-fread.patch b/libcgroup-0.40.rc1-fread.patch index c02d824..aec1e98 100644 --- a/libcgroup-0.40.rc1-fread.patch +++ b/libcgroup-0.40.rc1-fread.patch @@ -1,8 +1,8 @@ diff --git a/src/api.c b/src/api.c -index 54a6736..1557393 100644 +index df9afe8..537cf10 100644 --- a/src/api.c +++ b/src/api.c -@@ -2482,29 +2482,29 @@ static int cg_rd_ctrl_file(const char *subsys, const char *cgroup, +@@ -2981,29 +2981,29 @@ static int cg_rd_ctrl_file(const char *subsys, const char *cgroup, const char *file, char **value) { char path[FILENAME_MAX]; @@ -39,7 +39,7 @@ index 54a6736..1557393 100644 if (ret < 0) { free(*value); *value = NULL; -@@ -2514,7 +2514,7 @@ static int cg_rd_ctrl_file(const char *subsys, const char *cgroup, +@@ -3013,7 +3013,7 @@ static int cg_rd_ctrl_file(const char *subsys, const char *cgroup, (*value)[ret-1] = '\0'; } diff --git a/libcgroup-0.40.rc1-templates-fix.patch b/libcgroup-0.40.rc1-templates-fix.patch index bae04cb..1fc9fd0 100644 --- a/libcgroup-0.40.rc1-templates-fix.patch +++ b/libcgroup-0.40.rc1-templates-fix.patch @@ -1,8 +1,8 @@ diff --git a/src/api.c b/src/api.c -index 1557393..318a438 100644 +index 537cf10..483eabc 100644 --- a/src/api.c +++ b/src/api.c -@@ -3457,10 +3457,10 @@ int cgroup_change_cgroup_flags(uid_t uid, gid_t gid, +@@ -3959,10 +3959,10 @@ int cgroup_change_cgroup_flags(uid_t uid, gid_t gid, available, "%d", pid); break; case 'p': diff --git a/libcgroup-tests-unbundle-gtest.patch b/libcgroup-tests-unbundle-gtest.patch new file mode 100644 index 0000000..5db99b6 --- /dev/null +++ b/libcgroup-tests-unbundle-gtest.patch @@ -0,0 +1,32 @@ +diff --git a/tests/gunit/Makefile.am b/tests/gunit/Makefile.am +index 654002c..96399e9 100644 +--- a/tests/gunit/Makefile.am ++++ b/tests/gunit/Makefile.am +@@ -22,8 +22,6 @@ + AM_CPPFLAGS = -I$(top_srcdir)/include \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/src/tools \ +- -I$(top_builddir)/googletest/googletest/include \ +- -I$(top_builddir)/googletest/googletest \ + -std=c++11 \ + -Wno-write-strings \ + -DSTATIC= \ +@@ -31,10 +29,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include \ + LDADD = $(top_builddir)/src/.libs/libcgroupfortesting.la \ + $(top_builddir)/src/tools/.libs/libcgset.la + +-EXTRA_DIST = $(top_srcdir)/googletest/googletest/libgtest.so \ +- $(top_srcdir)/googletest/googletest/libgtest_main.so \ +- $(top_srcdir)/googletest/googletest/include \ +- libcgroup_unittest.map ++EXTRA_DIST = libcgroup_unittest.map + + check_PROGRAMS = gtest + TESTS = gtest +@@ -56,5 +51,4 @@ gtest_SOURCES = gtest.cpp \ + 014-cgroupv2_get_subtree_control.cpp \ + 015-cgroupv2_controller_enabled.cpp \ + 016-cgset_parse_r_flag.cpp +-gtest_LDFLAGS = -L$(top_builddir)/googletest/googletest -l:libgtest.so \ +- -rpath $(abs_top_builddir)/googletest/googletest ++gtest_LDFLAGS = -l:libgtest.so diff --git a/libcgroup.spec b/libcgroup.spec index 3468a05..c829cfd 100644 --- a/libcgroup.spec +++ b/libcgroup.spec @@ -1,22 +1,31 @@ +%bcond_with tests + +%global tests_commit 3c0c7b164b4221d78459fccdd49643a5dcb3f73d + Summary: Library to control and monitor control groups Name: libcgroup -Version: 0.42.2 -Release: 5%{?dist} +Version: 2.0 +Release: 1%{?dist} License: LGPLv2+ URL: http://libcg.sourceforge.net/ Source0: https://github.com/%{name}/%{name}/archive/v%{version}/%{name}-v%{version}.tar.gz -Source1: cgconfig.service +Source1: https://github.com/%{name}/%{name}-tests/archive/%{tests_commit}.tar.gz +Source2: cgconfig.service Patch0: fedora-config.patch Patch1: libcgroup-0.37-chmod.patch Patch2: libcgroup-0.40.rc1-coverity.patch Patch3: libcgroup-0.40.rc1-fread.patch Patch4: libcgroup-0.40.rc1-templates-fix.patch +Patch5: libcgroup-tests-unbundle-gtest.patch BuildRequires: autoconf, automake, libtool BuildRequires: gcc, gcc-c++ BuildRequires: byacc, coreutils, flex, pam-devel, systemd-units BuildRequires: make +%if %{with tests} +BuildRequires: gtest-devel +%endif Requires(pre): shadow-utils Requires(post): systemd Requires(preun): systemd @@ -61,6 +70,10 @@ provide scripts to manage that configuration. %patch3 -p1 -b .fread %patch4 -p1 -b .templates-fix +%setup -D -T -a 1 +mv -T %{name}-tests-%{tests_commit} tests +%patch5 -p1 -b .tests-unbundle-gtest + %build autoreconf -vif %configure --enable-pam-module-dir=%{_libdir}/security \ @@ -90,9 +103,14 @@ rm -f $RPM_BUILD_ROOT/%{_mandir}/man8/cgrulesengd.8* # install unit and sysconfig files install -d ${RPM_BUILD_ROOT}%{_unitdir} -install -m 644 %SOURCE1 ${RPM_BUILD_ROOT}%{_unitdir}/ +install -m 644 %SOURCE2 ${RPM_BUILD_ROOT}%{_unitdir}/ install -d ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig +%check +%if %{with tests} +make -C tests/gunit check +%endif + %pre getent group cgred >/dev/null || groupadd -r cgred @@ -120,6 +138,7 @@ getent group cgred >/dev/null || groupadd -r cgred %license COPYING %doc README %{_libdir}/libcgroup.so.1* +%{_libdir}/libcgset.so.0* %files tools %{!?_licensedir:%global license %%doc} @@ -156,9 +175,14 @@ getent group cgred >/dev/null || groupadd -r cgred %{_includedir}/libcgroup.h %{_includedir}/libcgroup/*.h %{_libdir}/libcgroup.so +%{_libdir}/libcgset.so %{_libdir}/pkgconfig/libcgroup.pc %changelog +* Sun May 16 2021 Nikola Forró - 2.0-1 +- resolves: #1953968 + new upstream release 2.0 + * Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek - 0.42.2-5 - Rebuilt for updated systemd-rpm-macros See https://pagure.io/fesco/issue/2583. diff --git a/sources b/sources index ee6ea77..5fa79b2 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ -SHA512 (libcgroup-v0.42.2.tar.gz) = 4dadb4060ff8b05beaa8133a51325b88c48e4552cb7721787dd2be0ee728ea628012f07126ebc1383df7a06205c4ccc4840501a87e8d6793e9dc82ea3969d475 +SHA512 (libcgroup-v2.0.tar.gz) = 22d867c6ff939d919c14d0e4af68b747bc21e9760344f12e9ed52574173d46822e85bace3976addd8a2826b4a985507eb78eb54c10df07442232bde30ba2181e +SHA512 (3c0c7b164b4221d78459fccdd49643a5dcb3f73d.tar.gz) = db69e13f1814134bdc73af64e07adf7097da284a82d4733209b955f59bacd7970e223408703dff59f358b11b4fd7bdb6b6adab759065a40cc098802f90c0afce