#!/usr/bin/perl

use strict;
use warnings;
use Carp;

use CPAN::Meta;
use Debian::Upstream::Metadata::Perl();
my $meta;

if ( -r 'META.json' ) {
    $meta = CPAN::Meta->load_file('META.json');
} elsif ( -r 'META.yml' ) {
    $meta = CPAN::Meta->load_file('META.yml');
} else {
    croak 'Neither META.json nor META.yml found.';
}

Debian::Upstream::Metadata::Perl->convert($meta, 'debian/upstream/metadata');

=pod

=head1 NAME

dpt-debian-upstream - convert resources from META.{json,yml} to debian/upstream/metadata

=head1 SYNOPSIS

B<dpt debian-upstream>

=head1 DESCRIPTION

B<dpt debian-upstream> reads information from F<META.json> or F<META.yml> and
writes it to F<debian/upstream/metadata>, according to the UpstreamMetaData
specification.

Please, note that upstream links will be switched to https URLs.

=head1 SEE ALSO

=over

=item *

L<CPAN::Meta::Spec>

=item *

L<UpstreamMetaData|https://wiki.debian.org/UpstreamMetadata>

=back

=head1 COPYRIGHT AND LICENSE

=over

=item Copyright 2013-2024, gregor herrmann L<gregoa@debian.org>

=item Copyright 2016, Alex Muntada L<alexm@alexm.org>

=back

This program is free software and can be distributed under the same terms as
Perl.
