summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2012-08-10 20:59:06 (GMT)
committerDavid Malcolm <dmalcolm@redhat.com>2012-08-10 20:59:06 (GMT)
commit794d0789064aa6fb5bbfe111393037e3c0e623bb (patch)
treeb96cd00eeeba82a9b827291bbd68b20c50e74121
parent58e8a6c275c75dc06d3b2baef623932569c82240 (diff)
downloadpygobject3-794d0789064aa6fb5bbfe111393037e3c0e623bb.zip
pygobject3-794d0789064aa6fb5bbfe111393037e3c0e623bb.tar.gz
pygobject3-794d0789064aa6fb5bbfe111393037e3c0e623bb.tar.xz
3.3.4-8: add endianness patch (rhbz#841596; attachment 603634)
-rwxr-xr-xephemeral-x.sh186
-rw-r--r--fix-argument-to-array.patch147
-rw-r--r--pygobject3.spec11
3 files changed, 157 insertions, 187 deletions
diff --git a/ephemeral-x.sh b/ephemeral-x.sh
deleted file mode 100755
index 43349a3..0000000
--- a/ephemeral-x.sh
+++ /dev/null
@@ -1,186 +0,0 @@
-#!/bin/sh
-# Start an ephemeral X server.
-#
-# This is useful for when you want to lauch an X server for a specific
-# process. When that process exits, the X server will be killed.
-#
-
-XSERVER=Xvfb
-WINMGR=
-
-prog=$0
-usage() {
- echo "Usage: $prog [-x XSERVER] [-w WINDOWMANAGER] [-q] [-h] <command>"
- echo "-h this help"
- echo "-q quiet"
- echo "-w window manager process to start once Xserver is up"
- echo " (default: '$WINMGR')"
- echo "-x Xserver (and args) to run"
- echo " (default: '$XSERVER')"
- echo
- echo "This tool will pick an unused DISPLAY value (:0, :1, etc) and"
- echo "start an Xserver on that display, then run your command."
- echo
- echo "Examples:"
- echo " $prog -x 'Xephyr -screen 1280x720' xterm"
- echo " $prog -x 'Xvnc -httpd /usr/share/vnc/classes -geometry 1024x768 -depth 24' -w "gnome-session" firefox"
-}
-
-quiet() {
- [ "0$QUIET" -eq 1 ]
-}
-
-test_x_available() {
- xsocket=$1
- ! test -S $xsocket
-}
-
-test_x_healthy() {
- xpid=$1
- xsocket=$2
- displaynum=$3
-
- # Try xterm to see if X is up.
- if which xterm > /dev/null 2>&1 ; then
- DISPLAY=:$displaynum xterm -e 'true'
- return $?
- fi
-
- # Try xdotool if available, if xterm is not.
- if which xdotool > /dev/null 2>&1 ; then
- DISPLAY=:$displaynum xdotool getmouselocation > /dev/null 2>&1
- return $?
- fi
-
- # Try lsof if no X clients (above) are available
- if which lsof > /dev/null 2>&1 ; then
- lsof -p $xpid | grep -qF $xsocket
- return $?
- fi
-
- echo "Unable to determine if X is healthy (no tools available)"
- return false
-}
-
-cleanup() {
- if [ ! -z "$winmgrpid" ] ; then
- kill -TERM "$winmgrpid" || true
- fi
- kill -TERM "$xpid" || true
-
- pkill -KILL -P $$ || true
-}
-
-eval "set -- $( (POSIXLY_CORRECT=1 getopt -s sh +x:w:qh "$@" || echo " "FAIL) | tr -d '\n' )"
-
-while [ "0$#" -gt 0 ] ; do
- case $1 in
- -x) XSERVER="$2"; shift ;;
- -w) WINMGR="$2"; shift ;;
- -q) QUIET=1 ;;
- -h) usage; exit ;;
- --) shift; break ;;
- esac
- shift
-done
-
-if [ "$1" = "FAIL" ] ; then
- usage
- exit 1
-fi
-
-num=-1
-XSERVERNAME=${XSERVER%% *}
-if ! which "$XSERVERNAME" > /dev/null 2>&1 ; then
- echo "Unable to find $XSERVERNAME. Aborting."
- cleanup
- exit 1
-fi
-
-while true; do
- num=$(expr $num + 1)
- xsocket=/tmp/.X11-unix/X$num
- quiet || echo "Trying :$num"
- test_x_available $xsocket || continue
- (
- if quiet ; then
- exec > /dev/null
- exec 2> /dev/null
- fi
- echo set -- $XSERVER
- set -- $XSERVER
- cmd=$1
- shift
- exec $cmd :$num "$@"
- ) &
- xpid=$!
-
- healthy=0
- for i in 1 2 3 4 5 6 7 8 9 ; do
- # Break early if the xserver died
- #ps -p $xpid > /dev/null 2>&1 || break
- kill -0 $xpid > /dev/null 2>&1 || break
-
- # See if the xserver got a hold of the display socket.
- # If so, the server is up and healthy.
- sleep 1
- if test_x_healthy $xpid $xsocket $num ; then
- quiet || echo "$XSERVERNAME looks healthy. Moving on."
- healthy=1
- break
- fi
- sleep 0.2 || sleep 1 # In case your sleep doesn't take subsecond values
- done
-
- if [ "0$healthy" -eq 1 ] ; then
- break
- fi
-done
-
-export DISPLAY=:$num
-quiet || echo "Using display: $DISPLAY"
-
-if [ ! -z "$WINMGR" -a "$WINMGR" != "none" ] ; then
- if ! which $WINMGR > /dev/null 2>&1 ; then
- echo "Cannot find $WINMGR. Aborting."
- cleanup
- exit 1
- fi
- WINMGRNAME=${WINMGR%% *}
- quiet || echo "Starting window manager: $WINMGRNAME"
- (
- if quiet ; then
- exec > /dev/null
- exec 2> /dev/null
- fi
- $WINMGR
- ) &
- winmgrpid=$!
-
- # Wait for the window manager to startup
- quiet || echo "Waiting for window manager '$WINMGRNAME' to be healthy."
- # Wait for the window manager to start.
- for i in 1 2 3 4 5 6 7 8 9 10 ABORT ; do
- # A good signal that the WM has started is that the WM_STATE property is
- # set or that any NETWM/ICCCM property is set.
- if xprop -root | egrep -q 'WM_STATE|^_NET' ; then
- quiet || echo "$WINMGRNAME looks healthy. Moving on."
- break;
- fi
- sleep .5
-
- if [ "$i" = "ABORT" ] ; then
- quiet || echo "Window manager ($WINMGRNAME) seems to have failed starting up."
- cleanup
- exit 1
- fi
- done
-fi
-
-quiet || echo "Running: $@"
-(
- "$@"
-)
-exitcode=$?
-cleanup
-exit $exitcode
diff --git a/fix-argument-to-array.patch b/fix-argument-to-array.patch
new file mode 100644
index 0000000..929b49c
--- /dev/null
+++ b/fix-argument-to-array.patch
@@ -0,0 +1,147 @@
+diff --git a/gi/pygi-argument.c b/gi/pygi-argument.c
+index b885ba0..2eff676 100644
+--- a/gi/pygi-argument.c
++++ b/gi/pygi-argument.c
+@@ -31,6 +31,44 @@
+ #include <pyglib-python-compat.h>
+ #include <pyglib.h>
+
++static gboolean
++gi_argument_to_gssize (GIArgument *arg_in,
++ GITypeTag type_tag,
++ gssize *gssize_out)
++{
++ switch (type_tag) {
++ case GI_TYPE_TAG_INT8:
++ *gssize_out = arg_in->v_int8;
++ return TRUE;
++ case GI_TYPE_TAG_UINT8:
++ *gssize_out = arg_in->v_uint8;
++ return TRUE;
++ case GI_TYPE_TAG_INT16:
++ *gssize_out = arg_in->v_int16;
++ return TRUE;
++ case GI_TYPE_TAG_UINT16:
++ *gssize_out = arg_in->v_uint16;
++ return TRUE;
++ case GI_TYPE_TAG_INT32:
++ *gssize_out = arg_in->v_int32;
++ return TRUE;
++ case GI_TYPE_TAG_UINT32:
++ *gssize_out = arg_in->v_uint32;
++ return TRUE;
++ case GI_TYPE_TAG_INT64:
++ *gssize_out = arg_in->v_int64;
++ return TRUE;
++ case GI_TYPE_TAG_UINT64:
++ *gssize_out = arg_in->v_uint64;
++ return TRUE;
++ default:
++ PyErr_Format (PyExc_TypeError,
++ "Unable to marshal %s to gssize",
++ g_type_tag_to_string(type_tag));
++ return FALSE;
++ }
++}
++
+ void
+ _pygi_hash_pointer_to_arg (GIArgument *arg,
+ GITypeTag type_tag)
+@@ -708,6 +746,7 @@ check_number_release:
+ * @arg: The argument to convert
+ * @args: Arguments to method invocation, possibly contaning the array length.
+ * Set to NULL if this is not for a method call
++ * @callable_info: Info on the callable, if this a method call; otherwise NULL
+ * @type_info: The type info for @arg
+ * @out_free_array: A return location for a gboolean that indicates whether
+ * or not the wrapped GArray should be freed
+@@ -725,6 +764,7 @@ check_number_release:
+ GArray *
+ _pygi_argument_to_array (GIArgument *arg,
+ GIArgument *args[],
++ GICallableInfo *callable_info,
+ GITypeInfo *type_info,
+ gboolean *out_free_array)
+ {
+@@ -762,12 +802,19 @@ _pygi_argument_to_array (GIArgument *arg,
+ return g_array;
+ }
+ gint length_arg_pos;
++ GIArgInfo *length_arg_info;
++ GITypeInfo *length_type_info;
+
+ length_arg_pos = g_type_info_get_array_length (type_info);
+ g_assert (length_arg_pos >= 0);
+-
+- /* FIXME: Take into account the type of the length argument */
+- length = args[length_arg_pos]->v_int;
++ g_assert (callable_info);
++ length_arg_info = g_callable_info_get_arg(callable_info, length_arg_pos);
++ length_type_info = g_arg_info_get_type(length_arg_info);
++ if (!gi_argument_to_gssize (args[length_arg_pos],
++ g_type_info_get_tag(length_type_info),
++ &length)) {
++ return NULL;
++ }
+ }
+ }
+
+diff --git a/gi/pygi-argument.h b/gi/pygi-argument.h
+index 1b9ef1d..1785f8f 100644
+--- a/gi/pygi-argument.h
++++ b/gi/pygi-argument.h
+@@ -50,6 +50,7 @@ gint _pygi_g_registered_type_info_check_object (GIRegisteredTypeInfo *info,
+
+ GArray* _pygi_argument_to_array (GIArgument *arg,
+ GIArgument *args[],
++ GICallableInfo *callable_info,
+ GITypeInfo *type_info,
+ gboolean *out_free_array);
+
+diff --git a/gi/pygi-closure.c b/gi/pygi-closure.c
+index 824d620..59721af 100644
+--- a/gi/pygi-closure.c
++++ b/gi/pygi-closure.c
+@@ -351,6 +351,7 @@ _pygi_closure_convert_arguments (GICallableInfo *callable_info, void **args,
+
+ if (g_type_info_get_tag (arg_type) == GI_TYPE_TAG_ARRAY)
+ arg->v_pointer = _pygi_argument_to_array (arg, args,
++ callable_info,
+ arg_type, &free_array);
+
+ value = _pygi_argument_to_object (arg, arg_type, transfer);
+diff --git a/gi/pygi-info.c b/gi/pygi-info.c
+index 9f92cd3..3ca5c8f 100644
+--- a/gi/pygi-info.c
++++ b/gi/pygi-info.c
+@@ -1157,7 +1157,7 @@ _wrap_g_constant_info_get_value (PyGIBaseInfo *self)
+ type_info = g_constant_info_get_type ( (GIConstantInfo *) self->info);
+
+ if (g_type_info_get_tag (type_info) == GI_TYPE_TAG_ARRAY) {
+- value.v_pointer = _pygi_argument_to_array (&value, NULL,
++ value.v_pointer = _pygi_argument_to_array (&value, NULL, NULL,
+ type_info, &free_array);
+ }
+
+@@ -1290,7 +1290,7 @@ _wrap_g_field_info_get_value (PyGIBaseInfo *self,
+ }
+
+ if (g_type_info_get_tag (field_type_info) == GI_TYPE_TAG_ARRAY) {
+- value.v_pointer = _pygi_argument_to_array (&value, NULL,
++ value.v_pointer = _pygi_argument_to_array (&value, NULL, NULL,
+ field_type_info, &free_array);
+ }
+
+diff --git a/gi/pygi-signal-closure.c b/gi/pygi-signal-closure.c
+index 4e9dcb5..83f9a41 100644
+--- a/gi/pygi-signal-closure.c
++++ b/gi/pygi-signal-closure.c
+@@ -154,7 +154,7 @@ pygi_signal_closure_marshal(GClosure *closure,
+ arg = _pygi_argument_from_g_value(&param_values[i], &type_info);
+
+ if (g_type_info_get_tag (&type_info) == GI_TYPE_TAG_ARRAY) {
+- arg.v_pointer = _pygi_argument_to_array (&arg, NULL,
++ arg.v_pointer = _pygi_argument_to_array (&arg, NULL, NULL,
+ &type_info, &free_array);
+ }
+
diff --git a/pygobject3.spec b/pygobject3.spec
index 4e925e5..2cfb664 100644
--- a/pygobject3.spec
+++ b/pygobject3.spec
@@ -22,7 +22,7 @@
Name: pygobject3
Version: 3.3.4
-Release: 7%{?dist}
+Release: 8%{?dist}
License: LGPLv2+ and MIT
Group: Development/Languages
Summary: Python 2 bindings for GObject Introspection
@@ -77,6 +77,10 @@ Patch4: fix-list-marshalling-on-big-endian-machines.patch
# Not yet sent upstream:
Patch5: test-list-marshalling.patch
+# Fix endianness issue in _pygi_argument_to_array (rhbz#841596;
+# attachment 603634):
+Patch6: fix-argument-to-array.patch
+
### Build Dependencies ###
@@ -152,6 +156,7 @@ for use in Python 3 programs.
%patch3 -p1 -b .endianness-fixes
%patch5 -p1 -b .test-list-marshalling
+%patch6 -p1 -b .fix-argument-to-array
%if 0%{?with_python3}
rm -rf %{py3dir}
@@ -203,6 +208,7 @@ find $RPM_BUILD_ROOT -name '*.a' -delete
# File "/builddir/build/BUILD/python3-pygobject3-3.3.4-4.fc19/gi/__init__.py", line 23, in <module>
# from ._gi import _API, Repository
#ValueError: level must be >= 0
+# Reported upstream as http://bugs.python.org/issue15610
%if 0
pushd %{py3dir}
PYTHON=%{__python3}
@@ -248,6 +254,9 @@ xvfb-run make DESTDIR=$RPM_BUILD_ROOT check %{verbosity}
%endif # with_python3
%changelog
+* Fri Aug 10 2012 David Malcolm <dmalcolm@redhat.com> - 3.3.4-8
+- add endianness patch (rhbz#841596; attachment 603634)
+
* Fri Aug 10 2012 David Malcolm <dmalcolm@redhat.com> - 3.3.4-7
- update endianness patch for rhbz#841596 (to attachment 603367)