Patrick Williams | 37567b7 | 2015-06-08 15:25:40 -0500 | [diff] [blame] | 1 | #!/bin/env perl |
| 2 | use strict; |
| 3 | |
| 4 | my $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 Williams | 4ac4919 | 2017-01-16 15:40:11 -0600 | [diff] [blame] | 34 | '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 Williams | 37567b7 | 2015-06-08 15:25:40 -0500 | [diff] [blame] | 40 | 'petitboot' => { REPO => "http://github.com/open-power/petitboot" , |
| 41 | DIR => "openpower/package/petitboot", |
| 42 | PACKAGE => "PETITBOOT" }, |
| 43 | }; |
| 44 | |
| 45 | my $begin_release = shift; |
| 46 | my $end_release = shift; |
| 47 | |
| 48 | foreach 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 | |
| 61 | system("cd op-build; git checkout $end_release --force; git reset HEAD --hard"); |
| 62 | |
| 63 | |
| 64 | open(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 | |
| 71 | my $old_level = {}; |
| 72 | my $new_level = {}; |
| 73 | |
| 74 | while(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 Williams | f4d24ee | 2017-01-16 15:34:15 -0600 | [diff] [blame] | 86 | if ($line =~ m/-([^[:space:]]*)_VERSION_BRANCH_MASTER([[:space:]]*\?*=[[:space:]]*)(.*)/) |
| 87 | { |
| 88 | print "Old $1:$3\n"; |
| 89 | $old_level->{$1} = $3; |
| 90 | } |
Patrick Williams | 37567b7 | 2015-06-08 15:25:40 -0500 | [diff] [blame] | 91 | if ($line =~ m/\+([^[:space:]]*)_VERSION([[:space:]]*\?*=[[:space:]]*)(.*)/) |
| 92 | { |
| 93 | print "New $1:$3\n"; |
| 94 | $new_level->{$1} = $3; |
| 95 | } |
Patrick Williams | f4d24ee | 2017-01-16 15:34:15 -0600 | [diff] [blame] | 96 | if ($line =~ m/\+([^[:space:]]*)_VERSION_BRANCH_MASTER([[:space:]]*\?*=[[:space:]]*)(.*)/) |
| 97 | { |
| 98 | print "New $1:$3\n"; |
| 99 | $new_level->{$1} = $3; |
| 100 | } |
| 101 | |
Patrick Williams | 37567b7 | 2015-06-08 15:25:40 -0500 | [diff] [blame] | 102 | 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 | |
| 114 | open(OUTPUT, "> RELEASE.md") || die "Failed to open RELEASE.md"; |
| 115 | |
| 116 | print OUTPUT "# Release Notes for OpenPower Firmware $end_release\n"; |
| 117 | |
| 118 | my $op_url = $repos->{'op-build'}->{REPO}; |
| 119 | |
| 120 | foreach 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 | } |