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