1+ %define hist_db_dir %{_libdir }/sysimage/%{name }
2+ %define history_db_fn %{hist_db_dir }/history.db
3+ %define history_autoins %{_sharedstatedir }/%{name }/autoinstalled
4+ %define history_util %{_libdir }/%{name }/%{name }-history-util
5+ %define _tdnfpluginsdir %{_libdir }/%{name }-plugins
6+
7+ %global automatic_services %{name }-automatic.timer %{name }-automatic-notifyonly.timer %{name }-automatic-install.timer
8+
19Summary: dnf/yum equivalent using C libs
210Name: tdnf
311Version: 3.5.10
4- Release: 1 %{?dist }
12+ Release: 2 %{?dist }
513Vendor: VMware, Inc.
614Distribution: Photon
715License: LGPLv2.1,GPLv2
@@ -14,6 +22,7 @@ Source0: https://github.com/vmware/tdnf/archive/refs/tags/%{name}-%{version}.tar
1422Patch0: 0001-do-not-nuke-RPMBUILD_DIR-in-pytests-since-it-can-be-.patch
1523Patch1: rpm-keyring-API-calls-1.patch
1624Patch2: rpm-keyring-API-calls-2.patch
25+ Patch3: updateinfo.patch
1726
1827Requires: rpm-libs
1928Requires: curl-libs
@@ -57,9 +66,6 @@ Provides: yum
5766%description
5867%{name } is a yum/dnf equivalent which uses libsolv and libcurl
5968
60- %define _tdnfpluginsdir %{_libdir }/%{name }-plugins
61- %define _tdnf_history_db_dir /usr/lib/sysimage/%{name }
62-
6369%package devel
6470Summary: A Library providing C API for %{name }
6571Group: Development/Libraries
@@ -138,42 +144,43 @@ Systemd units that can periodically download package upgrades and apply them.
138144%autosetup -p1 -n %{name }-%{version }
139145
140146%build
141- %cmake \
147+ %{ cmake } \
142148 -DCMAKE_BUILD_TYPE=Debug \
143149 -DBUILD_SHARED_LIBS=OFF \
144150 -DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir } \
145151 -DSYSTEMD_DIR=%{_unitdir } \
146- -DHISTORY_DB_DIR=%{_tdnf_history_db_dir }
147-
148- %cmake_build
152+ -DHISTORY_DB_DIR=%{hist_db_dir }
149153
150- cd %{__cmake_builddir}
151- %make_build python
154+ %{cmake_build }
152155
153- %if 0%{?with_check }
154- %check
155- pip3 install flake8
156- cd %{__cmake_builddir} && make %{?_smp_mflags } check
157- %endif
156+ %make_build -C %{__cmake_builddir} python
158157
159158%install
160- %cmake_install
161- find %{buildroot } -name ' *.a' -delete
162- mkdir -p %{buildroot }/var/cache/%{name } %{buildroot }%{_unitdir }
163- mkdir -p %{buildroot }%{_tdnf_history_db_dir }
159+ %{cmake_install }
160+
161+ protected_dir= "%{_sysconfdir }/%{name }/protected.d"
162+
163+ mkdir -p %{buildroot }{%{_var }/cache/%{name },%{_unitdir }} \
164+ %{buildroot }%{hist_db_dir } \
165+ %{buildroot }${protected_dir}
166+
164167ln -sfv %{name } %{buildroot }%{_bindir }/tyum
165168ln -sfv %{name } %{buildroot }%{_bindir }/yum
166169ln -sfv %{name } %{buildroot }%{_bindir }/tdnfj
167170
168- mkdir -p %{buildroot }%{_sysconfdir }/%{name }/protected.d && \
169- echo %{name } > %{buildroot }%{_sysconfdir }/%{name }/protected.d/%{name }.conf
171+ echo %{name } > %{buildroot }${protected_dir}/%{name }.conf
170172
171173pushd %{__cmake_builddir}/python
172174%py3_install
173175popd
174- find %{buildroot } -name '*.pyc' -delete
175176
176- %pre
177+ find %{buildroot } \( -name '*.a' -o -name '*.pyc' \) -delete
178+
179+ rm %{buildroot }%{_unitdir }/%{name }-cache-updateinfo.{timer,service}
180+
181+ %check
182+ pip3 install flake8
183+ %make_build -C %{__cmake_builddir} check
177184
178185%post
179186/sbin/ldconfig
@@ -183,46 +190,36 @@ find %{buildroot} -name '*.pyc' -delete
183190# to the new db.
184191# must be postrans because we read the rpm db
185192# cannot use tdnf because that is still running even in postrans
186- [ -f %{_tdnf_history_db_dir}/history.db ] || %{_libdir }/tdnf/tdnf-history-util init
187- if [ -f %{_sharedstatedir}/tdnf/autoinstalled ] ; then
188- %{_libdir}/tdnf/tdnf-history-util mark remove $( cat %{_sharedstatedir}/tdnf/autoinstalled) && \
189- rm %{_sharedstatedir}/tdnf/autoinstalled
193+ [ -d %{hist_db_dir} ] || mkdir -p %{hist_db_dir }
194+ [ -f %{history_db_fn} ] || %{history_util } init
195+ if [ -f %{history_autoins} ]; then
196+ %{history_util} mark remove $( cat %{history_autoins})
197+ mv %{history_autoins} %{history_autoins}.backup
190198fi
199+ exit 0
191200
192201%triggerin -- motd
193202[ $2 -eq 1 ] || exit 0
194- if [ $1 -eq 1 ]; then
195- echo "detected install of %{name }/motd, enabling %{name }-cache-updateinfo.timer" > &2
196- systemctl enable %{name }-cache-updateinfo.timer > /dev/null 2> &1 || :
197- systemctl start %{name }-cache-updateinfo.timer > /dev/null 2> &1 || :
198- elif [ $1 -eq 2 ]; then
203+ if [ $1 -eq 2 ]; then
199204 echo "detected upgrade of %{name }, daemon-reload" > &2
200205 systemctl daemon-reload > /dev/null 2> &1 || :
201206fi
202207
203208%preun
204209%triggerun -- motd
205210[ $1 -eq 1 ] && [ $2 -eq 1 ] && exit 0
206- echo " detected uninstall of %{name}/motd, disabling %{name}-cache-updateinfo.timer" >&2
207- systemctl --no-reload disable %{name }-cache-updateinfo.timer > /dev/null 2>&1 || :
208- systemctl stop %{name }-cache-updateinfo.timer > /dev/null 2>&1 || :
209- rm -f /var/cache/%{name }/cached-updateinfo.txt
211+ echo " detected uninstall of %{name}/motd" >&2
212+ rm -f %{_var }/cache/%{name }/cached-updateinfo.txt
210213
211214%postun
212215/sbin/ldconfig
213- %triggerpostun -- motd
214- [ $1 -eq 1 ] && [ $2 -eq 1 ] || exit 0
215- echo " detected upgrade of %{name}/motd, restarting %{name}-cache-updateinfo.timer" >&2
216- systemctl try-restart %{name }-cache-updateinfo.timer > /dev/null 2>&1 || :
217216
218217%post cli-libs
219218/sbin/ldconfig
220219
221220%postun cli-libs
222221/sbin/ldconfig
223222
224- %global automatic_services %{name }-automatic.timer %{name }-automatic-notifyonly.timer %{name }-automatic-install.timer
225-
226223%post automatic
227224%systemd_post %{automatic_services }
228225
@@ -239,16 +236,13 @@ systemctl try-restart %{name}-cache-updateinfo.timer >/dev/null 2>&1 || :
239236%{_bindir }/yum
240237%{_bindir }/tdnfj
241238%{_bindir }/tdnf-config
242- %{_bindir }/tdnf-cache-updateinfo
243239%{_libdir }/libtdnf.so.*
244240%{_libdir }/tdnf/tdnf-history-util
245241%config(noreplace) %{_sysconfdir }/%{name }/%{name }.conf
246242%config(noreplace) %{_sysconfdir }/%{name }/protected.d/%{name }.conf
247- %config %{_unitdir }/%{name }-cache-updateinfo.service
248- %config(noreplace) %{_unitdir }/%{name }-cache-updateinfo.timer
249243%config %{_sysconfdir }/motdgen.d/02-%{name }-updateinfo.sh
250- %dir /var /cache/%{name }
251- %dir %{_tdnf_history_db_dir }
244+ %dir %{ _var } /cache/%{name }
245+ %dir %{hist_db_dir }
252246%{_datadir }/bash-completion/completions/%{name }
253247
254248%files devel
@@ -297,6 +291,9 @@ systemctl try-restart %{name}-cache-updateinfo.timer >/dev/null 2>&1 || :
297291%{_unitdir }/%{name }-automatic-notifyonly.service
298292
299293%changelog
294+ * Fri Jan 31 2025 Shreenidhi Shedi <shreenidhi.shedi@broadcom.com> 3.5.10-2
295+ - Remove updateinfo timer
296+ - MOTD has its own timer now
300297* Wed Dec 18 2024 Shreenidhi Shedi <shreenidhi.shedi@broadcom.com> 3.5.10-1
301298- Upgrade to v3.5.10
302299* Tue Jun 25 2024 Oliver Kurth <oliver.kurth@broadcom.com> 3.5.7-1
0 commit comments