Patrick Williams | 37567b7 | 2015-06-08 15:25:40 -0500 | [diff] [blame] | 1 | #!/bin/env perl |
Stewart Smith | f76e7f9 | 2017-05-19 10:42:01 +1000 | [diff] [blame] | 2 | |
Patrick Williams | 37567b7 | 2015-06-08 15:25:40 -0500 | [diff] [blame] | 3 | use strict; |
| 4 | |
Stewart Smith | f76e7f9 | 2017-05-19 10:42:01 +1000 | [diff] [blame] | 5 | use Getopt::Long; |
| 6 | use DBI; |
| 7 | |
| 8 | # We use an in-memory SQLite database as SQL is good for doing queries |
| 9 | # of differences between data sets, and doing that in perl is annoying. |
| 10 | my $db = "dbi:SQLite:dbname=release-notes.sqlite"; |
| 11 | #my $dbh = DBI->connect("dbi:SQLite:dbname=:memory:","",""); |
| 12 | my $dbh = DBI->connect($db,undef,undef, {AutoCommit => 1, RaiseError=>1}); |
| 13 | |
Patrick Williams | 37567b7 | 2015-06-08 15:25:40 -0500 | [diff] [blame] | 14 | my $repos = |
| 15 | { |
Samuel Mendoza-Jonas | a6262a0 | 2017-08-17 14:46:02 +1000 | [diff] [blame] | 16 | 'op-build' => { REPO => "https://github.com/open-power/op-build" }, |
| 17 | 'hostboot' => { REPO => "https://github.com/open-power/hostboot" , |
Stewart Smith | f76e7f9 | 2017-05-19 10:42:01 +1000 | [diff] [blame] | 18 | DIR => "openpower/package/hostboot" }, |
Samuel Mendoza-Jonas | a6262a0 | 2017-08-17 14:46:02 +1000 | [diff] [blame] | 19 | 'sbe' => { REPO => "https://github.com/open-power/sbe" , |
Stewart Smith | f76e7f9 | 2017-05-19 10:42:01 +1000 | [diff] [blame] | 20 | DIR => "openpower/package/sbe"}, |
Samuel Mendoza-Jonas | a6262a0 | 2017-08-17 14:46:02 +1000 | [diff] [blame] | 21 | 'skiboot' => { REPO => "https://github.com/open-power/skiboot" , |
Stewart Smith | f76e7f9 | 2017-05-19 10:42:01 +1000 | [diff] [blame] | 22 | DIR => "openpower/package/skiboot"}, |
Samuel Mendoza-Jonas | a6262a0 | 2017-08-17 14:46:02 +1000 | [diff] [blame] | 23 | 'occ' => { REPO => "https://github.com/open-power/occ" , |
Stewart Smith | f76e7f9 | 2017-05-19 10:42:01 +1000 | [diff] [blame] | 24 | DIR => "openpower/package/occ"}, |
Samuel Mendoza-Jonas | a6262a0 | 2017-08-17 14:46:02 +1000 | [diff] [blame] | 25 | 'pnor' => { REPO => "https://github.com/open-power/pnor" , |
Stewart Smith | f76e7f9 | 2017-05-19 10:42:01 +1000 | [diff] [blame] | 26 | DIR => "openpower/package/openpower-pnor"}, |
Samuel Mendoza-Jonas | a6262a0 | 2017-08-17 14:46:02 +1000 | [diff] [blame] | 27 | 'petitboot' => { REPO => "https://github.com/open-power/petitboot" , |
Stewart Smith | f76e7f9 | 2017-05-19 10:42:01 +1000 | [diff] [blame] | 28 | DIR => "openpower/package/petitboot"}, |
Patrick Williams | 37567b7 | 2015-06-08 15:25:40 -0500 | [diff] [blame] | 29 | }; |
| 30 | |
Stewart Smith | f76e7f9 | 2017-05-19 10:42:01 +1000 | [diff] [blame] | 31 | my $begin_release; |
| 32 | my $end_release; |
| 33 | my $begin_worktree; |
| 34 | my $end_worktree; |
| 35 | my $platform; |
| 36 | |
| 37 | GetOptions("begin-release=s" => \$begin_release, |
| 38 | "end-release=s" => \$end_release, |
| 39 | "begin-worktree=s" => \$begin_worktree, |
| 40 | "platform=s" => \$platform, |
| 41 | "end-worktree=s" => \$end_worktree) |
| 42 | or die("Error in command line arguments"); |
| 43 | |
| 44 | die "Required argument missing" unless ($begin_release and $end_release and $begin_worktree and $end_worktree); |
| 45 | |
| 46 | open(OUTPUT, "> RELEASE.md") || die "Failed to open RELEASE.md"; |
| 47 | |
| 48 | print OUTPUT "# Release Notes for OpenPower Firmware $end_release\n"; |
| 49 | |
| 50 | if (-e $begin_worktree) { |
| 51 | system("cd $begin_worktree && git checkout $begin_release && git submodule update --reference ../buildroot && git submodule update") and die "Could not update $begin_worktree"; |
| 52 | } else { |
| 53 | system("git worktree add $begin_worktree $begin_release && cd $begin_worktree&& git submodule update --reference ../buildroot && git submodule update && rm -rf dl && ln -s ../dl dl") and die "Couldn't init $begin_worktree"; |
| 54 | } |
| 55 | |
| 56 | if (-e $end_worktree) { |
| 57 | system("cd $end_worktree && git checkout $end_release && git submodule update --reference ../buildroot && git submodule update") and die "Could not update $end_worktree"; |
| 58 | } else { |
| 59 | system("git worktree add $end_worktree $end_release && cd $end_worktree && git submodule update --reference ../buildroot && git submodule update && rm -rf dl && ln -s ../dl dl") and die "Couldn't init $end_worktree"; |
| 60 | } |
| 61 | |
| 62 | opendir (my $dh, "$begin_worktree/openpower/configs") |
| 63 | or die "can't scan $begin_worktree defconfigs"; |
| 64 | my @begin_platforms = grep { /.*_defconfig/ } readdir($dh); |
| 65 | closedir $dh; |
| 66 | |
| 67 | opendir (my $dh, "$end_worktree/openpower/configs") |
| 68 | or die "can't scan $end_worktree defconfigs"; |
| 69 | my @end_platforms = grep { /.*_defconfig/ } readdir($dh); |
| 70 | closedir $dh; |
| 71 | |
| 72 | s/_defconfig// foreach (@begin_platforms); |
| 73 | s/_defconfig// foreach (@end_platforms); |
| 74 | |
Stewart Smith | 24f8255 | 2017-07-14 15:53:22 +1000 | [diff] [blame] | 75 | my $witherspoon_insanity; |
| 76 | |
Samuel Mendoza-Jonas | 93c5a54 | 2017-09-21 13:55:00 +1000 | [diff] [blame^] | 77 | # If both witherspoon and witherspoon-sequoia exist we've switched back |
| 78 | # to a single witherspoon platform and the -sequoia platform is just to |
| 79 | # keep Jenkins happy - ignore it. |
| 80 | if ("witherspoon" ~~ @begin_platforms |
| 81 | && "witherspoon-sequoia" ~~ @begin_platforms) { |
| 82 | my $index = 0; |
| 83 | $index++ until @begin_platforms[$index] eq "witherspoon-sequoia"; |
| 84 | splice(@begin_platforms, $index, 1); |
| 85 | } |
| 86 | |
| 87 | if ("witherspoon" ~~ @end_platforms |
| 88 | && "witherspoon-sequoia" ~~ @end_platforms) { |
| 89 | my $index = 0; |
| 90 | $index++ until @end_platforms[$index] eq "witherspoon-sequoia"; |
| 91 | splice(@end_platforms, $index, 1); |
| 92 | } |
| 93 | |
Stewart Smith | 88c7e35 | 2017-07-14 15:12:36 +1000 | [diff] [blame] | 94 | if (($platform && $platform eq 'witherspoon') |
| 95 | && -f "$end_worktree/openpower/configs/witherspoon-sequoia_defconfig") { |
| 96 | @begin_platforms = ('witherspoon'); |
| 97 | @end_platforms = ('witherspoon-sequoia', 'witherspoon-redbud'); |
Stewart Smith | 24f8255 | 2017-07-14 15:53:22 +1000 | [diff] [blame] | 98 | $witherspoon_insanity = 1; |
Stewart Smith | 88c7e35 | 2017-07-14 15:12:36 +1000 | [diff] [blame] | 99 | } elsif ($platform) { |
Stewart Smith | f76e7f9 | 2017-05-19 10:42:01 +1000 | [diff] [blame] | 100 | @begin_platforms = ($platform); |
| 101 | @end_platforms = ($platform); |
| 102 | } |
| 103 | |
| 104 | $dbh->do("CREATE TABLE platforms (platform TEXT, version TEXT);") or die "$!"; |
| 105 | { |
| 106 | my $q = "INSERT INTO platforms (platform,version) VALUES (?,?)"; |
| 107 | my $sth = $dbh->prepare($q) or die "$!"; |
| 108 | $sth->execute($_, $begin_release) foreach (@begin_platforms); |
| 109 | $sth->execute($_, $end_release) foreach (@end_platforms); |
| 110 | } |
| 111 | |
| 112 | { |
Stewart Smith | 88c7e35 | 2017-07-14 15:12:36 +1000 | [diff] [blame] | 113 | my $q = "SELECT platform as p FROM platforms WHERE version is ? AND platform NOT IN (SELECT platform FROM platforms WHERE version is ? and platform=p)"; |
Stewart Smith | f76e7f9 | 2017-05-19 10:42:01 +1000 | [diff] [blame] | 114 | my $sth = $dbh->prepare($q) or die $!; |
| 115 | $sth->execute($begin_release, $end_release); |
| 116 | my $r; |
Stewart Smith | 88c7e35 | 2017-07-14 15:12:36 +1000 | [diff] [blame] | 117 | print OUTPUT "## Removed platforms\n\n- ".$r->{p}."\n" if $r = $sth->fetchrow_hashref; |
| 118 | print OUTPUT "- ".$r->{p}."\n" while ($r = $sth->fetchrow_hashref); |
Stewart Smith | f76e7f9 | 2017-05-19 10:42:01 +1000 | [diff] [blame] | 119 | |
| 120 | $sth->execute($end_release, $begin_release); |
Stewart Smith | 88c7e35 | 2017-07-14 15:12:36 +1000 | [diff] [blame] | 121 | print OUTPUT "## New platforms\n\n- ".$r->{p}."\n" if $r = $sth->fetchrow_hashref; |
| 122 | print OUTPUT "- ".$r->{p}."\n" while($r = $sth->fetchrow_hashref); |
Stewart Smith | f76e7f9 | 2017-05-19 10:42:01 +1000 | [diff] [blame] | 123 | } |
| 124 | |
| 125 | my @common_platforms; |
| 126 | { |
Stewart Smith | 88c7e35 | 2017-07-14 15:12:36 +1000 | [diff] [blame] | 127 | my $q = "SELECT platform as p FROM platforms WHERE version is ? AND EXISTS (select platform from platforms where version is ? and platform=p)"; |
Stewart Smith | f76e7f9 | 2017-05-19 10:42:01 +1000 | [diff] [blame] | 128 | my $sth = $dbh->prepare($q) or die $!; |
| 129 | $sth->execute($begin_release, $end_release); |
| 130 | my $r; |
Stewart Smith | 88c7e35 | 2017-07-14 15:12:36 +1000 | [diff] [blame] | 131 | push @common_platforms, $r->{p} while ($r = $sth->fetchrow_hashref); |
Stewart Smith | f76e7f9 | 2017-05-19 10:42:01 +1000 | [diff] [blame] | 132 | } |
| 133 | |
Stewart Smith | 88c7e35 | 2017-07-14 15:12:36 +1000 | [diff] [blame] | 134 | use Data::Dumper; |
| 135 | |
| 136 | print "# COMMON PLATFORMS\n"; |
| 137 | print Dumper(\@common_platforms); |
| 138 | |
Stewart Smith | f76e7f9 | 2017-05-19 10:42:01 +1000 | [diff] [blame] | 139 | foreach my $p (@common_platforms) { |
| 140 | next if $p =~ /firenze/; |
| 141 | next if $p =~ /^zz$/; |
| 142 | next if $p =~ /mambo/; |
Samuel Mendoza-Jonas | 84f3d25 | 2017-07-12 13:26:55 +1000 | [diff] [blame] | 143 | next if $p =~ /redbud/; |
Samuel Mendoza-Jonas | 264a6cd | 2017-08-04 11:42:41 +1000 | [diff] [blame] | 144 | next if $p =~ /pseries/; |
| 145 | next if $p =~ /witherspoon-redbud/; |
| 146 | if ($p =~ /witherspoon-sequoia/) { |
| 147 | $p = "witherspoon"; |
| 148 | $witherspoon_insanity = 1; |
| 149 | } |
Samuel Mendoza-Jonas | a6262a0 | 2017-08-17 14:46:02 +1000 | [diff] [blame] | 150 | $repos->{"$p-xml"} = { REPO => "https://github.com/open-power/$p-xml" , |
Stewart Smith | f76e7f9 | 2017-05-19 10:42:01 +1000 | [diff] [blame] | 151 | DIR => "openpower/package/$p-xml" }; |
| 152 | } |
| 153 | |
| 154 | foreach my $p (@begin_platforms) { |
| 155 | system("bash -c '(cd $begin_worktree && . op-build-env && op-build ".$p."_defconfig && op-build legal-info)'"); |
Stewart Smith | 88c7e35 | 2017-07-14 15:12:36 +1000 | [diff] [blame] | 156 | # Work-around bug in op-build v1.17, fixed 2 commits later |
| 157 | system('sed -e \'s/,""\([^",]\)/,"\1/; s/\([^,]\)"",/\1",/; s/machine-xml-"\(.*\)".tar/machine-xml-\1.tar/\' -i '. $begin_worktree .'/output/legal-info/manifest.csv'); |
Stewart Smith | f76e7f9 | 2017-05-19 10:42:01 +1000 | [diff] [blame] | 158 | # Forgive me for this.... |
Stewart Smith | cd96a99 | 2017-07-14 15:40:19 +1000 | [diff] [blame] | 159 | system("sqlite3 release-notes.sqlite \".mode csv\" \".import $begin_worktree/output/legal-info/manifest.csv i\""); |
| 160 | $dbh->do("ALTER TABLE i RENAME to 'begin_".$p."_manifest'") or die $!; |
Stewart Smith | f76e7f9 | 2017-05-19 10:42:01 +1000 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | foreach my $p (@end_platforms) { |
Stewart Smith | 88c7e35 | 2017-07-14 15:12:36 +1000 | [diff] [blame] | 164 | print "# END PLATFORMS LEGAL-INFO $p\n"; |
Stewart Smith | f76e7f9 | 2017-05-19 10:42:01 +1000 | [diff] [blame] | 165 | system("bash -c '(cd $end_worktree && . op-build-env && op-build ".$p."_defconfig && op-build legal-info)'"); |
| 166 | # Forgive me for this.... |
Stewart Smith | cd96a99 | 2017-07-14 15:40:19 +1000 | [diff] [blame] | 167 | print "# loading manifest\n"; |
| 168 | system("sqlite3 release-notes.sqlite \".mode csv\" \".import $end_worktree/output/legal-info/manifest.csv i\""); |
| 169 | $dbh->do("ALTER TABLE i RENAME to 'end_".$p."_manifest'") or die $!; |
Stewart Smith | f76e7f9 | 2017-05-19 10:42:01 +1000 | [diff] [blame] | 170 | } |
| 171 | |
Stewart Smith | 24f8255 | 2017-07-14 15:53:22 +1000 | [diff] [blame] | 172 | if ($witherspoon_insanity) { |
| 173 | $dbh->do("ALTER TABLE 'end_witherspoon-sequoia_manifest' RENAME to end_witherspoon_manifest"); |
Samuel Mendoza-Jonas | 264a6cd | 2017-08-04 11:42:41 +1000 | [diff] [blame] | 174 | $dbh->do("ALTER TABLE 'begin_witherspoon-sequoia_manifest' RENAME to begin_witherspoon_manifest"); |
Stewart Smith | 24f8255 | 2017-07-14 15:53:22 +1000 | [diff] [blame] | 175 | @end_platforms = grep { $_ != 'witherspoon-sequoia' } @end_platforms; |
Samuel Mendoza-Jonas | 264a6cd | 2017-08-04 11:42:41 +1000 | [diff] [blame] | 176 | @begin_platforms = grep { $_ != 'witherspoon-sequoia' } @begin_platforms; |
Stewart Smith | 24f8255 | 2017-07-14 15:53:22 +1000 | [diff] [blame] | 177 | push @end_platforms, 'witherspoon'; |
Samuel Mendoza-Jonas | 264a6cd | 2017-08-04 11:42:41 +1000 | [diff] [blame] | 178 | push @begin_platforms, 'witherspoon'; |
Stewart Smith | 24f8255 | 2017-07-14 15:53:22 +1000 | [diff] [blame] | 179 | push @common_platforms, 'witherspoon'; |
| 180 | } |
| 181 | |
Stewart Smith | f76e7f9 | 2017-05-19 10:42:01 +1000 | [diff] [blame] | 182 | $dbh->do(<<'SQL') or die "$!"; |
| 183 | CREATE TABLE package_upgrades ( |
| 184 | PACKAGE TEXT, |
| 185 | OLDVERSION TEXT, |
| 186 | NEWVERSION TEXT, |
| 187 | PLATFORM TEXT |
| 188 | ) |
| 189 | SQL |
| 190 | |
| 191 | foreach my $p (@common_platforms) { |
Stewart Smith | 88c7e35 | 2017-07-14 15:12:36 +1000 | [diff] [blame] | 192 | $dbh->do("INSERT INTO package_upgrades select b.package,b.version,e.version,'$p' from 'begin_".$p."_manifest' as b LEFT JOIN 'end_".$p."_manifest' AS e ON b.package=e.package WHERE b.version != e.version") or die $!; |
Stewart Smith | f76e7f9 | 2017-05-19 10:42:01 +1000 | [diff] [blame] | 193 | } |
| 194 | |
| 195 | $dbh->do(<<'SQL') or die "$!"; |
| 196 | CREATE TABLE new_package ( |
| 197 | PACKAGE TEXT, |
| 198 | VERSION TEXT, |
| 199 | PLATFORM TEXT |
| 200 | ) |
| 201 | SQL |
| 202 | |
| 203 | foreach my $p (@common_platforms) { |
Stewart Smith | 88c7e35 | 2017-07-14 15:12:36 +1000 | [diff] [blame] | 204 | $dbh->do("INSERT INTO new_package select b.package,b.version,'$p' from 'end_".$p."_manifest' as b WHERE NOT EXISTS(SELECT package FROM 'begin_".$p."_manifest' AS e WHERE b.package=e.package)") or die $!; |
Stewart Smith | f76e7f9 | 2017-05-19 10:42:01 +1000 | [diff] [blame] | 205 | } |
| 206 | |
| 207 | $dbh->do(<<'SQL') or die "$!"; |
| 208 | CREATE TABLE removed_package ( |
| 209 | PACKAGE TEXT, |
| 210 | VERSION TEXT, |
| 211 | PLATFORM TEXT |
| 212 | ) |
| 213 | SQL |
| 214 | |
| 215 | foreach my $p (@common_platforms) { |
Stewart Smith | 88c7e35 | 2017-07-14 15:12:36 +1000 | [diff] [blame] | 216 | $dbh->do("INSERT INTO removed_package select b.package,b.version,'$p' from 'begin_".$p."_manifest' as b WHERE NOT EXISTS(SELECT package FROM 'end_".$p."_manifest' AS e WHERE b.package=e.package)") or die $!; |
Stewart Smith | f76e7f9 | 2017-05-19 10:42:01 +1000 | [diff] [blame] | 217 | } |
| 218 | |
| 219 | my $old_level = {}; |
| 220 | my $new_level = {}; |
| 221 | |
| 222 | { |
| 223 | my $q = <<'SQL'; |
| 224 | select package as pk ,oldversion as o ,newversion as n, |
| 225 | GROUP_CONCAT(platform) as ps |
| 226 | FROM package_upgrades |
| 227 | GROUP BY package,oldversion,newversion |
| 228 | ORDER BY package,platform |
| 229 | SQL |
| 230 | my $sth = $dbh->prepare($q) or die $!; |
| 231 | $sth->execute(); |
| 232 | |
| 233 | print OUTPUT "## Updated Packages\n\n"; |
| 234 | print OUTPUT "Package | Old Version | New Version | Platforms\n"; |
| 235 | print OUTPUT "--- | --- | --- | ---\n"; |
| 236 | while (my $r = $sth->fetchrow_hashref) { |
| 237 | print OUTPUT join(' | ',($r->{pk}, $r->{o}, $r->{n}, $r->{ps}))."\n" ; |
| 238 | if ($r->{pk} eq 'machine-xml') { |
| 239 | $old_level->{$r->{ps}."-xml"} = $r->{o}; |
| 240 | $new_level->{$r->{ps}."-xml"} = $r->{n}; |
| 241 | } else { |
| 242 | $old_level->{$r->{pk}} = $r->{o}; |
| 243 | $new_level->{$r->{pk}} = $r->{n}; |
| 244 | } |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | { |
| 249 | my $q = <<'SQL'; |
| 250 | select package as pk ,version as v, |
| 251 | GROUP_CONCAT(platform) as ps |
| 252 | FROM new_package |
| 253 | GROUP BY package,version |
| 254 | ORDER BY package,platform |
| 255 | SQL |
| 256 | my $sth = $dbh->prepare($q) or die $!; |
| 257 | $sth->execute(); |
| 258 | |
| 259 | print OUTPUT "\n\n## New Packages\n\n"; |
| 260 | print OUTPUT "Package | Version | Platforms\n"; |
| 261 | print OUTPUT "--- | --- | ---\n"; |
| 262 | while (my $r = $sth->fetchrow_hashref) { |
| 263 | print OUTPUT join(' | ',($r->{pk}, $r->{v}, $r->{ps}))."\n" ; |
| 264 | if ($r->{pk} eq 'machine-xml') { |
| 265 | $new_level->{$r->{ps}."-xml"} = $r->{v}; |
| 266 | } |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | { |
| 271 | my $q = <<'SQL'; |
| 272 | select package as pk ,version as v, |
| 273 | GROUP_CONCAT(platform) as ps |
| 274 | FROM removed_package |
| 275 | GROUP BY package,version |
| 276 | ORDER BY package,platform |
| 277 | SQL |
| 278 | my $sth = $dbh->prepare($q) or die $!; |
| 279 | $sth->execute(); |
| 280 | |
| 281 | print OUTPUT "\n\n## Removed Packages\n\n"; |
| 282 | print OUTPUT "Package | Version | Platforms\n"; |
| 283 | print OUTPUT "--- | --- | ---\n"; |
| 284 | while (my $r = $sth->fetchrow_hashref) { |
| 285 | print OUTPUT join(' | ',($r->{pk}, $r->{v}, $r->{ps}))."\n" ; |
| 286 | if ($r->{pk} eq $r->{ps}."-xml") { |
| 287 | $old_level->{$r->{ps}."-xml"} = $r->{v}; |
| 288 | } |
| 289 | } |
| 290 | print OUTPUT "\n\n"; |
| 291 | } |
Patrick Williams | 37567b7 | 2015-06-08 15:25:40 -0500 | [diff] [blame] | 292 | |
| 293 | foreach my $repo (keys %{$repos}) |
| 294 | { |
| 295 | if (-e $repo) |
| 296 | { |
| 297 | system("cd $repo; git fetch") && die "Could not fetch $repo"; |
| 298 | } |
| 299 | else |
| 300 | { |
| 301 | system("git clone $repos->{$repo}->{REPO} $repo") && |
| 302 | die "Could not clone $repo"; |
| 303 | } |
| 304 | } |
| 305 | |
| 306 | system("cd op-build; git checkout $end_release --force; git reset HEAD --hard"); |
| 307 | |
| 308 | |
Patrick Williams | 37567b7 | 2015-06-08 15:25:40 -0500 | [diff] [blame] | 309 | my $op_url = $repos->{'op-build'}->{REPO}; |
| 310 | |
| 311 | foreach my $repo (sort keys %{$repos}) |
| 312 | { |
Stewart Smith | f76e7f9 | 2017-05-19 10:42:01 +1000 | [diff] [blame] | 313 | my $package = $repo; |
Patrick Williams | 37567b7 | 2015-06-08 15:25:40 -0500 | [diff] [blame] | 314 | my $url = $repos->{$repo}->{REPO}; |
| 315 | my $dir = $repos->{$repo}->{DIR}; |
| 316 | |
| 317 | print OUTPUT "## Package: $repo\n"; |
| 318 | print OUTPUT "[Repository]($url)\n"; |
| 319 | print OUTPUT "\n"; |
| 320 | |
Patrick Williams | 37567b7 | 2015-06-08 15:25:40 -0500 | [diff] [blame] | 321 | # Display patches. |
| 322 | if (open(LSLOG, "ls op-build/$dir/*.patch | ". |
| 323 | "xargs -n1 --no-run-if-empty basename |")) |
| 324 | { |
| 325 | print OUTPUT "### Patches\n"; |
| 326 | while (my $logline = <LSLOG>) |
| 327 | { |
| 328 | chomp $logline; |
| 329 | print OUTPUT "* [$logline]". |
| 330 | "($op_url/tree/$end_release/$dir/$logline)\n"; |
| 331 | } |
| 332 | close LSLOG; |
| 333 | print OUTPUT "\n"; |
| 334 | } |
| 335 | else |
| 336 | { |
| 337 | print OUTPUT "None.\n"; |
| 338 | } |
| 339 | |
| 340 | # Display changes. |
| 341 | print OUTPUT "### Commits\n"; |
| 342 | if ((not exists $old_level->{$package}) && |
| 343 | (not exists $new_level->{$package})) |
| 344 | { |
| 345 | # No change identified. |
| 346 | print "No changes: $repo\n"; |
| 347 | print OUTPUT "No changes.\n"; |
| 348 | next; |
| 349 | } |
| 350 | |
| 351 | if ((exists $old_level->{$package}) && |
| 352 | (exists $new_level->{$package})) |
| 353 | { |
| 354 | print "Changes in $repo...\n"; |
Patrick Williams | 37567b7 | 2015-06-08 15:25:40 -0500 | [diff] [blame] | 355 | open(GITLOG, "cd $repo; git shortlog $old_level->{$package}...". |
| 356 | "$new_level->{$package} --no-merges --format=". |
| 357 | "\"* [%h]($url/commit/%h) %s\" |"); |
| 358 | |
| 359 | while (my $logline = <GITLOG>) |
| 360 | { |
| 361 | chomp $logline; |
| 362 | $logline =~ s/^[[:space:]]*//; |
| 363 | print OUTPUT "$logline\n"; |
| 364 | } |
| 365 | close GITLOG; |
| 366 | print OUTPUT "\n"; |
| 367 | next; |
| 368 | } |
| 369 | |
| 370 | if (not exists $old_level->{$package}) |
| 371 | { |
| 372 | print "New package $repo.\n"; |
| 373 | print OUTPUT "New package.\n"; |
| 374 | next; |
| 375 | } |
| 376 | |
| 377 | if (not exists $new_level->{$package}) |
| 378 | { |
| 379 | print "Deleted package $repo.\n"; |
| 380 | print OUTPUT "Package removed.\n"; |
| 381 | next; |
| 382 | } |
| 383 | } |