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

RPM Package does not properly respond to `any` value for OS/ARCH #309

Open hollowaykeanho opened 7 months ago

hollowaykeanho commented 7 months ago

Description

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

Expected Behavior

RPM packager allows any target OS and target ARCH value.

Current Behavior

RPM 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 .rpm is not packaged due to incompatible type.

Associated Data Files

No response

hollowaykeanho commented 7 months ago
diff --git a/automataCI/_package-rpm_unix-any.sh b/automataCI/_package-rpm_unix-any.sh
index c3c24b0..cdf8b6f 100644
--- a/automataCI/_package-rpm_unix-any.sh
+++ b/automataCI/_package-rpm_unix-any.sh
@@ -56,11 +56,11 @@ PACKAGE_Run_RPM() {
         I18N_Check_Availability "RPM"
         RPM_Is_Available "$_target_os" "$_target_arch"
         case $? in
-        2|3)
+        2)
                 I18N_Check_Incompatible_Skipped
                 return 0
                 ;;
-        0)
+        0|3)
                 # accepted
                 ;;
         *)
diff --git a/automataCI/_package-rpm_windows-any.ps1 b/automataCI/_package-rpm_windows-any.ps1
index 1e8d364..dc5c985 100644
--- a/automataCI/_package-rpm_windows-any.ps1
+++ b/automataCI/_package-rpm_windows-any.ps1
@@ -47,10 +47,10 @@ function PACKAGE-Run-RPM {
        $null = I18N-Check-Availability "RPM"
        $___process = RPM-Is-Available "${_target_os}" "${_target_arch}"
        switch ($___process) {
-       { $_ -in 2, 3 } {
+       2 {
                $null = I18N-Check-Incompatible-Skipped
                return 0
-       } 0 {
+       } { $_ -in 0, 3} {
                # accepted
        } Default {
                $null = I18N-Check-Failed-Skipped
diff --git a/automataCI/services/compilers/rpm.ps1 b/automataCI/services/compilers/rpm.ps1
index 88bdd20..8f69079 100644
--- a/automataCI/services/compilers/rpm.ps1
+++ b/automataCI/services/compilers/rpm.ps1
@@ -464,7 +464,7 @@ function RPM-Is-Available {

        # check compatible target os
        switch ($___os) {
-       linux {
+       { $_ -in linux, any } {
                break
        } default {
                return 2
diff --git a/automataCI/services/compilers/rpm.sh b/automataCI/services/compilers/rpm.sh
index ebde475..ea7e947 100644
--- a/automataCI/services/compilers/rpm.sh
+++ b/automataCI/services/compilers/rpm.sh
@@ -475,7 +475,7 @@ RPM_Is_Available() {

         # check compatible target cpu architecture
         case "$___os" in
-        linux)
+        linux|any)
                 ;;
         *)
                 return 2
hollowaykeanho commented 6 months ago

fixed in 35f510bcfd29b2ae7d80a772a7475c68d4a55857