Blame erlang-find-requires.sh

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