From c65b8ccb28079f0c22b22ba1b2042d45924dfb9315043f8c409ec46aaeadb553 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Mon, 27 Jan 2014 20:35:55 +0000 Subject: [PATCH] - Try to introduce back the posttrans symlink creation needed for proper use of the "noarch" packages. - Support update from older releases. Rpm can't handle dir->link. OBS-URL: https://build.opensuse.org/package/show/LibreOffice:Factory/libreoffice?expand=0&rev=95 --- libreoffice.changes | 11 +++++++++++ libreoffice.spec | 14 ++++++++++++++ link-to-ooo-home | 40 +++++++++++++++++++--------------------- 3 files changed, 44 insertions(+), 21 deletions(-) diff --git a/libreoffice.changes b/libreoffice.changes index 496954c..c16f076 100644 --- a/libreoffice.changes +++ b/libreoffice.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Mon Jan 27 20:35:11 UTC 2014 - tchvatal@suse.com + +- Try to introduce back the posttrans symlink creation needed + for proper use of the "noarch" packages. + +------------------------------------------------------------------- +Mon Jan 27 10:07:33 UTC 2014 - tchvatal@suse.com + +- Support update from older releases. Rpm can't handle dir->link. + ------------------------------------------------------------------- Sun Jan 26 17:34:58 UTC 2014 - tchvatal@suse.com diff --git a/libreoffice.spec b/libreoffice.spec index 85f6c60..09dc729 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -720,6 +720,14 @@ Provides additional %{langname} translations and resources for %{project}. \ } \ %{-i:%{expand:%%_langpack_common %{-i*}}} \ } \ +\ +%posttrans %{pkgname} \ +rpm -ql %{pkgname} > %{_datadir}/libreoffice/%{pkgname}_list.txt || true \ +%{_datadir}/libreoffice/link-to-ooo-home %{_datadir}/libreoffice/%{pkgname}_list.txt || true \ +\ +%postun %{pkgname} \ +test "$1" = "0" && %{_datadir}/libreoffice/link-to-ooo-home --unlink %{_datadir}/libreoffice/%{pkgname}_list.txt \ +rm -f %{_datadir}/libreoffice/%{pkgname}_list.txt 2> /dev/null \ %{nil} %langpack -l af -n Afrikaans @@ -1091,6 +1099,12 @@ rm -rf %{buildroot}%{_libdir}/%{name}/readmes/ # Remove after 12.2 is out of support/migration scope. bundled_cache="%{_libdir}/%{name}/share/prereg/bundled" test -d "$bundled_cache" && rm -rf "$bundled_cache"/* || true; +# Directory to symlink is not working in RPM so workaround it +# Remove after 13.1 is out of update scope. +helpdir="%{_libdir}/%{name}/share/help" +autotextdir="%{_libdir}/%{name}/share/autotext" +test -d "$helpdir" && rm -rf "$helpdir" || true ; +test -d "$autotextdir" && rm -rf "$autotextdir" || true ; %post /sbin/ldconfig diff --git a/link-to-ooo-home b/link-to-ooo-home index 33f114c..a477fdd 100644 --- a/link-to-ooo-home +++ b/link-to-ooo-home @@ -12,33 +12,31 @@ change_linking() { local linkfile="" local linkdir="" - # If we are starting up then create the folder structure first + # Decide if we are linking or wiping first if ${link_mode}; then - for dir in `grep "%dir" ${filelist} | sed "s|%dir ||"` ; do - mkdir -p "${dir/${datadir}/${libdir}}" + # Grab all files from the proper folder + for file in `grep "/usr/share/libreoffice" ${fielist} | sort`; do + # if we get ourselves folder then just create it + # it might not be around so lets be safe + if [[ -d "${file}" ]] ; then + mkdir -p "${dir/${datadir}/${libdir}}" + continue + fi + ln -sf "${file}" "${file/${datadir}/${libdir}}" || exit 1 done - fi - - # Create link for each regular file or prune the link if removing - for file in `grep -v "%dir" ${filelist} | sed "s|%config ||"` ; do - linkfile=${file/${datadir}/${libdir}} - if ${link_mode}; then - ln -sf "${file}" "${linkfile}" || exit 1 - else - # remove only empty (broken links) - # there might be multiple deps providing the same + else + # first just remove the symlinks + for file in `grep "/usr/share/libreoffice" ${fielist} | sort`; do + linkfile=${file/${datadir}/${libdir}} if [[ -L "${linkfile}" && ! -r "${linfile}" ]]; then rm -f "${linkfile}" || exit 1 fi - fi - done - - # Remove all empty dirs but validate if they do not belong - # to some other pkg too - if ! ${link_mode}; then - for dir in `grep "%dir" ${filelist} | sed "s|%dir ||"` ; do + done + # continue by wiping out all EMPTY dirs + # we have to be sure it is not owned by anything else + # doing in 2nd run to ensure avoiding collisions + for file in `grep "/usr/share/libreoffice" ${fielist} | sort`; do linkdir="${dir/${datadir}/${libdir}}" - # Check if dir is empty if [[ -d "${linkdir}" && -z `ls "${linkdir}"/*` ]]; then # check if nothing else owns the dir if [[ $(rpm -qf "${dir}" 2>/dev/null |wc -l) == 0 ]]; then