#!/bin/sh

. $( droprdd "${@}" rdd_lang_rel=shell )

path_for_dumps=${any_rdd_root}/var/dump/builddep/
file_for_dump='file_usage.log'

for pack in $( lsrdd "${@}" ) ; do

    mkdir -p ${path_for_dumps}/${pack}
    usedfiles \
        -t ${path_for_dumps}/${pack}/ \
        -o ${path_for_dumps}/${pack}/${file_for_dump} \
        rdd "${@}" rdd_list_entry=$pack rdd_prf_id=staticdeproot
done

# new rdd_prf_entry will keep log and dump files in another directory, 
# so that it will not erase log of the whole build in the previous launch

rdd "${@}" rdd_prf_entry=${rdd_prf_entry},output,builddep
