Blame erlang-find-requires.sh

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