Blame SOURCES/gst-p-bad-cleanup.sh

8b2abe
#!/bin/sh
8b2abe
8b2abe
# Process a gst-plugins-bad tarball to remove
8b2abe
# unwanted GStreamer plugins.
8b2abe
#
8b2abe
# See https://bugzilla.redhat.com/show_bug.cgi?id=532470
8b2abe
# for details
8b2abe
#
8b2abe
# Bastien Nocera <bnocera@redhat.com> - 2010
8b2abe
#
8b2abe
8b2abe
SOURCE="$1"
8b2abe
NEW_SOURCE=`echo $SOURCE | sed 's/bad-/bad-free-/'`
8b2abe
DIRECTORY=`echo $SOURCE | sed 's/\.tar\.xz//'`
8b2abe
8b2abe
ALLOWED="
8b2abe
aacparse
8b2abe
adpcmdec
8b2abe
adpcmenc
8b2abe
aiff
8b2abe
aiffparse
8b2abe
amrparse
8b2abe
asfmux
8b2abe
audioparsers
8b2abe
audiovisualizers
8b2abe
autoconvert
8b2abe
bayer
8b2abe
camerabin
8b2abe
camerabin2
8b2abe
cdxaparse
8b2abe
coloreffects
8b2abe
colorspace
8b2abe
dataurisrc
8b2abe
dccp
8b2abe
debugutils
8b2abe
dtmf
8b2abe
faceoverlay
8b2abe
festival
8b2abe
fieldanalysis
8b2abe
freeverb
8b2abe
freeze
8b2abe
frei0r
8b2abe
gaudieffects
8b2abe
geometrictransform
8b2abe
h264parse
8b2abe
hdvparse
8b2abe
hls
8b2abe
id3tag
8b2abe
inter
8b2abe
interlace
8b2abe
invtelecine
8b2abe
ivfparse
8b2abe
jpegformat
8b2abe
jp2kdecimator
8b2abe
legacyresample
8b2abe
librfb
8b2abe
liveadder
8b2abe
mve
8b2abe
mpegdemux
8b2abe
mpeg4videoparse
8b2abe
mpegpsmux
8b2abe
mpegtsdemux
8b2abe
mpegtsmux
8b2abe
mpegvideoparse
8b2abe
mxf
8b2abe
nsf
8b2abe
nuvdemux
8b2abe
patchdetect
8b2abe
pcapparse
8b2abe
pnm
8b2abe
qtmux
8b2abe
rawparse
8b2abe
removesilence
8b2abe
rtpmux
8b2abe
rtpvp8
8b2abe
scaletempo
8b2abe
sdi
8b2abe
sdp
8b2abe
segmentclip
8b2abe
selector
8b2abe
smooth
8b2abe
speed
8b2abe
stereo
8b2abe
subenc
8b2abe
tta
8b2abe
valve
8b2abe
videofilters
8b2abe
videomaxrate
8b2abe
videomeasure
8b2abe
videoparsers
8b2abe
videosignal
8b2abe
vmnc
8b2abe
y4m
8b2abe
"
8b2abe
8b2abe
NOT_ALLOWED="
8b2abe
dvbsuboverlay
8b2abe
dvdspu
8b2abe
real
8b2abe
siren
8b2abe
"
8b2abe
8b2abe
error()
8b2abe
{
8b2abe
	MESSAGE=$1
8b2abe
	echo $MESSAGE
8b2abe
	exit 1
8b2abe
}
8b2abe
8b2abe
check_allowed()
8b2abe
{
8b2abe
	MODULE=$1
8b2abe
	for i in $ALLOWED ; do
8b2abe
		if test x$MODULE = x$i ; then
8b2abe
			return 0;
8b2abe
		fi
8b2abe
	done
8b2abe
	# Ignore errors coming from ext/ directory
8b2abe
	# they require external libraries so are ineffective anyway
8b2abe
	return 1;
8b2abe
}
8b2abe
8b2abe
check_not_allowed()
8b2abe
{
8b2abe
	MODULE=$1
8b2abe
	for i in $NOT_ALLOWED ; do
8b2abe
		if test x$MODULE = x$i ; then
8b2abe
			return 0;
8b2abe
		fi
8b2abe
	done
8b2abe
	return 1;
8b2abe
}
8b2abe
8b2abe
rm -rf $DIRECTORY
8b2abe
tar xJf $SOURCE || error "Cannot unpack $SOURCE"
8b2abe
pushd $DIRECTORY > /dev/null || error "Cannot open directory \"$DIRECTORY\""
8b2abe
8b2abe
unknown=""
8b2abe
for subdir in gst ext sys; do
8b2abe
	for dir in $subdir/* ; do
8b2abe
		# Don't touch non-directories
8b2abe
		if ! [ -d $dir ] ; then
8b2abe
			continue;
8b2abe
		fi
8b2abe
		MODULE=`basename $dir`
8b2abe
		if ( check_not_allowed $MODULE ) ; then
8b2abe
			echo "**** Removing $MODULE ****"
8b2abe
			echo "Removing directory $dir"
8b2abe
			rm -r $dir || error "Cannot remove $dir"
8b2abe
			if grep -q "AG_GST_CHECK_PLUGIN($MODULE)" configure.ac ; then
8b2abe
				echo "Removing element check for $MODULE"
8b2abe
				grep -v "AG_GST_CHECK_PLUGIN($MODULE)" configure.ac > configure.ac.new && mv configure.ac.new configure.ac
8b2abe
			fi
8b2abe
			echo "Removing Makefile generation for $MODULE"
8b2abe
			grep -v "$dir/Makefile" configure.ac > configure.ac.new && mv configure.ac.new configure.ac
8b2abe
			# Urgh
8b2abe
			if test $MODULE = real ; then
8b2abe
				grep -v "AG_GST_DISABLE_PLUGIN(real)" configure.ac > configure.ac.new && mv configure.ac.new configure.ac
8b2abe
			fi
8b2abe
			echo "Removing documentation for $MODULE"
8b2abe
			if grep -q "$MODULE" docs/plugins/Makefile.am ; then
8b2abe
				grep -v $dir docs/plugins/Makefile.am > docs/plugins/Makefile.am.new && mv docs/plugins/Makefile.am.new docs/plugins/Makefile.am
8b2abe
			fi
8b2abe
			echo
8b2abe
		elif test $subdir = ext  || test $subdir = sys; then
8b2abe
			# Ignore library or system non-blacklisted plugins
8b2abe
			continue;
8b2abe
		elif ! ( check_allowed $MODULE ) ; then
8b2abe
			echo "Unknown module in $dir"
8b2abe
			unknown="$unknown $dir"
8b2abe
		fi
8b2abe
	done
8b2abe
done
8b2abe
8b2abe
echo
8b2abe
8b2abe
if test "x$unknown" != "x"; then
8b2abe
  echo -n "Aborting due to unkown modules: "
8b2abe
  echo "$unknown" | sed "s/ /\n  /g"
8b2abe
  exit 1
8b2abe
fi
8b2abe
8b2abe
autoreconf
8b2abe
8b2abe
popd > /dev/null
8b2abe
8b2abe
tar cJf $NEW_SOURCE $DIRECTORY
8b2abe
echo "$NEW_SOURCE is ready to use"
8b2abe