App-tpnotify
view release on metacpan or search on metacpan
abend(EX_UNAVAILABLE, "$cmd exited on signal " . ($status & 127));
} elsif (my $e = ($status >> 8)) {
abend(EX_UNAVAILABLE, "$cmd exited with status $e");
}
}
# verify
# ------
# Verifies the tarball. Determines canonical package name, extracts the POT
# file and checks if it lists the correct package name in its
# "Project-Id-Version" header and that its msgids differ from the ones
# already registered on the TP.
sub verify {
my ($in, $out);
my $pid = open2($out, $in, "m4 -P - $files{'configure.ac'}")
or abend(EX_NOINPUT, "can't open $files{'configure.ac'}: $!");
print $in <<'EOT';
m4_divert(-1)
m4_changequote([,])
m4_define([AC_INIT],[m4_divert(0)$1
$2[]m4_divert(-1)])
if ($s =~ /^(.+?):\s*(.*)$/) {
$ret{lc $1}=$2;
}
}
\%ret;
}
# po_serialize($FILENAME)
# -----------------------
# Serializes the pot file in the unambiguous way.
# Extracts the msgids, sorts them lexicographically and concatenates them.
sub po_serialize {
my $name = shift;
join("\n", sort map { ($_->msgid // '') . ':' . ($_->msgid_plural // '') } @{Locale::PO->load_file_asarray($name)});
}
# po_cmp($A, $B)
# --------------
# Compares two POT files. Returns 'true' if the two files contain exactly
# the same set of msgids.
sub po_cmp {
my ($a,$b) = @_;
po_serialize($a) eq po_serialize($b);
}
# verify_potfile($FILENAME)
# -------------------------
# Verifies the potfile extracted from the archive.
# Checks if the POT file mentions the correct package string in its
# Project-Id-Version header. Downloads the POT file registered on the
# TP and makes sure its msgids are not the same as defined in the POT
# file from the archive.
sub verify_potfile {
my $potname = shift;
my $hdr = po_header($potname);
my $vs = $hdr->{'project-id-version'};
if ($vs ne "$package_name $package_version") {
err("$potname: Project-Id-Version does not match \"$package_name $package_version\"");
exit(EX_DATAERR) unless $force_option;
}
(my $url = $tp_url) =~ s/\$\{domain\}/$package_tarname/;
download($url, dest => \my $content);
if ($content =~ m{$pot_regex_str}) {
my $tp_potname = download($1);
if (po_cmp($potname, $tp_potname)) {
err("potfile contains no new msgids; no need to upload");
exit(0) unless $force_option;
}
}
}
# Reads the signature file from $signature_file.
sub read_signature {
if (defined($signature_file)) {
if (open(my $fd, '<', $signature_file)) {
local $/;
( run in 2.388 seconds using v1.01-cache-2.11-cpan-ceb78f64989 )