blob: 402c88d093463d30594564b4124e67ff26b78c98 [file] [log] [blame]
#!/bin/env perl
use strict;
my $repos =
{
'op-build' => { REPO => "http://github.com/open-power/op-build" },
'hostboot' => { REPO => "http://github.com/open-power/hostboot" ,
DIR => "openpower/package/hostboot",
PACKAGE => "HOSTBOOT" },
'skiboot' => { REPO => "http://github.com/open-power/skiboot" ,
DIR => "openpower/package/skiboot",
PACKAGE => "SKIBOOT" },
'occ' => { REPO => "http://github.com/open-power/occ" ,
DIR => "openpower/package/occ",
PACKAGE => "OCC" },
'pnor' => { REPO => "http://github.com/open-power/pnor" ,
DIR => "openpower/package/openpower-pnor",
PACKAGE => "OPENPOWER_PNOR" },
'palmetto-xml' => { REPO => "http://github.com/open-power/palmetto-xml" ,
DIR => "openpower/package/palmetto-xml",
PACKAGE => "PALMETTO_XML" },
'habanero-xml' => { REPO => "http://github.com/open-power/habanero-xml" ,
DIR => "openpower/package/habanero-xml",
PACKAGE => "HABANERO_XML" },
'firestone-xml' => { REPO => "http://github.com/open-power/firestone-xml" ,
DIR => "openpower/package/firestone-xml",
PACKAGE => "FIRESTONE_XML" },
'garrison-xml' => { REPO => "http://github.com/open-power/garrison-xml" ,
DIR => "openpower/package/garrison-xml",
PACKAGE => "GARRISON_XML" },
'barreleye-xml' => { REPO => "http://github.com/open-power/barreleye-xml" ,
DIR => "openpower/package/barreleye-xml",
PACKAGE => "BARRELEYE_XML" },
'petitboot' => { REPO => "http://github.com/open-power/petitboot" ,
DIR => "openpower/package/petitboot",
PACKAGE => "PETITBOOT" },
};
my $begin_release = shift;
my $end_release = shift;
foreach my $repo (keys %{$repos})
{
if (-e $repo)
{
system("cd $repo; git fetch") && die "Could not fetch $repo";
}
else
{
system("git clone $repos->{$repo}->{REPO} $repo") &&
die "Could not clone $repo";
}
}
system("cd op-build; git checkout $end_release --force; git reset HEAD --hard");
open(OP_SUMMARY, "cd op-build; ".
"git diff $begin_release...$end_release --name-only |".
"grep -e \"\.mk\" -e \"Config.in\" |".
"xargs git diff $begin_release...$end_release -- |".
"grep -e '^[+-][^[:space:]]*_VERSION' ".
"-e'^[+-][[:space:]]*default.*if.*LATEST_VERSION' |") || die;
my $old_level = {};
my $new_level = {};
while(my $line = <OP_SUMMARY>)
{
chomp $line;
if ($line =~ m/\$/) # Sanity check there are not variables here.
{
next;
}
if ($line =~ m/-([^[:space:]]*)_VERSION([[:space:]]*\?*=[[:space:]]*)(.*)/)
{
print "Old $1:$3\n";
$old_level->{$1} = $3;
}
if ($line =~ m/\+([^[:space:]]*)_VERSION([[:space:]]*\?*=[[:space:]]*)(.*)/)
{
print "New $1:$3\n";
$new_level->{$1} = $3;
}
if ($line =~ m/-[[:space:]]*default[[:space:]]*"([^[:space:]]*)"[[:space:]]*if[[:space:]]BR2_([^[:space:]]*)_LATEST_VERSION/)
{
print "Old $2:$1\n";
$old_level->{$2} = $1;
}
if ($line =~ m/\+[[:space:]]*default[[:space:]]*"([^[:space:]]*)"[[:space:]]*if[[:space:]]BR2_([^[:space:]]*)_LATEST_VERSION/)
{
print "New $2:$1\n";
$new_level->{$2} = $1;
}
}
open(OUTPUT, "> RELEASE.md") || die "Failed to open RELEASE.md";
print OUTPUT "# Release Notes for OpenPower Firmware $end_release\n";
my $op_url = $repos->{'op-build'}->{REPO};
foreach my $repo (sort keys %{$repos})
{
next if (not exists $repos->{$repo}->{PACKAGE});
my $package = $repos->{$repo}->{PACKAGE};
my $url = $repos->{$repo}->{REPO};
my $dir = $repos->{$repo}->{DIR};
print OUTPUT "## Package: $repo\n";
print OUTPUT "[Repository]($url)\n";
print OUTPUT "\n";
my $package = $repos->{$repo}->{PACKAGE};
# Display patches.
if (open(LSLOG, "ls op-build/$dir/*.patch | ".
"xargs -n1 --no-run-if-empty basename |"))
{
print OUTPUT "### Patches\n";
while (my $logline = <LSLOG>)
{
chomp $logline;
print OUTPUT "* [$logline]".
"($op_url/tree/$end_release/$dir/$logline)\n";
}
close LSLOG;
print OUTPUT "\n";
}
else
{
print OUTPUT "None.\n";
}
# Display changes.
print OUTPUT "### Commits\n";
if ((not exists $old_level->{$package}) &&
(not exists $new_level->{$package}))
{
# No change identified.
print "No changes: $repo\n";
print OUTPUT "No changes.\n";
next;
}
if ((exists $old_level->{$package}) &&
(exists $new_level->{$package}))
{
print "Changes in $repo...\n";
open(GITLOG, "cd $repo; git shortlog $old_level->{$package}...".
"$new_level->{$package} --no-merges --format=".
"\"* [%h]($url/commit/%h) %s\" |");
while (my $logline = <GITLOG>)
{
chomp $logline;
$logline =~ s/^[[:space:]]*//;
print OUTPUT "$logline\n";
}
close GITLOG;
print OUTPUT "\n";
next;
}
if (not exists $old_level->{$package})
{
print "New package $repo.\n";
print OUTPUT "New package.\n";
next;
}
if (not exists $new_level->{$package})
{
print "Deleted package $repo.\n";
print OUTPUT "Package removed.\n";
next;
}
}