commit a64b324668622aa01d7e5198625655e835ad04fd
Author: Bastien Nocera <hadess(a)fedoraproject.org>
Date: Tue Mar 25 10:48:18 2008 +0000
- Update to 0.10.18
- Add patch to gst-inspect to generate RPM provides
- Add RPM find-provides script
.cvsignore | 2 +-
gstreamer-inspect-rpm-format.patch | 313 +++++++++++++++++++++++++++++++++++++
gstreamer.prov | 37 +++++
gstreamer.spec | 19 ++-
sources | 2 +-
5 files changed, 370 insertions(+), 3 deletions(-)
---
diff --git a/.cvsignore b/.cvsignore
index b3921f5..78da39f 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -1 +1 @@
-gstreamer-0.10.17.2.tar.bz2
+gstreamer-0.10.18.tar.bz2
diff --git a/gstreamer-inspect-rpm-format.patch b/gstreamer-inspect-rpm-format.patch
new file mode 100644
index 0000000..0661364
--- /dev/null
+++ b/gstreamer-inspect-rpm-format.patch
@@ -0,0 +1,313 @@
+Index: gst-inspect.c
+===================================================================
+RCS file: /cvs/gstreamer/gstreamer/tools/gst-inspect.c,v
+retrieving revision 1.137
+diff -u -p -u -p -r1.137 gst-inspect.c
+--- gst-inspect.c 29 Feb 2008 12:41:32 -0000 1.137
++++ gst-inspect.c 17 Mar 2008 18:56:00 -0000
+@@ -1168,9 +1168,219 @@ print_element_info (GstElementFactory *
+ return 0;
+ }
+
++static void
++print_gst_structure_append_field (GList *strings, const char *field)
++{
++ GList *s;
++
++ //g_message ("adding '%s' to the string", field);
++
++ for (s = strings; s != NULL; s = s->next) {
++ g_string_append (s->data, field);
++ }
++}
++
++static void
++print_gst_structure_append_field_index (GList *strings, const char *field, guint
num_items, guint offset)
++{
++ GList *s;
++ guint i;
++
++ //g_message ("adding '%s' to the string (num: %d offset: %d)", field,
num_items, offset);
++
++ for (s = strings, i = 0; s != NULL; s = s->next, i++) {
++ if (i == offset) {
++ //g_message ("adding '%s' at '%d'", field, i);
++ g_string_append (s->data, field);
++ }
++ if (i == num_items)
++ i = 0;
++ }
++
++}
++
++static GList *
++print_gst_structure_dup_fields (GList *strings, guint num_items)
++{
++ guint new_items, i;
++
++ if (num_items == 1)
++ return strings;
++
++ //g_message ("creating %d new items", num_items);
++
++ new_items = g_list_length (strings) * (num_items - 1);
++ for (i = 0; i < new_items; i++) {
++ GString *s, *first;
++
++ first = strings->data;
++ s = g_string_new_len (first->str, first->len);
++ strings = g_list_prepend (strings, s);
++ }
++
++ return strings;
++}
++
++enum {
++ FIELD_VERSION = 0,
++ FIELD_LAYER,
++ FIELD_VARIANT,
++ FIELD_SYSTEMSTREAM
++};
++
++static int
++field_get_type (const char *field_name)
++{
++ if (strstr (field_name, "version") != NULL)
++ return FIELD_VERSION;
++ if (strcmp (field_name, "layer") == 0)
++ return FIELD_LAYER;
++ if (strcmp (field_name, "systemstream") == 0)
++ return FIELD_SYSTEMSTREAM;
++ if (strcmp (field_name, "variant") == 0)
++ return FIELD_VARIANT;
++
++ return -1;
++}
++
++static gint
++fields_type_compare (const char *a, const char *b)
++{
++ gint a_type, b_type;
++
++ a_type = field_get_type (a);
++ b_type = field_get_type (b);
++ if (a_type < b_type)
++ return -1;
++ if (b_type < a_type)
++ return 1;
++ return 0;
++}
++
++static void
++print_gst_structure_for_rpm (const char *type_name, GstStructure *s)
++{
++ guint i, num_fields;
++ const char *name;
++ GList *fields, *l, *strings;
++ GString *string;
++
++ name = gst_structure_get_name (s);
++ strings = NULL;
++ num_fields = gst_structure_n_fields (s);
++ fields = NULL;
++
++ for (i = 0; i < num_fields; i++) {
++ const char *field_name;
++
++ field_name = gst_structure_nth_field_name (s, i);
++ if (field_get_type (field_name) < 0) {
++ //g_message ("ignoring field named %s", field_name);
++ continue;
++ }
++
++ fields = g_list_insert_sorted (fields, g_strdup (field_name), (GCompareFunc)
fields_type_compare);
++ }
++
++ /* Example:
++ * gstreamer0.10(decoder-video/mpeg)(mpegversion=1)()(64bit) */
++ string = g_string_new ("gstreamer0.10");
++ g_string_append_c (string, '(');
++ g_string_append (string, type_name);
++ g_string_append_c (string, '-');
++ g_string_append (string, name);
++ g_string_append_c (string, ')');
++
++ strings = g_list_append (strings, string);
++
++ for (l = fields; l != NULL; l = l->next) {
++ char *field_name;
++ GType type;
++
++ field_name = l->data;
++
++ type = gst_structure_get_field_type (s, field_name);
++ //g_message ("field is: %s, type: %s", field_name, g_type_name (type));
++
++ if (type == G_TYPE_INT) {
++ char *field;
++ int value;
++
++ gst_structure_get_int (s, field_name, &value);
++ field = g_strdup_printf ("(%s=%d)", field_name, value);
++ print_gst_structure_append_field (strings, field);
++ g_free (field);
++ } else if (type == G_TYPE_BOOLEAN) {
++ char *field;
++ int value;
++
++ gst_structure_get_boolean (s, field_name, &value);
++ field = g_strdup_printf ("(%s=%s)", field_name, value ? "true"
: "false");
++ print_gst_structure_append_field (strings, field);
++ g_free (field);
++ } else if (type == GST_TYPE_INT_RANGE) {
++ const GValue *value;
++ int min, max;
++
++ value = gst_structure_get_value (s, field_name);
++ min = gst_value_get_int_range_min (value);
++ max = gst_value_get_int_range_max (value);
++
++ strings = print_gst_structure_dup_fields (strings, max - min + 1);
++
++ for (i = min; i <= max; i++) {
++ char *field;
++
++ field = g_strdup_printf ("(%s=%d)", field_name, i);
++ print_gst_structure_append_field_index (strings, field, max - min + 1, i -
min);
++ g_free (field);
++ }
++ } else if (type == GST_TYPE_LIST) {
++ const GValue *value;
++ int num_items;
++
++ value = gst_structure_get_value (s, field_name);
++ num_items = gst_value_list_get_size (value);
++
++ strings = print_gst_structure_dup_fields (strings, num_items);
++
++ for (i = 0; i < num_items; i++) {
++ char *field;
++ const GValue *item_value;
++
++ item_value = gst_value_list_get_value (value, i);
++ field = g_strdup_printf ("(%s=%d)", field_name,
++ g_value_get_int (item_value));
++ print_gst_structure_append_field_index (strings, field, num_items, i);
++ g_free (field);
++ }
++ } else if (type == G_TYPE_STRING) {
++ char *field;
++ const char *value;
++
++ value = gst_structure_get_string (s, field_name);
++ field = g_strdup_printf ("(%s=%s)", field_name, value);
++ print_gst_structure_append_field (strings, field);
++ g_free (field);
++ } else {
++ g_warning ("unhandled type! %s", g_type_name (type));
++ }
++
++ g_free (field_name);
++ }
++
++ g_list_free (fields);
++
++ for (l = strings; l != NULL; l = l->next) {
++ string = l->data;
++ g_print ("%s\n", string->str);
++ g_string_free (string, TRUE);
++ }
++ g_list_free (strings);
++}
+
+ static void
+-print_plugin_automatic_install_info_codecs (GstElementFactory * factory)
++print_plugin_automatic_install_info_codecs (GstElementFactory * factory, gboolean
rpm_format)
+ {
+ GstPadDirection direction;
+ const gchar *type_name;
+@@ -1231,15 +1441,19 @@ print_plugin_automatic_install_info_code
+ gst_structure_remove_field (s, "rate");
+ gst_structure_remove_field (s, "depth");
+ gst_structure_remove_field (s, "clock-rate");
+- s_str = gst_structure_to_string (s);
+- g_print ("%s-%s\n", type_name, s_str);
+- g_free (s_str);
++ if (!rpm_format) {
++ s_str = gst_structure_to_string (s);
++ g_print ("%s-%s\n", type_name, s_str);
++ g_free (s_str);
++ } else {
++ print_gst_structure_for_rpm (type_name, s);
++ }
+ }
+ gst_caps_unref (caps);
+ }
+
+ static void
+-print_plugin_automatic_install_info_protocols (GstElementFactory * factory)
++print_plugin_automatic_install_info_protocols (GstElementFactory * factory, gboolean
rpm_format)
+ {
+ gchar **protocols, **p;
+
+@@ -1262,7 +1476,7 @@ print_plugin_automatic_install_info_prot
+ }
+
+ static void
+-print_plugin_automatic_install_info (GstPlugin * plugin)
++print_plugin_automatic_install_info (GstPlugin * plugin, gboolean rpm_format)
+ {
+ const gchar *plugin_name;
+ GList *features, *l;
+@@ -1282,11 +1496,12 @@ print_plugin_automatic_install_info (Gst
+ if (g_str_equal (plugin_name, feature->plugin_name)) {
+ GstElementFactory *factory;
+
+- g_print ("element-%s\n", gst_plugin_feature_get_name (feature));
++ if (!rpm_format)
++ g_print ("element-%s\n", gst_plugin_feature_get_name (feature));
+
+ factory = GST_ELEMENT_FACTORY (feature);
+- print_plugin_automatic_install_info_protocols (factory);
+- print_plugin_automatic_install_info_codecs (factory);
++ print_plugin_automatic_install_info_protocols (factory, rpm_format);
++ print_plugin_automatic_install_info_codecs (factory, rpm_format);
+ }
+ }
+
+@@ -1299,6 +1514,7 @@ main (int argc, char *argv[])
+ {
+ gboolean print_all = FALSE;
+ gboolean print_aii = FALSE;
++ gboolean print_aii_rpm = FALSE;
+ GOptionEntry options[] = {
+ {"print-all", 'a', 0, G_OPTION_ARG_NONE, &print_all,
+ N_("Print all elements"), NULL},
+@@ -1307,6 +1523,9 @@ main (int argc, char *argv[])
+ "provides.\n "
+ "Useful in connection with external automatic plugin "
+ "installation mechanisms"), NULL},
++ {"rpm", '\0', 0, G_OPTION_ARG_NONE, &print_aii_rpm,
++ N_("Print the machine-parsable list of features of a plugin in RPM "
++ "Provides compatible-format"), NULL},
+ GST_TOOLS_GOPTION_VERSION,
+ {NULL}
+ };
+@@ -1364,7 +1583,7 @@ main (int argc, char *argv[])
+ /* if there is such a plugin, print out info */
+ if (plugin) {
+ if (print_aii) {
+- print_plugin_automatic_install_info (plugin);
++ print_plugin_automatic_install_info (plugin, print_aii_rpm);
+ } else {
+ print_plugin_info (plugin);
+ print_plugin_features (plugin);
+@@ -1377,7 +1596,7 @@ main (int argc, char *argv[])
+
+ if (plugin) {
+ if (print_aii) {
+- print_plugin_automatic_install_info (plugin);
++ print_plugin_automatic_install_info (plugin, print_aii_rpm);
+ } else {
+ print_plugin_info (plugin);
+ print_plugin_features (plugin);
diff --git a/gstreamer.prov b/gstreamer.prov
new file mode 100755
index 0000000..0b19c7e
--- /dev/null
+++ b/gstreamer.prov
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# Script to install in:
+# /usr/lib/rpm/redhat/find-provides.d
+#
+# Transform GStreamer auto install info into RPM provides
+#
+# Author: Bastien Nocera <hadess(a)hadess.net>
+# Based on other provides scripts from RPM
+#
+
+filelist=`sed "s/['\"]/\\\&/g"`
+
+# --- Alpha does not mark 64bit dependencies•
+case `uname -m` in
+ alpha*) mark64="" ;;
+ *) mark64="()(64bit)" ;;
+esac
+
+solist=$(echo $filelist | grep "\\.so" | grep -v "^/lib/ld.so" | \
+ xargs file -L 2>/dev/null | grep "ELF.*shared object" | cut -d: -f1 | grep
libgst)
+
+function getmark()
+{
+ lib64=`if file -L $1 2>/dev/null | \
+ grep "ELF 64-bit" >/dev/null; then echo -n "$mark64"; fi`
+}
+
+for so in $solist ; do
+ getmark $so
+ gst-inspect --print-plugin-auto-install-info --rpm $so | while read line ; do
+ echo -n "$line";
+ echo -n "$lib64"
+ echo
+ done
+done
+
diff --git a/gstreamer.spec b/gstreamer.spec
index 838aa5d..b028764 100644
--- a/gstreamer.spec
+++ b/gstreamer.spec
@@ -5,7 +5,7 @@
%define _libxml2 2.4.0
Name: %{gstreamer}
-Version: 0.10.17.2
+Version: 0.10.18
Release: 1%{?dist}
Summary: GStreamer streaming media framework runtime
@@ -31,6 +31,10 @@ BuildRequires: gettext
# because AM_PROG_LIBTOOL was used in configure.ac
BuildRequires: gcc-c++
+# For the GStreamer RPM provides
+Patch1: gstreamer-inspect-rpm-format.patch
+Source1: gstreamer.prov
+
### documentation requirements
### not needed currrently
# BuildRequires: python2
@@ -94,6 +98,10 @@ with different major/minor versions of GStreamer.
%prep
%setup -q -n gstreamer-%{version}
+pushd tools/
+%patch1 -p0 -b .rpm-provides
+popd
+
%build
# 0.10.0: manuals do not build due to an openjade error; disable for now
%configure \
@@ -122,6 +130,8 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/*.a
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
# Create empty cache directory
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/cache/gstreamer-%{majorminor}
+# Add the provides script
+install -m0755 -D %{SOURCE1} $RPM_BUILD_ROOT%{_libdir}/rpm/gstreamer.prov
%clean
rm -rf $RPM_BUILD_ROOT
@@ -197,7 +207,14 @@ rm -rf $RPM_BUILD_ROOT
%doc %{_datadir}/gtk-doc/html/gstreamer-libs-%{majorminor}/*
%doc %{_datadir}/gtk-doc/html/gstreamer-plugins-%{majorminor}/*
+%{_libdir}/rpm/gstreamer.prov
+
%changelog
+* Wed Mar 19 2008 - Bastien Nocera <bnocera(a)redhat.com> - 0.10.18-1
+- Update to 0.10.18
+- Add patch to gst-inspect to generate RPM provides
+- Add RPM find-provides script
+
* Tue Mar 04 2008 - Bastien Nocera <bnocera(a)redhat.com> - 0.10.17.2-1
- Update to 0.10.17.2 pre-release
diff --git a/sources b/sources
index 7c25a3c..16e21ca 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-8744e49321f6d68dee05fbfa80deb342 gstreamer-0.10.17.2.tar.bz2
+3b2f9b2b50f7265bbaac8ea10a8279b8 gstreamer-0.10.18.tar.bz2