From 2bf9fed4eabe1929baf17d0e9aed2a41252356ff Mon Sep 17 00:00:00 2001 From: Sameer Srivastava Date: Sun, 21 Jul 2024 20:56:33 +0200 Subject: [PATCH 1/7] Resolve issue 2053 - Update on MacOS seems not to install the correct architecture --- application/holder/src/env/os/platform.ts | 31 +++++++++++++++++++---- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/application/holder/src/env/os/platform.ts b/application/holder/src/env/os/platform.ts index d72e0dc4f5..08fddc97c5 100644 --- a/application/holder/src/env/os/platform.ts +++ b/application/holder/src/env/os/platform.ts @@ -1,4 +1,7 @@ import * as os from 'os'; +import { execSync } from 'child_process'; +import { scope } from 'platform/env/scope'; +import { error } from 'platform/log/utils'; export enum Platform { aix = 'aix', @@ -15,6 +18,25 @@ export enum Platform { undefined = 'undefined', } +let cachedCpuBrandString: string | null = null; + +function safeExecSync(command: string, timeout: number): string { + try { + scope.getLogger('PlatformChecker').warn(`Runnning command ${command}`); + return execSync(command, { timeout }).toString().trim().toLowerCase(); + } catch (err) { + scope.getLogger('PlatformChecker').warn(`Fail to detect arch for darwin. Command '${command}' gives error: ${error(err)}`); + return ''; + } +} + +function getCpuBrandString(): string { + if (cachedCpuBrandString === null) { + cachedCpuBrandString = safeExecSync('sysctl -n machdep.cpu.brand_string', 100); + } + return cachedCpuBrandString; +} + export function getPlatform(win32Only = false): Platform { switch (os.platform()) { case Platform.aix: @@ -25,16 +47,16 @@ export function getPlatform(win32Only = false): Platform { } else { return Platform.linux; } - break; case Platform.openbsd: return Platform.linux; - case Platform.darwin: - if (os.arch() === 'arm64') { + case Platform.darwin: { + const result = getCpuBrandString(); + if (os.arch() === 'arm64' || !result.includes('intel')) { return Platform.darwinaarch64; } else { return Platform.darwin; } - break; + } case Platform.win32: if (win32Only) { return Platform.win32; @@ -44,7 +66,6 @@ export function getPlatform(win32Only = false): Platform { } else if (os.arch() === 'x64') { return Platform.win64; } - break; } return Platform.undefined; } From 71912f48eb94c813bb405c39f7e44164310d9511 Mon Sep 17 00:00:00 2001 From: Sameer Srivastava Date: Sun, 28 Jul 2024 21:04:06 +0200 Subject: [PATCH 2/7] Resolve rust linting issues --- application/apps/indexer/addons/dlt-tools/src/lib.rs | 2 +- application/apps/indexer/processor/src/export/mod.rs | 12 ++++++------ application/apps/indexer/session/src/session.rs | 8 -------- application/holder/src/env/os/platform.ts | 1 - 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/application/apps/indexer/addons/dlt-tools/src/lib.rs b/application/apps/indexer/addons/dlt-tools/src/lib.rs index aafdef53cb..7bd83adb12 100644 --- a/application/apps/indexer/addons/dlt-tools/src/lib.rs +++ b/application/apps/indexer/addons/dlt-tools/src/lib.rs @@ -94,7 +94,7 @@ pub fn extract_dlt_ft( } let mut out = BufWriter::new( - File::create(&output.join(name)).map_err(|e| format!("Error opening file: {e}"))?, + File::create(output.join(name)).map_err(|e| format!("Error opening file: {e}"))?, ); let data = &file.data; diff --git a/application/apps/indexer/processor/src/export/mod.rs b/application/apps/indexer/processor/src/export/mod.rs index a591b76ad1..70d9e2e8d7 100644 --- a/application/apps/indexer/processor/src/export/mod.rs +++ b/application/apps/indexer/processor/src/export/mod.rs @@ -27,14 +27,14 @@ pub enum ExportError { /// # Arguments /// * `s` - instance of MessageProducer stream /// * `destination_path` - destination path to a target file. If the file doesn't -/// exist it would be created; if exists - it will be opened to append new -/// content to the end of the file +/// exist it would be created; if exists - it will be opened to append new +/// content to the end of the file /// * `sections` - an array of ranges, which should be written into destination -/// file +/// file /// * `read_to_end` - in "true" will continue iterating stream after all ranges -/// are processed; in "false" will stop listening to a stream as soon as all ranges -/// are processed. It should be used in "true" for example if exporting applied -/// to concatenated files. +/// are processed; in "false" will stop listening to a stream as soon as all ranges +/// are processed. It should be used in "true" for example if exporting applied +/// to concatenated files. /// * `cancel` - cancellation token to stop operation /// /// # Errors diff --git a/application/apps/indexer/session/src/session.rs b/application/apps/indexer/session/src/session.rs index 6406041b2c..7c1dbeb30b 100644 --- a/application/apps/indexer/session/src/session.rs +++ b/application/apps/indexer/session/src/session.rs @@ -2,7 +2,6 @@ use crate::{ events::{CallbackEvent, ComputationError}, operations, operations::Operation, - progress::Severity, state, state::{AttachmentInfo, GrabbedElement, IndexesMode, SessionStateAPI, SourceDefinition}, tracker, @@ -11,7 +10,6 @@ use crate::{ use futures::Future; use log::{debug, error, warn}; use processor::{grabber::LineRange, search::filter::SearchFilter}; -use serde::Serialize; use sources::{factory::ObserveOptions, sde}; use std::{ops::RangeInclusive, path::PathBuf}; use tokio::{ @@ -519,9 +517,3 @@ impl Session { .map_err(ComputationError::NativeError) } } - -#[derive(Debug, Clone, PartialEq, Eq, Serialize)] -pub struct GeneralError { - severity: Severity, - message: String, -} diff --git a/application/holder/src/env/os/platform.ts b/application/holder/src/env/os/platform.ts index 08fddc97c5..fdd2d98b40 100644 --- a/application/holder/src/env/os/platform.ts +++ b/application/holder/src/env/os/platform.ts @@ -22,7 +22,6 @@ let cachedCpuBrandString: string | null = null; function safeExecSync(command: string, timeout: number): string { try { - scope.getLogger('PlatformChecker').warn(`Runnning command ${command}`); return execSync(command, { timeout }).toString().trim().toLowerCase(); } catch (err) { scope.getLogger('PlatformChecker').warn(`Fail to detect arch for darwin. Command '${command}' gives error: ${error(err)}`); From 9cae6e4c83d021e84095d4369e27faf2314fb12b Mon Sep 17 00:00:00 2001 From: Sameer Srivastava Date: Mon, 5 Aug 2024 23:17:30 +0200 Subject: [PATCH 3/7] Disable CI Checks on Draft PRs --- .github/workflows/pullrequest_check.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/pullrequest_check.yml b/.github/workflows/pullrequest_check.yml index 833bb91546..16b1e4d9dd 100644 --- a/.github/workflows/pullrequest_check.yml +++ b/.github/workflows/pullrequest_check.yml @@ -4,6 +4,7 @@ on: [pull_request] jobs: ts_lint: + if: github.event.pull_request.draft == false runs-on: ubuntu-latest steps: - name: Checkout @@ -26,6 +27,7 @@ jobs: - name: JS/TS linting run: rake lint:js rust_lint: + if: github.event.pull_request.draft == false runs-on: ubuntu-latest steps: - name: Checkout @@ -48,6 +50,7 @@ jobs: - name: Rust linting run: rake lint:rust integration_tests: + if: github.event.pull_request.draft == false runs-on: ubuntu-latest steps: - name: Checkout @@ -74,6 +77,7 @@ jobs: - name: Run integration tests run: rake test:js unit_tests: + if: github.event.pull_request.draft == false runs-on: ubuntu-latest steps: - name: Checkout From 006265d9c29420bba648d0be965c610113230e5b Mon Sep 17 00:00:00 2001 From: Sameer Srivastava Date: Tue, 6 Aug 2024 10:21:42 +0200 Subject: [PATCH 4/7] Run CI checks when status changes --- .github/workflows/pullrequest_check.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pullrequest_check.yml b/.github/workflows/pullrequest_check.yml index 16b1e4d9dd..5aaabc939f 100644 --- a/.github/workflows/pullrequest_check.yml +++ b/.github/workflows/pullrequest_check.yml @@ -1,6 +1,12 @@ name: Checks -on: [pull_request] +on: + pull_request: + types: + - opened + - reopened + - synchronize + - ready_for_review jobs: ts_lint: From 46776968210df241d28f859892d63a5e3da938e9 Mon Sep 17 00:00:00 2001 From: Sameer Srivastava Date: Thu, 1 Aug 2024 09:19:56 +0200 Subject: [PATCH 5/7] Resolve issue with insufficient access for updates - issue 2063 --- .../ui/layout/snackbar/message/component.ts | 2 +- .../ui/layout/snackbar/message/template.html | 12 +++++----- application/holder/src/service/menu.ts | 4 ++++ application/holder/src/service/updater.ts | 22 ++++++++++++++++--- .../platform/types/notification/index.ts | 1 + 5 files changed, 32 insertions(+), 9 deletions(-) diff --git a/application/client/src/app/ui/layout/snackbar/message/component.ts b/application/client/src/app/ui/layout/snackbar/message/component.ts index 89cc05147a..4fdfc28e53 100644 --- a/application/client/src/app/ui/layout/snackbar/message/component.ts +++ b/application/client/src/app/ui/layout/snackbar/message/component.ts @@ -34,7 +34,7 @@ export class LayoutSnackBarMessage { .then((response) => { if (response.error !== undefined) { this.log().error( - `Fail to proccess action ${action.name} (${action.uuid}); error: ${response.error}`, + `Fail to process action ${action.name} (${action.uuid}); error: ${response.error}`, ); } }) diff --git a/application/client/src/app/ui/layout/snackbar/message/template.html b/application/client/src/app/ui/layout/snackbar/message/template.html index e5ad68654e..2704feb258 100644 --- a/application/client/src/app/ui/layout/snackbar/message/template.html +++ b/application/client/src/app/ui/layout/snackbar/message/template.html @@ -1,11 +1,13 @@
-

{{data.notification.message()}}

+

{{ data.notification.message() }}

- +