diff -Nru python-babel-1.3+dfsg.1/debian/changelog python-babel-1.3+dfsg.1/debian/changelog --- python-babel-1.3+dfsg.1/debian/changelog 2014-01-15 07:38:42.000000000 +0100 +++ python-babel-1.3+dfsg.1/debian/changelog 2014-06-08 18:48:54.000000000 +0200 @@ -1,3 +1,10 @@ +python-babel (1.3+dfsg.1-2ubuntu2) trusty; urgency=medium + + * Backport the python-babel package scripts from 1.3+dfsg.1-3 to fix upgrade + issue with the directory to symlink conversion (lp: #1299442) + + -- Michael Bienia Sun, 18 May 2014 11:55:11 +0200 + python-babel (1.3+dfsg.1-2ubuntu1) trusty; urgency=medium * Don't touch pyshared in debian/rules. diff -Nru python-babel-1.3+dfsg.1/debian/control python-babel-1.3+dfsg.1/debian/control --- python-babel-1.3+dfsg.1/debian/control 2013-12-06 15:56:06.000000000 +0100 +++ python-babel-1.3+dfsg.1/debian/control 2014-05-18 11:59:07.000000000 +0200 @@ -1,7 +1,8 @@ Source: python-babel Section: python Priority: optional -Maintainer: Debian Python Modules Team +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Debian Python Modules Team Uploaders: Christoph Haas , Thomas Goirand Build-Depends: debhelper (>= 9), python-all (>= 2.6.6-3), diff -Nru python-babel-1.3+dfsg.1/debian/python-babel.postinst python-babel-1.3+dfsg.1/debian/python-babel.postinst --- python-babel-1.3+dfsg.1/debian/python-babel.postinst 2013-12-06 15:56:06.000000000 +0100 +++ python-babel-1.3+dfsg.1/debian/python-babel.postinst 2014-06-08 18:45:44.000000000 +0200 @@ -2,8 +2,40 @@ set -e +## +## Postinst functions to replace a directory with a symlink +## +dir_to_symlink_postinst() { + local PATHNAME="$1" + local SYMLINK_TARGET="$2" + local LASTVERSION="$3" + local PACKAGE="$4" + + while [ "$1" != "--" -a $# -gt 0 ]; do shift; done + shift + + if [ -d "${PATHNAME}.dpkg-backup" ] && [ ! -h "$PATHNAME" ] && [ -d "$PATHNAME" ] && [ -f "$PATHNAME/.dpkg-staging-dir" ] ; then + # Move the contents of the staging directory to the symlink target, + # as those are all new files installed between this package being + # unpacked and configured. + rm "$PATHNAME/.dpkg-staging-dir" + find "$PATHNAME" -mindepth 1 -print0 | xargs -0 -i% mv -f "%" "$SYMLINK_TARGET/" + + # Remove the staging directory. + rmdir "$PATHNAME" + + # Do the actual switch. + ln -s "$SYMLINK_TARGET" "$PATHNAME" + + # We are left behind the old files owned by this package in the backup + # directory, just remove it. + rm -rf "${PATHNAME}.dpkg-backup" + fi +} + if [ "$1" = "configure" ] ; then update-alternatives --install /usr/bin/pybabel pybabel /usr/bin/pybabel-python2 300 + dir_to_symlink_postinst /usr/lib/python2.7/dist-packages/babel/localedata ../../../../share/python-babel-localedata/localedata 1.3+dfsg.1-2ubuntu2~ python-babel -- "$@" fi #DEBHELPER# diff -Nru python-babel-1.3+dfsg.1/debian/python-babel.postrm python-babel-1.3+dfsg.1/debian/python-babel.postrm --- python-babel-1.3+dfsg.1/debian/python-babel.postrm 2013-12-06 15:56:06.000000000 +0100 +++ python-babel-1.3+dfsg.1/debian/python-babel.postrm 2014-06-08 18:46:54.000000000 +0200 @@ -2,8 +2,38 @@ set -e +dir_to_symlink_postrm() { + local PATHNAME="$1" + local SYMLINK_TARGET="$2" + local LASTVERSION="$3" + local PACKAGE="$4" + + while [ "$1" != "--" -a $# -gt 0 ]; do shift; done + shift + + if [ "$1" = "purge" ] && [ -d "${PATHNAME}.dpkg-backup" ]; then + rm -rf "${PATHNAME}.dpkg-backup" + fi + if [ "$1" = "abort-install" -o "$1" = "abort-upgrade" ] && [ -n "$2" ] && [ -d "${PATHNAME}.dpkg-backup" ] && + [ \( ! -h "$PATHNAME" -a -d "$PATHNAME" -a -f "$PATHNAME/.dpkg-staging-dir" \) -o \( -h "$PATHNAME" -a "$(readlink -f $PATHNAME)" = "$SYMLINK_TARGET" \) ] && + dpkg --compare-versions "$2" le-nl "$LASTVERSION"; then + if [ -h "$PATHNAME" ]; then + rm -f "$PATHNAME" + else + # The staging directory must be empty, as no other package + # should have been unpacked inbetween. + rm -f "$PATHNAME/.dpkg-staging-dir" + rmdir "$PATHNAME" + fi + fi +} + if [ "$1" = "remove" ] || [ "$1" = "disappear" ]; then update-alternatives --remove pybabel /usr/bin/pybabel-python2 fi +dir_to_symlink_postrm /usr/lib/python2.7/dist-packages/babel/localedata ../../../../share/python-babel-localedata/localedata 1.3+dfsg.1-2ubuntu2~ python-babel -- "$@" + #DEBHELPER# + +exit 0 diff -Nru python-babel-1.3+dfsg.1/debian/python-babel.preinst python-babel-1.3+dfsg.1/debian/python-babel.preinst --- python-babel-1.3+dfsg.1/debian/python-babel.preinst 2013-12-06 15:56:06.000000000 +0100 +++ python-babel-1.3+dfsg.1/debian/python-babel.preinst 2014-06-08 18:47:08.000000000 +0200 @@ -2,14 +2,36 @@ set -e -if [ "${1}" = "upgrade" ] ; then - # What's below is needed for upgrading from packages before localedata was in an independent python-babel-localedata package. - for i in /usr/lib/python2.* ; do - if [ ! -h $i/dist-packages/babel/localedata ] && [ -d $i/dist-packages/babel/localedata ] ; then - find $i/dist-packages/babel/localedata -maxdepth 1 -type l -name '*.dat' -delete - rmdir $i/dist-packages/babel/localedata - fi - done +error() { + echo "error: $1" >&2 + exit 1 +} + +## +## Preinst functions to replace a directory with a symlink +## +dir_to_symlink_preinst() { + local PATHNAME="$1" + local SYMLINK_TARGET="$2" + local LASTVERSION="$3" + local PACKAGE="$4" + + # Skip remaining parameters up to -- + while [ "$1" != "--" -a $# -gt 0 ]; do shift; done + shift + + if [ -n "$DPKG_MAINTSCRIPT_NAME" ] || error "environment variable DPKG_MAINTSCRIPT_NAME is required" + [ -n "$1" ] || error "maintainer script parameters are missing" + + [ -n "$2" ] && [ ! -h "$PATHNAME" ] && [ -d "$PATHNAME" ] && dpkg --compare-versions "$2" le-nl "$LASTVERSION"; then + mv -f "$PATHNAME" "${PATHNAME}.dpkg-backup" + mkdir "$PATHNAME" + touch "$PATHNAME/.dpkg-staging-dir" + fi +} + +if [ "$1" = "install" -o "$1" = "upgrade" ] ; then + dir_to_symlink_preinst /usr/lib/python2.7/dist-packages/babel/localedata ../../../../share/python-babel-localedata/localedata 1.3+dfsg.1-2ubuntu2~ python-babel -- "$@" fi #DEBHELPER#