From f997c6795af0e66d31073b07dea1533332fa7b03 Mon Sep 17 00:00:00 2001 From: Daniel Gryniewicz Date: Tue, 17 Oct 2006 16:59:00 +0000 Subject: Add init-race fix for gstreamer from ubuntu svn path=/user/; revision=6 --- media-libs/gstreamer/Manifest | 12 +++ .../gstreamer/files/digest-gstreamer-0.10.10-r1 | 3 + .../files/gstreamer-0.10.10-fix-init-race.patch | 97 ++++++++++++++++++++++ media-libs/gstreamer/gstreamer-0.10.10-r1.ebuild | 67 +++++++++++++++ 4 files changed, 179 insertions(+) create mode 100644 media-libs/gstreamer/Manifest create mode 100644 media-libs/gstreamer/files/digest-gstreamer-0.10.10-r1 create mode 100644 media-libs/gstreamer/files/gstreamer-0.10.10-fix-init-race.patch create mode 100644 media-libs/gstreamer/gstreamer-0.10.10-r1.ebuild diff --git a/media-libs/gstreamer/Manifest b/media-libs/gstreamer/Manifest new file mode 100644 index 0000000..fa9ed4b --- /dev/null +++ b/media-libs/gstreamer/Manifest @@ -0,0 +1,12 @@ +AUX gstreamer-0.10.10-fix-init-race.patch 3088 RMD160 7c9c72ffef2856068969e143c6f542c4871a8a19 SHA1 2b70ca44e9673383b68a10640562ed84eb7e17b0 SHA256 cdd0185ed4a52e1921143620f479d24118ce27d702e583d452618cf7730ce1d7 +MD5 b52236d2b35967382d2ab67e942f770d files/gstreamer-0.10.10-fix-init-race.patch 3088 +RMD160 7c9c72ffef2856068969e143c6f542c4871a8a19 files/gstreamer-0.10.10-fix-init-race.patch 3088 +SHA256 cdd0185ed4a52e1921143620f479d24118ce27d702e583d452618cf7730ce1d7 files/gstreamer-0.10.10-fix-init-race.patch 3088 +DIST gstreamer-0.10.10.tar.bz2 1794450 RMD160 86f7028bb78ee88fb5eead9d3f9162e6f40a1315 SHA1 d3b87610a12e94b7c29bfee400cf178a832cd61a SHA256 d31981baee6a59ea87086f3bec19d2ab3e14f2ea75e47e70e39ca8acf4e87e59 +EBUILD gstreamer-0.10.10-r1.ebuild 2117 RMD160 344bbdfcfc146317d23fb301f9be99ccba93cbbf SHA1 cb8bbd938e48b2c502cc4eb417fefe11fecb79d7 SHA256 35472beffafd92d1355bf88edf875e3236c64db04fc30685c44706eeb47c2425 +MD5 e9ecfc43040a5104107abbc6da1e63fa gstreamer-0.10.10-r1.ebuild 2117 +RMD160 344bbdfcfc146317d23fb301f9be99ccba93cbbf gstreamer-0.10.10-r1.ebuild 2117 +SHA256 35472beffafd92d1355bf88edf875e3236c64db04fc30685c44706eeb47c2425 gstreamer-0.10.10-r1.ebuild 2117 +MD5 a3b8c99090fda4f0460baabe614d0b68 files/digest-gstreamer-0.10.10-r1 259 +RMD160 29b752d5dc17585ae80831ac8ba0d1d844df3310 files/digest-gstreamer-0.10.10-r1 259 +SHA256 1f3658533c0660c4c409894dc6b9ce69d0019322b84da30060a0fc5330d23e03 files/digest-gstreamer-0.10.10-r1 259 diff --git a/media-libs/gstreamer/files/digest-gstreamer-0.10.10-r1 b/media-libs/gstreamer/files/digest-gstreamer-0.10.10-r1 new file mode 100644 index 0000000..b831074 --- /dev/null +++ b/media-libs/gstreamer/files/digest-gstreamer-0.10.10-r1 @@ -0,0 +1,3 @@ +MD5 6875bf0bd3cf38b9ae1362b9e644e6fc gstreamer-0.10.10.tar.bz2 1794450 +RMD160 86f7028bb78ee88fb5eead9d3f9162e6f40a1315 gstreamer-0.10.10.tar.bz2 1794450 +SHA256 d31981baee6a59ea87086f3bec19d2ab3e14f2ea75e47e70e39ca8acf4e87e59 gstreamer-0.10.10.tar.bz2 1794450 diff --git a/media-libs/gstreamer/files/gstreamer-0.10.10-fix-init-race.patch b/media-libs/gstreamer/files/gstreamer-0.10.10-fix-init-race.patch new file mode 100644 index 0000000..e18d733 --- /dev/null +++ b/media-libs/gstreamer/files/gstreamer-0.10.10-fix-init-race.patch @@ -0,0 +1,97 @@ +diff --exclude-from=/home/dang/.diffrc -u -ruN gstreamer-0.10.10.orig/gst/gst.c gstreamer-0.10.10/gst/gst.c +--- gstreamer-0.10.10.orig/gst/gst.c 2006-09-14 10:02:23.000000000 -0400 ++++ gstreamer-0.10.10/gst/gst.c 2006-10-17 12:44:43.000000000 -0400 +@@ -683,10 +683,16 @@ + { + #ifdef HAVE_FORK + pid_t pid; ++ int pfd[2]; + + /* We fork here, and let the child read and possibly rebuild the registry. + * After that, the parent will re-read the freshly generated registry. */ + GST_DEBUG ("forking"); ++ ++ if (pipe (pfd) == -1) { ++ return FALSE; ++ } ++ + pid = fork (); + if (pid == -1) { + GST_ERROR ("Failed to fork()"); +@@ -695,8 +701,11 @@ + + if (pid == 0) { + gboolean res; ++ gchar res_byte; + +- /* this is the child */ ++ /* this is the child. Close the read pipe */ ++ close (pfd[0]); ++ + GST_DEBUG ("child reading registry cache"); + res = scan_and_update_registry (default_registry, registry_file, TRUE); + _gst_registry_remove_cache_plugins (default_registry); +@@ -708,38 +717,42 @@ + /* make valgrind happy (yes, you can call it insane) */ + g_free ((char *) registry_file); + +- _exit ((res) ? EXIT_SUCCESS : EXIT_FAILURE); ++ /* write a result byte to the pipe */ ++ res_byte = res ? '1' : '0'; ++ write (pfd[1], &res_byte, 1); ++ _exit (0); + } else { +- /* parent */ +- int status; +- pid_t ret; ++ int ret; ++ gchar res_byte; ++ ++ /* parent. Close write pipe */ ++ close (pfd[1]); ++ ++ /* Wait for result from the pipe */ ++ GST_DEBUG ("Waiting for data from child"); ++ ret = read (pfd[0], &res_byte, 1); + +- GST_DEBUG ("parent waiting on child"); +- ret = waitpid (pid, &status, 0); +- GST_DEBUG ("parent done waiting on child"); + if (ret == -1) { +- GST_ERROR ("error during waitpid: %s", g_strerror (errno)); ++ close (pfd[0]); + return FALSE; + } ++ close (pfd[0]); + +- if (!WIFEXITED (status)) { +- if (WIFSIGNALED (status)) { +- GST_ERROR ("child did not exit normally, terminated by signal %d", +- WTERMSIG (status)); +- } else { +- GST_ERROR ("child did not exit normally, status: %d", status); +- } ++ /* Wait to ensure the child is reaped, but ignore the result */ ++ GST_DEBUG ("parent waiting on child"); ++ waitpid (pid, NULL, 0); ++ GST_DEBUG ("parent done waiting on child"); ++ ++ if (ret == 0) { ++ GST_ERROR ("child did not exit normally, terminated by signal"); + return FALSE; + } + +- GST_DEBUG ("child exited normally with return value %d", +- WEXITSTATUS (status)); +- +- if (WEXITSTATUS (status) == EXIT_SUCCESS) { +- GST_DEBUG ("parent reading registry cache"); ++ if (res_byte == '1') { ++ GST_DEBUG ("Child succeeded. Parent reading registry cache"); + gst_registry_xml_read_cache (default_registry, registry_file); + } else { +- GST_DEBUG ("parent re-scanning registry"); ++ GST_DEBUG ("Child failed. Parent re-scanning registry, ignoring errors."); + scan_and_update_registry (default_registry, registry_file, FALSE); + } + } diff --git a/media-libs/gstreamer/gstreamer-0.10.10-r1.ebuild b/media-libs/gstreamer/gstreamer-0.10.10-r1.ebuild new file mode 100644 index 0000000..6c9167d --- /dev/null +++ b/media-libs/gstreamer/gstreamer-0.10.10-r1.ebuild @@ -0,0 +1,67 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/media-libs/gstreamer/gstreamer-0.10.10.ebuild,v 1.2 2006/10/14 21:08:34 vapier Exp $ + +inherit eutils + +# Create a major/minor combo for our SLOT and executables suffix +PVP=(${PV//[-\._]/ }) +PV_MAJ_MIN=${PVP[0]}.${PVP[1]} +#PV_MAJ_MIN=0.10 + +DESCRIPTION="Streaming media framework" +HOMEPAGE="http://gstreamer.sourceforge.net" +SRC_URI="http://gstreamer.freedesktop.org/src/gstreamer/${P}.tar.bz2" + +LICENSE="LGPL-2" +SLOT=${PV_MAJ_MIN} +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sh ~sparc ~x86" +IUSE="" + +RDEPEND=">=dev-libs/glib-2.8 + >=dev-libs/libxml2-2.4.9" +DEPEND="${RDEPEND} + >=sys-devel/gettext-0.11.5 + dev-util/pkgconfig" +# dev-util/gtk-doc +# =app-text/docbook-xml-dtd-4.2*" + +src_unpack() { + unpack ${A} + cd ${S} + epatch ${FILESDIR}/${P}-fix-init-race.patch +} + +src_compile() { + econf --disable-docs-build --with-package-name="Gentoo GStreamer Ebuild" --with-package-origin="http://www.gentoo.org" || die + emake -j1 || die "compile failed" +} + +src_install() { + make DESTDIR="${D}" install || die + + # remove the unversioned binaries gstreamer provide + # this is to prevent these binaries to be owned by several SLOTs + cd "${D}"/usr/bin + local gst_bins + for gst_bins in $(ls *-${PV_MAJ_MIN}) ; do + rm ${gst_bins/-${PV_MAJ_MIN}/} + einfo "Removed ${gst_bins/-${PV_MAJ_MIN}/}" + done + + cd "${S}" + dodoc AUTHORS ChangeLog DEVEL NEWS README RELEASE REQUIREMENTS TODO + + echo "PRELINK_PATH_MASK=/usr/lib/${PN}-${PV_MAJ_MIN}" > 60${PN}-${PV_MAJ_MIN} + doenvd 60${PN}-${PV_MAJ_MIN} +} + +pkg_postinst() { + einfo "Gstreamer has known problems with prelinking, as a workaround" + einfo "this ebuild adds the gstreamer plugins to the prelink mask" + einfo "path to stop them from being prelinked. It is imperative" + einfo "that you undo & redo prelinking after building this pack for" + einfo "this to take effect. Make sure the gstreamer lib path is indeed" + einfo "added to the PRELINK_PATH_MASK environment variable." + einfo "For more information see http://bugs.gentoo.org/81512" +} -- cgit v1.2.3-65-gdbad