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

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