summaryrefslogtreecommitdiff
path: root/debian/pypy.postinst.in
diff options
context:
space:
mode:
Diffstat (limited to 'debian/pypy.postinst.in')
-rw-r--r--debian/pypy.postinst.in65
1 files changed, 65 insertions, 0 deletions
diff --git a/debian/pypy.postinst.in b/debian/pypy.postinst.in
new file mode 100644
index 0000000..237fece
--- /dev/null
+++ b/debian/pypy.postinst.in
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+if [ '#ARCH#' = 'i386' ]; then
+ pypy -c '' 2>/dev/null
+ if [ $? -eq 132 ]; then
+ echo "PyPy doesn't appear to support this CPU." >&2
+ echo "SSE2 is required." >&2
+ exit 1
+ fi
+fi
+
+set -e
+
+hook() {
+ local action old new
+ hook=$1
+ action=$2
+ old_v=$3
+ new_v=$4
+ old=pypy
+ new=pypy
+ echo "running pypy $action hooks for $new_v"
+ for script in /usr/lib/pypy/runtime.d/*."$hook"; do
+ [ -x "$script" ] || continue
+ if ! "$script" "$action" "$old" "$new"; then
+ echo >&2 "error running pypy $action hook $(basename "$script")"
+ return 1
+ fi
+ done
+}
+
+case "$1" in
+ configure)
+ if [ -n "$2" ] && dpkg --compare-versions "$2" le 2.2; then
+ # We weren't running pypyclean in prerm in versions before 2.2
+ pypyclean /usr/lib/pypy/lib-python /usr/lib/pypy/lib_pypy
+ fi
+
+ pypycompile -p pypy -p 'pypy-lib:#ARCH#'
+
+ old_version=$(echo $2 | sed 's/\([[:digit:]]*\.[[:digit:]]*\).*/\1/')
+ new_version=$(echo "#VERSION#" | sed 's/\([[:digit:]]*\.[[:digit:]]*\).*/\1/')
+ if [ "$old_version" != "$new_version" ]; then
+ hook rtupdate rtupdate "$old_version" "$new_version" || exit 4
+ hook rtupdate post-rtupdate "$old_version" "$new_version" || exit 5
+ elif [ -n "$2" ] && dpkg --compare-versions "$2" le 4.0.0+dfsg-1; then
+ # Force a re-byte-compile. PyPy 4.0.0+dfsg-1 had tag pypy-40, but
+ # 4.0.0+dfsg-2 goes back to pypy-26 #803689
+ /usr/lib/pypy/runtime.d/public_modules.rtupdate rtupdate
+ fi
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+#DEBHELPER#
+
+exit 0
+# vim:set et ts=4 sw=4: