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