ChewKeanHo / AutomataCI

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

DEB Package does not properly respond to `any` value for OS/ARCH #307

Open hollowaykeanho opened 3 months ago

hollowaykeanho commented 3 months ago

Description

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

Expected Behavior

DEB packager allows any target OS and target ARCH value.

Current Behavior

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

Associated Data Files

No response

hollowaykeanho commented 3 months ago

Proposed fix:

diff --git a/automataCI/_package-deb_unix-any.sh b/automataCI/_package-deb_unix-any.sh
index b42acd0..5b3d576 100644
--- a/automataCI/_package-deb_unix-any.sh
+++ b/automataCI/_package-deb_unix-any.sh
@@ -56,11 +56,11 @@ PACKAGE_Run_DEB() {
         I18N_Check_Availability "DEB"
         DEB_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-deb_windows-any.ps1 b/automataCI/_package-deb_windows-any.ps1
index 2b1be84..4ec2e8e 100644
--- a/automataCI/_package-deb_windows-any.ps1
+++ b/automataCI/_package-deb_windows-any.ps1
@@ -46,10 +46,10 @@ function PACKAGE-Run-DEB {
        $null = I18N-Check-Availability "DEB"
        $___process = DEB-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
hollowaykeanho commented 3 months ago

If can, hitch-hike the following in src/.ci/_package-deb*:

@@ -168,6 +168,15 @@ function PACKAGE-Assemble-DEB-Content {
        }

+       # NOTE: REQUIRED file
+       $null = I18N-Create "${_directory}\control\md5sum"
+       $___process = DEB-Create-Checksum "${_directory}"
+       if ($___process -ne 0) {
+               $null = I18N-Create-Failed
+               return 1
+       }
+
+
        # NOTE: OPTIONAL (Comment to turn it off)
        $null = I18N-Create "source.list"
        $___process = DEB-Create-Source-List `
@@ -183,15 +192,6 @@ function PACKAGE-Assemble-DEB-Content {
        }

-       # NOTE: REQUIRED file
-       $null = I18N-Create "${_directory}\control\md5sum"
-       $___process = DEB-Create-Checksum "${_directory}"
-       if ($___process -ne 0) {
-               $null = I18N-Create-Failed
-               return 1
-       }
-
-
        # WARNING: THIS REQUIRED FILE MUST BE THE LAST ONE
        $null = I18N-Create "${_directory}\control\control"
        $___process = DEB-Create-Control `
hollowaykeanho commented 2 months ago

implemented.