#!/usr/bin/perl -w

use strict;
use warnings;
use Pod::Usage;
use Getopt::Long;
use Gear::Remotes::Watch;

my $default_action='gear-uupdate';
my $action;
my $verbose=1;
my ($help);

my $result = GetOptions (
    'verbose+' => \$verbose,
    'q|quiet'  => sub {$verbose=0},
    'h|help'   => \$help,
    'action=s'   => \$action,
    );

pod2usage(-verbose => 2) if $help;

&Gear::Remotes::Watch::watch_remotes(
    -action => $action,
    -verbose => $verbose,
    );

=head1	NAME

gear-remotes-watch - check for updates in git repo listed in .gear/upstream/remotes file

=head1	SYNOPSIS

B<gear-remotes-watch>
[B<-h|--help>]
[B<-v|--verbose>]
[B<-q|--quiet>]
[B<--action> I<command>]

=head1	DESCRIPTION

B<gear-remotes-watch> checks for updates in foreign upstream git repository(ies)
listed in I<.gear/upstream/remotes> file. For that B<gear-remotes-watch>
lists tags available in upstream git repository and compares them with the current
version in spec file. If a tag with greater version is found, notification is
issued.

B<gear-remotes-watch> uses the following auxiliary scripts, if found and
if they are executable: B<.gear/upstream/filter-tag> is used to separate release tags
from all tags found, and B<.gear/upstream/transform-tag> is used to transform
custom tags like RELEASE_1_0_1 to rpm version compatible look like 1.0.1.
In other words, after you fetch remote commits, you should get a list of available
upstream versions using
 git tag | .gear/upstream/filter-tag | .gear/upstream/transform-tag

=head1	OPTIONS

=over

=item	B<--action> I<command>

Execute a I<command> for new upstream version.
The arguments passed to I<command> follow the Debian's uupdate(1) style
but with tarball replaced with git tag.
For now it has 3 arguments:
The first is 2 which is I<watch_format_version>,
the second is I<new version> and the third is git tag for new version.

=item	B<-v|--verbose>

Verbose. Prints extra information. Multiple -v accumulate.

=item	B<-q|--quiet>

Quiet. Print no warnings.
=item	B<-h, --help>

Display this help and exit.

=back

=head1	AUTHOR

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

=head1	COPYING

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

