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

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