#!/usr/bin/perl -w
use strict;
use warnings;
use RPM::Source::Dependency::Analyzer::Sourcedep::Resolver;
$RPM::Source::Dependency::Analyzer::Sourcedep::Resolver::verbose=1;

if ($ARGV[0] eq '--help' or $ARGV[0] eq '-h') {
    print "sourcedep-resolve - resolve source dependencies.\nOptions:\n";
    map {print "\t",$_," <arg> ...\n"} &RPM::Source::Dependency::Analyzer::Sourcedep::Commandline::get_options_list();
    exit 0;
};

my ($status,$resolved)=&RPM::Source::Dependency::Analyzer::Sourcedep::Resolver::resolve_sourcedep($0,@ARGV);
if (not $status or not $resolved) {
    die "ERROR: bad command line options.\n";
} elsif (not @$resolved) {
    print "Source dependency not resolved.\n";
} else {
    map {print 'BuildRequires: ', ref($_) ? join('|',@$_) :$_,"\n"} @$resolved;
}


__END__

=head1	NAME

sourcedep-resolve - resolve source dependencies to package names.

=head1	SYNOPSIS

B<sourcedep-resolve>
[B<--help>] 
[B<--<opt> <arg> ...]

=head1	DESCRIPTION

sourcedep-resolve resolve source dependencies to package names. Its syntax 
is the same as in logoved's/logoved-batchfix's sourcedep-resolve/sourcedep.

Usage example:
sourcedep-resolve --add-devel-lib Xext

=head1	OPTIONS

Run sourcedep-resolve --help for the list of available options

=head1	AUTHOR

Written by Igor Vlasenko <viy@altlinux.org>.

=head1	COPYING

Copyright (c) 2018-2019 Igor Vlasenko, ALT Linux Team.

This is free software; you can redistribute it and/or modify it under the terms
of the GNU General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.

=cut
