# This is the configuration for dupload.
# It is intended to be read and evaluated from Perl.
#
### PLEASE READ THE dupload.conf(5) MANUAL PAGE
#
# Reading the dupload(1) manual page is also advisable.

package config;

use strict;
use warnings;

use Dpkg::Vendor qw(get_current_vendor);

# ----------------
# Global variables
# ----------------

# The host to use if no --to option is used.
our $default_host;

my $vendor = get_current_vendor();
if ($vendor eq 'Debian') {
    $default_host = 'ftp-master';
} elsif ($vendor eq 'Ubuntu') {
    $default_host = 'ubuntu';
}

# Boolean, as its name says.
our $no_parentheses_to_fullname;

# ------------
# Global hooks
# ------------

our %preupload = (
    # Check changes file for valid signatures.
    changes => '/usr/share/dupload/gpg-check %1',
    sourcepackage => undef,
    file => undef,
    # Lintian check of packages.
    #deb => 'lintian -v -i %1',
    package => undef,
);

our %postupload = (
    changes => undef,
    sourcepackage => undef,
    file => undef,
    deb => undef,
    package => undef,
);

# Note: hooks can also be defined in a per-host basis, this
# overrides globaly defined hooks.

# -------------------
# Hosts configuration
# -------------------

our %cfg;

# Per-host variables:
# fqdn          - full hostname
# method        - ftp, scp, scpb or rsync
#                 (defaults to ftp)
# login         - user name to use on the remote host
#                 (defaults to 'anonymous' for FTP and local username for SSH methods)
#                 use "user\@remote" for firewall logins
# password      - password for anonymous FTP logins
# filemode      - destination files mode (undef disables, defaults to 0644)
# incoming      - directory where to upload first
# queuedir      - directory where to move if upload succeeded
# distwhitelist - regex of the distributions allowed for this host
# distblacklist - regex of the distributions disallowed for this host
# mailto        - address for announcement email (stable)
# mailtx        - address for announcement email (unstable)
# cc            - address for carbon copy of the announcement email
# fullname      - the full name to use in the announcement email
#                 (defaults to what your local MTA uses)
# visibleuser   - the username to use in the announcement email
#                 (defaults to local username)
# visiblename   - the domainname to use in the announcement email
#                 (defaults to what your local MTA uses)

# -----------------
# Pre-defined hosts
# -----------------

$cfg{'ftp-master'} = {
    fqdn => 'ssh.upload.debian.org',
    method => 'scpb',
    incoming => '/srv/upload.debian.org/UploadQueue/',
    distblacklist => qr/^(?:UNRELEASED|.*-security$)/,
    # Files pass on to dinstall on ftp-master which sends emails itself.
    dinstall_runs => 1,
};
$cfg{'anonymous-ftp-master'} = {
    fqdn => 'ftp.upload.debian.org',
    passive => 1,
    incoming => '/pub/UploadQueue/',
    distblacklist => qr/^(?:UNRELEASED|.*-security$)/,
    # Files pass on to dinstall on ftp-master which sends emails itself.
    dinstall_runs => 1,
};
# See <https://lists.debian.org/debian-project/2009/05/msg00036.html>.
$cfg{'anonymous-ftp-eu'} = {
    fqdn => 'ftp.eu.upload.debian.org',
    passive => 1,
    incoming => '/pub/UploadQueue/',
    distblacklist => qr/^(?:UNRELEASED|.*-security$)/,
    # Files pass on to dinstall on ftp-master which sends emails itself.
    dinstall_runs => 1,
};

# See <https://backports.debian.org/Contribute/> for more information.
$cfg{'bpo'} = {
    fqdn => 'backports-master.debian.org',
    passive => 1,
    incoming => '/pub/UploadQueue/',
    distblacklist => qr/^(?:UNRELEASED|.*-security$)/,
    distwhitelist => qr/^.*-backports(?:-sloppy)?$/,
    dinstall_runs => 1,
};

# For Delayed uploads use this. You can use 0-day, which is uploaded
# one hour before dinstall runs.
my $delay = (defined($ENV{DEBDELAY}) ? $ENV{DEBDELAY} : 7);
$cfg{'delayed'} = {
    fqdn => 'ftp.upload.debian.org',
    passive => 1,
    incoming => "/pub/UploadQueue/DELAYED/$delay-day/",
    distblacklist => qr/^UNRELEASED/,
    # Files pass on to dinstall on ftp-master which sends emails itself.
    dinstall_runs => 1,
};

# Debian Ports upload queue, for more information see
# <https://www.ports.debian.org/archive>.
$cfg{'debian-ports'} = {
    fqdn => 'ports-master.debian.org',
    passive => 1,
    incoming => '/incoming/',
    distblacklist => qr/^UNRELEASED/,
    dinstall_runs => 1,
};

# Mentors upload queue, for more information see
# <https://mentors.debian.net/cgi-bin/maintainer-intro>.
$cfg{'mentors'} = {
    fqdn => 'mentors.debian.net',
    passive => 1,
    incoming => '/pub/UploadQueue/',
    dinstall_runs => 1,
};

# NOTE: Do _NOT_ upload a package to the security upload queue
# (oldstable-security, stable-security, etc.) without prior authorization
# from the Debian security team. Please see
# <https://www.debian.org/doc/developers-reference/pkgs.html#bug-security>.

# See <https://lists.debian.org/debian-devel-announce/2017/10/msg00000.html>
$cfg{'security'} = {
    fqdn => 'ssh.security.upload.debian.org',
    method => 'scpb',
    incoming => '/srv/security.upload.debian.org/SecurityUploadQueue',
    filemode => undef,
    distblacklist => qr/^UNRELEASED/,
    distwhitelist => qr/^.*-security$/,
    # Files pass on to dinstall on security which sends emails itself.
    dinstall_runs => 1,
    preupload => {
        changes => '/usr/share/dupload/debian-security-auth %1',
    },
};
$cfg{'anonymous-security'} = {
    fqdn => 'ftp.security.upload.debian.org',
    passive => 1,
    incoming => '/pub/SecurityUploadQueue',
    filemode => undef,
    distblacklist => qr/^UNRELEASED/,
    # Files pass on to dinstall on security which sends emails itself.
    dinstall_runs => 1,
    preupload => {
        changes => '/usr/share/dupload/debian-security-auth %1',
    },
};
$cfg{'security-unembargoed'} = {
    fqdn => 'ssh.security.upload.debian.org',
    method => 'scpb',
    incoming => '/srv/security.upload.debian.org/OpenSecurityUploadQueue',
    distblacklist => qr/^UNRELEASED/,
    distwhitelist => qr/^.*-security$/,
    # Files pass on to dinstall on security which sends emails itself.
    dinstall_runs => 1,
    preupload => {
        changes => '/usr/share/dupload/debian-security-auth %1',
    },
};
$cfg{'anonymous-security-unembargoed'} = {
    fqdn => 'ftp.security.upload.debian.org',
    passive => 1,
    incoming => '/pub/OpenSecurityUploadQueue',
    distblacklist => qr/^UNRELEASED/,
    distwhitelist => qr/^.*-security$/,
    # Files pass on to dinstall on security which sends emails itself.
    dinstall_runs => 1,
    preupload => {
        changes => '/usr/share/dupload/debian-security-auth %1',
    },
};

$cfg{'ubuntu'} = {
    fqdn => 'upload.ubuntu.com',
    passive => 1,
    incoming => '/ubuntu',
    distblacklist => qr/^UNRELEASED/,
    dinstall_runs => 1,
};

# Don't remove the following line.  Perl needs it.
1;

## vim: ft=perl
## Local Variables: ##
## mode:perl ##
## End: ##
