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