- 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
This commit is contained in:
Tomáš Chvátal 2014-01-27 20:35:55 +00:00 committed by Git OBS Bridge
parent 3133550ef8
commit c65b8ccb28
3 changed files with 44 additions and 21 deletions

View File

@ -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

View File

@ -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

View File

@ -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