Navigation Menu

Skip to content

Commit

Permalink
Item14233: Improve formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
gac410 committed Nov 26, 2016
1 parent 446b7dd commit ce0da4c
Showing 1 changed file with 39 additions and 7 deletions.
46 changes: 39 additions & 7 deletions core/tools/check_extensions.pl
Expand Up @@ -12,6 +12,7 @@
use JSON;

my $extension = shift;
my %items; # Hash to cache item # & descriptions.

my $start = `git describe --tags --abbrev=0`;
unless ($start) {
Expand Down Expand Up @@ -62,12 +63,25 @@ END

foreach my $ext ( sort @extensions ) {
chomp $ext;
print "\n========== $ext ============\n";
my @itemlist;
my $gitlog = `git log --oneline $start..HEAD $ext`;
if ($gitlog) {
print
"\n========================================================\ngit log --oneline $start..HEAD $ext\n";
print "$gitlog\n";
@itemlist = $gitlog =~ m/(Item\d+):/g;
my $topicText = get_ext_topic($ext);
my $last = '';
foreach my $item ( sort @itemlist ) {
next if $item eq $last;
$last = $item;
my $taskinfo = get_task_info($item);
print "WARNING: Wrong state: $taskinfo\n"
unless $taskinfo =~ m/Waiting for Release/;
next if $topicText =~ m/\b$item\b/;
print "MISSING: from change log: $taskinfo\n";

}
}

else {
print "No changes since last release\n";
}
Expand All @@ -82,7 +96,7 @@ END
print
"$ext - Last release: $ov, Uploaded $exthash->{version}, Module: $lv\n";

if ( $ov eq $lv && $gitlog ) {
if ( ( $ov eq $lv || $exthash->{version} eq $lv ) && $gitlog ) {
print
"ERROR: $ext: Identical versions, but commits logged since last release\n";
}
Expand Down Expand Up @@ -192,6 +206,17 @@ sub extractModuleVersion {
return $mod_version;
}

sub get_ext_topic {
my $ext = shift;
my $file = "$ext/data/System/$ext.txt";

open( my $mf, '<', "$file" ) or die "Unable to open $file";
local $/ = undef;
my $topicText = <$mf>;
close $mf;
return $mf;
}

sub get_ext_info {
my $ext = shift;

Expand All @@ -203,12 +228,19 @@ sub get_ext_info {
die
"ERROR: GET on Tasks.ItemStatusQuery failed. Check https://foswiki.org/Tasks/ItemStatusQuery\n";
}

my $jsonarray = decode_json($jsondata);
my $json = shift @{$jsonarray};
return $json;
}

#print Data::Dumper::Dumper( \$json );
sub get_task_info {
my $it = shift;

return $json;
return $items{$it} if $items{$it};
my $url = "http://foswiki.org/Tasks/ItemSummaryQuery?item=$it;skin=text";
my $description = get $url;
$description =~ s#<b>.*</b>\n##;
$items{$it} = $description;
return $description;
}

0 comments on commit ce0da4c

Please sign in to comment.