Blame erlang-find-requires.sh

Peter Lemenkov 7748c2
#!/bin/bash
Peter Lemenkov 7748c2
Peter Lemenkov 7748c2
# This script reads filenames from STDIN and outputs any relevant requires
Peter Lemenkov 7748c2
# information that needs to be included in the package.
Peter Lemenkov 7748c2
Peter Lemenkov 7748c2
filelist=`sed "s/['\"]/\\\&/g"`
Peter Lemenkov 7748c2
Peter Lemenkov 7748c2
/usr/lib/rpm/rpmdeps --requires $filelist
Peter Lemenkov 7748c2
Peter Lemenkov 7748c2
# Get the list of *.app files
Peter Lemenkov 7748c2
appfiles=$(echo $filelist | tr [:blank:] '\n' | grep -o -E '.*/ebin/.*\.app$')
Peter Lemenkov 7748c2
Peter Lemenkov 7748c2
for f in $appfiles; do
Peter Lemenkov 7748c2
	apps=`cat $f | tr -d [:space:] | grep -o -E '\{applications,\[.*[a-zA-Z0-9_]\]\}' | sed -e "s,.*\[,,g;s,\].*,,g;s.,. .g"`
Peter Lemenkov 7748c2
	for a in $apps; do
Peter Lemenkov 7748c2
		echo "erlang($a)"
Peter Lemenkov 7748c2
	done
Peter Lemenkov 7748c2
done
Peter Lemenkov 7748c2
Peter Lemenkov 7748c2
# Get the list of *.beam files
Peter Lemenkov 7748c2
beamfiles=$(echo $filelist | tr [:blank:] '\n' | grep -o -E '.*/ebin/.*\.beam$')
Peter Lemenkov 7748c2
/usr/lib/rpm/erlang-find-requires.escript $beamfiles | sort | uniq
Peter Lemenkov 7748c2