Blame gst-p-bad-cleanup.sh

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