Doit
view release on metacpan or search on metacpan
unshift @candidates, map { "$_.bat"} @candidates;
}
for my $candidate (@candidates) {
if (-x $candidate) {
return $candidate;
}
}
error "No 'prove' for the current perl found";
}
sub _cover_path {
my @candidates = ("$Config{bin}/cover");
if ($^O eq 'MSWin32') {
unshift @candidates, map { "$_.bat"} @candidates;
}
for my $candidate (@candidates) {
if (-x $candidate) {
return $candidate;
}
}
error "No 'cover' for the current perl found";
}
sub _Build_PL_mode {
require Data::Dumper;
my $argv_serialized = "\n" . '$Build_PL::ARGV = ' . Data::Dumper->new([\@ARGV], [])->Indent(1)->Useqq(1)->Sortkeys(1)->Terse(1)->Dump . ";\n\n";
{
if (-l "Build") { # formerly this used to be a symlink
$doit->unlink("Build");
}
my $preamble = <<"EOF";
#! $Config{perlpath}
# MD5: $Build_PL_md5hex
EOF
$preamble .= $argv_serialized;
$doit->write_binary({quiet=>1}, 'Build', $preamble . qq{# line 1 "Build.PL"\n} . $Build_PL_file_contents);
$doit->chmod(0755, 'Build');
eval {
generate_META_json("MYMETA.json");
generate_META_yml("MYMETA.yml" );
};
warning "Failure while generating MYMETA.* files, continue without.\nError was:\n$@" if $@;
}
exit;
}
# Return a string for adding to Dockerfile after the FROM line. Also
# the 2nd parameter (which has to be an empty hashref) is filled with
# further instructions to amend the Dockerfile (currently only
# apt_get_update_opts).
sub _fix_Dockerfile_for_dist {
my($distro_spec, $add_opts_ref) = @_;
if ($distro_spec =~ m{^debian:(wheezy|jessie|stretch|7|8|9)$}) {
my $codename = $1;
if ($codename eq '7') { $codename = 'wheezy' }
elsif ($codename eq '8') { $codename = 'jessie' }
elsif ($codename eq '9') { $codename = 'stretch' }
# https://unix.stackexchange.com/questions/508724/failed-to-fetch-jessie-backports-repository
$add_opts_ref->{apt_get_update_opts} = ' -o Acquire::Check-Valid-Until=false';
# https://askubuntu.com/questions/74345/how-do-i-bypass-ignore-the-gpg-signature-checks-of-apt
$add_opts_ref->{apt_get_install_opts} = ' -o APT::Get::AllowUnauthenticated=true';
<<EOF;
RUN echo 'deb [check-valid-until=no] http://archive.debian.org/debian $codename main' > /etc/apt/sources.list
RUN echo 'deb [check-valid-until=no] http://archive.debian.org/debian-security/ $codename/updates main' >> /etc/apt/sources.list
EOF
} elsif ($distro_spec =~ m{^perl:(5\.18\.\d+|.*stretch)$}) { # XXX add more perl versions based on jessie/stretch/... containers
# docker perl images are based on debian base images; older
# ones need patching
$add_opts_ref->{apt_get_install_opts} = ' -o APT::Get::AllowUnauthenticated=true';
<<'EOF';
RUN perl -i -pe \
's{deb http://(?:http.debian.net|deb.debian.org)/debian (\S+) main}{deb [check-valid-until=no] http://archive.debian.org/debian $1 main}; \
s{deb http://security.debian.org.* ([^/]+)/updates main}{deb [check-valid-until=no] http://archive.debian.org/debian-security/ $1/updates main}; \
$_ = "" if m{^deb .*-updates main}; \
' /etc/apt/sources.list
EOF
} else {
$add_opts_ref->{apt_get_update_opts} = '';
$add_opts_ref->{apt_get_install_opts} = '';
'';
}
}
sub _add_Dockerfile_invalidate_cmd {
my $dockerfile_ref = shift;
require POSIX;
$$dockerfile_ref .= <<"EOF";
# Just a hack to make sure that the following lines
# are executed at least once a day
RUN echo @{[ POSIX::strftime("%F", localtime) ]}
EOF
}
sub _docker_add_distro_specific_files {
my %opts = @_;
my $dir = delete $opts{dir} || die 'Please specify dir';
my $distro_spec = delete $opts{distro_spec} || die 'Please specify distro_spec';
die 'Unhandled options: ' . join(' ', %opts) if %opts;
if ($distro_spec eq 'centos:6') {
$doit->mkdir("$dir/.distro_support");
# Instructions from https://gcore.de/de/hilfe/linux/centos6-repo-nach-eol-anpassen.php
$doit->write_binary("$dir/.distro_support/CentOS.repo", <<'EOF');
[base]
name=CentOS-6.10 - Base
baseurl=http://vault.centos.org/6.10/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1
metadata_expire=never
#released updates
[updates]
name=CentOS-6.10 - Updates
baseurl=http://vault.centos.org/6.10/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1
metadata_expire=never
# additional packages that may be useful
[extras]
name=CentOS-6.10 - Extras
baseurl=http://vault.centos.org/6.10/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1
metadata_expire=never
# additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.10 - CentOSPlus
baseurl=http://vault.centos.org/6.10/centosplus/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0
metadata_expire=never
#contrib - packages by Centos Users
[contrib]
name=CentOS-6.10 - Contrib
baseurl=http://vault.centos.org/6.10/contrib/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0
metadata_expire=never
EOF
$doit->write_binary("$dir/.distro_support/epel.repo", <<'EOF');
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=https://archives.fedoraproject.org/pub/archive/epel/6/$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
metadata_expire=never
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 6 - $basearch - Debug
baseurl=https://archives.fedoraproject.org/pub/archive/epel/6/$basearch/debug
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1
metadata_expire=never
[epel-source]
name=Extra Packages for Enterprise Linux 6 - $basearch - Source
baseurl=https://archives.fedoraproject.org/pub/archive/epel/6/SRPMS
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1
metadata_expire=never
EOF
$doit->write_binary("$dir/.distro_support/run.sh", <<'EOF');
#! /bin/sh
set -ex
rm -f /etc/yum.repos.d/CentOS*.repo
rm -f /etc/yum.repos.d/epel.repo
cp .distro_support/CentOS.repo /etc/yum.repos.d/
cp .distro_support/epel.repo /etc/yum.repos.d/
yum clean all
EOF
$doit->chmod(0755, "$dir/.distro_support/run.sh");
}
}
sub _check_clean_git {
$doit->add_component('git');
my $status = $doit->git_short_status;
if ($status eq '<<') {
error 'Working directory has uncomitted changes: ' . `git status`;
}
if ($status eq '*') {
error 'Working directory has files not under git control (and not in .gitignore or .git/info/exclude): ' . `git status`;
}
}
# REPO BEGIN
# REPO NAME y_or_n /home/eserte/src/srezic-repository
# REPO MD5 146cfcf8f954555fe0117a55b0ddc9b1
#=head2 y_or_n
#
#Accept user input. Return true on 'y', return false on 'n', otherwise
#ask again.
#
#A default may be supplied as an optional argument:
#
# y_or_n 'y';
# y_or_n 'n';
#
#=cut
sub y_or_n (;$) {
my $default = shift;
while () {
chomp(my $yn = <STDIN>);
if ($yn eq '' && defined $default) {
$yn = $default;
}
if (lc $yn eq 'y') {
return 1;
} elsif (lc $yn eq 'n') {
return 0;
} else {
print STDERR "Please answer y or n: ";
}
}
}
# REPO END
( run in 0.529 second using v1.01-cache-2.11-cpan-df04353d9ac )