ChewKeanHo / AutomataCI

An open-source, redistributable, template-guided, and semi-autonomous CI infrastructure readily available your next project.
Apache License 2.0
21 stars 1 forks source link

FLATPAK Package does not properly respond to `any` value for OS/ARCH #310

Open hollowaykeanho opened 8 months ago

hollowaykeanho commented 8 months ago

Description

When the target OS/ARCH is having any value, the FLATPAK packager refused to package (incompatible candidate). It's likely due to mishap in safety checking.

Expected Behavior

FLATPAK packager allows any target OS and target ARCH value.

Current Behavior

FLATPAK packager rejects any value for both target's OS and target's ARCH.

Steps to Reproduce [COMPULSORY]

  1. build a polygot shell script that offers to any OS and any ARCH functionalities.
  2. run the CI. notice that .flatpak is not packaged due to incompatible type.

Associated Data Files

No response

hollowaykeanho commented 8 months ago

fixed in

diff --git a/automataCI/_package-flatpak_unix-any.sh b/automataCI/_package-flatpak_unix-any.sh
index d5503c8..00bb399 100644
--- a/automataCI/_package-flatpak_unix-any.sh
+++ b/automataCI/_package-flatpak_unix-any.sh
@@ -56,11 +56,12 @@ PACKAGE_Run_FLATPAK() {
         I18N_Check_Availability "FLATPAK"
         FLATPAK_Is_Available "$_target_os" "$_target_arch"
         case $? in
-        2|3)
+        2)
                 I18N_Check_Incompatible_Skipped
                 return 0
                 ;;
-        0)
+        0|3)
+                # accepted
                 ;;
         *)
                 I18N_Check_Failed
diff --git a/automataCI/_package-flatpak_windows-any.ps1 b/automataCI/_package-flatpak_windows-any.ps1
index 12486a6..7a38b0e 100644
--- a/automataCI/_package-flatpak_windows-any.ps1
+++ b/automataCI/_package-flatpak_windows-any.ps1
@@ -46,10 +46,10 @@ function PACKAGE-Run-FLATPAK {
        $null = I18N-Check-Availability "FLATPAK"
        $___process = FLATPAK-Is-Available "${_target_os}" "${_target_arch}"
        switch ($___process) {
-       { $_ -in 2, 3 } {
+       2 {
                $null = I18N-Check-Incompatible-Skipped
                return 0
-       } 0 {
+       } { $_ -in 0, 3 } {
                break
        } Default {
                $null = I18N-Check-Failed
diff --git a/automataCI/services/compilers/flatpak.ps1 b/automataCI/services/compilers/flatpak.ps1
index 9d925b9..9475d06 100644
--- a/automataCI/services/compilers/flatpak.ps1
+++ b/automataCI/services/compilers/flatpak.ps1
@@ -132,7 +132,7 @@ function FLATPAK-Is-Available {

        # check compatible target os
        switch ($___os) {
-       linux {
+       { $_ -in linux, any } {
                # accepted
        } Default {
                return 2
diff --git a/automataCI/services/compilers/flatpak.sh b/automataCI/services/compilers/flatpak.sh
index 367cdf5..a017bed 100644
--- a/automataCI/services/compilers/flatpak.sh
+++ b/automataCI/services/compilers/flatpak.sh
@@ -122,7 +122,7 @@ FLATPAK_Is_Available() {

         # check compatible target os
         case "$___os" in
-        linux)
+        linux|any)
                 # accepted
                 ;;
         *)
diff --git a/src/.ci/_package-flatpak_unix-any.sh b/src/.ci/_package-flatpak_unix-any.sh
index 76b2d5f..869cdcd 100644
--- a/src/.ci/_package-flatpak_unix-any.sh
+++ b/src/.ci/_package-flatpak_unix-any.sh
@@ -61,14 +61,13 @@ PACKAGE_Assemble_FLATPAK_Content() {
                 return 10 # not applicable
         elif [ $(FS_Is_Target_A_MSI "$_target") -eq 0 ]; then
                 return 10 # not applicable
-        elif [ ! "$_target_os" = "linux" ]; then
+        elif [ ! "$_target_os" = "linux" ] && [ ! "$_target_os" = "any" ]; then
                 return 10 # not applicable
         fi

diff --git a/src/.ci/_package-flatpak_windows-any.ps1 b/src/.ci/_package-flatpak_windows-any.ps1
index 98380b4..37417a4 100644
--- a/src/.ci/_package-flatpak_windows-any.ps1
+++ b/src/.ci/_package-flatpak_windows-any.ps1
@@ -61,13 +61,13 @@ function PACKAGE-Assemble-FLATPAK-Content {
                return 10 # not applicable
        } elseif ($(FS-Is-Target-A-MSI "${_target}") -eq 0) {
                return 10 # not applicable
-       } elseif ($_target_os -ne "linux") {
+       } elseif (($_target_os -ne "linux") -and ($_target_os -ne "any")) {
                return 10 # not applicable
        }
hollowaykeanho commented 6 months ago

fixed in e372d4fade487bfe79bc1d61d3a01c1c229eb382.