blob: 402c88d093463d30594564b4124e67ff26b78c98 [file] [log] [blame]
Patrick Williams37567b72015-06-08 15:25:40 -05001#!/bin/env perl
2use strict;
3
4my $repos =
5{
6 'op-build' => { REPO => "http://github.com/open-power/op-build" },
7 'hostboot' => { REPO => "http://github.com/open-power/hostboot" ,
8 DIR => "openpower/package/hostboot",
9 PACKAGE => "HOSTBOOT" },
10 'skiboot' => { REPO => "http://github.com/open-power/skiboot" ,
11 DIR => "openpower/package/skiboot",
12 PACKAGE => "SKIBOOT" },
13 'occ' => { REPO => "http://github.com/open-power/occ" ,
14 DIR => "openpower/package/occ",
15 PACKAGE => "OCC" },
16 'pnor' => { REPO => "http://github.com/open-power/pnor" ,
17 DIR => "openpower/package/openpower-pnor",
18 PACKAGE => "OPENPOWER_PNOR" },
19 'palmetto-xml' => { REPO => "http://github.com/open-power/palmetto-xml" ,
20 DIR => "openpower/package/palmetto-xml",
21 PACKAGE => "PALMETTO_XML" },
22 'habanero-xml' => { REPO => "http://github.com/open-power/habanero-xml" ,
23 DIR => "openpower/package/habanero-xml",
24 PACKAGE => "HABANERO_XML" },
25 'firestone-xml' => { REPO => "http://github.com/open-power/firestone-xml" ,
26 DIR => "openpower/package/firestone-xml",
27 PACKAGE => "FIRESTONE_XML" },
28 'garrison-xml' => { REPO => "http://github.com/open-power/garrison-xml" ,
29 DIR => "openpower/package/garrison-xml",
30 PACKAGE => "GARRISON_XML" },
31 'barreleye-xml' => { REPO => "http://github.com/open-power/barreleye-xml" ,
32 DIR => "openpower/package/barreleye-xml",
33 PACKAGE => "BARRELEYE_XML" },
34 'petitboot' => { REPO => "http://github.com/open-power/petitboot" ,
35 DIR => "openpower/package/petitboot",
36 PACKAGE => "PETITBOOT" },
37};
38
39my $begin_release = shift;
40my $end_release = shift;
41
42foreach my $repo (keys %{$repos})
43{
44 if (-e $repo)
45 {
46 system("cd $repo; git fetch") && die "Could not fetch $repo";
47 }
48 else
49 {
50 system("git clone $repos->{$repo}->{REPO} $repo") &&
51 die "Could not clone $repo";
52 }
53}
54
55system("cd op-build; git checkout $end_release --force; git reset HEAD --hard");
56
57
58open(OP_SUMMARY, "cd op-build; ".
59 "git diff $begin_release...$end_release --name-only |".
60 "grep -e \"\.mk\" -e \"Config.in\" |".
61 "xargs git diff $begin_release...$end_release -- |".
62 "grep -e '^[+-][^[:space:]]*_VERSION' ".
63 "-e'^[+-][[:space:]]*default.*if.*LATEST_VERSION' |") || die;
64
65my $old_level = {};
66my $new_level = {};
67
68while(my $line = <OP_SUMMARY>)
69{
70 chomp $line;
71 if ($line =~ m/\$/) # Sanity check there are not variables here.
72 {
73 next;
74 }
75 if ($line =~ m/-([^[:space:]]*)_VERSION([[:space:]]*\?*=[[:space:]]*)(.*)/)
76 {
77 print "Old $1:$3\n";
78 $old_level->{$1} = $3;
79 }
80 if ($line =~ m/\+([^[:space:]]*)_VERSION([[:space:]]*\?*=[[:space:]]*)(.*)/)
81 {
82 print "New $1:$3\n";
83 $new_level->{$1} = $3;
84 }
85 if ($line =~ m/-[[:space:]]*default[[:space:]]*"([^[:space:]]*)"[[:space:]]*if[[:space:]]BR2_([^[:space:]]*)_LATEST_VERSION/)
86 {
87 print "Old $2:$1\n";
88 $old_level->{$2} = $1;
89 }
90 if ($line =~ m/\+[[:space:]]*default[[:space:]]*"([^[:space:]]*)"[[:space:]]*if[[:space:]]BR2_([^[:space:]]*)_LATEST_VERSION/)
91 {
92 print "New $2:$1\n";
93 $new_level->{$2} = $1;
94 }
95}
96
97open(OUTPUT, "> RELEASE.md") || die "Failed to open RELEASE.md";
98
99print OUTPUT "# Release Notes for OpenPower Firmware $end_release\n";
100
101my $op_url = $repos->{'op-build'}->{REPO};
102
103foreach my $repo (sort keys %{$repos})
104{
105 next if (not exists $repos->{$repo}->{PACKAGE});
106
107 my $package = $repos->{$repo}->{PACKAGE};
108 my $url = $repos->{$repo}->{REPO};
109 my $dir = $repos->{$repo}->{DIR};
110
111 print OUTPUT "## Package: $repo\n";
112 print OUTPUT "[Repository]($url)\n";
113 print OUTPUT "\n";
114
115 my $package = $repos->{$repo}->{PACKAGE};
116
117 # Display patches.
118 if (open(LSLOG, "ls op-build/$dir/*.patch | ".
119 "xargs -n1 --no-run-if-empty basename |"))
120 {
121 print OUTPUT "### Patches\n";
122 while (my $logline = <LSLOG>)
123 {
124 chomp $logline;
125 print OUTPUT "* [$logline]".
126 "($op_url/tree/$end_release/$dir/$logline)\n";
127 }
128 close LSLOG;
129 print OUTPUT "\n";
130 }
131 else
132 {
133 print OUTPUT "None.\n";
134 }
135
136 # Display changes.
137 print OUTPUT "### Commits\n";
138 if ((not exists $old_level->{$package}) &&
139 (not exists $new_level->{$package}))
140 {
141 # No change identified.
142 print "No changes: $repo\n";
143 print OUTPUT "No changes.\n";
144 next;
145 }
146
147 if ((exists $old_level->{$package}) &&
148 (exists $new_level->{$package}))
149 {
150 print "Changes in $repo...\n";
151
152 open(GITLOG, "cd $repo; git shortlog $old_level->{$package}...".
153 "$new_level->{$package} --no-merges --format=".
154 "\"* [%h]($url/commit/%h) %s\" |");
155
156 while (my $logline = <GITLOG>)
157 {
158 chomp $logline;
159 $logline =~ s/^[[:space:]]*//;
160 print OUTPUT "$logline\n";
161 }
162 close GITLOG;
163 print OUTPUT "\n";
164 next;
165 }
166
167 if (not exists $old_level->{$package})
168 {
169 print "New package $repo.\n";
170 print OUTPUT "New package.\n";
171 next;
172 }
173
174 if (not exists $new_level->{$package})
175 {
176 print "Deleted package $repo.\n";
177 print OUTPUT "Package removed.\n";
178 next;
179 }
180}