#!/bin/sh -e

REPOCOP_TMP_HOME=
cleanup_repocop_tmp_home() {
   [ -n "$REPOCOP_TMP_HOME" ] && rm -rf "$REPOCOP_TMP_HOME"
   exit
}
trap cleanup_repocop_tmp_home INT TERM EXIT

REPOCOP_TMP_HOME=`mktemp -d repocop_tmp_dir.XXXXXXXXXX`

repocop-run --workdir "$REPOCOP_TMP_HOME" -q "$@"
repocop-report-stdout --workdir "$REPOCOP_TMP_HOME"
# TODO: diff

exit 0

: << __END__

=head1	NAME

repocop-check - run unit tests against a set of RPM packages

=head1	SYNOPSIS

B<repocop-check>
[I<DIR>...] [I<FILE>...]

=head1	DESCRIPTION

B<repocop-check> is a wrapper around B<repocop-run> that is used to check
locally built rpm packages without the need of the complete repocop database
for the repository and print the results to the stdout.

B<repocop-check> does not use default repocop workdir; instead, a temporary workdir
is created for each run.

Note that repocop tests are packaged separately. It is recommended to install
repocop-unittests-local metapackage.

=head1 ARGUMENTS

Each I<FILE> is treated as RPM package.  Each I<DIR> is listed with C<*.rpm>
pattern, and all RPM files found are processed.

=head1 EXAMPLE

repocop-check ~/hasher/repo/SRPMS.hasher ~/hasher/repo/x86_64/RPMS.hasher

=head1	OPTIONS

=over

For options, see repocop-run(1) for more details.

=back

=head1	AUTHOR

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

=head1	ACKNOWLEGEMENTS

To Alexey Torbin <at@altlinux.org>, whose qa-robot package
had a strong influence on repocop.

=head1	COPYING

Copyright (c) 2008-2022 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

__END__
