Update to last successful build
d2cd1341430c39d03e69f4576cc1f937d9e7f30f UsrEtc: Store logrotate files in %{_distconfdir} if defined (fixes #402) OBS-URL: https://build.opensuse.org/package/show/zypp:Head/libzypp?expand=0&rev=2486
This commit is contained in:
parent
014a2f7225
commit
707296034f
@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:d54863c526c8aedd0300fb40475b8d0a3cc1866bf084146ad15c87b8aa64440f
|
oid sha256:9c7bf6f428aad92d77f187f2e44d0f1dbfe2dfda9e97e3e1d485757940b2f9e7
|
||||||
size 5490444
|
size 5490613
|
||||||
|
86
libzypp.spec
86
libzypp.spec
@ -314,74 +314,34 @@ cd ..
|
|||||||
# Create filelist with translations
|
# Create filelist with translations
|
||||||
%{find_lang} zypp
|
%{find_lang} zypp
|
||||||
|
|
||||||
|
%if %{defined _distconfdir}
|
||||||
|
# Move logratate files form /etc/logrotate.d to /usr/etc/logrotate.d
|
||||||
|
mkdir -p %{buildroot}/%{_distconfdir}/logrotate.d
|
||||||
|
mv %{buildroot}/%{_sysconfdir}/logrotate.d/zypp-history.lr %{buildroot}%{_distconfdir}/logrotate.d
|
||||||
|
%endif
|
||||||
|
|
||||||
%check
|
%check
|
||||||
pushd build/tests
|
pushd build/tests
|
||||||
LD_LIBRARY_PATH="$(pwd)/../zypp:$LD_LIBRARY_PATH" ctest --output-on-failure .
|
LD_LIBRARY_PATH="$(pwd)/../zypp:$LD_LIBRARY_PATH" ctest --output-on-failure .
|
||||||
popd
|
popd
|
||||||
|
|
||||||
%post
|
%if %{defined _distconfdir}
|
||||||
/sbin/ldconfig
|
%pre
|
||||||
if [ -f /var/cache/zypp/zypp.db ]; then rm /var/cache/zypp/zypp.db; fi
|
# Prepare for migration to /usr/etc; save any old .rpmsave
|
||||||
|
for i in logrotate.d/zypp-history.lr; do
|
||||||
|
test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i}.rpmsave.old ||:
|
||||||
|
done
|
||||||
|
%endif
|
||||||
|
|
||||||
# convert old lock file to new
|
%if %{defined _distconfdir}
|
||||||
# TODO make this a separate file?
|
%posttrans
|
||||||
# TODO run the sript only when updating form pre-11.0 libzypp versions
|
# Migration to /usr/etc, restore just created .rpmsave
|
||||||
LOCKSFILE=%{_sysconfdir}/zypp/locks
|
for i in logrotate.d/zypp-history.lr; do
|
||||||
OLDLOCKSFILE=%{_sysconfdir}/zypp/locks.old
|
test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i} ||:
|
||||||
|
done
|
||||||
|
%endif
|
||||||
|
|
||||||
is_old(){
|
%post -p /sbin/ldconfig
|
||||||
# if no such file, exit with false (1 in bash)
|
|
||||||
test -f ${LOCKSFILE} || return 1
|
|
||||||
TEMP_FILE=`mktemp`
|
|
||||||
cat ${LOCKSFILE} | sed '/^\#.*/ d;/.*:.*/d;/^[^[a-zA-Z\*?.0-9]*$/d' > ${TEMP_FILE}
|
|
||||||
if [ -s ${TEMP_FILE} ]
|
|
||||||
then
|
|
||||||
RES=0
|
|
||||||
else
|
|
||||||
RES=1
|
|
||||||
fi
|
|
||||||
rm -f ${TEMP_FILE}
|
|
||||||
return ${RES}
|
|
||||||
}
|
|
||||||
|
|
||||||
append_new_lock(){
|
|
||||||
case "$#" in
|
|
||||||
1 )
|
|
||||||
echo "
|
|
||||||
solvable_name: $1
|
|
||||||
match_type: glob
|
|
||||||
" >> ${LOCKSFILE}
|
|
||||||
;;
|
|
||||||
2 ) #TODO version
|
|
||||||
echo "
|
|
||||||
solvable_name: $1
|
|
||||||
match_type: glob
|
|
||||||
Version: $2
|
|
||||||
" >> ${LOCKSFILE}
|
|
||||||
;;
|
|
||||||
3 ) #TODO version
|
|
||||||
echo "
|
|
||||||
solvable_name: $1
|
|
||||||
match_type: glob
|
|
||||||
Version: $2 $3
|
|
||||||
" >> ${LOCKSFILE}
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
die() {
|
|
||||||
echo $1
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
if is_old ${LOCKSFILE}
|
|
||||||
then
|
|
||||||
mv -f ${LOCKSFILE} ${OLDLOCKSFILE} || die "cannot backup old locks"
|
|
||||||
cat ${OLDLOCKSFILE}| sed "/^\#.*/d"| while read line
|
|
||||||
do
|
|
||||||
append_new_lock $line
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
%postun -p /sbin/ldconfig
|
%postun -p /sbin/ldconfig
|
||||||
|
|
||||||
@ -406,7 +366,11 @@ fi
|
|||||||
%dir %{_sysconfdir}/zypp/credentials.d
|
%dir %{_sysconfdir}/zypp/credentials.d
|
||||||
%config(noreplace) %{_sysconfdir}/zypp/zypp.conf
|
%config(noreplace) %{_sysconfdir}/zypp/zypp.conf
|
||||||
%config(noreplace) %{_sysconfdir}/zypp/systemCheck
|
%config(noreplace) %{_sysconfdir}/zypp/systemCheck
|
||||||
|
%if %{defined _distconfdir}
|
||||||
|
%{_distconfdir}/logrotate.d/zypp-history.lr
|
||||||
|
%else
|
||||||
%config(noreplace) %{_sysconfdir}/logrotate.d/zypp-history.lr
|
%config(noreplace) %{_sysconfdir}/logrotate.d/zypp-history.lr
|
||||||
|
%endif
|
||||||
%dir %{_var}/lib/zypp
|
%dir %{_var}/lib/zypp
|
||||||
%if "%{_libexecdir}" != "%{_prefix}/lib"
|
%if "%{_libexecdir}" != "%{_prefix}/lib"
|
||||||
%dir %{_libexecdir}/zypp
|
%dir %{_libexecdir}/zypp
|
||||||
|
Loading…
Reference in New Issue
Block a user