Permalink
Switch branches/tags
deployment/bbbikede/20180125 deployment/bbbikede/20171224 deployment/bbbikede/20171217 deployment/bbbikede/20171118 deployment/bbbikede/20170913 deployment/bbbikede/20170821 deployment/bbbikede/20170603_2 deployment/bbbikede/20170603 deployment/bbbikede/20170515 deployment/bbbikede/20170320 deployment/bbbikede/20161029_2 deployment/bbbikede/20161029 deployment/bbbikede/20160407 deployment/bbbikede/20160403 deployment/bbbikede/20160208 deployment/bbbikede/20160130 deployment/bbbikede/20160113 deployment/bbbikede/20150920 deployment/bbbikede/20150830_2 deployment/bbbikede/20150830 deployment/bbbikede/20150617 deployment/bbbikede/20150616 deployment/bbbikede/20150419 deployment/bbbikede/20150418 deployment/bbbikede/20150416 deployment/bbbikede/20150102 deployment/bbbikede/20141110 deployment/bbbikede/20140909 deployment/bbbikede/20140813 deployment/bbbikede/20140703 deployment/bbbikede/20140607 deployment/bbbikede/20140319 deployment/bbbikede/20140306 deployment/bbbikede/20140126 deployment/bbbikede/20131216 deployment/bbbikede/20131201 deployment/bbbikede/20131128 deployment/bbbikede/20131013 deployment/bbbikede/20130831 deployment/bbbikede/20130716 deployment/bbbikede/20130623_2 deployment/bbbikede/20130623 deployment/bbbikede/20130618 deployment/bbbikede/20130615 deployment/bbbikede/20130418 deployment/bbbikede/20130410 deployment/bbbikede/20130405_3 deployment/bbbikede/20130405_2 deployment/bbbikede/20130405 deployment/bbbikede/20130403_2 deployment/bbbikede/20130403 deployment/bbbikede/20130328 deployment/bbbikede/20130326 deployment/bbbikede/20130129 deployment/bbbikede/20130116 deployment/bbbikede/current
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
156 lines (127 sloc) 4.96 KB
# -*- cperl -*-
use strict;
use Cwd 'realpath', 'getcwd';
use ExtUtils::MakeMaker;
my $eumm_recent_enough = $ExtUtils::MakeMaker::VERSION >= 6.54;
if (!$eumm_recent_enough) {
*MY::dist_core = sub {
<<'EOF';
dist :
$(NOECHO) $(ECHO) "Sorry, use a newer EUMM!"
EOF
};
}
WriteMakefile(NAME => 'CPAN::Testers::Matrix',
VERSION_FROM => 'cgi-bin/cpantestersmatrix.pl',
($eumm_recent_enough ?
(META_ADD => { resources => { repository => 'git://github.com/eserte/cpan-testers-matrix.git' },
}) : ()),
PREREQ_PM => {
'CGI' => 0,
'CPAN::DistnameInfo' => 0,
'CPAN::Version' => 0,
'Gravatar::URL' => 0, # optional
'HTML::Table' => 0,
'Kwalify' => 0, # only for validation of "amendment" data
'LWP' => 5.808,
'Parse::CPAN::Packages::Fast' => 0, # may work also without
'URI::Query' => 0.08, # escaping is wrong before this version
'version' => 0.76, # may work also with CPAN::Version
'JSON::XS' => 0,
'YAML::Syck' => 0, # may work also with YAML, but not recommended
},
);
sub MY::postamble {
my $srcroot = realpath(getcwd().'/../..');
my $postamble = '';
my $fix_permissions_data_target = (
$^O eq 'freebsd' ? 'fix-permissions-data-freebsd' :
$^O eq 'linux' && getpwnam('www-data') ? 'fix-permissions-data-debian' :
'fix-permissions-data-unhandled'
);
$postamble .= "fix-permissions-data: $fix_permissions_data_target\n\n";
$postamble .= <<"EOF";
SRCROOT= $srcroot
EOF
$postamble .= <<'EOF';
validate-cpantestersmatrix-data:
pkwalify -f etc/cpantesters_amendments.kwalify data/cpantesters_amendments.yml
validate-config:
[ ! -e cgi-bin/cpantestersmatrix.yml ] || pkwalify -f etc/cpantestersmatrix_config.kwalify cgi-bin/cpantestersmatrix.yml
update: git-pull fix-permissions
git-pull:
git pull --ff-only
fix-permissions: fix-permissions-data
chmod ugo+rx cgi-bin/cpantestersmatrix.pl cgi-bin/zdjelameda.pl
chmod ugo+r data/*.yml htdocs/* images/*
fix-permissions-data-freebsd:
sudo chgrp www data
sudo chmod g+w data
fix-permissions-data-debian:
sudo chgrp www-data data
sudo chmod g+w data
BOTCHECKER= ${SRCROOT}/botchecker/Botchecker.pm
EOF
for my $def (
['live', 'live-matrix', '/srv/www'],
['pps', 'pps-matrix', '/root/work'],
['pps-jessie', 'pps-jessie-matrix', '/srv/www'],
) {
my($type, $host, $wwwroot) = @$def;
if ($type eq 'pps' || $type eq 'pps-jessie') {
$postamble .= <<EOF;
update-$type-from-home: rsync-$type-cpantestersmatrix
ssh -A $host 'cd $wwwroot/cpan-testers-matrix.beta && git fetch cvrsnica && git checkout cvrsnica/master'
ssh -A $host 'cd $wwwroot/cpan-testers-matrix && git fetch cvrsnica && git checkout cvrsnica/master'
update-$type: rsync-$type-cpantestersmatrix
ssh -A $host 'cd $wwwroot/cpan-testers-matrix.beta && git checkout master && git pull --ff-only'
ssh -A $host 'cd $wwwroot/cpan-testers-matrix && git checkout master && git pull --ff-only'
EOF
} else {
$postamble .= <<EOF;
update-$type-beta: rsync-$type-cpantestersmatrix-beta
ssh -A $host 'cd $wwwroot/cpan-testers-matrix.beta && git checkout master && git pull --ff-only'
update-$type-beta-from-home: rsync-$type-cpantestersmatrix-beta
ssh -A $host 'cd $wwwroot/cpan-testers-matrix.beta && git fetch cvrsnica && git checkout cvrsnica/master'
update-$type-stable: rsync-$type-cpantestersmatrix
ssh -A $host 'cd $wwwroot/cpan-testers-matrix && git checkout master && git pull --ff-only'
EOF
}
$postamble .= <<EOF;
rsync-$type-cpantestersmatrix: rsync-$type-cpantestersmatrix-beta rsync-$type-cpantestersmatrix-stable
rsync-$type-cpantestersmatrix-beta:
perl -c \${BOTCHECKER}
rsync -av \${BOTCHECKER} $host:$wwwroot/cpan-testers-matrix.beta/cgi-bin/
rsync-$type-cpantestersmatrix-stable:
perl -c \${BOTCHECKER}
rsync -av \${BOTCHECKER} $host:$wwwroot/cpan-testers-matrix/cgi-bin/
fix-$type-cpantestersmatrix-permissions:
ssh $host chgrp www-data $wwwroot/cpantestersmatrix
ssh $host chmod g+w $wwwroot/cpantestersmatrix
EOF
}
if (defined $ENV{USER} && $ENV{USER} eq 'eserte' && $^O =~ /bsd/i) {
$postamble .= <<'EOF';
GIT_TAG_DATE!= date +%Y%m%d
GIT_TAG= deployment/bbbikede/${GIT_TAG_DATE}
git-post-tasks:
git diff-index --quiet --cached HEAD
git diff-files --quiet || (\
echo "There are uncommitted changes"; \
git diff-files; \
false; \
)
test -z "$$(git ls-files --exclude-standard --others)" || (\
echo "There are untracked files"; \
git ls-files --exclude-standard --others; \
false; \
)
$(NOECHO) echo -n "This will tag version $(GIT_TAG) and push the default branch and the current tag. OK? "
$(NOECHO) read yn
git tag -a -m "* $(GIT_TAG)" $(GIT_TAG) || (echo "If setting this tag fails, then try using a suffix e.g. _2"; false)
git push
git push origin $(GIT_TAG)
EOF
}
$postamble;
}