diff --git a/CMakeLists.txt b/CMakeLists.txt index c0aa5071..4cc4d7da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,6 +101,5 @@ add_subdirectory("${PROJECT_SOURCE_DIR}/tools") add_subdirectory("${PROJECT_SOURCE_DIR}/pytests") CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/bin/tdnf-automatic.in ${PROJECT_SOURCE_DIR}/bin/tdnf-automatic @ONLY) -CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/bin/tdnf-cache-updateinfo.in ${PROJECT_SOURCE_DIR}/bin/tdnf-cache-updateinfo @ONLY) CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/tdnf.spec.in ${CMAKE_SOURCE_DIR}/tdnf.spec @ONLY) CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/scripts/build-tdnf-rpms.in ${CMAKE_SOURCE_DIR}/scripts/build-tdnf-rpms @ONLY) diff --git a/bin/CMakeLists.txt b/bin/CMakeLists.txt index 3becd28a..49f3a2f9 100644 --- a/bin/CMakeLists.txt +++ b/bin/CMakeLists.txt @@ -7,4 +7,3 @@ # install(PROGRAMS "tdnf-automatic" DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT binary) -install(PROGRAMS "tdnf-cache-updateinfo" DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT binary) diff --git a/bin/tdnf-cache-updateinfo.in b/bin/tdnf-cache-updateinfo.in deleted file mode 100755 index 6ab77161..00000000 --- a/bin/tdnf-cache-updateinfo.in +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -# -# Copyright (C) 2020 VMware, Inc. All Rights Reserved. -# -# Licensed under the GNU General Public License v2 (the "License"); -# you may not use this file except in compliance with the License. The terms -# of the License are located in the COPYING file of this distribution. -# - -exec > /var/cache/tdnf/cached-updateinfo.txt - -tdnf -q --refresh updateinfo | grep -vE '^Refreshing|^Disabling' - -exit ${PIPESTATUS[0]} diff --git a/etc/motdgen.d/02-tdnf-updateinfo.sh b/etc/motdgen.d/02-tdnf-updateinfo.sh index fb386a08..5c8c90cc 100755 --- a/etc/motdgen.d/02-tdnf-updateinfo.sh +++ b/etc/motdgen.d/02-tdnf-updateinfo.sh @@ -2,6 +2,7 @@ # # Copyright (C) 2020 VMware, Inc. All Rights Reserved. +# Copyright (C) 2024, Broadcom, Inc. All Rights Reserved. # # Licensed under the GNU General Public License v2 (the "License"); # you may not use this file except in compliance with the License. The terms @@ -10,9 +11,13 @@ path="/var/cache/tdnf/cached-updateinfo.txt" +tdnf -q --refresh updateinfo | grep -vE '^Refreshing|^Disabling' > "${path}" + if [ -s "${path}" ]; then - grep -qE 'Security|Bugfix|Enhancement' "${path}" || exit 0 - echo; cat "${path}"; echo "Run 'tdnf updateinfo info' to see the details." + grep -qE 'Security|Bugfix|Enhancement' "${path}" || exit 0 + echo + cat "${path}" + echo "Run 'tdnf updateinfo info' to see the details." else - echo "tdnf update info not available yet!" + echo "tdnf update info not available yet!" fi diff --git a/pytests/tests/test_granular_perms.py b/pytests/tests/test_granular_perms.py index c905642b..581a5568 100644 --- a/pytests/tests/test_granular_perms.py +++ b/pytests/tests/test_granular_perms.py @@ -53,6 +53,10 @@ def run_tdnf_cmd(utils, cmd, rc): def setup_test(utils): run_bash_cmd(['userdel', '-f', test_usr], 'ignore') run_bash_cmd(['useradd', test_usr], 0, bash_cmd=True) + run_bash_cmd(['useradd', test_usr], 0, bash_cmd=True) + + if os.geteuid() != 0: + return 1 global pkgname pkgname = utils.config['sglversion_pkgname'] diff --git a/scripts/build-tdnf-rpms.in b/scripts/build-tdnf-rpms.in index fde75676..9f0d89ce 100755 --- a/scripts/build-tdnf-rpms.in +++ b/scripts/build-tdnf-rpms.in @@ -47,7 +47,7 @@ mkdir -p "${rpm_build_path}"/{SOURCES,BUILD,RPMS/"${arch}"} mv -f "${full_name}".tar.gz "${rpm_build_path}"/SOURCES dist=$(rpm -q glibc | cut -d'.' -f3) -rpmbuild --nodeps -D "dist .${dist}" -D "_topdir ${rpm_build_path}" -bb "${project_name}".spec +rpmbuild --nocheck -D "dist .${dist}" -D "_topdir ${rpm_build_path}" -bb "${project_name}".spec mkdir -p ${rpmdir} mv -f "${rpm_build_path}"/RPMS/"${arch}"/*.rpm ${rpmdir} diff --git a/tdnf.spec.in b/tdnf.spec.in index 61b432e6..a304f5c7 100644 --- a/tdnf.spec.in +++ b/tdnf.spec.in @@ -1,6 +1,5 @@ -%define hist_db_dir %{_sharedstatedir}/%{name} +%define hist_db_dir %{_libdir}/sysimage/%{name} %define history_db_fn %{hist_db_dir}/history.db -%define history_autoins %{hist_db_dir}/autoinstalled %define history_util %{_libexecdir}/%{name}/%{name}-history-util %define _tdnfpluginsdir %{_libdir}/%{name}-plugins @@ -143,43 +142,36 @@ Requires: %{name} = %{version}-%{release} Systemd units that can periodically download package upgrades and apply them. %prep -%autosetup -p1 -n %{name}-%{version} +%autosetup -p1 %build -mkdir -p build -pushd build -cmake \ +%{cmake} \ -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_INSTALL_PREFIX=%{_prefix} \ -DCMAKE_INSTALL_LIBDIR=%{_libdir} \ -DSYSTEMD_DIR=%{_unitdir} \ .. -%make_build -%make_build python -popd +%{cmake_build} +%make_build -C %{__cmake_builddir} python %install -pushd build -%make_install %{?_smp_mflags} -popd +%{cmake_install} mkdir -p %{buildroot}{%{_var}/cache/%{name},%{_unitdir}} ln -sv %{name} %{buildroot}%{_bindir}/tyum ln -sv %{name} %{buildroot}%{_bindir}/yum ln -sv %{name} %{buildroot}%{_bindir}/tdnfj -pushd build/python -python3 setup.py install --skip-build --prefix=%{_prefix} --install-lib=%{python3_sitelib} --root=%{buildroot} +pushd %{__cmake_builddir}/python +%py3_install popd find %{buildroot} \( -name '*.a' -o -name '*.pyc' \) -delete -%if 0%{?with_check} %check pip3 install flake8 -%make_build -C build check -%endif +%make_build -C %{__cmake_builddir} check %post /sbin/ldconfig @@ -192,9 +184,7 @@ pip3 install flake8 # cannot use tdnf because that is still running even in postrans [ -d %{hist_db_dir} ] || mkdir -p %{hist_db_dir} [ -f %{history_db_fn} ] || %{history_util} init -[ ! -f %{history_autoins} ] || exit 0 -%{history_util} mark remove $(cat %{history_autoins}) -mv %{history_autoins} %{history_autoins}.backup +exit 0 %triggerin -- motd [ $2 -eq 1 ] || exit 0 @@ -230,7 +220,6 @@ rm -f %{_var}/cache/%{name}/cached-updateinfo.txt %{_bindir}/yum %{_bindir}/tdnfj %{_bindir}/%{name}-config -%{_bindir}/%{name}-cache-updateinfo %{_libdir}/libtdnf.so.* %{_libexecdir}/%{name}/%{name}-history-util %config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf