Skip to content

Commit

Permalink
Merge pull request vmware#508 from sshedi/updateinfo-fix
Browse files Browse the repository at this point in the history
Fix updateinfo script
  • Loading branch information
oliverkurth authored and sshedi committed Dec 18, 2024
2 parents 56681b2 + ec54913 commit a823d37
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 42 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 0 additions & 1 deletion bin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
15 changes: 0 additions & 15 deletions bin/tdnf-cache-updateinfo.in

This file was deleted.

11 changes: 8 additions & 3 deletions etc/motdgen.d/02-tdnf-updateinfo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
4 changes: 4 additions & 0 deletions pytests/tests/test_granular_perms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-tdnf-rpms.in
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
31 changes: 10 additions & 21 deletions tdnf.spec.in
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a823d37

Please sign in to comment.