Skip to content

Commit

Permalink
Fix bad ordering of debian changelog
Browse files Browse the repository at this point in the history
No notes before 5.14.0 because of issues
  • Loading branch information
Cyberboss committed Aug 20, 2023
1 parent dd57d0a commit f34288f
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions tools/Tgstation.Server.ReleaseNotes/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1290,9 +1290,11 @@ static async Task<ReleaseNotes> GenerateNotes(IGitHubClient client, Dictionary<C

static void PrintChanges(StringBuilder newNotes, Changelist changelist, bool debianMode = false)
{
var none = true;
foreach (var change in changelist.Changes)
foreach (var line in change.Descriptions)
{
none = false;
newNotes.AppendLine();
if (debianMode)
newNotes.Append(" * ");
Expand All @@ -1306,6 +1308,9 @@ static void PrintChanges(StringBuilder newNotes, Changelist changelist, bool deb
newNotes.Append(change.Author);
newNotes.Append(')');
}

if (debian && none)

Check failure on line 1312 in tools/Tgstation.Server.ReleaseNotes/Program.cs

View workflow job for this annotation

GitHub Actions / Build gh-pages

The name 'debian' does not exist in the current context

Check failure on line 1312 in tools/Tgstation.Server.ReleaseNotes/Program.cs

View workflow job for this annotation

GitHub Actions / Build gh-pages

The name 'debian' does not exist in the current context

Check failure on line 1312 in tools/Tgstation.Server.ReleaseNotes/Program.cs

View workflow job for this annotation

GitHub Actions / Check winget-pkgs Pull Request Template is up to date

The name 'debian' does not exist in the current context

Check failure on line 1312 in tools/Tgstation.Server.ReleaseNotes/Program.cs

View workflow job for this annotation

GitHub Actions / Check winget-pkgs Pull Request Template is up to date

The name 'debian' does not exist in the current context

Check failure on line 1312 in tools/Tgstation.Server.ReleaseNotes/Program.cs

View workflow job for this annotation

GitHub Actions / Linux Tests (Release)

The name 'debian' does not exist in the current context
throw new Exception($"Changlist {changelist.Version} has no changes!");
}

static string GenerateComponentNotes(ReleaseNotes releaseNotes, Component component, Version version)
Expand Down Expand Up @@ -1404,11 +1409,14 @@ static async Task<int> GenDebianChangelog(IGitHubClient client, Version version,
*/

// debian package did not exist before uhhh...
var debianPackageFirstRelease = new Version(5, 13, 0);
// var debianPackageFirstRelease = new Version(5, 13, 0);
// can't use that, there are irreconcilable changelog/version errors
// keep it straight going forwards
var noChangelogsBeforeVersion = new Version(5, 14, 0);

var coreChangelists = releaseNotes
.Components[Component.Core]
.Where(x => x.Version >= debianPackageFirstRelease && (!x.Unreleased || x.Version == version))
.Where(x => x.Version >= noChangelogsBeforeVersion && (!x.Unreleased || x.Version == version))
.OrderByDescending(x => x.Version)
.ToList();

Expand All @@ -1417,13 +1425,13 @@ static async Task<int> GenDebianChangelog(IGitHubClient client, Version version,
for (var i = 0; i < coreChangelists.Count; ++i)
{
var currentDic = new SortedDictionary<Component, Changelist>();
currentReleaseChangelists.Insert(0, currentDic);
currentReleaseChangelists.Add(currentDic);
var nowRelease = coreChangelists[i];
var previousRelease = (i + 1) < coreChangelists.Count
? coreChangelists[i + 1]
: releaseNotes
.Components[Component.Core]
.First(x => x.Version == new Version(5, 12, 7));
.First(x => x.Version == new Version(5, 13, 7));

currentDic.Add(Component.Core, nowRelease);
foreach (var componentKvp in nowRelease.ComponentVersions)
Expand All @@ -1450,7 +1458,8 @@ static async Task<int> GenDebianChangelog(IGitHubClient client, Version version,
.ToList(),
};

currentDic.Add(component, changelist);
if (changelist.Changes.Any())
currentDic.Add(component, changelist);
}
catch when (Debugger.IsAttached)
{
Expand Down Expand Up @@ -1491,7 +1500,7 @@ static async Task<int> GenDebianChangelog(IGitHubClient client, Version version,
builder.Append("-1) unstable; urgency=");
builder.Append(urgency);

foreach (var kvp in releaseDictionary)
foreach (var kvp in releaseDictionary.Where(x => x.Value.Changes.Count > 0 || x.Key == Component.Configuration))
{
builder.AppendLine();
builder.AppendLine();
Expand Down

0 comments on commit f34288f

Please sign in to comment.