CPANPLUS-Dist-Debora

 view release on metacpan or  search on metacpan

lib/CPANPLUS/Dist/Debora/Package/Debian.pm  view on Meta::CPAN

sub _get_epoch_from_system {
    my $self = shift;

    my %epoch_for = %{$self->_read_epochs};
    my $epoch     = $epoch_for{$self->name} // 0;

    return $epoch;
}

sub _get_epoch {
    my $self = shift;

    my $epoch_env = $self->_get_epoch_from_env;
    my $epoch_sys = $self->_get_epoch_from_system;
    my $epoch     = $epoch_env > $epoch_sys ? $epoch_env : $epoch_sys;

    return $epoch;
}

sub _get_version_with_epoch {
    my $self = shift;

    my $version = $self->version;

    my $epoch = $self->_get_epoch;
    if ($epoch) {
        $version = $epoch . q{:} . $version;
    }

    return $version;
}

sub _get_mangled_vendor {
    my $self = shift;

    my $vendor = lc $self->vendor;
    $vendor =~ tr{a-z0-9}{}cd;    # Remove anything but alphanumeric characters.
    $vendor =~ s{\A \d+}{}xms;    # Remove leading numbers.

    return $vendor;
}

sub _write_debian {
    my ($self, $name, $text, $mode) = @_;

    my $debiandir = $self->debiandir;

    my $ok = 0;

    if (!defined $text) {
        error("Could not render the $name file");
    }
    else {
        my $filename = catfile($debiandir, $name);
        $ok = spew_utf8($filename, $text);
        if (!$ok) {
            error("Could not create '$filename': $OS_ERROR");
        }
        else {
            if (defined $mode) {
                $ok = chmod $mode, $filename;
                if (!$ok) {
                    error("Could not chmod '$filename': $OS_ERROR");
                }
            }
        }
    }

    return $ok;
}

sub _get_license_apache_2_0 {
    my $self = shift;

    return <<'END_LICENSE';
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

On Debian systems, the complete text of version 2.0 of the Apache
License can be found in `/usr/share/common-licenses/Apache-2.0'.
END_LICENSE
}

sub _get_license_cc0_1_0 {
    my $self = shift;

    return <<'END_LICENSE';
To the extent possible under law, the author(s) have dedicated all
copyright and related and neighboring rights to this software to the
public domain worldwide. This software is distributed without any
warranty.

On Debian systems, the complete text of the CC0 1.0 Universal license
can be found in `/usr/share/common-licenses/CC0-1.0'.
END_LICENSE
}

sub _get_license_fsf {
    my ($self, $file, $version) = @_;

    my $name = q{};
    if ($file =~ m{\A GPL-}xms) {
        $name = 'GNU General Public License';
    }
    elsif ($file =~ m{\A LGPL-}xms) {
        $name = 'GNU Lesser General Public License';
    }
    else {
        croak "Unknown license: '$file'";
    }

    my $text = <<"END_LICENSE";
This is free software; you can redistribute it and/or modify it under
the terms of the $name as published by the Free Software Foundation;



( run in 0.631 second using v1.01-cache-2.11-cpan-39bf76dae61 )