Skip to content

Commit 1c140fe

Browse files
committed
update: patch
1 parent ba4eeb8 commit 1c140fe

File tree

1 file changed

+13
-139
lines changed

1 file changed

+13
-139
lines changed

patches/runner-main-sdk8-ppc64le.patch

+13-139
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ index 2c20d1b1..63957a5d 100644
110110
public static readonly Architecture PlatformArchitecture = Architecture.X64;
111111
#endif
112112
diff --git a/src/Runner.Common/HostTraceListener.cs b/src/Runner.Common/HostTraceListener.cs
113-
index c1953d88..61561ba7 100644
113+
index c1953d88..f48d9581 100644
114114
--- a/src/Runner.Common/HostTraceListener.cs
115115
+++ b/src/Runner.Common/HostTraceListener.cs
116116
@@ -4,19 +4,21 @@ using System.Diagnostics;
@@ -150,7 +150,7 @@ index c1953d88..61561ba7 100644
150150
_currentPageSize = 0;
151151
}
152152

153-
@@ -49,12 +51,10 @@ namespace GitHub.Runner.Common
153+
@@ -49,7 +51,7 @@ namespace GitHub.Runner.Common
154154
{
155155
ArgUtil.NotNullOrEmpty(logFile, nameof(logFile));
156156
Directory.CreateDirectory(Path.GetDirectoryName(logFile));
@@ -159,12 +159,7 @@ index c1953d88..61561ba7 100644
159159
Writer = new StreamWriter(logStream);
160160
}
161161

162-
- // Copied and modified slightly from .Net Core source code. Modification was required to make it compile.
163-
- // There must be some TraceFilter extension class that is missing in this source code.
164-
public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id, string message)
165-
{
166-
if (Filter != null && !Filter.ShouldTrace(eventCache, source, eventType, id, message, null, null, null))
167-
@@ -69,10 +69,16 @@ namespace GitHub.Runner.Common
162+
@@ -69,10 +71,16 @@ namespace GitHub.Runner.Common
168163

169164
public override void WriteLine(string message)
170165
{
@@ -183,7 +178,7 @@ index c1953d88..61561ba7 100644
183178
_currentPageSize += messageSize;
184179
if (_currentPageSize > _pageSizeLimit)
185180
{
186-
@@ -93,10 +99,16 @@ namespace GitHub.Runner.Common
181+
@@ -93,10 +101,16 @@ namespace GitHub.Runner.Common
187182

188183
public override void Write(string message)
189184
{
@@ -202,7 +197,7 @@ index c1953d88..61561ba7 100644
202197
_currentPageSize += messageSize;
203198
}
204199

205-
@@ -111,30 +123,17 @@ namespace GitHub.Runner.Common
200+
@@ -111,30 +125,17 @@ namespace GitHub.Runner.Common
206201
// Altered from the original .Net Core implementation.
207202
private void WriteHeader(string source, TraceEventType eventType, int id)
208203
{
@@ -243,7 +238,7 @@ index c1953d88..61561ba7 100644
243238
}
244239

245240
// Copied and modified slightly from .Net Core source code to make it compile. The original code
246-
@@ -164,38 +163,43 @@ namespace GitHub.Runner.Common
241+
@@ -164,38 +165,43 @@ namespace GitHub.Runner.Common
247242
{
248243
if (_enableLogRetention)
249244
{
@@ -309,7 +304,7 @@ index c1953d88..61561ba7 100644
309304
}
310305
}
311306
diff --git a/src/Runner.Common/Logging.cs b/src/Runner.Common/Logging.cs
312-
index 9200ca59..6fa0decc 100644
307+
index 9200ca59..eefa042b 100644
313308
--- a/src/Runner.Common/Logging.cs
314309
+++ b/src/Runner.Common/Logging.cs
315310
@@ -1,5 +1,7 @@
@@ -320,93 +315,8 @@ index 9200ca59..6fa0decc 100644
320315

321316
namespace GitHub.Runner.Common
322317
{
323-
@@ -8,10 +10,8 @@ namespace GitHub.Runner.Common
324-
{
325-
long TotalLines { get; }
326-
void Setup(Guid timelineId, Guid timelineRecordId);
327-
-
328-
- void Write(string message);
329-
-
330-
- void End();
331-
+ Task WriteAsync(string message); // Changed to async
332-
+ Task EndAsync();
333-
}
334-
335-
public class PagingLogger : RunnerService, IPagingLogger
336-
@@ -70,98 +70,93 @@ namespace GitHub.Runner.Common
337-
// and the consumer queues it for upload
338-
// Ensure this is lazy. Create a page on first write
339-
//
340-
- public void Write(string message)
341-
+ public async Task WriteAsync(string message)
342-
{
343-
// lazy creation on write
344-
if (_pageWriter == null)
345-
{
346-
- NewPage();
347-
+ await NewPageAsync();
348-
}
349-
350-
if (_resultsBlockWriter == null)
351-
{
352-
- NewBlock();
353-
+ await NewBlockAsync();
354-
}
355-
356-
- string line = $"{DateTime.UtcNow.ToString("O")} {message}";
357-
- _pageWriter.WriteLine(line);
358-
- _resultsBlockWriter.WriteLine(line);
359-
+ string line = $"{DateTime.UtcNow:O} {message}";
360-
+ await _pageWriter.WriteLineAsync(line);
361-
+ await _resultsBlockWriter.WriteLineAsync(line);
362-
363-
_totalLines++;
364-
- if (line.IndexOf('\n') != -1)
365-
+ if (line.Contains('\n'))
366-
{
367-
- foreach (char c in line)
368-
- {
369-
- if (c == '\n')
370-
- {
371-
- _totalLines++;
372-
- }
373-
- }
374-
+ _totalLines += line.Split('\n').Length - 1;
375-
}
376-
377-
- var bytes = System.Text.Encoding.UTF8.GetByteCount(line);
378-
+ int bytes = Encoding.UTF8.GetByteCount(line);
379-
_byteCount += bytes;
380-
_blockByteCount += bytes;
381-
+
382-
if (_byteCount >= PageSize)
383-
{
384-
- NewPage();
385-
+ await NewPageAsync();
386-
}
387-
388-
if (_blockByteCount >= BlockSize)
389-
{
390-
- NewBlock();
391-
+ await NewBlockAsync();
392-
}
393-
-
394-
}
395-
396-
- public void End()
397-
+ public async Task EndAsync()
398-
{
399-
- EndPage();
400-
- EndBlock(true);
401-
+ await EndPageAsync();
402-
+ await EndBlockAsync(true);
403-
}
404-
405-
- private void NewPage()
406-
+ private async Task NewPageAsync()
407-
{
408-
- EndPage();
409-
+ await EndPageAsync();
318+
@@ -125,8 +127,9 @@ namespace GitHub.Runner.Common
319+
EndPage();
410320
_byteCount = 0;
411321
_dataFileName = Path.Combine(_pagesFolder, $"{_timelineId}_{_timelineRecordId}_{++_pageCount}.log");
412322
- _pageData = new FileStream(_dataFileName, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.ReadWrite);
@@ -416,29 +326,9 @@ index 9200ca59..6fa0decc 100644
416326
+ _pageWriter = new StreamWriter(bufferedStream, Encoding.UTF8);
417327
}
418328

419-
- private void EndPage()
420-
+ private async Task EndPageAsync()
421-
{
422-
if (_pageWriter != null)
423-
{
424-
- _pageWriter.Flush();
425-
- _pageData.Flush();
426-
- //The StreamWriter object calls Dispose() on the provided Stream object when StreamWriter.Dispose is called.
427-
+ await _pageWriter.FlushAsync();
428-
+ await _pageData.FlushAsync();
429-
_pageWriter.Dispose();
430-
_pageWriter = null;
431-
_pageData = null;
432-
- _jobServerQueue.QueueFileUpload(_timelineId, _timelineRecordId, "DistributedTask.Core.Log", "CustomToolLog", _dataFileName, true);
433-
+ await _jobServerQueue.QueueFileUpload(_timelineId, _timelineRecordId, "DistributedTask.Core.Log", "CustomToolLog", _dataFileName, true);
434-
}
435-
}
436-
437-
- private void NewBlock()
438-
+ private async Task NewBlockAsync()
439-
{
440-
- EndBlock(false);
441-
+ await EndBlockAsync(false);
329+
private void EndPage()
330+
@@ -148,8 +151,9 @@ namespace GitHub.Runner.Common
331+
EndBlock(false);
442332
_blockByteCount = 0;
443333
_resultsDataFileName = Path.Combine(_resultsBlockFolder, $"{_timelineId}_{_timelineRecordId}.{++_blockCount}");
444334
- _resultsBlockData = new FileStream(_resultsDataFileName, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.ReadWrite);
@@ -448,23 +338,7 @@ index 9200ca59..6fa0decc 100644
448338
+ _resultsBlockWriter = new StreamWriter(bufferedStream, Encoding.UTF8);
449339
}
450340

451-
- private void EndBlock(bool finalize)
452-
+ private async Task EndBlockAsync(bool finalize)
453-
{
454-
if (_resultsBlockWriter != null)
455-
{
456-
- _resultsBlockWriter.Flush();
457-
- _resultsBlockData.Flush();
458-
+ await _resultsBlockWriter.FlushAsync();
459-
+ await _resultsBlockData.FlushAsync();
460-
_resultsBlockWriter.Dispose();
461-
_resultsBlockWriter = null;
462-
_resultsBlockData = null;
463-
- _jobServerQueue.QueueResultsUpload(_timelineRecordId, "ResultsLog", _resultsDataFileName, "Results.Core.Log", deleteSource: true, finalize, firstBlock: _resultsDataFileName.EndsWith(".1"), totalLines: _totalLines);
464-
+ await _jobServerQueue.QueueResultsUpload(_timelineRecordId, "ResultsLog", _resultsDataFileName, "Results.Core.Log", deleteSource: true, finalize, firstBlock: _resultsDataFileName.EndsWith(".1"), totalLines: _totalLines);
465-
}
466-
}
467-
}
341+
private void EndBlock(bool finalize)
468342
diff --git a/src/Runner.Common/Runner.Common.csproj b/src/Runner.Common/Runner.Common.csproj
469343
index 6c463562..933385ed 100644
470344
--- a/src/Runner.Common/Runner.Common.csproj

0 commit comments

Comments
 (0)