blob: eb32d5c3f3c8c07cf52f1d22496205f1d0b7fc04 [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 }
Patrick Williamsf4d24ee2017-01-16 15:34:15 -060080 if ($line =~ m/-([^[:space:]]*)_VERSION_BRANCH_MASTER([[:space:]]*\?*=[[:space:]]*)(.*)/)
81 {
82 print "Old $1:$3\n";
83 $old_level->{$1} = $3;
84 }
Patrick Williams37567b72015-06-08 15:25:40 -050085 if ($line =~ m/\+([^[:space:]]*)_VERSION([[:space:]]*\?*=[[:space:]]*)(.*)/)
86 {
87 print "New $1:$3\n";
88 $new_level->{$1} = $3;
89 }
Patrick Williamsf4d24ee2017-01-16 15:34:15 -060090 if ($line =~ m/\+([^[:space:]]*)_VERSION_BRANCH_MASTER([[:space:]]*\?*=[[:space:]]*)(.*)/)
91 {
92 print "New $1:$3\n";
93 $new_level->{$1} = $3;
94 }
95
Patrick Williams37567b72015-06-08 15:25:40 -050096 if ($line =~ m/-[[:space:]]*default[[:space:]]*"([^[:space:]]*)"[[:space:]]*if[[:space:]]BR2_([^[:space:]]*)_LATEST_VERSION/)
97 {
98 print "Old $2:$1\n";
99 $old_level->{$2} = $1;
100 }
101 if ($line =~ m/\+[[:space:]]*default[[:space:]]*"([^[:space:]]*)"[[:space:]]*if[[:space:]]BR2_([^[:space:]]*)_LATEST_VERSION/)
102 {
103 print "New $2:$1\n";
104 $new_level->{$2} = $1;
105 }
106}
107
108open(OUTPUT, "> RELEASE.md") || die "Failed to open RELEASE.md";
109
110print OUTPUT "# Release Notes for OpenPower Firmware $end_release\n";
111
112my $op_url = $repos->{'op-build'}->{REPO};
113
114foreach my $repo (sort keys %{$repos})
115{
116 next if (not exists $repos->{$repo}->{PACKAGE});
117
118 my $package = $repos->{$repo}->{PACKAGE};
119 my $url = $repos->{$repo}->{REPO};
120 my $dir = $repos->{$repo}->{DIR};
121
122 print OUTPUT "## Package: $repo\n";
123 print OUTPUT "[Repository]($url)\n";
124 print OUTPUT "\n";
125
126 my $package = $repos->{$repo}->{PACKAGE};
127
128 # Display patches.
129 if (open(LSLOG, "ls op-build/$dir/*.patch | ".
130 "xargs -n1 --no-run-if-empty basename |"))
131 {
132 print OUTPUT "### Patches\n";
133 while (my $logline = <LSLOG>)
134 {
135 chomp $logline;
136 print OUTPUT "* [$logline]".
137 "($op_url/tree/$end_release/$dir/$logline)\n";
138 }
139 close LSLOG;
140 print OUTPUT "\n";
141 }
142 else
143 {
144 print OUTPUT "None.\n";
145 }
146
147 # Display changes.
148 print OUTPUT "### Commits\n";
149 if ((not exists $old_level->{$package}) &&
150 (not exists $new_level->{$package}))
151 {
152 # No change identified.
153 print "No changes: $repo\n";
154 print OUTPUT "No changes.\n";
155 next;
156 }
157
158 if ((exists $old_level->{$package}) &&
159 (exists $new_level->{$package}))
160 {
161 print "Changes in $repo...\n";
162
163 open(GITLOG, "cd $repo; git shortlog $old_level->{$package}...".
164 "$new_level->{$package} --no-merges --format=".
165 "\"* [%h]($url/commit/%h) %s\" |");
166
167 while (my $logline = <GITLOG>)
168 {
169 chomp $logline;
170 $logline =~ s/^[[:space:]]*//;
171 print OUTPUT "$logline\n";
172 }
173 close GITLOG;
174 print OUTPUT "\n";
175 next;
176 }
177
178 if (not exists $old_level->{$package})
179 {
180 print "New package $repo.\n";
181 print OUTPUT "New package.\n";
182 next;
183 }
184
185 if (not exists $new_level->{$package})
186 {
187 print "Deleted package $repo.\n";
188 print OUTPUT "Package removed.\n";
189 next;
190 }
191}