#!/bin/bash

# 
# Usage: write_row RPM_FILE ANALYZED_FILE INDEX_FILE STANDARD_DIRS_PATTERN
# $1 - name of rpm file
# $2 - name of analyzed file
# $3 - name of output file
# $4 - standard_dirs_pattern
#
# This function analyze the file and write a row to the index file
function write_row() {

    local rpm_file library_file index_file python_module

    rpm_file=${1}
    library_file=${2}
    index_file=${3}
    standard_dirs_pattern=${4}

    echo "${rpm_file} ${library_file}" >> ${index_file}
}

source scan_lib

# Usage
# $1 - RPMS_ROOT
# $2 - INDEX_FILE
function scan_library () {
   local rpms_root index_file

   rpms_root=${1}
   index_file=${2}

   scan ${rpms_root} ${index_file} "\(/usr\)\?/lib/" '*\.so\.*' '*\.so' '*\.a'

}

mode=${0/.*scan-/}
scan_all_mode $mode
